@univerjs/core 0.21.1 → 0.22.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/README.md +22 -49
- package/lib/cjs/facade.js +8 -7
- package/lib/cjs/index.js +618 -571
- package/lib/es/facade.js +8 -7
- package/lib/es/index.js +618 -572
- package/lib/facade.js +8 -7
- package/lib/index.js +618 -572
- package/lib/types/docs/data-model/types.d.ts +17 -17
- package/lib/types/index.d.ts +1 -1
- package/lib/types/sheets/worksheet.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +9 -9
- package/package.json +14 -10
package/lib/index.js
CHANGED
|
@@ -390,7 +390,7 @@ function throttle(fn, wait = 16) {
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
//#endregion
|
|
393
|
-
//#region \0@oxc-project+runtime@0.
|
|
393
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
394
394
|
function _typeof(o) {
|
|
395
395
|
"@babel/helpers - typeof";
|
|
396
396
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -401,7 +401,7 @@ function _typeof(o) {
|
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
//#endregion
|
|
404
|
-
//#region \0@oxc-project+runtime@0.
|
|
404
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
405
405
|
function toPrimitive(t, r) {
|
|
406
406
|
if ("object" != _typeof(t) || !t) return t;
|
|
407
407
|
var e = t[Symbol.toPrimitive];
|
|
@@ -414,14 +414,14 @@ function toPrimitive(t, r) {
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
//#endregion
|
|
417
|
-
//#region \0@oxc-project+runtime@0.
|
|
417
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
418
418
|
function toPropertyKey(t) {
|
|
419
419
|
var i = toPrimitive(t, "string");
|
|
420
420
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
//#endregion
|
|
424
|
-
//#region \0@oxc-project+runtime@0.
|
|
424
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
425
425
|
function _defineProperty(e, r, t) {
|
|
426
426
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
427
427
|
value: t,
|
|
@@ -2015,10 +2015,10 @@ let Direction = /* @__PURE__ */ function(Direction) {
|
|
|
2015
2015
|
}({});
|
|
2016
2016
|
function getReverseDirection(direction) {
|
|
2017
2017
|
switch (direction) {
|
|
2018
|
-
case
|
|
2019
|
-
case
|
|
2020
|
-
case
|
|
2021
|
-
case
|
|
2018
|
+
case 3: return 1;
|
|
2019
|
+
case 1: return 3;
|
|
2020
|
+
case 0: return 2;
|
|
2021
|
+
case 2: return 0;
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
2024
|
|
|
@@ -2783,17 +2783,17 @@ let PaperType = /* @__PURE__ */ function(PaperType) {
|
|
|
2783
2783
|
return PaperType;
|
|
2784
2784
|
}({});
|
|
2785
2785
|
const PAPER_TYPES = [
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2786
|
+
"A3",
|
|
2787
|
+
"A4",
|
|
2788
|
+
"A5",
|
|
2789
|
+
"B4",
|
|
2790
|
+
"B5",
|
|
2791
|
+
"Letter",
|
|
2792
|
+
"Tabloid",
|
|
2793
|
+
"Legal",
|
|
2794
|
+
"Statement",
|
|
2795
|
+
"Executive",
|
|
2796
|
+
"Folio"
|
|
2797
2797
|
];
|
|
2798
2798
|
|
|
2799
2799
|
//#endregion
|
|
@@ -2944,7 +2944,7 @@ const STYLE_KEYS = defineExactKeys()([
|
|
|
2944
2944
|
|
|
2945
2945
|
//#endregion
|
|
2946
2946
|
//#region src/docs/data-model/empty-snapshot.ts
|
|
2947
|
-
function getEmptySnapshot$1(unitID = generateRandomId(6), locale =
|
|
2947
|
+
function getEmptySnapshot$1(unitID = generateRandomId(6), locale = "enUS", title = "") {
|
|
2948
2948
|
return {
|
|
2949
2949
|
id: unitID,
|
|
2950
2950
|
locale,
|
|
@@ -2974,19 +2974,19 @@ function getEmptySnapshot$1(unitID = generateRandomId(6), locale = LocaleType.EN
|
|
|
2974
2974
|
width: 595 / .75,
|
|
2975
2975
|
height: 842 / .75
|
|
2976
2976
|
},
|
|
2977
|
-
documentFlavor:
|
|
2977
|
+
documentFlavor: 1,
|
|
2978
2978
|
marginTop: 50,
|
|
2979
2979
|
marginBottom: 50,
|
|
2980
2980
|
marginRight: 50,
|
|
2981
2981
|
marginLeft: 50,
|
|
2982
2982
|
renderConfig: {
|
|
2983
|
-
zeroWidthParagraphBreak:
|
|
2983
|
+
zeroWidthParagraphBreak: 0,
|
|
2984
2984
|
vertexAngle: 0,
|
|
2985
2985
|
centerAngle: 0,
|
|
2986
2986
|
background: { rgb: "#ccc" }
|
|
2987
2987
|
},
|
|
2988
|
-
autoHyphenation:
|
|
2989
|
-
doNotHyphenateCaps:
|
|
2988
|
+
autoHyphenation: 1,
|
|
2989
|
+
doNotHyphenateCaps: 0,
|
|
2990
2990
|
consecutiveHyphenLimit: 2,
|
|
2991
2991
|
defaultHeaderId: "",
|
|
2992
2992
|
defaultFooterId: "",
|
|
@@ -2994,8 +2994,8 @@ function getEmptySnapshot$1(unitID = generateRandomId(6), locale = LocaleType.EN
|
|
|
2994
2994
|
evenPageFooterId: "",
|
|
2995
2995
|
firstPageHeaderId: "",
|
|
2996
2996
|
firstPageFooterId: "",
|
|
2997
|
-
evenAndOddHeaders:
|
|
2998
|
-
useFirstPageHeaderFooter:
|
|
2997
|
+
evenAndOddHeaders: 0,
|
|
2998
|
+
useFirstPageHeaderFooter: 0,
|
|
2999
2999
|
marginHeader: 30,
|
|
3000
3000
|
marginFooter: 30
|
|
3001
3001
|
},
|
|
@@ -3151,28 +3151,28 @@ const ILogService = createIdentifier("univer.log");
|
|
|
3151
3151
|
var DesktopLogService = class extends Disposable {
|
|
3152
3152
|
constructor(..._args) {
|
|
3153
3153
|
super(..._args);
|
|
3154
|
-
_defineProperty(this, "_logLevel",
|
|
3154
|
+
_defineProperty(this, "_logLevel", 3);
|
|
3155
3155
|
_defineProperty(this, "_deduction", /* @__PURE__ */ new Set());
|
|
3156
3156
|
}
|
|
3157
3157
|
dispose() {
|
|
3158
3158
|
super.dispose();
|
|
3159
|
-
this._logLevel =
|
|
3159
|
+
this._logLevel = 3;
|
|
3160
3160
|
this._deduction.clear();
|
|
3161
3161
|
}
|
|
3162
3162
|
debug(...args) {
|
|
3163
|
-
if (this._logLevel >=
|
|
3163
|
+
if (this._logLevel >= 4) this._log(console.debug, ...args);
|
|
3164
3164
|
}
|
|
3165
3165
|
log(...args) {
|
|
3166
|
-
if (this._logLevel >=
|
|
3166
|
+
if (this._logLevel >= 3) this._log(console.log, ...args);
|
|
3167
3167
|
}
|
|
3168
3168
|
warn(...args) {
|
|
3169
|
-
if (this._logLevel >=
|
|
3169
|
+
if (this._logLevel >= 2) this._log(console.warn, ...args);
|
|
3170
3170
|
}
|
|
3171
3171
|
error(...args) {
|
|
3172
|
-
if (this._logLevel >=
|
|
3172
|
+
if (this._logLevel >= 1) this._log(console.error, ...args);
|
|
3173
3173
|
}
|
|
3174
3174
|
deprecate(...args) {
|
|
3175
|
-
if (this._logLevel >=
|
|
3175
|
+
if (this._logLevel >= 2) this._logWithDeduplication(console.error, ...args);
|
|
3176
3176
|
}
|
|
3177
3177
|
setLogLevel(logLevel) {
|
|
3178
3178
|
this._logLevel = logLevel;
|
|
@@ -3194,7 +3194,7 @@ function hashLogContent(...args) {
|
|
|
3194
3194
|
}
|
|
3195
3195
|
|
|
3196
3196
|
//#endregion
|
|
3197
|
-
//#region \0@oxc-project+runtime@0.
|
|
3197
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
3198
3198
|
function __decorateParam(paramIndex, decorator) {
|
|
3199
3199
|
return function(target, key) {
|
|
3200
3200
|
decorator(target, key, paramIndex);
|
|
@@ -3202,7 +3202,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
3202
3202
|
}
|
|
3203
3203
|
|
|
3204
3204
|
//#endregion
|
|
3205
|
-
//#region \0@oxc-project+runtime@0.
|
|
3205
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
3206
3206
|
function __decorate(decorators, target, key, desc) {
|
|
3207
3207
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3208
3208
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3275,7 +3275,7 @@ var CommandRegistry = class {
|
|
|
3275
3275
|
};
|
|
3276
3276
|
const NilCommand = {
|
|
3277
3277
|
id: "nil",
|
|
3278
|
-
type:
|
|
3278
|
+
type: 0,
|
|
3279
3279
|
handler: () => true
|
|
3280
3280
|
};
|
|
3281
3281
|
let CommandService = class CommandService extends Disposable {
|
|
@@ -3362,10 +3362,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3362
3362
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3363
3363
|
const result = await this._execute(command, params, _options);
|
|
3364
3364
|
if (_options.syncOnly) {
|
|
3365
|
-
if (command.type ===
|
|
3365
|
+
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3366
3366
|
} else {
|
|
3367
3367
|
this._commandExecutedListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3368
|
-
if (command.type ===
|
|
3368
|
+
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3369
3369
|
}
|
|
3370
3370
|
stackItemDisposable.dispose();
|
|
3371
3371
|
return result;
|
|
@@ -3386,8 +3386,8 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3386
3386
|
type: command.type,
|
|
3387
3387
|
params
|
|
3388
3388
|
};
|
|
3389
|
-
if (command.type ===
|
|
3390
|
-
const triggerCommand = findLast(this._commandExecutionStack, (item) => item.type ===
|
|
3389
|
+
if (command.type === 2) {
|
|
3390
|
+
const triggerCommand = findLast(this._commandExecutionStack, (item) => item.type === 0);
|
|
3391
3391
|
if (triggerCommand) {
|
|
3392
3392
|
var _commandInfo$params;
|
|
3393
3393
|
commandInfo.params = (_commandInfo$params = commandInfo.params) !== null && _commandInfo$params !== void 0 ? _commandInfo$params : {};
|
|
@@ -3399,10 +3399,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3399
3399
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3400
3400
|
const result = this._syncExecute(command, params, _options);
|
|
3401
3401
|
if (_options.syncOnly) {
|
|
3402
|
-
if (command.type ===
|
|
3402
|
+
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3403
3403
|
} else {
|
|
3404
3404
|
this._commandExecutedListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3405
|
-
if (command.type ===
|
|
3405
|
+
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3406
3406
|
}
|
|
3407
3407
|
stackItemDisposable.dispose();
|
|
3408
3408
|
return result;
|
|
@@ -3481,7 +3481,7 @@ var MultiCommand = class {
|
|
|
3481
3481
|
this.id = id;
|
|
3482
3482
|
_defineProperty(this, "name", void 0);
|
|
3483
3483
|
_defineProperty(this, "multi", true);
|
|
3484
|
-
_defineProperty(this, "type",
|
|
3484
|
+
_defineProperty(this, "type", 0);
|
|
3485
3485
|
_defineProperty(this, "priority", 0);
|
|
3486
3486
|
_defineProperty(this, "_implementations", []);
|
|
3487
3487
|
_defineProperty(this, "handler", async (accessor, params) => {
|
|
@@ -3577,7 +3577,7 @@ function convertObservableToBehaviorSubject(observable, initValue) {
|
|
|
3577
3577
|
const afterInitApply = (commandService) => {
|
|
3578
3578
|
return new Promise((res) => {
|
|
3579
3579
|
merge$1(fromCallback(commandService.onCommandExecuted.bind(commandService)).pipe(filter$1(([info]) => {
|
|
3580
|
-
return info.type ===
|
|
3580
|
+
return info.type === 2;
|
|
3581
3581
|
})), timer(300)).pipe(debounceTime$1(16), first()).subscribe(() => {
|
|
3582
3582
|
res();
|
|
3583
3583
|
});
|
|
@@ -4908,9 +4908,9 @@ function isICellData(value) {
|
|
|
4908
4908
|
}
|
|
4909
4909
|
function getCellValueType(cell) {
|
|
4910
4910
|
if (cell.t !== void 0) return cell.t;
|
|
4911
|
-
if (typeof cell.v === "string") return
|
|
4912
|
-
if (typeof cell.v === "number") return
|
|
4913
|
-
if (typeof cell.v === "boolean") return
|
|
4911
|
+
if (typeof cell.v === "string") return 1;
|
|
4912
|
+
if (typeof cell.v === "number") return 2;
|
|
4913
|
+
if (typeof cell.v === "boolean") return 3;
|
|
4914
4914
|
}
|
|
4915
4915
|
function isNullCell(cell) {
|
|
4916
4916
|
if (cell == null) return true;
|
|
@@ -5028,34 +5028,19 @@ let CellModeEnum = /* @__PURE__ */ function(CellModeEnum) {
|
|
|
5028
5028
|
|
|
5029
5029
|
//#endregion
|
|
5030
5030
|
//#region src/types/const/theme-color-map.ts
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
* limitations under the License.
|
|
5045
|
-
*/
|
|
5046
|
-
const THEME_COLORS = { [ThemeColors.OFFICE]: {
|
|
5047
|
-
[ThemeColorType.ACCENT1]: "#4472C4",
|
|
5048
|
-
[ThemeColorType.ACCENT2]: "#ED7D31",
|
|
5049
|
-
[ThemeColorType.ACCENT3]: "#A5A5A5",
|
|
5050
|
-
[ThemeColorType.ACCENT4]: "#70AD47",
|
|
5051
|
-
[ThemeColorType.ACCENT5]: "#5B9BD5",
|
|
5052
|
-
[ThemeColorType.ACCENT6]: "#70AD47",
|
|
5053
|
-
[ThemeColorType.DARK1]: "#000000",
|
|
5054
|
-
[ThemeColorType.DARK2]: "#44546A",
|
|
5055
|
-
[ThemeColorType.LIGHT1]: "#FFFFFF",
|
|
5056
|
-
[ThemeColorType.LIGHT2]: "#E7E6E6",
|
|
5057
|
-
[ThemeColorType.HYPERLINK]: "#0563C1",
|
|
5058
|
-
[ThemeColorType.FOLLOWED_HYPERLINK]: "#954F72"
|
|
5031
|
+
const THEME_COLORS = { ["Office"]: {
|
|
5032
|
+
[4]: "#4472C4",
|
|
5033
|
+
[5]: "#ED7D31",
|
|
5034
|
+
[6]: "#A5A5A5",
|
|
5035
|
+
[7]: "#70AD47",
|
|
5036
|
+
[8]: "#5B9BD5",
|
|
5037
|
+
[9]: "#70AD47",
|
|
5038
|
+
[0]: "#000000",
|
|
5039
|
+
[2]: "#44546A",
|
|
5040
|
+
[1]: "#FFFFFF",
|
|
5041
|
+
[3]: "#E7E6E6",
|
|
5042
|
+
[10]: "#0563C1",
|
|
5043
|
+
[11]: "#954F72"
|
|
5059
5044
|
} };
|
|
5060
5045
|
|
|
5061
5046
|
//#endregion
|
|
@@ -5798,7 +5783,7 @@ function getColorStyle(color) {
|
|
|
5798
5783
|
if (color.rgb) return new ColorKit(color.rgb).toHexString();
|
|
5799
5784
|
if (color.th != null) {
|
|
5800
5785
|
var _THEME_COLORS$ThemeCo;
|
|
5801
|
-
const themeColor = (_THEME_COLORS$ThemeCo = THEME_COLORS[
|
|
5786
|
+
const themeColor = (_THEME_COLORS$ThemeCo = THEME_COLORS["Office"]) === null || _THEME_COLORS$ThemeCo === void 0 ? void 0 : _THEME_COLORS$ThemeCo[color.th];
|
|
5802
5787
|
if (themeColor) return new ColorKit(themeColor).toRgbString();
|
|
5803
5788
|
}
|
|
5804
5789
|
}
|
|
@@ -5897,12 +5882,12 @@ function handleStyleToString(style, isCell = false) {
|
|
|
5897
5882
|
if (style.cl) str += `color: ${getColorStyle(style.cl)}; `;
|
|
5898
5883
|
}],
|
|
5899
5884
|
["va", () => {
|
|
5900
|
-
if (style.va ===
|
|
5901
|
-
else if (style.va ===
|
|
5885
|
+
if (style.va === 2) str += "vertical-align: sub; ";
|
|
5886
|
+
else if (style.va === 3) str += "vertical-align: super; ";
|
|
5902
5887
|
}],
|
|
5903
5888
|
["td", () => {
|
|
5904
|
-
if (style.td ===
|
|
5905
|
-
else if (style.td ===
|
|
5889
|
+
if (style.td === 1) str += "direction: ltr; ";
|
|
5890
|
+
else if (style.td === 2) str += "direction: rtl; ";
|
|
5906
5891
|
}],
|
|
5907
5892
|
["tr", () => {
|
|
5908
5893
|
if (style.tr) {
|
|
@@ -5911,19 +5896,19 @@ function handleStyleToString(style, isCell = false) {
|
|
|
5911
5896
|
}
|
|
5912
5897
|
}],
|
|
5913
5898
|
["ht", () => {
|
|
5914
|
-
if (style.ht ===
|
|
5915
|
-
else if (style.ht ===
|
|
5916
|
-
else if (style.ht ===
|
|
5917
|
-
else if (style.ht ===
|
|
5899
|
+
if (style.ht === 1) str += "text-align: left; ";
|
|
5900
|
+
else if (style.ht === 3) str += "text-align: right; ";
|
|
5901
|
+
else if (style.ht === 2) str += "text-align: center; ";
|
|
5902
|
+
else if (style.ht === 4) str += "text-align: justify; ";
|
|
5918
5903
|
}],
|
|
5919
5904
|
["vt", () => {
|
|
5920
|
-
if (style.vt ===
|
|
5921
|
-
else if (style.vt ===
|
|
5922
|
-
else if (style.vt ===
|
|
5905
|
+
if (style.vt === 3) str += "vertical-align: bottom; ";
|
|
5906
|
+
else if (style.vt === 1) str += "vertical-align: top; ";
|
|
5907
|
+
else if (style.vt === 2) str += "vertical-align: middle; ";
|
|
5923
5908
|
}],
|
|
5924
5909
|
["tb", () => {
|
|
5925
|
-
if (style.tb ===
|
|
5926
|
-
else if (style.tb ===
|
|
5910
|
+
if (style.tb === 2) str += "white-space: nowrap; overflow-x: hidden; ";
|
|
5911
|
+
else if (style.tb === 3) str += "white-space: normal;";
|
|
5927
5912
|
}],
|
|
5928
5913
|
["pd", () => {
|
|
5929
5914
|
var _style$pd, _style$pd2, _style$pd3, _style$pd4, _style$pd5, _style$pd6, _style$pd7, _style$pd8;
|
|
@@ -5951,36 +5936,36 @@ function handleStyleToString(style, isCell = false) {
|
|
|
5951
5936
|
}
|
|
5952
5937
|
function getBorderStyle(type) {
|
|
5953
5938
|
let str = "";
|
|
5954
|
-
if (type ===
|
|
5955
|
-
else if (type ===
|
|
5956
|
-
else if (type ===
|
|
5957
|
-
else if (type ===
|
|
5958
|
-
else if (type ===
|
|
5959
|
-
else if (type ===
|
|
5960
|
-
else if (type ===
|
|
5961
|
-
else if (type ===
|
|
5962
|
-
else if (type ===
|
|
5963
|
-
else if (type ===
|
|
5964
|
-
else if (type ===
|
|
5965
|
-
else if (type ===
|
|
5966
|
-
else if (type ===
|
|
5967
|
-
else if (type ===
|
|
5939
|
+
if (type === 0) str = "none";
|
|
5940
|
+
else if (type === 1) str = "0.5pt solid";
|
|
5941
|
+
else if (type === 2) str = "0.5pt double";
|
|
5942
|
+
else if (type === 3) str = "0.5pt dotted";
|
|
5943
|
+
else if (type === 4) str = "0.5pt dashed";
|
|
5944
|
+
else if (type === 5) str = "0.5pt dashed";
|
|
5945
|
+
else if (type === 6) str = "0.5pt dotted";
|
|
5946
|
+
else if (type === 7) str = "0.5pt double";
|
|
5947
|
+
else if (type === 8) str = "1pt solid";
|
|
5948
|
+
else if (type === 9) str = "1pt dashed";
|
|
5949
|
+
else if (type === 10) str = "1pt dashed";
|
|
5950
|
+
else if (type === 11) str = "1pt dotted";
|
|
5951
|
+
else if (type === 12) str = "0.5pt dashed";
|
|
5952
|
+
else if (type === 13) str = "1.5pt solid";
|
|
5968
5953
|
return str;
|
|
5969
5954
|
}
|
|
5970
5955
|
function getBorderStyleType(type) {
|
|
5971
5956
|
let str = 0;
|
|
5972
5957
|
type = type.trim();
|
|
5973
|
-
if (type === "none") str =
|
|
5974
|
-
else if (type === "0.5pt solid") str =
|
|
5975
|
-
else if (type === "0.5pt double") str =
|
|
5976
|
-
else if (type === "0.5pt dotted") str =
|
|
5977
|
-
else if (type === "0.5pt dashed") str =
|
|
5978
|
-
else if (type === "1pt solid") str =
|
|
5979
|
-
else if (type === "1pt dashed") str =
|
|
5980
|
-
else if (type === "1pt dotted") str =
|
|
5981
|
-
else if (type === "1.5pt solid") str =
|
|
5982
|
-
else if (!type.includes("none")) str =
|
|
5983
|
-
else return
|
|
5958
|
+
if (type === "none") str = 0;
|
|
5959
|
+
else if (type === "0.5pt solid") str = 1;
|
|
5960
|
+
else if (type === "0.5pt double") str = 2;
|
|
5961
|
+
else if (type === "0.5pt dotted") str = 3;
|
|
5962
|
+
else if (type === "0.5pt dashed") str = 4;
|
|
5963
|
+
else if (type === "1pt solid") str = 8;
|
|
5964
|
+
else if (type === "1pt dashed") str = 9;
|
|
5965
|
+
else if (type === "1pt dotted") str = 11;
|
|
5966
|
+
else if (type === "1.5pt solid") str = 13;
|
|
5967
|
+
else if (!type.includes("none")) str = 1;
|
|
5968
|
+
else return 0;
|
|
5984
5969
|
return str;
|
|
5985
5970
|
}
|
|
5986
5971
|
function getDocsUpdateBody(model, segmentId) {
|
|
@@ -5995,9 +5980,9 @@ function getDocsUpdateBody(model, segmentId) {
|
|
|
5995
5980
|
function isValidRange(range, worksheet) {
|
|
5996
5981
|
const { startRow, endRow, startColumn, endColumn, rangeType } = range;
|
|
5997
5982
|
if (startRow < 0 || startColumn < 0 || endRow < 0 || endColumn < 0) return false;
|
|
5998
|
-
if (!(Number.isNaN(startRow) && Number.isNaN(endRow)) && rangeType ===
|
|
5999
|
-
if (!(Number.isNaN(startColumn) && Number.isNaN(endColumn)) && rangeType ===
|
|
6000
|
-
if (rangeType !==
|
|
5983
|
+
if (!(Number.isNaN(startRow) && Number.isNaN(endRow)) && rangeType === 2) return false;
|
|
5984
|
+
if (!(Number.isNaN(startColumn) && Number.isNaN(endColumn)) && rangeType === 1) return false;
|
|
5985
|
+
if (rangeType !== 1 && rangeType !== 2 && (Number.isNaN(startColumn) || Number.isNaN(startRow) || Number.isNaN(endColumn) || Number.isNaN(endRow))) return false;
|
|
6001
5986
|
if (worksheet) {
|
|
6002
5987
|
const rowCount = worksheet.getRowCount();
|
|
6003
5988
|
const colCount = worksheet.getColumnCount();
|
|
@@ -7037,23 +7022,76 @@ const DEFAULT_CELL = {
|
|
|
7037
7022
|
* Default styles.
|
|
7038
7023
|
*/
|
|
7039
7024
|
const DEFAULT_STYLES = {
|
|
7025
|
+
/**
|
|
7026
|
+
* fontFamily
|
|
7027
|
+
*/
|
|
7040
7028
|
ff: "Arial",
|
|
7029
|
+
/**
|
|
7030
|
+
* fontSize
|
|
7031
|
+
*/
|
|
7041
7032
|
fs: 11,
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7033
|
+
/**
|
|
7034
|
+
* italic
|
|
7035
|
+
* 0: false
|
|
7036
|
+
* 1: true
|
|
7037
|
+
*/
|
|
7038
|
+
it: 0,
|
|
7039
|
+
/**
|
|
7040
|
+
* bold
|
|
7041
|
+
* 0: false
|
|
7042
|
+
* 1: true
|
|
7043
|
+
*/
|
|
7044
|
+
bl: 0,
|
|
7045
|
+
/**
|
|
7046
|
+
* underline
|
|
7047
|
+
*/
|
|
7048
|
+
ul: { s: 0 },
|
|
7049
|
+
/**
|
|
7050
|
+
* strikethrough
|
|
7051
|
+
*/
|
|
7052
|
+
st: { s: 0 },
|
|
7053
|
+
/**
|
|
7054
|
+
* overline
|
|
7055
|
+
*/
|
|
7056
|
+
ol: { s: 0 },
|
|
7057
|
+
/**
|
|
7058
|
+
* textRotation
|
|
7059
|
+
*/
|
|
7047
7060
|
tr: {
|
|
7048
7061
|
a: 0,
|
|
7049
|
-
|
|
7062
|
+
/**
|
|
7063
|
+
* true : 1
|
|
7064
|
+
* false : 0
|
|
7065
|
+
*/
|
|
7066
|
+
v: 0
|
|
7050
7067
|
},
|
|
7051
|
-
|
|
7068
|
+
/**
|
|
7069
|
+
* textDirection
|
|
7070
|
+
*/
|
|
7071
|
+
td: 0,
|
|
7072
|
+
/**
|
|
7073
|
+
* color
|
|
7074
|
+
*/
|
|
7052
7075
|
cl: { rgb: "#000000" },
|
|
7076
|
+
/**
|
|
7077
|
+
* background
|
|
7078
|
+
*/
|
|
7053
7079
|
bg: { rgb: "#fff" },
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7080
|
+
/**
|
|
7081
|
+
* horizontalAlignment
|
|
7082
|
+
*/
|
|
7083
|
+
ht: 0,
|
|
7084
|
+
/**
|
|
7085
|
+
* verticalAlignment
|
|
7086
|
+
*/
|
|
7087
|
+
vt: 0,
|
|
7088
|
+
/**
|
|
7089
|
+
* wrapStrategy
|
|
7090
|
+
*/
|
|
7091
|
+
tb: 0,
|
|
7092
|
+
/**
|
|
7093
|
+
* padding
|
|
7094
|
+
*/
|
|
7057
7095
|
pd: {
|
|
7058
7096
|
t: 0,
|
|
7059
7097
|
r: 0,
|
|
@@ -7061,6 +7099,9 @@ const DEFAULT_STYLES = {
|
|
|
7061
7099
|
l: 0
|
|
7062
7100
|
},
|
|
7063
7101
|
n: null,
|
|
7102
|
+
/**
|
|
7103
|
+
* border
|
|
7104
|
+
*/
|
|
7064
7105
|
bd: {
|
|
7065
7106
|
b: null,
|
|
7066
7107
|
l: null,
|
|
@@ -7074,72 +7115,72 @@ const SHEET_EDITOR_UNITS = [
|
|
|
7074
7115
|
DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY
|
|
7075
7116
|
];
|
|
7076
7117
|
const NAMED_STYLE_MAP = {
|
|
7077
|
-
[
|
|
7118
|
+
[4]: {
|
|
7078
7119
|
fs: 20,
|
|
7079
7120
|
bl: 1
|
|
7080
7121
|
},
|
|
7081
|
-
[
|
|
7122
|
+
[5]: {
|
|
7082
7123
|
fs: 18,
|
|
7083
7124
|
bl: 1
|
|
7084
7125
|
},
|
|
7085
|
-
[
|
|
7126
|
+
[6]: {
|
|
7086
7127
|
fs: 16,
|
|
7087
7128
|
bl: 1
|
|
7088
7129
|
},
|
|
7089
|
-
[
|
|
7130
|
+
[7]: {
|
|
7090
7131
|
fs: 14,
|
|
7091
7132
|
bl: 1
|
|
7092
7133
|
},
|
|
7093
|
-
[
|
|
7134
|
+
[8]: {
|
|
7094
7135
|
fs: 12,
|
|
7095
7136
|
bl: 1
|
|
7096
7137
|
},
|
|
7097
|
-
[
|
|
7098
|
-
[
|
|
7138
|
+
[1]: null,
|
|
7139
|
+
[2]: {
|
|
7099
7140
|
fs: 26,
|
|
7100
7141
|
bl: 1
|
|
7101
7142
|
},
|
|
7102
|
-
[
|
|
7143
|
+
[3]: {
|
|
7103
7144
|
fs: 15,
|
|
7104
7145
|
cl: { rgb: "#999999" }
|
|
7105
7146
|
},
|
|
7106
|
-
[
|
|
7147
|
+
[0]: null
|
|
7107
7148
|
};
|
|
7108
7149
|
const BOTTOM_P = 4;
|
|
7109
7150
|
const NAMED_STYLE_SPACE_MAP = {
|
|
7110
|
-
[
|
|
7151
|
+
[4]: {
|
|
7111
7152
|
spaceAbove: { v: 20 },
|
|
7112
7153
|
spaceBelow: { v: 6 + BOTTOM_P }
|
|
7113
7154
|
},
|
|
7114
|
-
[
|
|
7155
|
+
[5]: {
|
|
7115
7156
|
spaceAbove: { v: 18 },
|
|
7116
7157
|
spaceBelow: { v: 6 + BOTTOM_P }
|
|
7117
7158
|
},
|
|
7118
|
-
[
|
|
7159
|
+
[6]: {
|
|
7119
7160
|
spaceAbove: { v: 16 },
|
|
7120
7161
|
spaceBelow: { v: 6 + BOTTOM_P }
|
|
7121
7162
|
},
|
|
7122
|
-
[
|
|
7163
|
+
[7]: {
|
|
7123
7164
|
spaceAbove: { v: 14 },
|
|
7124
7165
|
spaceBelow: { v: 4 + BOTTOM_P }
|
|
7125
7166
|
},
|
|
7126
|
-
[
|
|
7167
|
+
[8]: {
|
|
7127
7168
|
spaceAbove: { v: 12 },
|
|
7128
7169
|
spaceBelow: { v: 4 + BOTTOM_P }
|
|
7129
7170
|
},
|
|
7130
|
-
[
|
|
7171
|
+
[1]: {
|
|
7131
7172
|
spaceAbove: { v: 0 },
|
|
7132
7173
|
spaceBelow: { v: 0 }
|
|
7133
7174
|
},
|
|
7134
|
-
[
|
|
7175
|
+
[2]: {
|
|
7135
7176
|
spaceAbove: { v: 0 },
|
|
7136
7177
|
spaceBelow: { v: 3 + BOTTOM_P }
|
|
7137
7178
|
},
|
|
7138
|
-
[
|
|
7179
|
+
[3]: {
|
|
7139
7180
|
spaceAbove: { v: 0 },
|
|
7140
7181
|
spaceBelow: { v: 16 }
|
|
7141
7182
|
},
|
|
7142
|
-
[
|
|
7183
|
+
[0]: null
|
|
7143
7184
|
};
|
|
7144
7185
|
const PRINT_CHART_COMPONENT_KEY = "univer-sheets-chart-print-chart";
|
|
7145
7186
|
const DOC_DRAWING_PRINTING_COMPONENT_KEY = "univer-docs-drawing-printing";
|
|
@@ -7170,47 +7211,47 @@ let EXTENSION_NAMES = /* @__PURE__ */ function(EXTENSION_NAMES) {
|
|
|
7170
7211
|
//#endregion
|
|
7171
7212
|
//#region src/types/const/page-size.ts
|
|
7172
7213
|
const PAGE_SIZE = {
|
|
7173
|
-
[
|
|
7214
|
+
["A3"]: {
|
|
7174
7215
|
width: 1123,
|
|
7175
7216
|
height: 1587
|
|
7176
7217
|
},
|
|
7177
|
-
[
|
|
7218
|
+
["A4"]: {
|
|
7178
7219
|
width: 794,
|
|
7179
7220
|
height: 1124
|
|
7180
7221
|
},
|
|
7181
|
-
[
|
|
7222
|
+
["A5"]: {
|
|
7182
7223
|
width: 559,
|
|
7183
7224
|
height: 794
|
|
7184
7225
|
},
|
|
7185
|
-
[
|
|
7226
|
+
["B4"]: {
|
|
7186
7227
|
width: 944,
|
|
7187
7228
|
height: 1344
|
|
7188
7229
|
},
|
|
7189
|
-
[
|
|
7230
|
+
["B5"]: {
|
|
7190
7231
|
width: 665,
|
|
7191
7232
|
height: 944
|
|
7192
7233
|
},
|
|
7193
|
-
[
|
|
7234
|
+
["Executive"]: {
|
|
7194
7235
|
width: 696,
|
|
7195
7236
|
height: 1008
|
|
7196
7237
|
},
|
|
7197
|
-
[
|
|
7238
|
+
["Folio"]: {
|
|
7198
7239
|
width: 816,
|
|
7199
7240
|
height: 1248
|
|
7200
7241
|
},
|
|
7201
|
-
[
|
|
7242
|
+
["Legal"]: {
|
|
7202
7243
|
width: 816,
|
|
7203
7244
|
height: 1344
|
|
7204
7245
|
},
|
|
7205
|
-
[
|
|
7246
|
+
["Letter"]: {
|
|
7206
7247
|
width: 816,
|
|
7207
7248
|
height: 1056
|
|
7208
7249
|
},
|
|
7209
|
-
[
|
|
7250
|
+
["Statement"]: {
|
|
7210
7251
|
width: 528,
|
|
7211
7252
|
height: 816
|
|
7212
7253
|
},
|
|
7213
|
-
[
|
|
7254
|
+
["Tabloid"]: {
|
|
7214
7255
|
width: 1056,
|
|
7215
7256
|
height: 1632
|
|
7216
7257
|
}
|
|
@@ -7223,21 +7264,21 @@ function isAllFormatInTextRuns(key, body) {
|
|
|
7223
7264
|
let len = 0;
|
|
7224
7265
|
for (const textRun of textRuns) {
|
|
7225
7266
|
const { ts = {}, st, ed } = textRun;
|
|
7226
|
-
if (ts[key] == null) return
|
|
7267
|
+
if (ts[key] == null) return 0;
|
|
7227
7268
|
switch (key) {
|
|
7228
7269
|
case "bl":
|
|
7229
7270
|
case "it":
|
|
7230
|
-
if (ts[key] ===
|
|
7271
|
+
if (ts[key] === 0) return 0;
|
|
7231
7272
|
break;
|
|
7232
7273
|
case "ul":
|
|
7233
7274
|
case "st":
|
|
7234
|
-
if (ts[key].s ===
|
|
7275
|
+
if (ts[key].s === 0) return 0;
|
|
7235
7276
|
break;
|
|
7236
7277
|
default: throw new Error(`unknown style key: ${key} in IStyleBase`);
|
|
7237
7278
|
}
|
|
7238
7279
|
len += ed - st;
|
|
7239
7280
|
}
|
|
7240
|
-
return body.dataStream.indexOf("\r\n") === len ?
|
|
7281
|
+
return body.dataStream.indexOf("\r\n") === len ? 1 : 0;
|
|
7241
7282
|
}
|
|
7242
7283
|
/**
|
|
7243
7284
|
* Access and modify spreadsheet ranges.
|
|
@@ -7456,7 +7497,7 @@ var Range = class Range {
|
|
|
7456
7497
|
getUnderline() {
|
|
7457
7498
|
var _this$getValue, _p$body;
|
|
7458
7499
|
const { p } = (_this$getValue = this.getValue()) !== null && _this$getValue !== void 0 ? _this$getValue : {};
|
|
7459
|
-
if (p && Array.isArray((_p$body = p.body) === null || _p$body === void 0 ? void 0 : _p$body.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("ul", p.body) ===
|
|
7500
|
+
if (p && Array.isArray((_p$body = p.body) === null || _p$body === void 0 ? void 0 : _p$body.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("ul", p.body) === 1 ? { s: 1 } : { s: 0 };
|
|
7460
7501
|
return this.getUnderlines()[0][0];
|
|
7461
7502
|
}
|
|
7462
7503
|
/**
|
|
@@ -7477,7 +7518,7 @@ var Range = class Range {
|
|
|
7477
7518
|
getStrikeThrough() {
|
|
7478
7519
|
var _this$getValue2, _p$body2;
|
|
7479
7520
|
const { p } = (_this$getValue2 = this.getValue()) !== null && _this$getValue2 !== void 0 ? _this$getValue2 : {};
|
|
7480
|
-
if (p && Array.isArray((_p$body2 = p.body) === null || _p$body2 === void 0 ? void 0 : _p$body2.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("st", p.body) ===
|
|
7521
|
+
if (p && Array.isArray((_p$body2 = p.body) === null || _p$body2 === void 0 ? void 0 : _p$body2.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("st", p.body) === 1 ? { s: 1 } : { s: 0 };
|
|
7481
7522
|
return this.getStrikeThroughs()[0][0];
|
|
7482
7523
|
}
|
|
7483
7524
|
/**
|
|
@@ -7523,7 +7564,7 @@ var Range = class Range {
|
|
|
7523
7564
|
getFontStyle() {
|
|
7524
7565
|
var _this$getValue4, _p$body4;
|
|
7525
7566
|
const { p } = (_this$getValue4 = this.getValue()) !== null && _this$getValue4 !== void 0 ? _this$getValue4 : {};
|
|
7526
|
-
if (p && Array.isArray((_p$body4 = p.body) === null || _p$body4 === void 0 ? void 0 : _p$body4.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("it", p.body) ===
|
|
7567
|
+
if (p && Array.isArray((_p$body4 = p.body) === null || _p$body4 === void 0 ? void 0 : _p$body4.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("it", p.body) === 1 ? 1 : 0;
|
|
7527
7568
|
return this._getFontStyles()[0][0];
|
|
7528
7569
|
}
|
|
7529
7570
|
/**
|
|
@@ -7541,7 +7582,7 @@ var Range = class Range {
|
|
|
7541
7582
|
getFontWeight() {
|
|
7542
7583
|
var _this$getValue5, _p$body5;
|
|
7543
7584
|
const { p } = (_this$getValue5 = this.getValue()) !== null && _this$getValue5 !== void 0 ? _this$getValue5 : {};
|
|
7544
|
-
if (p && Array.isArray((_p$body5 = p.body) === null || _p$body5 === void 0 ? void 0 : _p$body5.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("bl", p.body) ===
|
|
7585
|
+
if (p && Array.isArray((_p$body5 = p.body) === null || _p$body5 === void 0 ? void 0 : _p$body5.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("bl", p.body) === 1 ? 1 : 0;
|
|
7545
7586
|
return this._getFontWeights()[0][0];
|
|
7546
7587
|
}
|
|
7547
7588
|
/**
|
|
@@ -7694,7 +7735,7 @@ var Range = class Range {
|
|
|
7694
7735
|
* Returns whether the text in the cell wraps.
|
|
7695
7736
|
*/
|
|
7696
7737
|
getWrap() {
|
|
7697
|
-
return this.getWrapStrategy() ===
|
|
7738
|
+
return this.getWrapStrategy() === 3 ? 1 : 0;
|
|
7698
7739
|
}
|
|
7699
7740
|
/**
|
|
7700
7741
|
* Returns the text wrapping strategies for the cells in the range.
|
|
@@ -7727,19 +7768,19 @@ var Range = class Range {
|
|
|
7727
7768
|
_defineProperty(Range, "transformRange", (range, worksheet) => {
|
|
7728
7769
|
const maxColumns = worksheet.getMaxColumns() - 1;
|
|
7729
7770
|
const maxRows = worksheet.getMaxRows() - 1;
|
|
7730
|
-
if (range.rangeType ===
|
|
7771
|
+
if (range.rangeType === 3) return {
|
|
7731
7772
|
startColumn: 0,
|
|
7732
7773
|
startRow: 0,
|
|
7733
7774
|
endColumn: maxColumns,
|
|
7734
7775
|
endRow: maxRows
|
|
7735
7776
|
};
|
|
7736
|
-
if (range.rangeType ===
|
|
7777
|
+
if (range.rangeType === 2) return {
|
|
7737
7778
|
startRow: 0,
|
|
7738
7779
|
endRow: maxRows,
|
|
7739
7780
|
startColumn: range.startColumn,
|
|
7740
7781
|
endColumn: range.endColumn
|
|
7741
7782
|
};
|
|
7742
|
-
if (range.rangeType ===
|
|
7783
|
+
if (range.rangeType === 1) return {
|
|
7743
7784
|
startColumn: 0,
|
|
7744
7785
|
endColumn: maxColumns,
|
|
7745
7786
|
startRow: range.startRow,
|
|
@@ -7758,57 +7799,57 @@ _defineProperty(Range, "transformRange", (range, worksheet) => {
|
|
|
7758
7799
|
function moveRangeByOffset(range, refOffsetX, refOffsetY, ignoreAbsolute = false) {
|
|
7759
7800
|
if (refOffsetX === 0 && refOffsetY === 0) return range;
|
|
7760
7801
|
let newRange = { ...range };
|
|
7761
|
-
const startAbsoluteRefType = newRange.startAbsoluteRefType ||
|
|
7762
|
-
const endAbsoluteRefType = newRange.endAbsoluteRefType ||
|
|
7763
|
-
const rangeType = newRange.rangeType ||
|
|
7764
|
-
if (!ignoreAbsolute && startAbsoluteRefType ===
|
|
7802
|
+
const startAbsoluteRefType = newRange.startAbsoluteRefType || 0;
|
|
7803
|
+
const endAbsoluteRefType = newRange.endAbsoluteRefType || 0;
|
|
7804
|
+
const rangeType = newRange.rangeType || 0;
|
|
7805
|
+
if (!ignoreAbsolute && startAbsoluteRefType === 3 && endAbsoluteRefType === 3) return newRange;
|
|
7765
7806
|
const start = moveRangeByRangeType(newRange.startRow, refOffsetY, newRange.startColumn, refOffsetX, rangeType);
|
|
7766
7807
|
const end = moveRangeByRangeType(newRange.endRow, refOffsetY, newRange.endColumn, refOffsetX, rangeType);
|
|
7767
|
-
if (ignoreAbsolute || startAbsoluteRefType ===
|
|
7808
|
+
if (ignoreAbsolute || startAbsoluteRefType === 0 && endAbsoluteRefType === 0) return newRange = {
|
|
7768
7809
|
...newRange,
|
|
7769
7810
|
startRow: start.row,
|
|
7770
7811
|
startColumn: start.column,
|
|
7771
7812
|
endRow: end.row,
|
|
7772
7813
|
endColumn: end.column
|
|
7773
7814
|
};
|
|
7774
|
-
if (startAbsoluteRefType ===
|
|
7815
|
+
if (startAbsoluteRefType === 0) newRange = {
|
|
7775
7816
|
...newRange,
|
|
7776
7817
|
startRow: start.row,
|
|
7777
7818
|
startColumn: start.column
|
|
7778
7819
|
};
|
|
7779
|
-
else if (startAbsoluteRefType ===
|
|
7820
|
+
else if (startAbsoluteRefType === 2) newRange = {
|
|
7780
7821
|
...newRange,
|
|
7781
7822
|
startRow: start.row
|
|
7782
7823
|
};
|
|
7783
|
-
else if (startAbsoluteRefType ===
|
|
7824
|
+
else if (startAbsoluteRefType === 1) newRange = {
|
|
7784
7825
|
...newRange,
|
|
7785
7826
|
startColumn: start.column
|
|
7786
7827
|
};
|
|
7787
|
-
if (endAbsoluteRefType ===
|
|
7828
|
+
if (endAbsoluteRefType === 0) newRange = {
|
|
7788
7829
|
...newRange,
|
|
7789
7830
|
endRow: end.row,
|
|
7790
7831
|
endColumn: end.column
|
|
7791
7832
|
};
|
|
7792
|
-
else if (endAbsoluteRefType ===
|
|
7833
|
+
else if (endAbsoluteRefType === 2) newRange = {
|
|
7793
7834
|
...newRange,
|
|
7794
7835
|
endRow: end.row
|
|
7795
7836
|
};
|
|
7796
|
-
else if (endAbsoluteRefType ===
|
|
7837
|
+
else if (endAbsoluteRefType === 1) newRange = {
|
|
7797
7838
|
...newRange,
|
|
7798
7839
|
endColumn: end.column
|
|
7799
7840
|
};
|
|
7800
7841
|
return newRange;
|
|
7801
7842
|
}
|
|
7802
7843
|
function moveRangeByRangeType(row, rowOffset, column, columnOffset, rangeType) {
|
|
7803
|
-
if (rangeType ===
|
|
7844
|
+
if (rangeType === 0) return {
|
|
7804
7845
|
row: row + rowOffset,
|
|
7805
7846
|
column: column + columnOffset
|
|
7806
7847
|
};
|
|
7807
|
-
else if (rangeType ===
|
|
7848
|
+
else if (rangeType === 1) return {
|
|
7808
7849
|
row: row + rowOffset,
|
|
7809
7850
|
column
|
|
7810
7851
|
};
|
|
7811
|
-
else if (rangeType ===
|
|
7852
|
+
else if (rangeType === 2) return {
|
|
7812
7853
|
row,
|
|
7813
7854
|
column: column + columnOffset
|
|
7814
7855
|
};
|
|
@@ -7986,12 +8027,12 @@ function getOverlap1D(start1, end1, start2, end2) {
|
|
|
7986
8027
|
function determineRangeType(srcType, targetType, startRow, endRow, startColumn, endColumn) {
|
|
7987
8028
|
const resolvedSrcType = srcType !== void 0 ? srcType : inferRangeType(startRow, endRow, startColumn, endColumn);
|
|
7988
8029
|
const resolvedTargetType = targetType !== void 0 ? targetType : inferRangeType(startRow, endRow, startColumn, endColumn);
|
|
7989
|
-
if (resolvedSrcType ===
|
|
8030
|
+
if (resolvedSrcType === 3 || resolvedTargetType === 3) {
|
|
7990
8031
|
if (resolvedSrcType === resolvedTargetType) return resolvedSrcType;
|
|
7991
|
-
return resolvedSrcType ===
|
|
8032
|
+
return resolvedSrcType === 3 ? resolvedTargetType : resolvedSrcType;
|
|
7992
8033
|
} else if (resolvedSrcType === resolvedTargetType) return resolvedSrcType;
|
|
7993
|
-
else if (resolvedSrcType ===
|
|
7994
|
-
else return
|
|
8034
|
+
else if (resolvedSrcType === 0 || resolvedTargetType === 0) return 0;
|
|
8035
|
+
else return 0;
|
|
7995
8036
|
}
|
|
7996
8037
|
/**
|
|
7997
8038
|
* Infers the rangeType based on whether start and end rows or columns are NaN (unbounded).
|
|
@@ -8006,10 +8047,10 @@ function determineRangeType(srcType, targetType, startRow, endRow, startColumn,
|
|
|
8006
8047
|
function inferRangeType(startRow, endRow, startColumn, endColumn) {
|
|
8007
8048
|
const hasRow = !isNaN(startRow) && !isNaN(endRow);
|
|
8008
8049
|
const hasColumn = !isNaN(startColumn) && !isNaN(endColumn);
|
|
8009
|
-
if (hasRow && hasColumn) return
|
|
8010
|
-
else if (hasRow) return
|
|
8011
|
-
else if (hasColumn) return
|
|
8012
|
-
else return
|
|
8050
|
+
if (hasRow && hasColumn) return 0;
|
|
8051
|
+
else if (hasRow) return 1;
|
|
8052
|
+
else if (hasColumn) return 2;
|
|
8053
|
+
else return 3;
|
|
8013
8054
|
}
|
|
8014
8055
|
|
|
8015
8056
|
//#endregion
|
|
@@ -8068,7 +8109,7 @@ var Rectangle = class Rectangle {
|
|
|
8068
8109
|
*/
|
|
8069
8110
|
static equals(src, target) {
|
|
8070
8111
|
if (src == null || target == null) return false;
|
|
8071
|
-
return src.endRow === target.endRow && src.endColumn === target.endColumn && src.startRow === target.startRow && src.startColumn === target.startColumn && (src.rangeType === target.rangeType || src.rangeType === void 0 && target.rangeType ===
|
|
8112
|
+
return src.endRow === target.endRow && src.endColumn === target.endColumn && src.startRow === target.startRow && src.startColumn === target.startColumn && (src.rangeType === target.rangeType || src.rangeType === void 0 && target.rangeType === 0 || target.rangeType === void 0 && src.rangeType === 0);
|
|
8072
8113
|
}
|
|
8073
8114
|
/**
|
|
8074
8115
|
* Quickly checks if two normal ranges intersect. For specialized range types,
|
|
@@ -8107,10 +8148,10 @@ var Rectangle = class Rectangle {
|
|
|
8107
8148
|
* ```
|
|
8108
8149
|
*/
|
|
8109
8150
|
static intersects(src, target) {
|
|
8110
|
-
if (src.rangeType ===
|
|
8111
|
-
if (src.rangeType ===
|
|
8112
|
-
if (src.rangeType ===
|
|
8113
|
-
if (src.rangeType ===
|
|
8151
|
+
if (src.rangeType === 1 && target.rangeType === 2) return true;
|
|
8152
|
+
if (src.rangeType === 2 && target.rangeType === 1) return true;
|
|
8153
|
+
if (src.rangeType === 1 && target.rangeType === 1) return src.startRow <= target.endRow && src.endRow >= target.startRow;
|
|
8154
|
+
if (src.rangeType === 2 && target.rangeType === 2) return src.startColumn <= target.endColumn && src.endColumn >= target.startColumn;
|
|
8114
8155
|
const currentStartRow = Number.isNaN(src.startRow) ? 0 : src.startRow;
|
|
8115
8156
|
const currentEndRow = Number.isNaN(src.endRow) ? MAX_ROW_COUNT - 1 : src.endRow;
|
|
8116
8157
|
const currentStartColumn = Number.isNaN(src.startColumn) ? 0 : src.startColumn;
|
|
@@ -8201,7 +8242,7 @@ var Rectangle = class Rectangle {
|
|
|
8201
8242
|
endRow,
|
|
8202
8243
|
startColumn,
|
|
8203
8244
|
endColumn,
|
|
8204
|
-
rangeType:
|
|
8245
|
+
rangeType: 0
|
|
8205
8246
|
};
|
|
8206
8247
|
}
|
|
8207
8248
|
/**
|
|
@@ -8249,7 +8290,7 @@ var Rectangle = class Rectangle {
|
|
|
8249
8290
|
startColumn: Math.min(acc.startColumn, current.startColumn),
|
|
8250
8291
|
endRow: Math.max(acc.endRow, current.endRow),
|
|
8251
8292
|
endColumn: Math.max(acc.endColumn, current.endColumn),
|
|
8252
|
-
rangeType:
|
|
8293
|
+
rangeType: 0
|
|
8253
8294
|
}), ranges[0]);
|
|
8254
8295
|
}
|
|
8255
8296
|
/**
|
|
@@ -8270,15 +8311,15 @@ var Rectangle = class Rectangle {
|
|
|
8270
8311
|
* ```
|
|
8271
8312
|
*/
|
|
8272
8313
|
static realUnion(...ranges) {
|
|
8273
|
-
const hasColRange = ranges.some((range) => range.rangeType ===
|
|
8274
|
-
const hasRowRange = ranges.some((range) => range.rangeType ===
|
|
8314
|
+
const hasColRange = ranges.some((range) => range.rangeType === 2);
|
|
8315
|
+
const hasRowRange = ranges.some((range) => range.rangeType === 1);
|
|
8275
8316
|
const res = Rectangle.union(...ranges);
|
|
8276
8317
|
return {
|
|
8277
8318
|
startColumn: hasRowRange ? NaN : res.startColumn,
|
|
8278
8319
|
endColumn: hasRowRange ? NaN : res.endColumn,
|
|
8279
8320
|
startRow: hasColRange ? NaN : res.startRow,
|
|
8280
8321
|
endRow: hasColRange ? NaN : res.endRow,
|
|
8281
|
-
rangeType: hasRowRange ?
|
|
8322
|
+
rangeType: hasRowRange ? 1 : hasColRange ? 2 : 0
|
|
8282
8323
|
};
|
|
8283
8324
|
}
|
|
8284
8325
|
/**
|
|
@@ -8446,10 +8487,10 @@ _defineProperty(Rectangle, "getRelativeRange", (range, originRange) => ({
|
|
|
8446
8487
|
}));
|
|
8447
8488
|
_defineProperty(Rectangle, "getPositionRange", (relativeRange, originRange, absoluteRange) => ({
|
|
8448
8489
|
...absoluteRange || {},
|
|
8449
|
-
startRow: absoluteRange ? [
|
|
8450
|
-
endRow: absoluteRange ? [
|
|
8451
|
-
startColumn: absoluteRange ? [
|
|
8452
|
-
endColumn: absoluteRange ? [
|
|
8490
|
+
startRow: absoluteRange ? [1, 3].includes(absoluteRange.startAbsoluteRefType || 0) ? absoluteRange.startRow : relativeRange.startRow + originRange.startRow : relativeRange.startRow + originRange.startRow,
|
|
8491
|
+
endRow: absoluteRange ? [1, 3].includes(absoluteRange.endAbsoluteRefType || 0) ? absoluteRange.endRow : relativeRange.endRow + relativeRange.startRow + originRange.startRow : relativeRange.endRow + relativeRange.startRow + originRange.startRow,
|
|
8492
|
+
startColumn: absoluteRange ? [2, 3].includes(absoluteRange.startAbsoluteRefType || 0) ? absoluteRange.startColumn : relativeRange.startColumn + originRange.startColumn : relativeRange.startColumn + originRange.startColumn,
|
|
8493
|
+
endColumn: absoluteRange ? [2, 3].includes(absoluteRange.endAbsoluteRefType || 0) ? absoluteRange.endColumn : relativeRange.endColumn + relativeRange.startColumn + originRange.startColumn : relativeRange.endColumn + relativeRange.startColumn + originRange.startColumn
|
|
8453
8494
|
}));
|
|
8454
8495
|
_defineProperty(Rectangle, "moveHorizontal", (range, step = 0, length = 0) => ({
|
|
8455
8496
|
...range,
|
|
@@ -8464,28 +8505,28 @@ _defineProperty(Rectangle, "moveVertical", (range, step = 0, length = 0) => ({
|
|
|
8464
8505
|
_defineProperty(Rectangle, "moveOffset", (range, offsetX, offsetY) => {
|
|
8465
8506
|
const _range = { ...range };
|
|
8466
8507
|
switch (range.startAbsoluteRefType) {
|
|
8467
|
-
case
|
|
8508
|
+
case 1:
|
|
8468
8509
|
_range.startColumn += offsetX;
|
|
8469
8510
|
break;
|
|
8470
|
-
case
|
|
8511
|
+
case 2:
|
|
8471
8512
|
_range.startRow += offsetY;
|
|
8472
8513
|
break;
|
|
8473
|
-
case
|
|
8474
|
-
case
|
|
8514
|
+
case 3: break;
|
|
8515
|
+
case 0:
|
|
8475
8516
|
default:
|
|
8476
8517
|
_range.startRow += offsetY;
|
|
8477
8518
|
_range.startColumn += offsetX;
|
|
8478
8519
|
break;
|
|
8479
8520
|
}
|
|
8480
8521
|
switch (range.endAbsoluteRefType) {
|
|
8481
|
-
case
|
|
8522
|
+
case 1:
|
|
8482
8523
|
_range.endColumn += offsetX;
|
|
8483
8524
|
break;
|
|
8484
|
-
case
|
|
8525
|
+
case 2:
|
|
8485
8526
|
_range.endRow += offsetY;
|
|
8486
8527
|
break;
|
|
8487
|
-
case
|
|
8488
|
-
case
|
|
8528
|
+
case 3: break;
|
|
8529
|
+
case 0:
|
|
8489
8530
|
default:
|
|
8490
8531
|
_range.endRow += offsetY;
|
|
8491
8532
|
_range.endColumn += offsetX;
|
|
@@ -9392,27 +9433,27 @@ let PresetListType = /* @__PURE__ */ function(PresetListType) {
|
|
|
9392
9433
|
const orderListSymbolMap = {
|
|
9393
9434
|
"a)": {
|
|
9394
9435
|
glyphFormat: "%1)",
|
|
9395
|
-
glyphType:
|
|
9436
|
+
glyphType: 2
|
|
9396
9437
|
},
|
|
9397
9438
|
"1.": {
|
|
9398
9439
|
glyphFormat: "%1.",
|
|
9399
|
-
glyphType:
|
|
9440
|
+
glyphType: 2
|
|
9400
9441
|
},
|
|
9401
9442
|
"a.": {
|
|
9402
9443
|
glyphFormat: "%1.",
|
|
9403
|
-
glyphType:
|
|
9444
|
+
glyphType: 5
|
|
9404
9445
|
},
|
|
9405
9446
|
"A.": {
|
|
9406
9447
|
glyphFormat: "%1.",
|
|
9407
|
-
glyphType:
|
|
9448
|
+
glyphType: 4
|
|
9408
9449
|
},
|
|
9409
9450
|
"i.": {
|
|
9410
9451
|
glyphFormat: "%1.",
|
|
9411
|
-
glyphType:
|
|
9452
|
+
glyphType: 7
|
|
9412
9453
|
},
|
|
9413
9454
|
"I.": {
|
|
9414
9455
|
glyphFormat: "%1.",
|
|
9415
|
-
glyphType:
|
|
9456
|
+
glyphType: 4
|
|
9416
9457
|
}
|
|
9417
9458
|
};
|
|
9418
9459
|
const bulletListFactory = (symbols) => {
|
|
@@ -9423,7 +9464,7 @@ const bulletListFactory = (symbols) => {
|
|
|
9423
9464
|
].map((templateSymbol, i) => ({
|
|
9424
9465
|
glyphFormat: ` %${i + 1}`,
|
|
9425
9466
|
glyphSymbol: templateSymbol,
|
|
9426
|
-
bulletAlignment:
|
|
9467
|
+
bulletAlignment: 1,
|
|
9427
9468
|
textStyle: { fs: 12 },
|
|
9428
9469
|
startNumber: 0,
|
|
9429
9470
|
paragraphProperties: {
|
|
@@ -9435,7 +9476,7 @@ const bulletListFactory = (symbols) => {
|
|
|
9435
9476
|
const orderListFactory = (options) => {
|
|
9436
9477
|
return options.map((format, i) => ({
|
|
9437
9478
|
...format,
|
|
9438
|
-
bulletAlignment:
|
|
9479
|
+
bulletAlignment: 1,
|
|
9439
9480
|
textStyle: { fs: 12 },
|
|
9440
9481
|
startNumber: 0,
|
|
9441
9482
|
paragraphProperties: {
|
|
@@ -9448,7 +9489,7 @@ const checkListFactory = (symbol, textStyle) => {
|
|
|
9448
9489
|
return new Array(9).fill(0).map((_, i) => ({
|
|
9449
9490
|
glyphFormat: ` %${i + 1}`,
|
|
9450
9491
|
glyphSymbol: symbol,
|
|
9451
|
-
bulletAlignment:
|
|
9492
|
+
bulletAlignment: 1,
|
|
9452
9493
|
textStyle: { fs: 16 },
|
|
9453
9494
|
startNumber: 0,
|
|
9454
9495
|
paragraphProperties: {
|
|
@@ -9459,138 +9500,138 @@ const checkListFactory = (symbol, textStyle) => {
|
|
|
9459
9500
|
}));
|
|
9460
9501
|
};
|
|
9461
9502
|
const PRESET_LIST_TYPE = {
|
|
9462
|
-
[
|
|
9463
|
-
listType:
|
|
9503
|
+
["BULLET_LIST"]: {
|
|
9504
|
+
listType: "BULLET_LIST",
|
|
9464
9505
|
nestingLevel: bulletListFactory([
|
|
9465
9506
|
"●",
|
|
9466
9507
|
"○",
|
|
9467
9508
|
"■"
|
|
9468
9509
|
])
|
|
9469
9510
|
},
|
|
9470
|
-
[
|
|
9471
|
-
listType:
|
|
9511
|
+
["BULLET_LIST_1"]: {
|
|
9512
|
+
listType: "BULLET_LIST",
|
|
9472
9513
|
nestingLevel: bulletListFactory([
|
|
9473
9514
|
"❖",
|
|
9474
9515
|
"➢",
|
|
9475
9516
|
"■"
|
|
9476
9517
|
])
|
|
9477
9518
|
},
|
|
9478
|
-
[
|
|
9479
|
-
listType:
|
|
9519
|
+
["BULLET_LIST_2"]: {
|
|
9520
|
+
listType: "BULLET_LIST",
|
|
9480
9521
|
nestingLevel: bulletListFactory([
|
|
9481
9522
|
"✔",
|
|
9482
9523
|
"●",
|
|
9483
9524
|
"◆"
|
|
9484
9525
|
])
|
|
9485
9526
|
},
|
|
9486
|
-
[
|
|
9487
|
-
listType:
|
|
9527
|
+
["BULLET_LIST_3"]: {
|
|
9528
|
+
listType: "BULLET_LIST",
|
|
9488
9529
|
nestingLevel: bulletListFactory([
|
|
9489
9530
|
"■",
|
|
9490
9531
|
"◆",
|
|
9491
9532
|
"○"
|
|
9492
9533
|
])
|
|
9493
9534
|
},
|
|
9494
|
-
[
|
|
9495
|
-
listType:
|
|
9535
|
+
["BULLET_LIST_4"]: {
|
|
9536
|
+
listType: "BULLET_LIST",
|
|
9496
9537
|
nestingLevel: bulletListFactory([
|
|
9497
9538
|
"✧",
|
|
9498
9539
|
"○",
|
|
9499
9540
|
"■"
|
|
9500
9541
|
])
|
|
9501
9542
|
},
|
|
9502
|
-
[
|
|
9503
|
-
listType:
|
|
9543
|
+
["BULLET_LIST_5"]: {
|
|
9544
|
+
listType: "BULLET_LIST",
|
|
9504
9545
|
nestingLevel: bulletListFactory([
|
|
9505
9546
|
"➢",
|
|
9506
9547
|
"○",
|
|
9507
9548
|
"◆"
|
|
9508
9549
|
])
|
|
9509
9550
|
},
|
|
9510
|
-
[
|
|
9511
|
-
listType:
|
|
9551
|
+
["ORDER_LIST"]: {
|
|
9552
|
+
listType: "ORDER_LIST",
|
|
9512
9553
|
nestingLevel: orderListFactory([
|
|
9513
9554
|
{
|
|
9514
9555
|
glyphFormat: "%1.",
|
|
9515
|
-
glyphType:
|
|
9556
|
+
glyphType: 2
|
|
9516
9557
|
},
|
|
9517
9558
|
{
|
|
9518
9559
|
glyphFormat: "%2.",
|
|
9519
|
-
glyphType:
|
|
9560
|
+
glyphType: 5
|
|
9520
9561
|
},
|
|
9521
9562
|
{
|
|
9522
9563
|
glyphFormat: "%3.",
|
|
9523
|
-
glyphType:
|
|
9564
|
+
glyphType: 7
|
|
9524
9565
|
},
|
|
9525
9566
|
{
|
|
9526
9567
|
glyphFormat: "%4.",
|
|
9527
|
-
glyphType:
|
|
9568
|
+
glyphType: 2
|
|
9528
9569
|
},
|
|
9529
9570
|
{
|
|
9530
9571
|
glyphFormat: "%5.",
|
|
9531
|
-
glyphType:
|
|
9572
|
+
glyphType: 5
|
|
9532
9573
|
},
|
|
9533
9574
|
{
|
|
9534
9575
|
glyphFormat: "%6.",
|
|
9535
|
-
glyphType:
|
|
9576
|
+
glyphType: 7
|
|
9536
9577
|
},
|
|
9537
9578
|
{
|
|
9538
9579
|
glyphFormat: "%7.",
|
|
9539
|
-
glyphType:
|
|
9580
|
+
glyphType: 2
|
|
9540
9581
|
},
|
|
9541
9582
|
{
|
|
9542
9583
|
glyphFormat: "%8.",
|
|
9543
|
-
glyphType:
|
|
9584
|
+
glyphType: 5
|
|
9544
9585
|
},
|
|
9545
9586
|
{
|
|
9546
9587
|
glyphFormat: "%9.",
|
|
9547
|
-
glyphType:
|
|
9588
|
+
glyphType: 7
|
|
9548
9589
|
}
|
|
9549
9590
|
])
|
|
9550
9591
|
},
|
|
9551
|
-
[
|
|
9552
|
-
listType:
|
|
9592
|
+
["ORDER_LIST_1"]: {
|
|
9593
|
+
listType: "ORDER_LIST",
|
|
9553
9594
|
nestingLevel: orderListFactory([
|
|
9554
9595
|
{
|
|
9555
9596
|
glyphFormat: "%1)",
|
|
9556
|
-
glyphType:
|
|
9597
|
+
glyphType: 2
|
|
9557
9598
|
},
|
|
9558
9599
|
{
|
|
9559
9600
|
glyphFormat: "%2)",
|
|
9560
|
-
glyphType:
|
|
9601
|
+
glyphType: 5
|
|
9561
9602
|
},
|
|
9562
9603
|
{
|
|
9563
9604
|
glyphFormat: "%3)",
|
|
9564
|
-
glyphType:
|
|
9605
|
+
glyphType: 7
|
|
9565
9606
|
},
|
|
9566
9607
|
{
|
|
9567
9608
|
glyphFormat: "%4)",
|
|
9568
|
-
glyphType:
|
|
9609
|
+
glyphType: 2
|
|
9569
9610
|
},
|
|
9570
9611
|
{
|
|
9571
9612
|
glyphFormat: "%5)",
|
|
9572
|
-
glyphType:
|
|
9613
|
+
glyphType: 5
|
|
9573
9614
|
},
|
|
9574
9615
|
{
|
|
9575
9616
|
glyphFormat: "%6)",
|
|
9576
|
-
glyphType:
|
|
9617
|
+
glyphType: 7
|
|
9577
9618
|
},
|
|
9578
9619
|
{
|
|
9579
9620
|
glyphFormat: "%7)",
|
|
9580
|
-
glyphType:
|
|
9621
|
+
glyphType: 2
|
|
9581
9622
|
},
|
|
9582
9623
|
{
|
|
9583
9624
|
glyphFormat: "%8)",
|
|
9584
|
-
glyphType:
|
|
9625
|
+
glyphType: 5
|
|
9585
9626
|
},
|
|
9586
9627
|
{
|
|
9587
9628
|
glyphFormat: "%9)",
|
|
9588
|
-
glyphType:
|
|
9629
|
+
glyphType: 7
|
|
9589
9630
|
}
|
|
9590
9631
|
])
|
|
9591
9632
|
},
|
|
9592
|
-
[
|
|
9593
|
-
listType:
|
|
9633
|
+
["ORDER_LIST_2"]: {
|
|
9634
|
+
listType: "ORDER_LIST",
|
|
9594
9635
|
nestingLevel: orderListFactory([
|
|
9595
9636
|
"%1.",
|
|
9596
9637
|
"%1.%2.",
|
|
@@ -9601,164 +9642,164 @@ const PRESET_LIST_TYPE = {
|
|
|
9601
9642
|
"%1.%2.%3.%4.%5.%6.%7."
|
|
9602
9643
|
].map((format) => ({
|
|
9603
9644
|
glyphFormat: format,
|
|
9604
|
-
glyphType:
|
|
9645
|
+
glyphType: 2
|
|
9605
9646
|
})))
|
|
9606
9647
|
},
|
|
9607
|
-
[
|
|
9608
|
-
listType:
|
|
9648
|
+
["ORDER_LIST_3"]: {
|
|
9649
|
+
listType: "ORDER_LIST",
|
|
9609
9650
|
nestingLevel: orderListFactory([
|
|
9610
9651
|
{
|
|
9611
9652
|
glyphFormat: "%1.",
|
|
9612
|
-
glyphType:
|
|
9653
|
+
glyphType: 4
|
|
9613
9654
|
},
|
|
9614
9655
|
{
|
|
9615
9656
|
glyphFormat: "%2.",
|
|
9616
|
-
glyphType:
|
|
9657
|
+
glyphType: 5
|
|
9617
9658
|
},
|
|
9618
9659
|
{
|
|
9619
9660
|
glyphFormat: "%3.",
|
|
9620
|
-
glyphType:
|
|
9661
|
+
glyphType: 7
|
|
9621
9662
|
},
|
|
9622
9663
|
{
|
|
9623
9664
|
glyphFormat: "%4.",
|
|
9624
|
-
glyphType:
|
|
9665
|
+
glyphType: 4
|
|
9625
9666
|
},
|
|
9626
9667
|
{
|
|
9627
9668
|
glyphFormat: "%5.",
|
|
9628
|
-
glyphType:
|
|
9669
|
+
glyphType: 5
|
|
9629
9670
|
},
|
|
9630
9671
|
{
|
|
9631
9672
|
glyphFormat: "%6.",
|
|
9632
|
-
glyphType:
|
|
9673
|
+
glyphType: 7
|
|
9633
9674
|
},
|
|
9634
9675
|
{
|
|
9635
9676
|
glyphFormat: "%7.",
|
|
9636
|
-
glyphType:
|
|
9677
|
+
glyphType: 4
|
|
9637
9678
|
},
|
|
9638
9679
|
{
|
|
9639
9680
|
glyphFormat: "%8.",
|
|
9640
|
-
glyphType:
|
|
9681
|
+
glyphType: 5
|
|
9641
9682
|
},
|
|
9642
9683
|
{
|
|
9643
9684
|
glyphFormat: "%9.",
|
|
9644
|
-
glyphType:
|
|
9685
|
+
glyphType: 7
|
|
9645
9686
|
}
|
|
9646
9687
|
])
|
|
9647
9688
|
},
|
|
9648
|
-
[
|
|
9649
|
-
listType:
|
|
9689
|
+
["ORDER_LIST_4"]: {
|
|
9690
|
+
listType: "ORDER_LIST",
|
|
9650
9691
|
nestingLevel: orderListFactory([
|
|
9651
9692
|
{
|
|
9652
9693
|
glyphFormat: "%1.",
|
|
9653
|
-
glyphType:
|
|
9694
|
+
glyphType: 4
|
|
9654
9695
|
},
|
|
9655
9696
|
{
|
|
9656
9697
|
glyphFormat: "%2.",
|
|
9657
|
-
glyphType:
|
|
9698
|
+
glyphType: 2
|
|
9658
9699
|
},
|
|
9659
9700
|
{
|
|
9660
9701
|
glyphFormat: "%3.",
|
|
9661
|
-
glyphType:
|
|
9702
|
+
glyphType: 7
|
|
9662
9703
|
},
|
|
9663
9704
|
{
|
|
9664
9705
|
glyphFormat: "%4.",
|
|
9665
|
-
glyphType:
|
|
9706
|
+
glyphType: 4
|
|
9666
9707
|
},
|
|
9667
9708
|
{
|
|
9668
9709
|
glyphFormat: "%5.",
|
|
9669
|
-
glyphType:
|
|
9710
|
+
glyphType: 2
|
|
9670
9711
|
},
|
|
9671
9712
|
{
|
|
9672
9713
|
glyphFormat: "%6.",
|
|
9673
|
-
glyphType:
|
|
9714
|
+
glyphType: 7
|
|
9674
9715
|
},
|
|
9675
9716
|
{
|
|
9676
9717
|
glyphFormat: "%7.",
|
|
9677
|
-
glyphType:
|
|
9718
|
+
glyphType: 4
|
|
9678
9719
|
},
|
|
9679
9720
|
{
|
|
9680
9721
|
glyphFormat: "%8.",
|
|
9681
|
-
glyphType:
|
|
9722
|
+
glyphType: 2
|
|
9682
9723
|
},
|
|
9683
9724
|
{
|
|
9684
9725
|
glyphFormat: "%9.",
|
|
9685
|
-
glyphType:
|
|
9726
|
+
glyphType: 7
|
|
9686
9727
|
}
|
|
9687
9728
|
])
|
|
9688
9729
|
},
|
|
9689
|
-
[
|
|
9690
|
-
listType:
|
|
9730
|
+
["ORDER_LIST_5"]: {
|
|
9731
|
+
listType: "ORDER_LIST",
|
|
9691
9732
|
nestingLevel: orderListFactory([
|
|
9692
9733
|
{
|
|
9693
9734
|
glyphFormat: "%1.",
|
|
9694
|
-
glyphType:
|
|
9735
|
+
glyphType: 3
|
|
9695
9736
|
},
|
|
9696
9737
|
{
|
|
9697
9738
|
glyphFormat: "%2.",
|
|
9698
|
-
glyphType:
|
|
9739
|
+
glyphType: 5
|
|
9699
9740
|
},
|
|
9700
9741
|
{
|
|
9701
9742
|
glyphFormat: "%3.",
|
|
9702
|
-
glyphType:
|
|
9743
|
+
glyphType: 7
|
|
9703
9744
|
},
|
|
9704
9745
|
{
|
|
9705
9746
|
glyphFormat: "%4.",
|
|
9706
|
-
glyphType:
|
|
9747
|
+
glyphType: 3
|
|
9707
9748
|
},
|
|
9708
9749
|
{
|
|
9709
9750
|
glyphFormat: "%5.",
|
|
9710
|
-
glyphType:
|
|
9751
|
+
glyphType: 5
|
|
9711
9752
|
},
|
|
9712
9753
|
{
|
|
9713
9754
|
glyphFormat: "%6.",
|
|
9714
|
-
glyphType:
|
|
9755
|
+
glyphType: 7
|
|
9715
9756
|
},
|
|
9716
9757
|
{
|
|
9717
9758
|
glyphFormat: "%7.",
|
|
9718
|
-
glyphType:
|
|
9759
|
+
glyphType: 3
|
|
9719
9760
|
},
|
|
9720
9761
|
{
|
|
9721
9762
|
glyphFormat: "%8.",
|
|
9722
|
-
glyphType:
|
|
9763
|
+
glyphType: 5
|
|
9723
9764
|
},
|
|
9724
9765
|
{
|
|
9725
9766
|
glyphFormat: "%9.",
|
|
9726
|
-
glyphType:
|
|
9767
|
+
glyphType: 7
|
|
9727
9768
|
}
|
|
9728
9769
|
])
|
|
9729
9770
|
},
|
|
9730
|
-
[
|
|
9731
|
-
listType:
|
|
9771
|
+
["CHECK_LIST"]: {
|
|
9772
|
+
listType: "CHECK_LIST",
|
|
9732
9773
|
nestingLevel: checkListFactory("☐")
|
|
9733
9774
|
},
|
|
9734
|
-
[
|
|
9735
|
-
listType:
|
|
9736
|
-
nestingLevel: checkListFactory("☑", { st: { s:
|
|
9775
|
+
["CHECK_LIST_CHECKED"]: {
|
|
9776
|
+
listType: "CHECK_LIST_CHECKED",
|
|
9777
|
+
nestingLevel: checkListFactory("☑", { st: { s: 1 } })
|
|
9737
9778
|
}
|
|
9738
9779
|
};
|
|
9739
9780
|
const generateOrderList = (opt) => {
|
|
9740
9781
|
const { glyphFormat, glyphType } = opt;
|
|
9741
|
-
const data = Tools.deepClone(PRESET_LIST_TYPE[
|
|
9782
|
+
const data = Tools.deepClone(PRESET_LIST_TYPE["ORDER_LIST"]);
|
|
9742
9783
|
data.nestingLevel[0].glyphFormat = glyphFormat;
|
|
9743
9784
|
data.nestingLevel[0].glyphType = glyphType;
|
|
9744
9785
|
return data;
|
|
9745
9786
|
};
|
|
9746
9787
|
const QUICK_LIST_TYPE = {
|
|
9747
|
-
[
|
|
9748
|
-
[
|
|
9749
|
-
[
|
|
9750
|
-
[
|
|
9788
|
+
["ORDER_LIST_QUICK_2"]: generateOrderList(orderListSymbolMap["a)"]),
|
|
9789
|
+
["ORDER_LIST_QUICK_3"]: generateOrderList(orderListSymbolMap["a."]),
|
|
9790
|
+
["ORDER_LIST_QUICK_4"]: generateOrderList(orderListSymbolMap["i."]),
|
|
9791
|
+
["ORDER_LIST_QUICK_6"]: generateOrderList(orderListSymbolMap["I."])
|
|
9751
9792
|
};
|
|
9752
9793
|
Object.assign(PRESET_LIST_TYPE, QUICK_LIST_TYPE);
|
|
9753
9794
|
const QuickListTypeMap = {
|
|
9754
|
-
[
|
|
9755
|
-
[
|
|
9756
|
-
[
|
|
9757
|
-
[
|
|
9758
|
-
[
|
|
9759
|
-
[
|
|
9760
|
-
[
|
|
9761
|
-
[
|
|
9795
|
+
["1."]: "ORDER_LIST",
|
|
9796
|
+
["a)"]: "ORDER_LIST_QUICK_2",
|
|
9797
|
+
["a."]: "ORDER_LIST_QUICK_3",
|
|
9798
|
+
["i."]: "ORDER_LIST_QUICK_4",
|
|
9799
|
+
["A."]: "ORDER_LIST_3",
|
|
9800
|
+
["I."]: "ORDER_LIST_QUICK_6",
|
|
9801
|
+
["01."]: "ORDER_LIST_5",
|
|
9802
|
+
["*"]: "BULLET_LIST"
|
|
9762
9803
|
};
|
|
9763
9804
|
|
|
9764
9805
|
//#endregion
|
|
@@ -9780,7 +9821,7 @@ function updateTextRuns(body, updateBody, textLength, currentIndex, coverType) {
|
|
|
9780
9821
|
const { textRuns: updateTextRuns } = updateBody;
|
|
9781
9822
|
if (textRuns == null || updateTextRuns == null) return;
|
|
9782
9823
|
const removeTextRuns = deleteTextRuns(body, textLength, currentIndex);
|
|
9783
|
-
if (coverType !==
|
|
9824
|
+
if (coverType !== 1) updateBody.textRuns = coverTextRuns(updateTextRuns, removeTextRuns, coverType);
|
|
9784
9825
|
insertTextRuns(body, updateBody, textLength, currentIndex);
|
|
9785
9826
|
return removeTextRuns;
|
|
9786
9827
|
}
|
|
@@ -9806,7 +9847,7 @@ function coverTextRuns(updateDataTextRuns, originTextRuns, coverType) {
|
|
|
9806
9847
|
const { st: updateSt, ed: updateEd, ts: updateStyle } = updateDataTextRuns[updateIndex];
|
|
9807
9848
|
const { st: removeSt, ed: removeEd, ts: originStyle, sId } = originTextRuns[removeIndex];
|
|
9808
9849
|
let newTs;
|
|
9809
|
-
if (coverType ===
|
|
9850
|
+
if (coverType === 0) newTs = {
|
|
9810
9851
|
...originStyle,
|
|
9811
9852
|
...updateStyle
|
|
9812
9853
|
};
|
|
@@ -9862,7 +9903,7 @@ function updateParagraphs(body, updateBody, textLength, currentIndex, coverType)
|
|
|
9862
9903
|
const { paragraphs: updateDataParagraphs } = updateBody;
|
|
9863
9904
|
if (paragraphs == null || updateDataParagraphs == null) return;
|
|
9864
9905
|
const removeParagraphs = deleteParagraphs(body, textLength, currentIndex);
|
|
9865
|
-
if (coverType !==
|
|
9906
|
+
if (coverType !== 1) {
|
|
9866
9907
|
const newUpdateParagraphs = [];
|
|
9867
9908
|
for (const updateParagraph of updateDataParagraphs) {
|
|
9868
9909
|
const { startIndex: updateStartIndex, paragraphStyle: updateParagraphStyle, bullet: updateBullet } = updateParagraph;
|
|
@@ -9871,14 +9912,14 @@ function updateParagraphs(body, updateBody, textLength, currentIndex, coverType)
|
|
|
9871
9912
|
const { startIndex: removeStartIndex, paragraphStyle: removeParagraphStyle, bullet: removeBullet } = removeParagraph;
|
|
9872
9913
|
let newParagraphStyle;
|
|
9873
9914
|
let newBullet;
|
|
9874
|
-
if (coverType ===
|
|
9915
|
+
if (coverType === 0) {
|
|
9875
9916
|
newParagraphStyle = {
|
|
9876
9917
|
...removeParagraphStyle,
|
|
9877
9918
|
...updateParagraphStyle
|
|
9878
9919
|
};
|
|
9879
9920
|
newBullet = {
|
|
9880
9921
|
listId: "",
|
|
9881
|
-
listType:
|
|
9922
|
+
listType: "BULLET_LIST",
|
|
9882
9923
|
nestingLevel: 0,
|
|
9883
9924
|
textStyle: {},
|
|
9884
9925
|
...removeBullet,
|
|
@@ -9891,7 +9932,7 @@ function updateParagraphs(body, updateBody, textLength, currentIndex, coverType)
|
|
|
9891
9932
|
};
|
|
9892
9933
|
newBullet = {
|
|
9893
9934
|
listId: "",
|
|
9894
|
-
listType:
|
|
9935
|
+
listType: "BULLET_LIST",
|
|
9895
9936
|
nestingLevel: 0,
|
|
9896
9937
|
textStyle: {},
|
|
9897
9938
|
...updateBullet,
|
|
@@ -9920,7 +9961,7 @@ function updateSectionBreaks(body, updateBody, textLength, currentIndex, coverTy
|
|
|
9920
9961
|
const { sectionBreaks: updateDataSectionBreaks } = updateBody;
|
|
9921
9962
|
if (sectionBreaks == null || updateDataSectionBreaks == null) return;
|
|
9922
9963
|
const removeSectionBreaks = deleteSectionBreaks(body, textLength, currentIndex);
|
|
9923
|
-
if (coverType !==
|
|
9964
|
+
if (coverType !== 1) {
|
|
9924
9965
|
const newUpdateSectionBreaks = [];
|
|
9925
9966
|
for (const updateSectionBreak of updateDataSectionBreaks) {
|
|
9926
9967
|
const { startIndex: updateStartIndex } = updateSectionBreak;
|
|
@@ -9928,7 +9969,7 @@ function updateSectionBreaks(body, updateBody, textLength, currentIndex, coverTy
|
|
|
9928
9969
|
for (const removeSectionBreak of removeSectionBreaks) {
|
|
9929
9970
|
const { startIndex: removeStartIndex } = removeSectionBreak;
|
|
9930
9971
|
if (updateStartIndex === removeStartIndex) {
|
|
9931
|
-
if (coverType ===
|
|
9972
|
+
if (coverType === 0) splitUpdateSectionBreaks.push({
|
|
9932
9973
|
...removeSectionBreak,
|
|
9933
9974
|
...updateSectionBreak
|
|
9934
9975
|
});
|
|
@@ -9952,7 +9993,7 @@ function updateCustomBlocks(body, updateBody, textLength, currentIndex, coverTyp
|
|
|
9952
9993
|
const { customBlocks: updateDataCustomBlocks } = updateBody;
|
|
9953
9994
|
if (customBlocks == null || updateDataCustomBlocks == null) return;
|
|
9954
9995
|
const removeCustomBlocks = deleteCustomBlocks(body, textLength, currentIndex);
|
|
9955
|
-
if (coverType !==
|
|
9996
|
+
if (coverType !== 1) {
|
|
9956
9997
|
const newUpdateCustomBlocks = [];
|
|
9957
9998
|
for (const updateCustomBlock of updateDataCustomBlocks) {
|
|
9958
9999
|
const { startIndex: updateStartIndex } = updateCustomBlock;
|
|
@@ -9960,7 +10001,7 @@ function updateCustomBlocks(body, updateBody, textLength, currentIndex, coverTyp
|
|
|
9960
10001
|
for (const removeCustomBlock of removeCustomBlocks) {
|
|
9961
10002
|
const { startIndex: removeStartIndex } = removeCustomBlock;
|
|
9962
10003
|
if (updateStartIndex === removeStartIndex) {
|
|
9963
|
-
if (coverType ===
|
|
10004
|
+
if (coverType === 0) splitUpdateCustomBlocks.push({
|
|
9964
10005
|
...removeCustomBlock,
|
|
9965
10006
|
...updateCustomBlock
|
|
9966
10007
|
});
|
|
@@ -9985,7 +10026,7 @@ function updateTables(body, updateBody, textLength, currentIndex, coverType) {
|
|
|
9985
10026
|
const { tables: updateDataTables } = updateBody;
|
|
9986
10027
|
if (tables == null || updateDataTables == null) return;
|
|
9987
10028
|
const removeTables = deleteTables(body, textLength, currentIndex);
|
|
9988
|
-
if (coverType !==
|
|
10029
|
+
if (coverType !== 1) {
|
|
9989
10030
|
const newUpdateTables = [];
|
|
9990
10031
|
for (const updateTable of updateDataTables) {
|
|
9991
10032
|
const { startIndex: updateStartIndex, endIndex: updateEndIndex } = updateTable;
|
|
@@ -9993,7 +10034,7 @@ function updateTables(body, updateBody, textLength, currentIndex, coverType) {
|
|
|
9993
10034
|
for (const removeTable of removeTables) {
|
|
9994
10035
|
const { startIndex: removeStartIndex, endIndex: removeEndIndex } = removeTable;
|
|
9995
10036
|
if (removeStartIndex >= updateStartIndex && removeEndIndex <= updateEndIndex) {
|
|
9996
|
-
if (coverType ===
|
|
10037
|
+
if (coverType === 0) splitUpdateTables.push({
|
|
9997
10038
|
...removeTable,
|
|
9998
10039
|
...updateTable
|
|
9999
10040
|
});
|
|
@@ -10046,7 +10087,7 @@ function updateCustomDecorations(body, updateBody, textLength, currentIndex, cov
|
|
|
10046
10087
|
const removeCustomDecorations = [];
|
|
10047
10088
|
const { customDecorations } = body;
|
|
10048
10089
|
const { customDecorations: updateDataCustomDecorations = [] } = updateBody;
|
|
10049
|
-
if (coverType ===
|
|
10090
|
+
if (coverType === 1) {
|
|
10050
10091
|
for (let index = 0; index < customDecorations.length; index++) {
|
|
10051
10092
|
const customDecoration = customDecorations[index];
|
|
10052
10093
|
const { startIndex, endIndex } = customDecoration;
|
|
@@ -10062,7 +10103,7 @@ function updateCustomDecorations(body, updateBody, textLength, currentIndex, cov
|
|
|
10062
10103
|
});
|
|
10063
10104
|
} else for (const updateCustomDecoration of updateDataCustomDecorations) {
|
|
10064
10105
|
const { id } = updateCustomDecoration;
|
|
10065
|
-
if (updateCustomDecoration.type ===
|
|
10106
|
+
if (updateCustomDecoration.type === 9999) {
|
|
10066
10107
|
const oldCustomDecorations = customDecorations.filter((d) => d.id === id);
|
|
10067
10108
|
if (oldCustomDecorations.length) removeCustomDecorations.push(...oldCustomDecorations);
|
|
10068
10109
|
} else customDecorations.push({
|
|
@@ -10173,14 +10214,14 @@ function getCustomBlockSlice(body, startOffset, endOffset) {
|
|
|
10173
10214
|
startIndex: b.startIndex - startOffset
|
|
10174
10215
|
}));
|
|
10175
10216
|
}
|
|
10176
|
-
function getBodySlice(body, startOffset, endOffset, returnEmptyArray = true, type =
|
|
10217
|
+
function getBodySlice(body, startOffset, endOffset, returnEmptyArray = true, type = 1) {
|
|
10177
10218
|
const { dataStream } = body;
|
|
10178
10219
|
const docBody = { dataStream: dataStream.slice(startOffset, endOffset) };
|
|
10179
10220
|
docBody.textRuns = getTextRunSlice(body, startOffset, endOffset, returnEmptyArray);
|
|
10180
10221
|
const newTables = getTableSlice(body, startOffset, endOffset);
|
|
10181
10222
|
if (newTables.length) docBody.tables = newTables;
|
|
10182
10223
|
docBody.paragraphs = getParagraphsSlice(body, startOffset, endOffset);
|
|
10183
|
-
if (type ===
|
|
10224
|
+
if (type === 1) {
|
|
10184
10225
|
const customDecorations = getCustomDecorationSlice(body, startOffset, endOffset);
|
|
10185
10226
|
if (customDecorations) docBody.customDecorations = customDecorations;
|
|
10186
10227
|
else if (returnEmptyArray) docBody.customDecorations = [];
|
|
@@ -10274,7 +10315,7 @@ function composeCustomRanges(updateDataCustomRanges, originCustomRanges, coverTy
|
|
|
10274
10315
|
if (updateDataCustomRanges == null || originCustomRanges == null) return updateDataCustomRanges !== null && updateDataCustomRanges !== void 0 ? updateDataCustomRanges : originCustomRanges;
|
|
10275
10316
|
if (originCustomRanges.length === 0 || updateDataCustomRanges.length === 0) return updateDataCustomRanges;
|
|
10276
10317
|
if (originCustomRanges.length > 1 || updateDataCustomRanges.length > 1) throw new Error("Cannot cover multiple customRanges");
|
|
10277
|
-
if (coverType ===
|
|
10318
|
+
if (coverType === 1) return [{ ...updateDataCustomRanges[0] }];
|
|
10278
10319
|
else return [{
|
|
10279
10320
|
...originCustomRanges[0],
|
|
10280
10321
|
...updateDataCustomRanges[0]
|
|
@@ -10282,14 +10323,14 @@ function composeCustomRanges(updateDataCustomRanges, originCustomRanges, coverTy
|
|
|
10282
10323
|
}
|
|
10283
10324
|
function composeCustomDecorations(updateDataCustomDecorations, originCustomDecorations, coverType) {
|
|
10284
10325
|
if (originCustomDecorations.length === 0 || updateDataCustomDecorations.length === 0) return updateDataCustomDecorations;
|
|
10285
|
-
if (coverType ===
|
|
10326
|
+
if (coverType === 1) return updateDataCustomDecorations;
|
|
10286
10327
|
else return [...updateDataCustomDecorations, ...originCustomDecorations.filter((originCustomDecoration) => {
|
|
10287
10328
|
return !updateDataCustomDecorations.some((updateDataCustomDecoration) => {
|
|
10288
10329
|
return originCustomDecoration.id === updateDataCustomDecoration.id;
|
|
10289
10330
|
});
|
|
10290
10331
|
})];
|
|
10291
10332
|
}
|
|
10292
|
-
function composeBody(thisBody, otherBody, coverType =
|
|
10333
|
+
function composeBody(thisBody, otherBody, coverType = 0) {
|
|
10293
10334
|
if (otherBody.dataStream !== "") throw new Error("Cannot compose other body with non-empty dataStream");
|
|
10294
10335
|
const retBody = { dataStream: thisBody.dataStream };
|
|
10295
10336
|
const { textRuns: thisTextRuns, paragraphs: thisParagraphs = [], customRanges: thisCustomRanges, customDecorations: thisCustomDecorations = [] } = thisBody;
|
|
@@ -10362,7 +10403,7 @@ var ActionIterator = class {
|
|
|
10362
10403
|
* 2) Slice the body and slice the range [offset, length]
|
|
10363
10404
|
* 3) Reassemble the returned action
|
|
10364
10405
|
*/
|
|
10365
|
-
if (nextAction.t ===
|
|
10406
|
+
if (nextAction.t === "d" || nextAction.t === "r" && nextAction.body == null) return Tools.deepClone({
|
|
10366
10407
|
...nextAction,
|
|
10367
10408
|
len: length
|
|
10368
10409
|
});
|
|
@@ -10372,7 +10413,7 @@ var ActionIterator = class {
|
|
|
10372
10413
|
body: getBodySlice(nextAction.body, offset, offset + length, false)
|
|
10373
10414
|
});
|
|
10374
10415
|
} else return {
|
|
10375
|
-
t:
|
|
10416
|
+
t: "r",
|
|
10376
10417
|
len: Number.POSITIVE_INFINITY
|
|
10377
10418
|
};
|
|
10378
10419
|
}
|
|
@@ -10386,7 +10427,7 @@ var ActionIterator = class {
|
|
|
10386
10427
|
peekType() {
|
|
10387
10428
|
const action = this._actions[this._index];
|
|
10388
10429
|
if (action) return action.t;
|
|
10389
|
-
return
|
|
10430
|
+
return "r";
|
|
10390
10431
|
}
|
|
10391
10432
|
rest() {
|
|
10392
10433
|
if (!this.hasNext()) return [];
|
|
@@ -10448,7 +10489,7 @@ function updateAttributeByInsert(body, insertBody, textLength, currentIndex) {
|
|
|
10448
10489
|
|
|
10449
10490
|
//#endregion
|
|
10450
10491
|
//#region src/docs/data-model/text-x/apply.ts
|
|
10451
|
-
function updateApply(doc, updateBody, textLength, currentIndex, coverType =
|
|
10492
|
+
function updateApply(doc, updateBody, textLength, currentIndex, coverType = 0) {
|
|
10452
10493
|
return updateAttribute(doc, updateBody, textLength, currentIndex, coverType);
|
|
10453
10494
|
}
|
|
10454
10495
|
function deleteApply(doc, textLength, currentIndex) {
|
|
@@ -10465,19 +10506,19 @@ function textXApply(doc, actions) {
|
|
|
10465
10506
|
actions.forEach((action) => {
|
|
10466
10507
|
const clonedAction = Tools.deepClone(action);
|
|
10467
10508
|
switch (clonedAction.t) {
|
|
10468
|
-
case
|
|
10509
|
+
case "r": {
|
|
10469
10510
|
const { coverType, body, len } = clonedAction;
|
|
10470
10511
|
if (body != null) updateApply(doc, body, len, memoryCursor.cursor, coverType);
|
|
10471
10512
|
memoryCursor.moveCursor(len);
|
|
10472
10513
|
break;
|
|
10473
10514
|
}
|
|
10474
|
-
case
|
|
10515
|
+
case "i": {
|
|
10475
10516
|
const { body, len } = clonedAction;
|
|
10476
10517
|
insertApply(doc, body, len, memoryCursor.cursor);
|
|
10477
10518
|
memoryCursor.moveCursor(len);
|
|
10478
10519
|
break;
|
|
10479
10520
|
}
|
|
10480
|
-
case
|
|
10521
|
+
case "d": {
|
|
10481
10522
|
const { len } = clonedAction;
|
|
10482
10523
|
deleteApply(doc, len, memoryCursor.cursor);
|
|
10483
10524
|
break;
|
|
@@ -10490,11 +10531,6 @@ function textXApply(doc, actions) {
|
|
|
10490
10531
|
|
|
10491
10532
|
//#endregion
|
|
10492
10533
|
//#region src/docs/data-model/text-x/transform-utils.ts
|
|
10493
|
-
var TextXTransformType = /* @__PURE__ */ function(TextXTransformType) {
|
|
10494
|
-
TextXTransformType[TextXTransformType["COVER"] = 0] = "COVER";
|
|
10495
|
-
TextXTransformType[TextXTransformType["COVER_ONLY_NOT_EXISTED"] = 1] = "COVER_ONLY_NOT_EXISTED";
|
|
10496
|
-
return TextXTransformType;
|
|
10497
|
-
}(TextXTransformType || {});
|
|
10498
10534
|
function transformTextRuns(originTextRuns, targetTextRuns, originCoverType, targetCoverType, transformType) {
|
|
10499
10535
|
if (originTextRuns == null || targetTextRuns == null) return targetTextRuns;
|
|
10500
10536
|
if (originTextRuns.length === 0 || targetTextRuns.length === 0) return [];
|
|
@@ -10518,18 +10554,18 @@ function transformTextRuns(originTextRuns, targetTextRuns, originCoverType, targ
|
|
|
10518
10554
|
const { st: updateSt, ed: updateEd, ts: targetStyle } = targetTextRuns[updateIndex];
|
|
10519
10555
|
const { st: removeSt, ed: removeEd, ts: originStyle, sId } = originTextRuns[removeIndex];
|
|
10520
10556
|
let newTs = {};
|
|
10521
|
-
if (transformType ===
|
|
10557
|
+
if (transformType === 0) {
|
|
10522
10558
|
newTs = { ...targetStyle };
|
|
10523
|
-
if (originCoverType ===
|
|
10559
|
+
if (originCoverType === 0 && targetCoverType === 1 && originStyle) newTs = Object.assign({}, originStyle, newTs);
|
|
10524
10560
|
} else {
|
|
10525
10561
|
newTs = { ...targetStyle };
|
|
10526
|
-
if (originCoverType ===
|
|
10527
|
-
if (targetCoverType ===
|
|
10562
|
+
if (originCoverType === 1) {
|
|
10563
|
+
if (targetCoverType === 1) newTs = { ...originStyle };
|
|
10528
10564
|
else if (targetStyle && originStyle) {
|
|
10529
10565
|
const keys = Object.keys(targetStyle);
|
|
10530
10566
|
for (const key of keys) if (originStyle[key]) delete newTs[key];
|
|
10531
10567
|
}
|
|
10532
|
-
} else if (targetCoverType ===
|
|
10568
|
+
} else if (targetCoverType === 1) {
|
|
10533
10569
|
if (originStyle) {
|
|
10534
10570
|
const keys = Object.keys(originStyle);
|
|
10535
10571
|
for (const key of keys) if (originStyle[key] !== void 0) newTs[key] = originStyle[key];
|
|
@@ -10591,14 +10627,14 @@ function transformCustomRanges(originCustomRanges, targetCustomRanges, originCov
|
|
|
10591
10627
|
if (originCustomRanges.length > 1 || targetCustomRanges.length > 1) throw new Error("CustomRanges is only supported transform for length one now.");
|
|
10592
10628
|
const originCustomRange = originCustomRanges[0];
|
|
10593
10629
|
const targetCustomRange = targetCustomRanges[0];
|
|
10594
|
-
if (originCoverType ===
|
|
10595
|
-
else if (targetCoverType ===
|
|
10630
|
+
if (originCoverType === 1) return transformType === 1 ? [Tools.deepClone(originCustomRange)] : [Tools.deepClone(targetCustomRange)];
|
|
10631
|
+
else if (targetCoverType === 1) {
|
|
10596
10632
|
const customRange = Tools.deepClone(targetCustomRange);
|
|
10597
|
-
if (transformType ===
|
|
10633
|
+
if (transformType === 1) Object.assign(customRange, Tools.deepClone(originCustomRange));
|
|
10598
10634
|
return [customRange];
|
|
10599
10635
|
} else {
|
|
10600
10636
|
const customRange = Tools.deepClone(targetCustomRange);
|
|
10601
|
-
if (transformType ===
|
|
10637
|
+
if (transformType === 1) Object.assign(customRange, Tools.deepClone(originCustomRange));
|
|
10602
10638
|
return [customRange];
|
|
10603
10639
|
}
|
|
10604
10640
|
}
|
|
@@ -10607,32 +10643,32 @@ function transformParagraph(originParagraph, targetParagraph, originCoverType, t
|
|
|
10607
10643
|
if (targetParagraph.paragraphStyle) {
|
|
10608
10644
|
paragraph.paragraphStyle = Tools.deepClone(targetParagraph.paragraphStyle);
|
|
10609
10645
|
if (originParagraph.paragraphStyle) {
|
|
10610
|
-
if (originCoverType ===
|
|
10611
|
-
if (transformType ===
|
|
10612
|
-
} else if (transformType ===
|
|
10646
|
+
if (originCoverType === 1) if (targetCoverType === 1) {
|
|
10647
|
+
if (transformType === 1) paragraph.paragraphStyle = { ...originParagraph.paragraphStyle };
|
|
10648
|
+
} else if (transformType === 1) {
|
|
10613
10649
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10614
10650
|
for (const key of keys) if (originParagraph.paragraphStyle[key] !== void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
10615
10651
|
} else {
|
|
10616
10652
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10617
10653
|
for (const key of keys) if (paragraph.paragraphStyle[key] === void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
10618
10654
|
}
|
|
10619
|
-
else if (targetCoverType ===
|
|
10655
|
+
else if (targetCoverType === 1) if (transformType === 1) {
|
|
10620
10656
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10621
10657
|
for (const key of keys) if (originParagraph.paragraphStyle[key] !== void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
10622
10658
|
} else {
|
|
10623
10659
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10624
10660
|
for (const key of keys) if (paragraph.paragraphStyle[key] === void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
10625
10661
|
}
|
|
10626
|
-
else if (transformType ===
|
|
10662
|
+
else if (transformType === 1) {
|
|
10627
10663
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10628
10664
|
for (const key of keys) if (paragraph.paragraphStyle[key]) delete paragraph.paragraphStyle[key];
|
|
10629
10665
|
}
|
|
10630
10666
|
}
|
|
10631
10667
|
}
|
|
10632
|
-
if (originCoverType ===
|
|
10668
|
+
if (originCoverType === 1 && targetCoverType === 1) paragraph.bullet = transformType === 1 ? Tools.deepClone(originParagraph.bullet) : Tools.deepClone(targetParagraph.bullet);
|
|
10633
10669
|
else if (originParagraph.bullet === void 0) paragraph.bullet = Tools.deepClone(targetParagraph.bullet);
|
|
10634
|
-
else if (originCoverType ===
|
|
10635
|
-
else if (transformType ===
|
|
10670
|
+
else if (originCoverType === 1 || targetCoverType === 1) paragraph.bullet = transformType === 0 && targetParagraph.bullet ? Tools.deepClone(targetParagraph.bullet) : Tools.deepClone(originParagraph.bullet);
|
|
10671
|
+
else if (transformType === 0 && targetParagraph.bullet !== void 0) paragraph.bullet = Tools.deepClone(targetParagraph.bullet);
|
|
10636
10672
|
return paragraph;
|
|
10637
10673
|
}
|
|
10638
10674
|
function transformCustomDecorations(originCustomDecorations, targetCustomDecorations) {
|
|
@@ -10643,11 +10679,11 @@ function transformCustomDecorations(originCustomDecorations, targetCustomDecorat
|
|
|
10643
10679
|
const { id, type } = decoration;
|
|
10644
10680
|
let pushed = false;
|
|
10645
10681
|
for (const originDecoration of originCustomDecorations) if (originDecoration.id === id) {
|
|
10646
|
-
if (originDecoration.type ===
|
|
10682
|
+
if (originDecoration.type === 9999 || type === 9999) {
|
|
10647
10683
|
pushed = true;
|
|
10648
10684
|
customDecorations.push({
|
|
10649
10685
|
...decoration,
|
|
10650
|
-
type:
|
|
10686
|
+
type: 9999
|
|
10651
10687
|
});
|
|
10652
10688
|
}
|
|
10653
10689
|
break;
|
|
@@ -10657,16 +10693,16 @@ function transformCustomDecorations(originCustomDecorations, targetCustomDecorat
|
|
|
10657
10693
|
return customDecorations;
|
|
10658
10694
|
}
|
|
10659
10695
|
function transformBody(thisAction, otherAction, priority = false) {
|
|
10660
|
-
const { body: thisBody, coverType: thisCoverType =
|
|
10661
|
-
const { body: otherBody, coverType: otherCoverType =
|
|
10696
|
+
const { body: thisBody, coverType: thisCoverType = 0 } = thisAction;
|
|
10697
|
+
const { body: otherBody, coverType: otherCoverType = 0 } = otherAction;
|
|
10662
10698
|
if (thisBody == null || thisBody.dataStream !== "" || otherBody == null || otherBody.dataStream !== "") throw new Error("Data stream is not supported in retain transform.");
|
|
10663
10699
|
const retBody = { dataStream: "" };
|
|
10664
10700
|
const coverType = otherCoverType;
|
|
10665
10701
|
const { textRuns: thisTextRuns, paragraphs: thisParagraphs = [], customRanges: thisCustomRanges, customDecorations: thisCustomDecorations } = thisBody;
|
|
10666
10702
|
const { textRuns: otherTextRuns, paragraphs: otherParagraphs = [], customRanges: otherCustomRanges, customDecorations: otherCustomDecorations } = otherBody;
|
|
10667
|
-
const textRuns = transformTextRuns(thisTextRuns, otherTextRuns, thisCoverType, otherCoverType, priority ?
|
|
10703
|
+
const textRuns = transformTextRuns(thisTextRuns, otherTextRuns, thisCoverType, otherCoverType, priority ? 1 : 0);
|
|
10668
10704
|
if (textRuns) retBody.textRuns = textRuns;
|
|
10669
|
-
const customRanges = transformCustomRanges(thisCustomRanges, otherCustomRanges, thisCoverType, otherCoverType, priority ?
|
|
10705
|
+
const customRanges = transformCustomRanges(thisCustomRanges, otherCustomRanges, thisCoverType, otherCoverType, priority ? 1 : 0);
|
|
10670
10706
|
if (customRanges) retBody.customRanges = customRanges;
|
|
10671
10707
|
const customDecorations = transformCustomDecorations(thisCustomDecorations, otherCustomDecorations);
|
|
10672
10708
|
if (customDecorations) retBody.customDecorations = customDecorations;
|
|
@@ -10680,8 +10716,8 @@ function transformBody(thisAction, otherAction, priority = false) {
|
|
|
10680
10716
|
const { startIndex: otherStart } = otherParagraph;
|
|
10681
10717
|
if (thisStart === otherStart) {
|
|
10682
10718
|
let paragraph = { startIndex: thisStart };
|
|
10683
|
-
if (priority) paragraph = transformParagraph(thisParagraph, otherParagraph, thisCoverType, otherCoverType,
|
|
10684
|
-
else paragraph = transformParagraph(thisParagraph, otherParagraph, thisCoverType, otherCoverType,
|
|
10719
|
+
if (priority) paragraph = transformParagraph(thisParagraph, otherParagraph, thisCoverType, otherCoverType, 1);
|
|
10720
|
+
else paragraph = transformParagraph(thisParagraph, otherParagraph, thisCoverType, otherCoverType, 0);
|
|
10685
10721
|
paragraphs.push(paragraph);
|
|
10686
10722
|
thisIndex++;
|
|
10687
10723
|
otherIndex++;
|
|
@@ -10715,29 +10751,29 @@ var TextX = class TextX {
|
|
|
10715
10751
|
const thisIter = new ActionIterator(thisActions);
|
|
10716
10752
|
const otherIter = new ActionIterator(otherActions);
|
|
10717
10753
|
const textX = new TextX();
|
|
10718
|
-
while (thisIter.hasNext() || otherIter.hasNext()) if (otherIter.peekType() ===
|
|
10719
|
-
else if (thisIter.peekType() ===
|
|
10754
|
+
while (thisIter.hasNext() || otherIter.hasNext()) if (otherIter.peekType() === "i") textX.push(otherIter.next());
|
|
10755
|
+
else if (thisIter.peekType() === "d") textX.push(thisIter.next());
|
|
10720
10756
|
else {
|
|
10721
10757
|
const length = Math.min(thisIter.peekLength(), otherIter.peekLength());
|
|
10722
10758
|
const thisAction = thisIter.next(length);
|
|
10723
10759
|
const otherAction = otherIter.next(length);
|
|
10724
|
-
if (thisAction.t ===
|
|
10760
|
+
if (thisAction.t === "i" && otherAction.t === "r") if (otherAction.body == null) textX.push(thisAction);
|
|
10725
10761
|
else textX.push({
|
|
10726
10762
|
...thisAction,
|
|
10727
10763
|
body: composeBody(thisAction.body, otherAction.body, otherAction.coverType)
|
|
10728
10764
|
});
|
|
10729
|
-
else if (thisAction.t ===
|
|
10765
|
+
else if (thisAction.t === "r" && otherAction.t === "r") if (thisAction.body == null && otherAction.body == null) textX.push(thisAction.len !== Number.POSITIVE_INFINITY ? thisAction : otherAction);
|
|
10730
10766
|
else if (thisAction.body && otherAction.body) {
|
|
10731
|
-
const coverType = thisAction.coverType ===
|
|
10767
|
+
const coverType = thisAction.coverType === 1 || otherAction.coverType === 1 ? 1 : 0;
|
|
10732
10768
|
textX.push({
|
|
10733
10769
|
...thisAction,
|
|
10734
|
-
t:
|
|
10770
|
+
t: "r",
|
|
10735
10771
|
coverType,
|
|
10736
10772
|
body: composeBody(thisAction.body, otherAction.body, otherAction.coverType)
|
|
10737
10773
|
});
|
|
10738
10774
|
} else textX.push(thisAction.body ? thisAction : otherAction);
|
|
10739
|
-
else if (thisAction.t ===
|
|
10740
|
-
else if (thisAction.t ===
|
|
10775
|
+
else if (thisAction.t === "r" && otherAction.t === "d") textX.push(otherAction);
|
|
10776
|
+
else if (thisAction.t === "i" && otherAction.t === "d") {}
|
|
10741
10777
|
}
|
|
10742
10778
|
textX.trimEndUselessRetainAction();
|
|
10743
10779
|
return textX.serialize();
|
|
@@ -10773,16 +10809,16 @@ var TextX = class TextX {
|
|
|
10773
10809
|
const thisIter = new ActionIterator(thisActions);
|
|
10774
10810
|
const otherIter = new ActionIterator(otherActions);
|
|
10775
10811
|
const textX = new TextX();
|
|
10776
|
-
while (thisIter.hasNext() || otherIter.hasNext()) if (thisIter.peekType() ===
|
|
10812
|
+
while (thisIter.hasNext() || otherIter.hasNext()) if (thisIter.peekType() === "i" && (priority === "left" || otherIter.peekType() !== "i")) {
|
|
10777
10813
|
const thisAction = thisIter.next();
|
|
10778
10814
|
textX.retain(thisAction.len);
|
|
10779
|
-
} else if (otherIter.peekType() ===
|
|
10815
|
+
} else if (otherIter.peekType() === "i") textX.push(otherIter.next());
|
|
10780
10816
|
else {
|
|
10781
10817
|
const length = Math.min(thisIter.peekLength(), otherIter.peekLength());
|
|
10782
10818
|
const thisAction = thisIter.next(length);
|
|
10783
10819
|
const otherAction = otherIter.next(length);
|
|
10784
|
-
if (thisAction.t ===
|
|
10785
|
-
if (otherAction.t ===
|
|
10820
|
+
if (thisAction.t === "d") continue;
|
|
10821
|
+
if (otherAction.t === "d") {
|
|
10786
10822
|
textX.push(otherAction);
|
|
10787
10823
|
continue;
|
|
10788
10824
|
}
|
|
@@ -10791,7 +10827,7 @@ var TextX = class TextX {
|
|
|
10791
10827
|
const { coverType, body } = transformBody(thisAction, otherAction, priority === "left");
|
|
10792
10828
|
textX.push({
|
|
10793
10829
|
...otherAction,
|
|
10794
|
-
t:
|
|
10830
|
+
t: "r",
|
|
10795
10831
|
coverType,
|
|
10796
10832
|
body
|
|
10797
10833
|
});
|
|
@@ -10811,10 +10847,10 @@ var TextX = class TextX {
|
|
|
10811
10847
|
const length = thisIter.peekLength();
|
|
10812
10848
|
const nextType = thisIter.peekType();
|
|
10813
10849
|
thisIter.next();
|
|
10814
|
-
if (nextType ===
|
|
10850
|
+
if (nextType === "d") {
|
|
10815
10851
|
index -= Math.min(length, index - offset);
|
|
10816
10852
|
continue;
|
|
10817
|
-
} else if (nextType ===
|
|
10853
|
+
} else if (nextType === "i" && (offset < index || !priority)) index += length;
|
|
10818
10854
|
offset += length;
|
|
10819
10855
|
}
|
|
10820
10856
|
return index;
|
|
@@ -10824,26 +10860,26 @@ var TextX = class TextX {
|
|
|
10824
10860
|
}
|
|
10825
10861
|
static invert(actions) {
|
|
10826
10862
|
const invertedActions = [];
|
|
10827
|
-
for (const action of actions) if (action.t ===
|
|
10828
|
-
t:
|
|
10863
|
+
for (const action of actions) if (action.t === "i") invertedActions.push({
|
|
10864
|
+
t: "d",
|
|
10829
10865
|
len: action.len,
|
|
10830
10866
|
body: action.body
|
|
10831
10867
|
});
|
|
10832
|
-
else if (action.t ===
|
|
10868
|
+
else if (action.t === "d") {
|
|
10833
10869
|
if (action.body == null) throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");
|
|
10834
10870
|
invertedActions.push({
|
|
10835
|
-
t:
|
|
10871
|
+
t: "i",
|
|
10836
10872
|
body: action.body,
|
|
10837
10873
|
len: action.len
|
|
10838
10874
|
});
|
|
10839
10875
|
} else if (action.body != null) {
|
|
10840
10876
|
if (action.oldBody == null) throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");
|
|
10841
10877
|
invertedActions.push({
|
|
10842
|
-
t:
|
|
10878
|
+
t: "r",
|
|
10843
10879
|
body: action.oldBody,
|
|
10844
10880
|
oldBody: action.body,
|
|
10845
10881
|
len: action.len,
|
|
10846
|
-
coverType:
|
|
10882
|
+
coverType: 1
|
|
10847
10883
|
});
|
|
10848
10884
|
} else invertedActions.push(action);
|
|
10849
10885
|
return invertedActions;
|
|
@@ -10852,12 +10888,12 @@ var TextX = class TextX {
|
|
|
10852
10888
|
const invertibleActions = [];
|
|
10853
10889
|
let index = 0;
|
|
10854
10890
|
for (const action of actions) {
|
|
10855
|
-
if (action.t ===
|
|
10891
|
+
if (action.t === "d" && (action.body == null || action.body && action.body.dataStream.length !== action.len)) {
|
|
10856
10892
|
const body = getBodySlice(doc, index, index + action.len, false);
|
|
10857
10893
|
action.len = body.dataStream.length;
|
|
10858
10894
|
action.body = body;
|
|
10859
10895
|
}
|
|
10860
|
-
if (action.t ===
|
|
10896
|
+
if (action.t === "r" && action.body != null) {
|
|
10861
10897
|
const body = getBodySlice(doc, index, index + action.len, true);
|
|
10862
10898
|
action.oldBody = {
|
|
10863
10899
|
...body,
|
|
@@ -10866,13 +10902,13 @@ var TextX = class TextX {
|
|
|
10866
10902
|
action.len = body.dataStream.length;
|
|
10867
10903
|
}
|
|
10868
10904
|
invertibleActions.push(action);
|
|
10869
|
-
if (action.t !==
|
|
10905
|
+
if (action.t !== "i") index += action.len;
|
|
10870
10906
|
}
|
|
10871
10907
|
return invertibleActions;
|
|
10872
10908
|
}
|
|
10873
10909
|
insert(len, body) {
|
|
10874
10910
|
const insertAction = {
|
|
10875
|
-
t:
|
|
10911
|
+
t: "i",
|
|
10876
10912
|
body,
|
|
10877
10913
|
len
|
|
10878
10914
|
};
|
|
@@ -10881,7 +10917,7 @@ var TextX = class TextX {
|
|
|
10881
10917
|
}
|
|
10882
10918
|
retain(len, body, coverType) {
|
|
10883
10919
|
const retainAction = {
|
|
10884
|
-
t:
|
|
10920
|
+
t: "r",
|
|
10885
10921
|
len
|
|
10886
10922
|
};
|
|
10887
10923
|
if (body != null) retainAction.body = body;
|
|
@@ -10891,7 +10927,7 @@ var TextX = class TextX {
|
|
|
10891
10927
|
}
|
|
10892
10928
|
delete(len) {
|
|
10893
10929
|
const deleteAction = {
|
|
10894
|
-
t:
|
|
10930
|
+
t: "d",
|
|
10895
10931
|
len
|
|
10896
10932
|
};
|
|
10897
10933
|
this.push(deleteAction);
|
|
@@ -10912,13 +10948,13 @@ var TextX = class TextX {
|
|
|
10912
10948
|
let index = this._actions.length;
|
|
10913
10949
|
let lastAction = this._actions[index - 1];
|
|
10914
10950
|
const newAction = Tools.deepClone(args[0]);
|
|
10915
|
-
if (newAction.t ===
|
|
10951
|
+
if (newAction.t === "r" && newAction.len === 0 && newAction.body == null) return this;
|
|
10916
10952
|
if (typeof lastAction === "object") {
|
|
10917
|
-
if (lastAction.t ===
|
|
10953
|
+
if (lastAction.t === "d" && newAction.t === "d") {
|
|
10918
10954
|
lastAction.len += newAction.len;
|
|
10919
10955
|
return this;
|
|
10920
10956
|
}
|
|
10921
|
-
if (lastAction.t ===
|
|
10957
|
+
if (lastAction.t === "d" && newAction.t === "i") {
|
|
10922
10958
|
index -= 1;
|
|
10923
10959
|
lastAction = this._actions[index - 1];
|
|
10924
10960
|
if (lastAction == null) {
|
|
@@ -10926,11 +10962,11 @@ var TextX = class TextX {
|
|
|
10926
10962
|
return this;
|
|
10927
10963
|
}
|
|
10928
10964
|
}
|
|
10929
|
-
if (lastAction.t ===
|
|
10965
|
+
if (lastAction.t === "r" && newAction.t === "r" && lastAction.body == null && newAction.body == null) {
|
|
10930
10966
|
lastAction.len += newAction.len;
|
|
10931
10967
|
return this;
|
|
10932
10968
|
}
|
|
10933
|
-
if (lastAction.t ===
|
|
10969
|
+
if (lastAction.t === "i" && onlyHasDataStream(lastAction.body) && newAction.t === "i" && onlyHasDataStream(newAction.body)) {
|
|
10934
10970
|
lastAction.len += newAction.len;
|
|
10935
10971
|
lastAction.body.dataStream += newAction.body.dataStream;
|
|
10936
10972
|
return this;
|
|
@@ -10942,7 +10978,7 @@ var TextX = class TextX {
|
|
|
10942
10978
|
}
|
|
10943
10979
|
trimEndUselessRetainAction() {
|
|
10944
10980
|
let lastAction = this._actions[this._actions.length - 1];
|
|
10945
|
-
while (lastAction && lastAction.t ===
|
|
10981
|
+
while (lastAction && lastAction.t === "r" && isUselessRetainAction(lastAction)) {
|
|
10946
10982
|
this._actions.pop();
|
|
10947
10983
|
lastAction = this._actions[this._actions.length - 1];
|
|
10948
10984
|
}
|
|
@@ -11067,12 +11103,12 @@ function makeCustomRangeStream(stream) {
|
|
|
11067
11103
|
//#endregion
|
|
11068
11104
|
//#region src/docs/data-model/text-x/build-utils/parse.ts
|
|
11069
11105
|
const tags = [
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
11106
|
+
"",
|
|
11107
|
+
"\x1B",
|
|
11108
|
+
"",
|
|
11109
|
+
"",
|
|
11110
|
+
"",
|
|
11111
|
+
""
|
|
11076
11112
|
];
|
|
11077
11113
|
const getPlainText = (dataStream) => {
|
|
11078
11114
|
const text = dataStream.endsWith("\r\n") ? dataStream.slice(0, -2) : dataStream;
|
|
@@ -11097,7 +11133,7 @@ const fromPlainText = (text) => {
|
|
|
11097
11133
|
startIndex: cursor,
|
|
11098
11134
|
endIndex: cursor + urlText.length - 1,
|
|
11099
11135
|
rangeId: id,
|
|
11100
|
-
rangeType:
|
|
11136
|
+
rangeType: 0,
|
|
11101
11137
|
properties: { url: text }
|
|
11102
11138
|
};
|
|
11103
11139
|
customRanges.push(range);
|
|
@@ -11268,7 +11304,8 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
|
|
|
11268
11304
|
_defineProperty(this, "headerModelMap", /* @__PURE__ */ new Map());
|
|
11269
11305
|
_defineProperty(this, "footerModelMap", /* @__PURE__ */ new Map());
|
|
11270
11306
|
_defineProperty(this, "change$", new BehaviorSubject(0));
|
|
11271
|
-
|
|
11307
|
+
const UNIT_ID_LENGTH = 6;
|
|
11308
|
+
this._unitId = (_this$snapshot$id = this.snapshot.id) !== null && _this$snapshot$id !== void 0 ? _this$snapshot$id : generateRandomId(UNIT_ID_LENGTH);
|
|
11272
11309
|
this._initializeHeaderFooterModel();
|
|
11273
11310
|
this._name$.next((_this$snapshot$title2 = this.snapshot.title) !== null && _this$snapshot$title2 !== void 0 ? _this$snapshot$title2 : "");
|
|
11274
11311
|
}
|
|
@@ -11329,7 +11366,7 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
|
|
|
11329
11366
|
this.change$.next(this.change$.value + 1);
|
|
11330
11367
|
return this.snapshot;
|
|
11331
11368
|
}
|
|
11332
|
-
sliceBody(startOffset, endOffset, type =
|
|
11369
|
+
sliceBody(startOffset, endOffset, type = 0) {
|
|
11333
11370
|
const body = this.getBody();
|
|
11334
11371
|
if (body == null) return;
|
|
11335
11372
|
return getBodySlice(body, startOffset, endOffset, false, type);
|
|
@@ -11366,11 +11403,11 @@ function addCustomDecorationTextX(param) {
|
|
|
11366
11403
|
for (let i = 0; i < ranges.length; i++) {
|
|
11367
11404
|
const { startOffset: start, endOffset: end } = ranges[i];
|
|
11368
11405
|
if (start > 0) textX.push({
|
|
11369
|
-
t:
|
|
11406
|
+
t: "r",
|
|
11370
11407
|
len: start - cursor
|
|
11371
11408
|
});
|
|
11372
11409
|
textX.push({
|
|
11373
|
-
t:
|
|
11410
|
+
t: "r",
|
|
11374
11411
|
body: {
|
|
11375
11412
|
dataStream: "",
|
|
11376
11413
|
customDecorations: [{
|
|
@@ -11397,11 +11434,11 @@ function deleteCustomDecorationTextX(params) {
|
|
|
11397
11434
|
const { startIndex, endIndex } = decoration;
|
|
11398
11435
|
const len = endIndex - startIndex + 1;
|
|
11399
11436
|
textX.push({
|
|
11400
|
-
t:
|
|
11437
|
+
t: "r",
|
|
11401
11438
|
len: startIndex
|
|
11402
11439
|
});
|
|
11403
11440
|
textX.push({
|
|
11404
|
-
t:
|
|
11441
|
+
t: "r",
|
|
11405
11442
|
len,
|
|
11406
11443
|
body: {
|
|
11407
11444
|
dataStream: "",
|
|
@@ -11409,7 +11446,7 @@ function deleteCustomDecorationTextX(params) {
|
|
|
11409
11446
|
startIndex: 0,
|
|
11410
11447
|
endIndex: len - 1,
|
|
11411
11448
|
id,
|
|
11412
|
-
type:
|
|
11449
|
+
type: 9999
|
|
11413
11450
|
}]
|
|
11414
11451
|
}
|
|
11415
11452
|
});
|
|
@@ -11489,11 +11526,11 @@ function deleteCustomRangeTextX(params) {
|
|
|
11489
11526
|
const textX = new TextX();
|
|
11490
11527
|
const len = endIndex - startIndex + 1;
|
|
11491
11528
|
textX.push({
|
|
11492
|
-
t:
|
|
11529
|
+
t: "r",
|
|
11493
11530
|
len: startIndex
|
|
11494
11531
|
});
|
|
11495
11532
|
textX.push({
|
|
11496
|
-
t:
|
|
11533
|
+
t: "r",
|
|
11497
11534
|
len,
|
|
11498
11535
|
body: {
|
|
11499
11536
|
dataStream: "",
|
|
@@ -11501,7 +11538,7 @@ function deleteCustomRangeTextX(params) {
|
|
|
11501
11538
|
}
|
|
11502
11539
|
});
|
|
11503
11540
|
if (insert) textX.push({
|
|
11504
|
-
t:
|
|
11541
|
+
t: "i",
|
|
11505
11542
|
body: insert,
|
|
11506
11543
|
len: insert.dataStream.length
|
|
11507
11544
|
});
|
|
@@ -11539,17 +11576,17 @@ function addCustomRangeTextX(param) {
|
|
|
11539
11576
|
properties: { ...properties }
|
|
11540
11577
|
};
|
|
11541
11578
|
textX.push({
|
|
11542
|
-
t:
|
|
11579
|
+
t: "r",
|
|
11543
11580
|
len: rangeStartIndex - cursor
|
|
11544
11581
|
});
|
|
11545
11582
|
textX.push({
|
|
11546
|
-
t:
|
|
11583
|
+
t: "r",
|
|
11547
11584
|
len: rangeEndIndex - rangeStartIndex + 1,
|
|
11548
11585
|
body: {
|
|
11549
11586
|
dataStream: "",
|
|
11550
11587
|
customRanges: [customRange]
|
|
11551
11588
|
},
|
|
11552
|
-
coverType:
|
|
11589
|
+
coverType: 0
|
|
11553
11590
|
});
|
|
11554
11591
|
cursor = rangeEndIndex + 1;
|
|
11555
11592
|
};
|
|
@@ -11575,21 +11612,21 @@ function deleteSelectionTextX(selections, body, memoryCursor = 0, insertBody = n
|
|
|
11575
11612
|
const { startOffset, endOffset } = selection;
|
|
11576
11613
|
if (startOffset > cursor) {
|
|
11577
11614
|
dos.push({
|
|
11578
|
-
t:
|
|
11615
|
+
t: "r",
|
|
11579
11616
|
len: startOffset - cursor
|
|
11580
11617
|
});
|
|
11581
11618
|
cursor = startOffset;
|
|
11582
11619
|
}
|
|
11583
11620
|
if (cursor < endOffset) {
|
|
11584
11621
|
dos.push({
|
|
11585
|
-
t:
|
|
11622
|
+
t: "d",
|
|
11586
11623
|
len: endOffset - cursor
|
|
11587
11624
|
});
|
|
11588
11625
|
cursor = endOffset;
|
|
11589
11626
|
}
|
|
11590
11627
|
});
|
|
11591
11628
|
if (insertBody) dos.push({
|
|
11592
|
-
t:
|
|
11629
|
+
t: "i",
|
|
11593
11630
|
body: insertBody,
|
|
11594
11631
|
len: insertBody.dataStream.length
|
|
11595
11632
|
});
|
|
@@ -11598,13 +11635,13 @@ function deleteSelectionTextX(selections, body, memoryCursor = 0, insertBody = n
|
|
|
11598
11635
|
if (nextParagraph) {
|
|
11599
11636
|
if (nextParagraph.startIndex > cursor) {
|
|
11600
11637
|
dos.push({
|
|
11601
|
-
t:
|
|
11638
|
+
t: "r",
|
|
11602
11639
|
len: nextParagraph.startIndex - cursor
|
|
11603
11640
|
});
|
|
11604
11641
|
cursor = nextParagraph.startIndex;
|
|
11605
11642
|
}
|
|
11606
11643
|
dos.push({
|
|
11607
|
-
t:
|
|
11644
|
+
t: "r",
|
|
11608
11645
|
len: 1,
|
|
11609
11646
|
body: {
|
|
11610
11647
|
dataStream: "",
|
|
@@ -11614,7 +11651,7 @@ function deleteSelectionTextX(selections, body, memoryCursor = 0, insertBody = n
|
|
|
11614
11651
|
bullet: paragraphInRange === null || paragraphInRange === void 0 ? void 0 : paragraphInRange.bullet
|
|
11615
11652
|
}]
|
|
11616
11653
|
},
|
|
11617
|
-
coverType:
|
|
11654
|
+
coverType: 1
|
|
11618
11655
|
});
|
|
11619
11656
|
}
|
|
11620
11657
|
}
|
|
@@ -11627,14 +11664,14 @@ function retainSelectionTextX(selections, body, memoryCursor = 0) {
|
|
|
11627
11664
|
const { startOffset, endOffset } = selection;
|
|
11628
11665
|
if (startOffset > cursor) {
|
|
11629
11666
|
dos.push({
|
|
11630
|
-
t:
|
|
11667
|
+
t: "r",
|
|
11631
11668
|
len: startOffset - cursor
|
|
11632
11669
|
});
|
|
11633
11670
|
cursor = startOffset;
|
|
11634
11671
|
}
|
|
11635
11672
|
if (endOffset > cursor) {
|
|
11636
11673
|
dos.push({
|
|
11637
|
-
t:
|
|
11674
|
+
t: "r",
|
|
11638
11675
|
len: endOffset - cursor,
|
|
11639
11676
|
body: {
|
|
11640
11677
|
...Tools.deepClone(body),
|
|
@@ -11659,7 +11696,7 @@ const replaceSelectionTextX = (params) => {
|
|
|
11659
11696
|
switch (type) {
|
|
11660
11697
|
case 0: {
|
|
11661
11698
|
const action = {
|
|
11662
|
-
t:
|
|
11699
|
+
t: "r",
|
|
11663
11700
|
body: {
|
|
11664
11701
|
...getBodySlice(insertBody, cursor, cursor + text.length, false),
|
|
11665
11702
|
dataStream: ""
|
|
@@ -11671,7 +11708,7 @@ const replaceSelectionTextX = (params) => {
|
|
|
11671
11708
|
}
|
|
11672
11709
|
case 1: {
|
|
11673
11710
|
const action = {
|
|
11674
|
-
t:
|
|
11711
|
+
t: "i",
|
|
11675
11712
|
body: getBodySlice(insertBody, cursor, cursor + text.length),
|
|
11676
11713
|
len: text.length
|
|
11677
11714
|
};
|
|
@@ -11679,14 +11716,14 @@ const replaceSelectionTextX = (params) => {
|
|
|
11679
11716
|
return action;
|
|
11680
11717
|
}
|
|
11681
11718
|
default: return {
|
|
11682
|
-
t:
|
|
11719
|
+
t: "d",
|
|
11683
11720
|
len: text.length
|
|
11684
11721
|
};
|
|
11685
11722
|
}
|
|
11686
11723
|
});
|
|
11687
11724
|
const textX = new TextX();
|
|
11688
11725
|
textX.push({
|
|
11689
|
-
t:
|
|
11726
|
+
t: "r",
|
|
11690
11727
|
len: selection.startOffset
|
|
11691
11728
|
});
|
|
11692
11729
|
textX.push(...actions);
|
|
@@ -11711,7 +11748,7 @@ const replaceSelectionTextRuns = (params) => {
|
|
|
11711
11748
|
const textRunsSlice = getTextRunSlice(insertBody, cursor, cursor + text.length, false);
|
|
11712
11749
|
const oldTextRunsSlice = getTextRunSlice(oldBody, cursor, cursor + text.length, false);
|
|
11713
11750
|
const action = {
|
|
11714
|
-
t:
|
|
11751
|
+
t: "r",
|
|
11715
11752
|
body: isTextRunsEqual(textRunsSlice, oldTextRunsSlice) ? void 0 : {
|
|
11716
11753
|
textRuns: textRunsSlice === null || textRunsSlice === void 0 ? void 0 : textRunsSlice.map((textRun) => {
|
|
11717
11754
|
var _textRun$ts, _textRun$ts$cl$rgb, _textRun$ts2, _textRun$ts3;
|
|
@@ -11732,7 +11769,7 @@ const replaceSelectionTextRuns = (params) => {
|
|
|
11732
11769
|
}
|
|
11733
11770
|
case 1: {
|
|
11734
11771
|
const action = {
|
|
11735
|
-
t:
|
|
11772
|
+
t: "i",
|
|
11736
11773
|
body: getBodySlice(insertBody, cursor, cursor + text.length),
|
|
11737
11774
|
len: text.length
|
|
11738
11775
|
};
|
|
@@ -11740,15 +11777,15 @@ const replaceSelectionTextRuns = (params) => {
|
|
|
11740
11777
|
return action;
|
|
11741
11778
|
}
|
|
11742
11779
|
default: return {
|
|
11743
|
-
t:
|
|
11780
|
+
t: "d",
|
|
11744
11781
|
len: text.length
|
|
11745
11782
|
};
|
|
11746
11783
|
}
|
|
11747
11784
|
});
|
|
11748
|
-
if (actions.every((action) => action.t ===
|
|
11785
|
+
if (actions.every((action) => action.t === "r" && !action.body)) return false;
|
|
11749
11786
|
const textX = new TextX();
|
|
11750
11787
|
textX.push({
|
|
11751
|
-
t:
|
|
11788
|
+
t: "r",
|
|
11752
11789
|
len: selection.startOffset
|
|
11753
11790
|
});
|
|
11754
11791
|
textX.push(...actions);
|
|
@@ -11799,7 +11836,7 @@ const addDrawing = (param) => {
|
|
|
11799
11836
|
let removeDrawingLen = 0;
|
|
11800
11837
|
if (collapsed) {
|
|
11801
11838
|
if (startOffset > 0) textX.push({
|
|
11802
|
-
t:
|
|
11839
|
+
t: "r",
|
|
11803
11840
|
len: startOffset
|
|
11804
11841
|
});
|
|
11805
11842
|
} else {
|
|
@@ -11826,7 +11863,7 @@ const addDrawing = (param) => {
|
|
|
11826
11863
|
}
|
|
11827
11864
|
}
|
|
11828
11865
|
textX.push({
|
|
11829
|
-
t:
|
|
11866
|
+
t: "i",
|
|
11830
11867
|
body: {
|
|
11831
11868
|
dataStream: "\b".repeat(drawings.length),
|
|
11832
11869
|
customBlocks: drawings.map((drawing, i) => ({
|
|
@@ -11901,12 +11938,12 @@ function getParagraphsInRanges(ranges, paragraphs, dataStream) {
|
|
|
11901
11938
|
return results;
|
|
11902
11939
|
}
|
|
11903
11940
|
const NOT_PARAGRAPH_TOKENS = [
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11941
|
+
"\r",
|
|
11942
|
+
"",
|
|
11943
|
+
"",
|
|
11944
|
+
"\x1B",
|
|
11945
|
+
"",
|
|
11946
|
+
""
|
|
11910
11947
|
];
|
|
11911
11948
|
function transformParagraphs(paragraphs, dataStream) {
|
|
11912
11949
|
const results = [];
|
|
@@ -11942,10 +11979,10 @@ const switchParagraphBullet = (params) => {
|
|
|
11942
11979
|
const nextParagraph = paragraphs[curIndex + 1];
|
|
11943
11980
|
if (prevParagraph && prevParagraph.bullet && prevParagraph.bullet.listType.indexOf(listType) === 0) {
|
|
11944
11981
|
listId = prevParagraph.bullet.listId;
|
|
11945
|
-
if (listType !==
|
|
11982
|
+
if (listType !== "CHECK_LIST") listType = prevParagraph.bullet.listType;
|
|
11946
11983
|
} else if (nextParagraph && nextParagraph.bullet && nextParagraph.bullet.listType.indexOf(listType) === 0) {
|
|
11947
11984
|
listId = nextParagraph.bullet.listId;
|
|
11948
|
-
if (listType !==
|
|
11985
|
+
if (listType !== "CHECK_LIST") listType = nextParagraph.bullet.listType;
|
|
11949
11986
|
}
|
|
11950
11987
|
}
|
|
11951
11988
|
const memoryCursor = new MemoryCursor();
|
|
@@ -11955,11 +11992,11 @@ const switchParagraphBullet = (params) => {
|
|
|
11955
11992
|
var _bullet$nestingLevel;
|
|
11956
11993
|
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
11957
11994
|
textX.push({
|
|
11958
|
-
t:
|
|
11995
|
+
t: "r",
|
|
11959
11996
|
len: startIndex - memoryCursor.cursor
|
|
11960
11997
|
});
|
|
11961
11998
|
textX.push({
|
|
11962
|
-
t:
|
|
11999
|
+
t: "r",
|
|
11963
12000
|
len: 1,
|
|
11964
12001
|
body: {
|
|
11965
12002
|
dataStream: "",
|
|
@@ -11977,7 +12014,7 @@ const switchParagraphBullet = (params) => {
|
|
|
11977
12014
|
}
|
|
11978
12015
|
}]
|
|
11979
12016
|
},
|
|
11980
|
-
coverType:
|
|
12017
|
+
coverType: 1
|
|
11981
12018
|
});
|
|
11982
12019
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
11983
12020
|
}
|
|
@@ -11989,18 +12026,18 @@ const toggleChecklistParagraph = (params) => {
|
|
|
11989
12026
|
const paragraphs = (_docDataModel$getSelf3 = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) === null || _docDataModel$getSelf3 === void 0 ? void 0 : _docDataModel$getSelf3.paragraphs;
|
|
11990
12027
|
if (paragraphs == null) return false;
|
|
11991
12028
|
const currentParagraph = paragraphs.find((p) => p.startIndex === paragraphIndex);
|
|
11992
|
-
if (!(currentParagraph === null || currentParagraph === void 0 ? void 0 : currentParagraph.bullet) || currentParagraph.bullet.listType.indexOf(
|
|
12029
|
+
if (!(currentParagraph === null || currentParagraph === void 0 ? void 0 : currentParagraph.bullet) || currentParagraph.bullet.listType.indexOf("CHECK_LIST") === -1) return false;
|
|
11993
12030
|
const memoryCursor = new MemoryCursor();
|
|
11994
12031
|
memoryCursor.reset();
|
|
11995
12032
|
const textX = new TextX();
|
|
11996
12033
|
const { startIndex, paragraphStyle = {} } = currentParagraph;
|
|
11997
|
-
const listType = currentParagraph.bullet.listType ===
|
|
12034
|
+
const listType = currentParagraph.bullet.listType === "CHECK_LIST" ? "CHECK_LIST_CHECKED" : "CHECK_LIST";
|
|
11998
12035
|
textX.push({
|
|
11999
|
-
t:
|
|
12036
|
+
t: "r",
|
|
12000
12037
|
len: startIndex - memoryCursor.cursor
|
|
12001
12038
|
});
|
|
12002
12039
|
textX.push({
|
|
12003
|
-
t:
|
|
12040
|
+
t: "r",
|
|
12004
12041
|
len: 1,
|
|
12005
12042
|
body: {
|
|
12006
12043
|
dataStream: "",
|
|
@@ -12014,7 +12051,7 @@ const toggleChecklistParagraph = (params) => {
|
|
|
12014
12051
|
}
|
|
12015
12052
|
}]
|
|
12016
12053
|
},
|
|
12017
|
-
coverType:
|
|
12054
|
+
coverType: 1
|
|
12018
12055
|
});
|
|
12019
12056
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
12020
12057
|
return textX;
|
|
@@ -12031,11 +12068,11 @@ const setParagraphBullet = (params) => {
|
|
|
12031
12068
|
var _bullet$nestingLevel2;
|
|
12032
12069
|
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
12033
12070
|
textX.push({
|
|
12034
|
-
t:
|
|
12071
|
+
t: "r",
|
|
12035
12072
|
len: startIndex - memoryCursor.cursor
|
|
12036
12073
|
});
|
|
12037
12074
|
textX.push({
|
|
12038
|
-
t:
|
|
12075
|
+
t: "r",
|
|
12039
12076
|
len: 1,
|
|
12040
12077
|
body: {
|
|
12041
12078
|
dataStream: "",
|
|
@@ -12050,7 +12087,7 @@ const setParagraphBullet = (params) => {
|
|
|
12050
12087
|
}
|
|
12051
12088
|
}]
|
|
12052
12089
|
},
|
|
12053
|
-
coverType:
|
|
12090
|
+
coverType: 1
|
|
12054
12091
|
});
|
|
12055
12092
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
12056
12093
|
}
|
|
@@ -12075,14 +12112,14 @@ const changeParagraphBulletNestLevel = (params) => {
|
|
|
12075
12112
|
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
12076
12113
|
const isInTable = hasParagraphInTable(paragraph, tables);
|
|
12077
12114
|
textX.push({
|
|
12078
|
-
t:
|
|
12115
|
+
t: "r",
|
|
12079
12116
|
len: startIndex - memoryCursor.cursor
|
|
12080
12117
|
});
|
|
12081
12118
|
if (bullet) {
|
|
12082
12119
|
let maxLevel = lists[bullet.listType].nestingLevel.length - 1;
|
|
12083
12120
|
if (isInTable) maxLevel = Math.min(maxLevel, 2);
|
|
12084
12121
|
textX.push({
|
|
12085
|
-
t:
|
|
12122
|
+
t: "r",
|
|
12086
12123
|
len: 1,
|
|
12087
12124
|
body: {
|
|
12088
12125
|
dataStream: "",
|
|
@@ -12095,10 +12132,10 @@ const changeParagraphBulletNestLevel = (params) => {
|
|
|
12095
12132
|
}
|
|
12096
12133
|
}]
|
|
12097
12134
|
},
|
|
12098
|
-
coverType:
|
|
12135
|
+
coverType: 1
|
|
12099
12136
|
});
|
|
12100
12137
|
} else textX.push({
|
|
12101
|
-
t:
|
|
12138
|
+
t: "r",
|
|
12102
12139
|
len: 1
|
|
12103
12140
|
});
|
|
12104
12141
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
@@ -12117,20 +12154,20 @@ const setParagraphStyle = (params) => {
|
|
|
12117
12154
|
const start = Math.max(0, currentParagraphs[0].paragraphStart - 1);
|
|
12118
12155
|
if (start > memoryCursor.cursor) {
|
|
12119
12156
|
textX.push({
|
|
12120
|
-
t:
|
|
12157
|
+
t: "r",
|
|
12121
12158
|
len: start - memoryCursor.cursor
|
|
12122
12159
|
});
|
|
12123
12160
|
memoryCursor.moveCursorTo(start);
|
|
12124
12161
|
}
|
|
12125
12162
|
if (deleteLen) textX.push({
|
|
12126
|
-
t:
|
|
12163
|
+
t: "d",
|
|
12127
12164
|
len: deleteLen
|
|
12128
12165
|
});
|
|
12129
12166
|
for (const paragraph of currentParagraphs) {
|
|
12130
12167
|
const { startIndex, paragraphStyle = {} } = paragraph;
|
|
12131
12168
|
const len = startIndex - memoryCursor.cursor;
|
|
12132
12169
|
textX.push({
|
|
12133
|
-
t:
|
|
12170
|
+
t: "r",
|
|
12134
12171
|
len,
|
|
12135
12172
|
...paragraphTextRun ? {
|
|
12136
12173
|
body: {
|
|
@@ -12141,11 +12178,11 @@ const setParagraphStyle = (params) => {
|
|
|
12141
12178
|
ed: len
|
|
12142
12179
|
}]
|
|
12143
12180
|
},
|
|
12144
|
-
coverType:
|
|
12181
|
+
coverType: 1
|
|
12145
12182
|
} : null
|
|
12146
12183
|
});
|
|
12147
12184
|
textX.push({
|
|
12148
|
-
t:
|
|
12185
|
+
t: "r",
|
|
12149
12186
|
len: 1,
|
|
12150
12187
|
body: {
|
|
12151
12188
|
dataStream: "",
|
|
@@ -12157,7 +12194,7 @@ const setParagraphStyle = (params) => {
|
|
|
12157
12194
|
}
|
|
12158
12195
|
}]
|
|
12159
12196
|
},
|
|
12160
|
-
coverType:
|
|
12197
|
+
coverType: 1
|
|
12161
12198
|
});
|
|
12162
12199
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
12163
12200
|
}
|
|
@@ -12354,7 +12391,7 @@ var TextStyleValue = class TextStyleValue {
|
|
|
12354
12391
|
* ```
|
|
12355
12392
|
*/
|
|
12356
12393
|
get italic() {
|
|
12357
|
-
return this._style.it ===
|
|
12394
|
+
return this._style.it === 1;
|
|
12358
12395
|
}
|
|
12359
12396
|
/**
|
|
12360
12397
|
* Gets whether the text is bold
|
|
@@ -12366,7 +12403,7 @@ var TextStyleValue = class TextStyleValue {
|
|
|
12366
12403
|
* ```
|
|
12367
12404
|
*/
|
|
12368
12405
|
get bold() {
|
|
12369
|
-
return this._style.bl ===
|
|
12406
|
+
return this._style.bl === 1;
|
|
12370
12407
|
}
|
|
12371
12408
|
/**
|
|
12372
12409
|
* Gets the underline decoration
|
|
@@ -12726,14 +12763,14 @@ var TextDecorationBuilder = class TextDecorationBuilder {
|
|
|
12726
12763
|
* @returns {boolean} True if the decoration is shown
|
|
12727
12764
|
*/
|
|
12728
12765
|
get show() {
|
|
12729
|
-
return this._decoration.s ===
|
|
12766
|
+
return this._decoration.s === 1;
|
|
12730
12767
|
}
|
|
12731
12768
|
/**
|
|
12732
12769
|
* Gets whether the decoration color follows the font color
|
|
12733
12770
|
* @returns {boolean} True if the decoration color follows the font color
|
|
12734
12771
|
*/
|
|
12735
12772
|
get followFontColor() {
|
|
12736
|
-
return this._decoration.c ===
|
|
12773
|
+
return this._decoration.c === 1;
|
|
12737
12774
|
}
|
|
12738
12775
|
/**
|
|
12739
12776
|
* Gets the decoration color
|
|
@@ -13091,7 +13128,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13091
13128
|
* ```
|
|
13092
13129
|
*/
|
|
13093
13130
|
get keepLines() {
|
|
13094
|
-
return this._style.keepLines ===
|
|
13131
|
+
return this._style.keepLines === 1;
|
|
13095
13132
|
}
|
|
13096
13133
|
/**
|
|
13097
13134
|
* Gets the keep next
|
|
@@ -13103,7 +13140,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13103
13140
|
* ```
|
|
13104
13141
|
*/
|
|
13105
13142
|
get keepNext() {
|
|
13106
|
-
return this._style.keepNext ===
|
|
13143
|
+
return this._style.keepNext === 1;
|
|
13107
13144
|
}
|
|
13108
13145
|
/**
|
|
13109
13146
|
* Gets the word wrap
|
|
@@ -13115,7 +13152,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13115
13152
|
* ```
|
|
13116
13153
|
*/
|
|
13117
13154
|
get wordWrap() {
|
|
13118
|
-
return this._style.wordWrap ===
|
|
13155
|
+
return this._style.wordWrap === 1;
|
|
13119
13156
|
}
|
|
13120
13157
|
/**
|
|
13121
13158
|
* Gets the widow control
|
|
@@ -13127,7 +13164,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13127
13164
|
* ```
|
|
13128
13165
|
*/
|
|
13129
13166
|
get widowControl() {
|
|
13130
|
-
return this._style.widowControl ===
|
|
13167
|
+
return this._style.widowControl === 1;
|
|
13131
13168
|
}
|
|
13132
13169
|
/**
|
|
13133
13170
|
* Gets the shading
|
|
@@ -13151,7 +13188,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13151
13188
|
* ```
|
|
13152
13189
|
*/
|
|
13153
13190
|
get suppressHyphenation() {
|
|
13154
|
-
return this._style.suppressHyphenation ===
|
|
13191
|
+
return this._style.suppressHyphenation === 1;
|
|
13155
13192
|
}
|
|
13156
13193
|
/**
|
|
13157
13194
|
* Creates a copy of the paragraph style
|
|
@@ -13765,7 +13802,7 @@ var RichTextValue = class RichTextValue {
|
|
|
13765
13802
|
*/
|
|
13766
13803
|
getLinks() {
|
|
13767
13804
|
var _this$_data$body$cust, _this$_data$body6;
|
|
13768
|
-
return (_this$_data$body$cust = (_this$_data$body6 = this._data.body) === null || _this$_data$body6 === void 0 || (_this$_data$body6 = _this$_data$body6.customRanges) === null || _this$_data$body6 === void 0 ? void 0 : _this$_data$body6.filter((r) => r.rangeType ===
|
|
13805
|
+
return (_this$_data$body$cust = (_this$_data$body6 = this._data.body) === null || _this$_data$body6 === void 0 || (_this$_data$body6 = _this$_data$body6.customRanges) === null || _this$_data$body6 === void 0 ? void 0 : _this$_data$body6.filter((r) => r.rangeType === 0)) !== null && _this$_data$body$cust !== void 0 ? _this$_data$body$cust : [];
|
|
13769
13806
|
}
|
|
13770
13807
|
/**
|
|
13771
13808
|
* Gets the data of the current RichTextValue instance
|
|
@@ -13925,7 +13962,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
13925
13962
|
*/
|
|
13926
13963
|
setLink(start, end, link) {
|
|
13927
13964
|
const textX = BuildTextUtils.customRange.add({
|
|
13928
|
-
rangeType:
|
|
13965
|
+
rangeType: 0,
|
|
13929
13966
|
rangeId: generateRandomId(),
|
|
13930
13967
|
properties: { url: link },
|
|
13931
13968
|
ranges: [{
|
|
@@ -14007,7 +14044,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
14007
14044
|
const rich = RichTextBuilder.createByBody({
|
|
14008
14045
|
dataStream: textStr,
|
|
14009
14046
|
customRanges: [{
|
|
14010
|
-
rangeType:
|
|
14047
|
+
rangeType: 0,
|
|
14011
14048
|
rangeId: generateRandomId(),
|
|
14012
14049
|
properties: { url: textUrl },
|
|
14013
14050
|
startIndex: 0,
|
|
@@ -14687,11 +14724,11 @@ const IURLImageService = createIdentifier("core.url-image.service");
|
|
|
14687
14724
|
//#endregion
|
|
14688
14725
|
//#region package.json
|
|
14689
14726
|
var name = "@univerjs/core";
|
|
14690
|
-
var version = "0.
|
|
14727
|
+
var version = "0.22.0";
|
|
14691
14728
|
|
|
14692
14729
|
//#endregion
|
|
14693
14730
|
//#region src/sheets/empty-snapshot.ts
|
|
14694
|
-
function getEmptySnapshot(unitID = "", locale =
|
|
14731
|
+
function getEmptySnapshot(unitID = "", locale = "zhCN", name = "") {
|
|
14695
14732
|
return {
|
|
14696
14733
|
id: unitID,
|
|
14697
14734
|
sheetOrder: [],
|
|
@@ -14810,7 +14847,7 @@ const getDefaultBaselineOffset = (fontSize) => ({
|
|
|
14810
14847
|
});
|
|
14811
14848
|
function createDocumentModelWithStyle(content, textStyle, config = {}) {
|
|
14812
14849
|
const contentLength = content.length;
|
|
14813
|
-
const { textRotation, paddingData, horizontalAlign =
|
|
14850
|
+
const { textRotation, paddingData, horizontalAlign = 0, verticalAlign = 0, wrapStrategy = 0, cellValueType } = config;
|
|
14814
14851
|
const { t: marginTop, r: marginRight, b: marginBottom, l: marginLeft } = paddingData || DEFAULT_PADDING_DATA;
|
|
14815
14852
|
const { vertexAngle, centerAngle } = convertTextRotation(textRotation);
|
|
14816
14853
|
return new DocumentDataModel({
|
|
@@ -14885,7 +14922,7 @@ function getFontFormat(format) {
|
|
|
14885
14922
|
function addLinkToDocumentModel(documentModel, linkUrl, linkId) {
|
|
14886
14923
|
var _body$customRanges;
|
|
14887
14924
|
const body = documentModel.getBody();
|
|
14888
|
-
if ((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.some((range) => range.rangeType ===
|
|
14925
|
+
if ((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.some((range) => range.rangeType === 0)) return;
|
|
14889
14926
|
const textX = BuildTextUtils.customRange.add({
|
|
14890
14927
|
ranges: [{
|
|
14891
14928
|
startOffset: 0,
|
|
@@ -14893,7 +14930,7 @@ function addLinkToDocumentModel(documentModel, linkUrl, linkId) {
|
|
|
14893
14930
|
collapsed: false
|
|
14894
14931
|
}],
|
|
14895
14932
|
rangeId: linkId,
|
|
14896
|
-
rangeType:
|
|
14933
|
+
rangeType: 0,
|
|
14897
14934
|
body,
|
|
14898
14935
|
properties: {
|
|
14899
14936
|
url: linkUrl,
|
|
@@ -14935,10 +14972,10 @@ function getFontStyleString(textStyle) {
|
|
|
14935
14972
|
fontFamily: defaultFont
|
|
14936
14973
|
};
|
|
14937
14974
|
}
|
|
14938
|
-
let italic =
|
|
14939
|
-
if (textStyle.it === 0 || textStyle.it === void 0) italic =
|
|
14940
|
-
let bold =
|
|
14941
|
-
if (textStyle.bl === 0 || textStyle.bl === void 0) bold =
|
|
14975
|
+
let italic = "italic";
|
|
14976
|
+
if (textStyle.it === 0 || textStyle.it === void 0) italic = "normal";
|
|
14977
|
+
let bold = "bold";
|
|
14978
|
+
if (textStyle.bl === 0 || textStyle.bl === void 0) bold = "normal";
|
|
14942
14979
|
let originFontSize = defaultFontSize;
|
|
14943
14980
|
if (textStyle.fs) originFontSize = Math.ceil(textStyle.fs);
|
|
14944
14981
|
let fontFamilyResult = defaultFont;
|
|
@@ -14951,9 +14988,9 @@ function getFontStyleString(textStyle) {
|
|
|
14951
14988
|
}
|
|
14952
14989
|
const { va: baselineOffset } = textStyle;
|
|
14953
14990
|
let fontSize = originFontSize;
|
|
14954
|
-
if (baselineOffset ===
|
|
14991
|
+
if (baselineOffset === 2 || baselineOffset === 3) {
|
|
14955
14992
|
const { sbr, spr } = getBaselineOffsetInfo(fontFamilyResult, fontSize);
|
|
14956
|
-
fontSize *= baselineOffset ===
|
|
14993
|
+
fontSize *= baselineOffset === 2 ? sbr : spr;
|
|
14957
14994
|
}
|
|
14958
14995
|
const fontStringPure = `${italic} ${bold} ${fontSize}pt ${fontFamilyResult}`;
|
|
14959
14996
|
return {
|
|
@@ -14968,13 +15005,13 @@ function getBaselineOffsetInfo(_fontFamily, fontSize) {
|
|
|
14968
15005
|
return getDefaultBaselineOffset(fontSize);
|
|
14969
15006
|
}
|
|
14970
15007
|
function convertTextRotation(textRotation) {
|
|
14971
|
-
const { a: angle = 0, v: isVertical =
|
|
15008
|
+
const { a: angle = 0, v: isVertical = 0 } = textRotation || {
|
|
14972
15009
|
a: 0,
|
|
14973
|
-
v:
|
|
15010
|
+
v: 0
|
|
14974
15011
|
};
|
|
14975
15012
|
let centerAngle = 0;
|
|
14976
15013
|
let vertexAngle = angle;
|
|
14977
|
-
if (isVertical ===
|
|
15014
|
+
if (isVertical === 1) {
|
|
14978
15015
|
centerAngle = 90;
|
|
14979
15016
|
vertexAngle = 90;
|
|
14980
15017
|
}
|
|
@@ -15198,7 +15235,7 @@ var ColumnManager = class {
|
|
|
15198
15235
|
const { _columnData } = this;
|
|
15199
15236
|
const col = _columnData[colPos];
|
|
15200
15237
|
if (!col) return true;
|
|
15201
|
-
return col.hd !==
|
|
15238
|
+
return col.hd !== 1;
|
|
15202
15239
|
}
|
|
15203
15240
|
/**
|
|
15204
15241
|
* Get the column style
|
|
@@ -15233,7 +15270,7 @@ var ColumnManager = class {
|
|
|
15233
15270
|
if (inHiddenRange && visible) {
|
|
15234
15271
|
inHiddenRange = false;
|
|
15235
15272
|
hiddenCols.push({
|
|
15236
|
-
rangeType:
|
|
15273
|
+
rangeType: 2,
|
|
15237
15274
|
startColumn,
|
|
15238
15275
|
endColumn: i - 1,
|
|
15239
15276
|
startRow: 0,
|
|
@@ -15249,7 +15286,7 @@ var ColumnManager = class {
|
|
|
15249
15286
|
endRow: 0,
|
|
15250
15287
|
startColumn,
|
|
15251
15288
|
endColumn: end,
|
|
15252
|
-
rangeType:
|
|
15289
|
+
rangeType: 2
|
|
15253
15290
|
});
|
|
15254
15291
|
return hiddenCols;
|
|
15255
15292
|
}
|
|
@@ -15268,7 +15305,7 @@ var ColumnManager = class {
|
|
|
15268
15305
|
if (inVisibleRange && !visible) {
|
|
15269
15306
|
inVisibleRange = false;
|
|
15270
15307
|
visibleCols.push({
|
|
15271
|
-
rangeType:
|
|
15308
|
+
rangeType: 2,
|
|
15272
15309
|
startColumn,
|
|
15273
15310
|
endColumn: i - 1,
|
|
15274
15311
|
startRow: 0,
|
|
@@ -15284,7 +15321,7 @@ var ColumnManager = class {
|
|
|
15284
15321
|
endRow: 0,
|
|
15285
15322
|
startColumn,
|
|
15286
15323
|
endColumn: end,
|
|
15287
|
-
rangeType:
|
|
15324
|
+
rangeType: 2
|
|
15288
15325
|
});
|
|
15289
15326
|
return visibleCols;
|
|
15290
15327
|
}
|
|
@@ -15295,7 +15332,7 @@ var ColumnManager = class {
|
|
|
15295
15332
|
const data = this.getColumn(i);
|
|
15296
15333
|
columnData[index] = data !== null && data !== void 0 ? data : {
|
|
15297
15334
|
w: this._config.defaultColumnWidth,
|
|
15298
|
-
hd:
|
|
15335
|
+
hd: 0
|
|
15299
15336
|
};
|
|
15300
15337
|
index++;
|
|
15301
15338
|
}
|
|
@@ -15439,7 +15476,7 @@ var RowManager = class {
|
|
|
15439
15476
|
const data = this.getRow(i);
|
|
15440
15477
|
rowData[index] = data !== null && data !== void 0 ? data : {
|
|
15441
15478
|
h: this._config.defaultRowHeight,
|
|
15442
|
-
hd:
|
|
15479
|
+
hd: 0
|
|
15443
15480
|
};
|
|
15444
15481
|
index++;
|
|
15445
15482
|
}
|
|
@@ -15451,10 +15488,10 @@ var RowManager = class {
|
|
|
15451
15488
|
let height = 0;
|
|
15452
15489
|
for (let i = 0; i < count; i++) {
|
|
15453
15490
|
const { ia, ah, h = config.defaultRowHeight } = _rowData[i + rowPos] || {
|
|
15454
|
-
hd:
|
|
15491
|
+
hd: 0,
|
|
15455
15492
|
h: config.defaultRowHeight
|
|
15456
15493
|
};
|
|
15457
|
-
height += (ia == null || ia ===
|
|
15494
|
+
height += (ia == null || ia === 1) && typeof ah === "number" ? ah : h;
|
|
15458
15495
|
}
|
|
15459
15496
|
return height;
|
|
15460
15497
|
}
|
|
@@ -15548,7 +15585,7 @@ var RowManager = class {
|
|
|
15548
15585
|
endRow: i - 1,
|
|
15549
15586
|
startColumn: 0,
|
|
15550
15587
|
endColumn: 0,
|
|
15551
|
-
rangeType:
|
|
15588
|
+
rangeType: 1
|
|
15552
15589
|
});
|
|
15553
15590
|
} else if (!inHiddenRange && !visible) {
|
|
15554
15591
|
inHiddenRange = true;
|
|
@@ -15560,7 +15597,7 @@ var RowManager = class {
|
|
|
15560
15597
|
endRow: end,
|
|
15561
15598
|
startColumn: 0,
|
|
15562
15599
|
endColumn: 0,
|
|
15563
|
-
rangeType:
|
|
15600
|
+
rangeType: 1
|
|
15564
15601
|
});
|
|
15565
15602
|
return hiddenRows;
|
|
15566
15603
|
}
|
|
@@ -15583,7 +15620,7 @@ var RowManager = class {
|
|
|
15583
15620
|
endRow: i - 1,
|
|
15584
15621
|
startColumn: 0,
|
|
15585
15622
|
endColumn: 0,
|
|
15586
|
-
rangeType:
|
|
15623
|
+
rangeType: 1
|
|
15587
15624
|
});
|
|
15588
15625
|
} else if (!inVisibleRange && visible) {
|
|
15589
15626
|
inVisibleRange = true;
|
|
@@ -15595,14 +15632,14 @@ var RowManager = class {
|
|
|
15595
15632
|
endRow: end,
|
|
15596
15633
|
startColumn: 0,
|
|
15597
15634
|
endColumn: 0,
|
|
15598
|
-
rangeType:
|
|
15635
|
+
rangeType: 1
|
|
15599
15636
|
});
|
|
15600
15637
|
return visibleRows;
|
|
15601
15638
|
}
|
|
15602
15639
|
getRowRawVisible(row) {
|
|
15603
15640
|
const rowData = this.getRow(row);
|
|
15604
15641
|
if (!rowData) return true;
|
|
15605
|
-
return rowData.hd !==
|
|
15642
|
+
return rowData.hd !== 1;
|
|
15606
15643
|
}
|
|
15607
15644
|
/**
|
|
15608
15645
|
* Get count of row in the sheet
|
|
@@ -15647,7 +15684,7 @@ function mergeWorksheetSnapshotWithDefault(snapshot) {
|
|
|
15647
15684
|
name: "Sheet1",
|
|
15648
15685
|
id: "sheet-01",
|
|
15649
15686
|
tabColor: "",
|
|
15650
|
-
hidden:
|
|
15687
|
+
hidden: 0,
|
|
15651
15688
|
rowCount: DEFAULT_WORKSHEET_ROW_COUNT,
|
|
15652
15689
|
columnCount: 20,
|
|
15653
15690
|
zoomRatio: 1,
|
|
@@ -15665,16 +15702,16 @@ function mergeWorksheetSnapshotWithDefault(snapshot) {
|
|
|
15665
15702
|
cellData: {},
|
|
15666
15703
|
rowData: {},
|
|
15667
15704
|
columnData: {},
|
|
15668
|
-
showGridlines:
|
|
15705
|
+
showGridlines: 1,
|
|
15669
15706
|
rowHeader: {
|
|
15670
15707
|
width: 46,
|
|
15671
|
-
hidden:
|
|
15708
|
+
hidden: 0
|
|
15672
15709
|
},
|
|
15673
15710
|
columnHeader: {
|
|
15674
15711
|
height: 20,
|
|
15675
|
-
hidden:
|
|
15712
|
+
hidden: 0
|
|
15676
15713
|
},
|
|
15677
|
-
rightToLeft:
|
|
15714
|
+
rightToLeft: 0
|
|
15678
15715
|
};
|
|
15679
15716
|
Object.keys(defaultSnapshot).forEach((_key) => {
|
|
15680
15717
|
const key = _key;
|
|
@@ -15717,9 +15754,9 @@ var SpanModel = class extends Disposable {
|
|
|
15717
15754
|
let index = 0;
|
|
15718
15755
|
for (const range of mergeData) {
|
|
15719
15756
|
const { rangeType } = range;
|
|
15720
|
-
if (rangeType ===
|
|
15721
|
-
else if (rangeType ===
|
|
15722
|
-
else if (rangeType ===
|
|
15757
|
+
if (rangeType === 1) this._createRowCache(range, index);
|
|
15758
|
+
else if (rangeType === 2) this._createColumnCache(range, index);
|
|
15759
|
+
else if (rangeType === 3) this._createCellAllCache(index);
|
|
15723
15760
|
else this._createCellCache(range, index);
|
|
15724
15761
|
index++;
|
|
15725
15762
|
}
|
|
@@ -15866,15 +15903,15 @@ var SheetViewModel = class extends Disposable {
|
|
|
15866
15903
|
this._rowFilteredInterceptor = null;
|
|
15867
15904
|
}
|
|
15868
15905
|
getCell(row, col, key, filter) {
|
|
15869
|
-
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col,
|
|
15906
|
+
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col, 2 | 1, key, filter);
|
|
15870
15907
|
return this.getRawCell(row, col);
|
|
15871
15908
|
}
|
|
15872
15909
|
getCellValueOnly(row, col) {
|
|
15873
|
-
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col,
|
|
15910
|
+
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col, 2);
|
|
15874
15911
|
return this.getRawCell(row, col);
|
|
15875
15912
|
}
|
|
15876
15913
|
getCellStyleOnly(row, col) {
|
|
15877
|
-
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col,
|
|
15914
|
+
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col, 1);
|
|
15878
15915
|
return this.getRawCell(row, col);
|
|
15879
15916
|
}
|
|
15880
15917
|
getRowFiltered(row) {
|
|
@@ -16329,15 +16366,15 @@ var Worksheet = class Worksheet {
|
|
|
16329
16366
|
for (let r = range.startRow; r <= range.endRow; r++) if (this.getRowFiltered(r)) rangeFilteredRows.push(r);
|
|
16330
16367
|
return rangeFilteredRows;
|
|
16331
16368
|
}
|
|
16332
|
-
getMatrixWithMergedCells(row, col, endRow, endCol, dataMode =
|
|
16369
|
+
getMatrixWithMergedCells(row, col, endRow, endCol, dataMode = "raw") {
|
|
16333
16370
|
const matrix = this.getCellMatrix();
|
|
16334
16371
|
const mergedCellsInRange = this._spanModel.getMergedCellRange(row, col, endRow, endCol);
|
|
16335
16372
|
const returnCellMatrix = new ObjectMatrix();
|
|
16336
16373
|
createRowColIter(row, endRow, col, endCol).forEach((row, col) => {
|
|
16337
16374
|
let cellData;
|
|
16338
|
-
if (dataMode ===
|
|
16339
|
-
else if (dataMode ===
|
|
16340
|
-
else if (dataMode ===
|
|
16375
|
+
if (dataMode === "raw") cellData = this.getCellRaw(row, col);
|
|
16376
|
+
else if (dataMode === "intercepted") cellData = this.getCell(row, col);
|
|
16377
|
+
else if (dataMode === "both") {
|
|
16341
16378
|
const cellDataRaw = this.getCellRaw(row, col);
|
|
16342
16379
|
if (cellDataRaw) {
|
|
16343
16380
|
var _this$getCell;
|
|
@@ -16739,7 +16776,7 @@ var Worksheet = class Worksheet {
|
|
|
16739
16776
|
const textStyle = getFontFormat(style);
|
|
16740
16777
|
fontString = getFontStyleString(textStyle).fontCache;
|
|
16741
16778
|
let cellText = extractPureTextFromCell(cell);
|
|
16742
|
-
if (cell.t ===
|
|
16779
|
+
if (cell.t === 4 && displayRawFormula) cellText = `'${cellText}`;
|
|
16743
16780
|
documentModel = createDocumentModelWithStyle(cellText, textStyle, {
|
|
16744
16781
|
...cellOtherConfig,
|
|
16745
16782
|
textRotation,
|
|
@@ -16859,16 +16896,30 @@ function extractPureTextFromCell(cell) {
|
|
|
16859
16896
|
if (richTextValue) return BuildTextUtils.transform.getPlainText(richTextValue);
|
|
16860
16897
|
const rawValue = cell.v;
|
|
16861
16898
|
if (typeof rawValue === "string") {
|
|
16862
|
-
if (cell.t ===
|
|
16899
|
+
if (cell.t === 3) return rawValue.toUpperCase();
|
|
16863
16900
|
return rawValue.replace(/[\r\n]/g, "");
|
|
16864
16901
|
}
|
|
16865
16902
|
if (typeof rawValue === "number") {
|
|
16866
|
-
if (cell.t ===
|
|
16903
|
+
if (cell.t === 3) return rawValue ? "TRUE" : "FALSE";
|
|
16867
16904
|
return rawValue.toString();
|
|
16868
16905
|
}
|
|
16869
16906
|
if (typeof rawValue === "boolean") return rawValue ? "TRUE" : "FALSE";
|
|
16870
16907
|
return "";
|
|
16871
16908
|
}
|
|
16909
|
+
function getDisplayValueFromCell(cell) {
|
|
16910
|
+
var _cell$p2;
|
|
16911
|
+
if (!cell) return "";
|
|
16912
|
+
const richTextValue = (_cell$p2 = cell.p) === null || _cell$p2 === void 0 || (_cell$p2 = _cell$p2.body) === null || _cell$p2 === void 0 ? void 0 : _cell$p2.dataStream;
|
|
16913
|
+
if (richTextValue) return BuildTextUtils.transform.getPlainText(richTextValue);
|
|
16914
|
+
const displayValue = cell.v;
|
|
16915
|
+
if (displayValue === null || displayValue === void 0) return "";
|
|
16916
|
+
if (cell.t === 3) {
|
|
16917
|
+
if (typeof displayValue === "string") return displayValue.toUpperCase();
|
|
16918
|
+
if (typeof displayValue === "number") return displayValue ? "TRUE" : "FALSE";
|
|
16919
|
+
}
|
|
16920
|
+
if (typeof displayValue === "boolean") return displayValue ? "TRUE" : "FALSE";
|
|
16921
|
+
return String(displayValue);
|
|
16922
|
+
}
|
|
16872
16923
|
function getOriginCellValue(cell) {
|
|
16873
16924
|
if (cell === null) return "";
|
|
16874
16925
|
if (cell === null || cell === void 0 ? void 0 : cell.p) {
|
|
@@ -17044,7 +17095,7 @@ let Workbook = class Workbook extends UnitModel {
|
|
|
17044
17095
|
const sheetOrder = this._snapshot.sheetOrder;
|
|
17045
17096
|
for (let i = 0, len = sheetOrder.length; i < len; i++) {
|
|
17046
17097
|
const worksheet = this._worksheets.get(sheetOrder[i]);
|
|
17047
|
-
if (worksheet && worksheet.isSheetHidden() !==
|
|
17098
|
+
if (worksheet && worksheet.isSheetHidden() !== 1) {
|
|
17048
17099
|
this.setActiveSheet(worksheet);
|
|
17049
17100
|
return worksheet;
|
|
17050
17101
|
}
|
|
@@ -17119,10 +17170,10 @@ let Workbook = class Workbook extends UnitModel {
|
|
|
17119
17170
|
return this._worksheets.get(sheetOrder[index]);
|
|
17120
17171
|
}
|
|
17121
17172
|
getHiddenWorksheets() {
|
|
17122
|
-
return this.getSheets().filter((s) => s.getConfig().hidden ===
|
|
17173
|
+
return this.getSheets().filter((s) => s.getConfig().hidden === 1).map((s) => s.getConfig().id);
|
|
17123
17174
|
}
|
|
17124
17175
|
getUnhiddenWorksheets() {
|
|
17125
|
-
return this.getSheets().filter((s) => s.getConfig().hidden !==
|
|
17176
|
+
return this.getSheets().filter((s) => s.getConfig().hidden !== 1).map((s) => s.getConfig().id);
|
|
17126
17177
|
}
|
|
17127
17178
|
load(config) {
|
|
17128
17179
|
this._snapshot = config;
|
|
@@ -17444,10 +17495,10 @@ let LifecycleStages = /* @__PURE__ */ function(LifecycleStages) {
|
|
|
17444
17495
|
return LifecycleStages;
|
|
17445
17496
|
}({});
|
|
17446
17497
|
const LifecycleNameMap = {
|
|
17447
|
-
[
|
|
17448
|
-
[
|
|
17449
|
-
[
|
|
17450
|
-
[
|
|
17498
|
+
[0]: "Starting",
|
|
17499
|
+
[1]: "Ready",
|
|
17500
|
+
[2]: "Rendered",
|
|
17501
|
+
[3]: "Steady"
|
|
17451
17502
|
};
|
|
17452
17503
|
|
|
17453
17504
|
//#endregion
|
|
@@ -17466,10 +17517,10 @@ let LifecycleService = class LifecycleService extends Disposable {
|
|
|
17466
17517
|
constructor(_logService) {
|
|
17467
17518
|
super();
|
|
17468
17519
|
this._logService = _logService;
|
|
17469
|
-
_defineProperty(this, "_lifecycle$", new BehaviorSubject(
|
|
17520
|
+
_defineProperty(this, "_lifecycle$", new BehaviorSubject(0));
|
|
17470
17521
|
_defineProperty(this, "lifecycle$", this._lifecycle$.asObservable());
|
|
17471
17522
|
_defineProperty(this, "_lock", false);
|
|
17472
|
-
this._reportProgress(
|
|
17523
|
+
this._reportProgress(0);
|
|
17473
17524
|
}
|
|
17474
17525
|
get stage() {
|
|
17475
17526
|
return this._lifecycle$.getValue();
|
|
@@ -17508,7 +17559,7 @@ let LifecycleService = class LifecycleService extends Disposable {
|
|
|
17508
17559
|
* @returns An observable that emits the lifecycle stages, including the current
|
|
17509
17560
|
*/
|
|
17510
17561
|
subscribeWithPrevious() {
|
|
17511
|
-
return merge$1(getLifecycleStagesAndBefore(this.stage), this._lifecycle$.pipe(skip(1))).pipe(takeAfter((s) => s ===
|
|
17562
|
+
return merge$1(getLifecycleStagesAndBefore(this.stage), this._lifecycle$.pipe(skip(1))).pipe(takeAfter((s) => s === 3));
|
|
17512
17563
|
}
|
|
17513
17564
|
_reportProgress(stage) {
|
|
17514
17565
|
this._logService.debug("[LifecycleService]", `lifecycle progressed to "${LifecycleNameMap[stage]}".`);
|
|
@@ -17517,10 +17568,10 @@ let LifecycleService = class LifecycleService extends Disposable {
|
|
|
17517
17568
|
LifecycleService = __decorate([__decorateParam(0, ILogService)], LifecycleService);
|
|
17518
17569
|
function getLifecycleStagesAndBefore(lifecycleStage) {
|
|
17519
17570
|
switch (lifecycleStage) {
|
|
17520
|
-
case
|
|
17521
|
-
case
|
|
17522
|
-
case
|
|
17523
|
-
default: return of(
|
|
17571
|
+
case 0: return of(0);
|
|
17572
|
+
case 1: return of(0, 1);
|
|
17573
|
+
case 2: return of(0, 1, 2);
|
|
17574
|
+
default: return of(0, 1, 2, 3);
|
|
17524
17575
|
}
|
|
17525
17576
|
}
|
|
17526
17577
|
|
|
@@ -17554,7 +17605,7 @@ var LocaleService = class extends Disposable {
|
|
|
17554
17605
|
}
|
|
17555
17606
|
constructor() {
|
|
17556
17607
|
super();
|
|
17557
|
-
_defineProperty(this, "_currentLocale$", new BehaviorSubject(
|
|
17608
|
+
_defineProperty(this, "_currentLocale$", new BehaviorSubject("zhCN"));
|
|
17558
17609
|
_defineProperty(this, "currentLocale$", this._currentLocale$.asObservable());
|
|
17559
17610
|
_defineProperty(this, "_locales", null);
|
|
17560
17611
|
_defineProperty(this, "localeChanged$", new Subject());
|
|
@@ -17645,9 +17696,9 @@ let MentionIOLocalService = class MentionIOLocalService {
|
|
|
17645
17696
|
async list(params) {
|
|
17646
17697
|
return {
|
|
17647
17698
|
list: [{
|
|
17648
|
-
type:
|
|
17699
|
+
type: 0,
|
|
17649
17700
|
mentions: [{
|
|
17650
|
-
objectType:
|
|
17701
|
+
objectType: 0,
|
|
17651
17702
|
objectId: this._userManagerService.getCurrentUser().userID,
|
|
17652
17703
|
label: this._userManagerService.getCurrentUser().name,
|
|
17653
17704
|
metadata: { icon: this._userManagerService.getCurrentUser().avatar }
|
|
@@ -17717,7 +17768,7 @@ var PermissionService = class extends Disposable {
|
|
|
17717
17768
|
if (!permissionPoint) return;
|
|
17718
17769
|
const subject = permissionPoint.getValue();
|
|
17719
17770
|
subject.value = value;
|
|
17720
|
-
subject.status =
|
|
17771
|
+
subject.status = "done";
|
|
17721
17772
|
permissionPoint.next(subject);
|
|
17722
17773
|
this._permissionPointUpdate$.next(subject);
|
|
17723
17774
|
}
|
|
@@ -17929,26 +17980,26 @@ let PluginService = class PluginService {
|
|
|
17929
17980
|
_pluginsRunLifecycle(plugins) {
|
|
17930
17981
|
const currentStage = this._lifecycleService.stage;
|
|
17931
17982
|
getLifecycleStagesAndBefore(currentStage).subscribe((stage) => this._runStage(plugins, stage));
|
|
17932
|
-
if (currentStage !==
|
|
17983
|
+
if (currentStage !== 3) {
|
|
17933
17984
|
const subscription = this._lifecycleService.lifecycle$.pipe(skip(1)).subscribe((stage) => {
|
|
17934
17985
|
this._runStage(plugins, stage);
|
|
17935
|
-
if (stage ===
|
|
17986
|
+
if (stage === 3) subscription.unsubscribe();
|
|
17936
17987
|
});
|
|
17937
17988
|
}
|
|
17938
17989
|
}
|
|
17939
17990
|
_runStage(plugins, stage) {
|
|
17940
17991
|
plugins.forEach((p) => {
|
|
17941
17992
|
switch (stage) {
|
|
17942
|
-
case
|
|
17993
|
+
case 0:
|
|
17943
17994
|
p.onStarting();
|
|
17944
17995
|
break;
|
|
17945
|
-
case
|
|
17996
|
+
case 1:
|
|
17946
17997
|
p.onReady();
|
|
17947
17998
|
break;
|
|
17948
|
-
case
|
|
17999
|
+
case 2:
|
|
17949
18000
|
p.onRendered();
|
|
17950
18001
|
break;
|
|
17951
|
-
case
|
|
18002
|
+
case 3:
|
|
17952
18003
|
p.onSteady();
|
|
17953
18004
|
break;
|
|
17954
18005
|
}
|
|
@@ -18114,11 +18165,6 @@ var ThemeService = class extends Disposable {
|
|
|
18114
18165
|
|
|
18115
18166
|
//#endregion
|
|
18116
18167
|
//#region src/services/undoredo/undoredo.service.ts
|
|
18117
|
-
var BatchingStatus = /* @__PURE__ */ function(BatchingStatus) {
|
|
18118
|
-
BatchingStatus[BatchingStatus["WAITING"] = 0] = "WAITING";
|
|
18119
|
-
BatchingStatus[BatchingStatus["CREATED"] = 1] = "CREATED";
|
|
18120
|
-
return BatchingStatus;
|
|
18121
|
-
}(BatchingStatus || {});
|
|
18122
18168
|
const IUndoRedoService = createIdentifier("univer.undo-redo.service");
|
|
18123
18169
|
const STACK_CAPACITY = 20;
|
|
18124
18170
|
var MultiImplementationCommand = class {
|
|
@@ -18132,7 +18178,7 @@ const UndoCommandId = "univer.command.undo";
|
|
|
18132
18178
|
const UndoCommand = new class extends MultiImplementationCommand {
|
|
18133
18179
|
constructor(..._args) {
|
|
18134
18180
|
super(..._args);
|
|
18135
|
-
_defineProperty(this, "type",
|
|
18181
|
+
_defineProperty(this, "type", 0);
|
|
18136
18182
|
_defineProperty(this, "id", UndoCommandId);
|
|
18137
18183
|
}
|
|
18138
18184
|
handler(accessor) {
|
|
@@ -18140,7 +18186,7 @@ const UndoCommand = new class extends MultiImplementationCommand {
|
|
|
18140
18186
|
const element = undoRedoService.pitchTopUndoElement();
|
|
18141
18187
|
if (!element) return false;
|
|
18142
18188
|
const commandService = accessor.get(ICommandService);
|
|
18143
|
-
if (sequenceExecute(element.undoMutations, commandService)) {
|
|
18189
|
+
if (sequenceExecute(element.undoMutations, commandService).result) {
|
|
18144
18190
|
undoRedoService.popUndoToRedo();
|
|
18145
18191
|
return true;
|
|
18146
18192
|
}
|
|
@@ -18150,7 +18196,7 @@ const UndoCommand = new class extends MultiImplementationCommand {
|
|
|
18150
18196
|
const RedoCommand = new class extends MultiImplementationCommand {
|
|
18151
18197
|
constructor(..._args2) {
|
|
18152
18198
|
super(..._args2);
|
|
18153
|
-
_defineProperty(this, "type",
|
|
18199
|
+
_defineProperty(this, "type", 0);
|
|
18154
18200
|
_defineProperty(this, "id", RedoCommandId);
|
|
18155
18201
|
}
|
|
18156
18202
|
handler(accessor) {
|
|
@@ -18158,7 +18204,7 @@ const RedoCommand = new class extends MultiImplementationCommand {
|
|
|
18158
18204
|
const element = undoRedoService.pitchTopRedoElement();
|
|
18159
18205
|
if (!element) return false;
|
|
18160
18206
|
const commandService = accessor.get(ICommandService);
|
|
18161
|
-
if (sequenceExecute(element.redoMutations, commandService)) {
|
|
18207
|
+
if (sequenceExecute(element.redoMutations, commandService).result) {
|
|
18162
18208
|
undoRedoService.popRedoToUndo();
|
|
18163
18209
|
return true;
|
|
18164
18210
|
}
|
|
@@ -18193,9 +18239,9 @@ let LocalUndoRedoService = class LocalUndoRedoService extends Disposable {
|
|
|
18193
18239
|
if (this._batchingStatus.has(item.unitID)) {
|
|
18194
18240
|
const batchingStatus = this._batchingStatus.get(item.unitID);
|
|
18195
18241
|
const lastItem = this._pitchUndoElement(item.unitID);
|
|
18196
|
-
if (batchingStatus ===
|
|
18242
|
+
if (batchingStatus === 0 || !lastItem) {
|
|
18197
18243
|
appendNewItem(item);
|
|
18198
|
-
this._batchingStatus.set(item.unitID,
|
|
18244
|
+
this._batchingStatus.set(item.unitID, 1);
|
|
18199
18245
|
} else this._tryBatchingElements(lastItem, item);
|
|
18200
18246
|
} else appendNewItem(item);
|
|
18201
18247
|
function appendNewItem(item) {
|
|
@@ -18252,7 +18298,7 @@ let LocalUndoRedoService = class LocalUndoRedoService extends Disposable {
|
|
|
18252
18298
|
}
|
|
18253
18299
|
__tempBatchingUndoRedo(unitId) {
|
|
18254
18300
|
if (this._batchingStatus.has(unitId)) throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");
|
|
18255
|
-
this._batchingStatus.set(unitId,
|
|
18301
|
+
this._batchingStatus.set(unitId, 0);
|
|
18256
18302
|
return toDisposable(() => this._batchingStatus.delete(unitId));
|
|
18257
18303
|
}
|
|
18258
18304
|
_updateStatus() {
|
|
@@ -18339,12 +18385,12 @@ var ImageCacheMap = class {
|
|
|
18339
18385
|
const newImageElement = new Image();
|
|
18340
18386
|
const imageIoService = this._injector.has(IImageIoService) ? this._injector.get(IImageIoService) : null;
|
|
18341
18387
|
const urlImageService = this._injector.has(IURLImageService) ? this._injector.get(IURLImageService) : null;
|
|
18342
|
-
if (imageSourceType ===
|
|
18388
|
+
if (imageSourceType === "UUID") try {
|
|
18343
18389
|
newImageElement.src = await (imageIoService === null || imageIoService === void 0 ? void 0 : imageIoService.getImage(source)) || "";
|
|
18344
18390
|
} catch (error) {
|
|
18345
18391
|
console.error(error);
|
|
18346
18392
|
}
|
|
18347
|
-
else if (imageSourceType ===
|
|
18393
|
+
else if (imageSourceType === "URL") try {
|
|
18348
18394
|
newImageElement.src = await (urlImageService === null || urlImageService === void 0 ? void 0 : urlImageService.getImage(source)) || source;
|
|
18349
18395
|
} catch (error) {
|
|
18350
18396
|
newImageElement.src = source;
|
|
@@ -18953,9 +18999,9 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
18953
18999
|
const rowDataItem = data[r];
|
|
18954
19000
|
if (!rowDataItem) continue;
|
|
18955
19001
|
const { h = defaultRowHeight, ah, ia } = rowDataItem;
|
|
18956
|
-
if ((ia == null || ia ===
|
|
19002
|
+
if ((ia == null || ia === 1) && typeof ah === "number" && ah > 0) rowHeight = ah;
|
|
18957
19003
|
else rowHeight = h;
|
|
18958
|
-
if (rowDataItem.hd ===
|
|
19004
|
+
if (rowDataItem.hd === 1) rowHeight = 0;
|
|
18959
19005
|
}
|
|
18960
19006
|
const gapSize = (_this$_gapConfig$rowG3 = (_this$_gapConfig$rowG4 = this._gapConfig.rowGaps) === null || _this$_gapConfig$rowG4 === void 0 || (_this$_gapConfig$rowG4 = _this$_gapConfig$rowG4[r]) === null || _this$_gapConfig$rowG4 === void 0 ? void 0 : _this$_gapConfig$rowG4.size) !== null && _this$_gapConfig$rowG3 !== void 0 ? _this$_gapConfig$rowG3 : 0;
|
|
18961
19007
|
rowTotalHeight += gapSize;
|
|
@@ -18981,7 +19027,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
18981
19027
|
const columnDataItem = data[c];
|
|
18982
19028
|
if (!columnDataItem) continue;
|
|
18983
19029
|
if (columnDataItem.w != null) columnWidth = columnDataItem.w;
|
|
18984
|
-
if (columnDataItem.hd ===
|
|
19030
|
+
if (columnDataItem.hd === 1) columnWidth = 0;
|
|
18985
19031
|
}
|
|
18986
19032
|
const gapSize = (_this$_gapConfig$colG3 = (_this$_gapConfig$colG4 = this._gapConfig.colGaps) === null || _this$_gapConfig$colG4 === void 0 || (_this$_gapConfig$colG4 = _this$_gapConfig$colG4[c]) === null || _this$_gapConfig$colG4 === void 0 ? void 0 : _this$_gapConfig$colG4.size) !== null && _this$_gapConfig$colG3 !== void 0 ? _this$_gapConfig$colG3 : 0;
|
|
18987
19033
|
columnTotalWidth += gapSize;
|
|
@@ -18997,7 +19043,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
18997
19043
|
const mergedData = this.worksheet.getMergedCell(row, column);
|
|
18998
19044
|
return Boolean(mergedData);
|
|
18999
19045
|
}
|
|
19000
|
-
_getOverflowBound(row, startColumn, endColumn, contentWidth, horizontalAlign =
|
|
19046
|
+
_getOverflowBound(row, startColumn, endColumn, contentWidth, horizontalAlign = 1) {
|
|
19001
19047
|
let cumWidth = 0;
|
|
19002
19048
|
if (startColumn > endColumn) {
|
|
19003
19049
|
const columnCount = this._columnWidthAccumulation.length - 1;
|
|
@@ -19008,7 +19054,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
19008
19054
|
return column + 1 > columnCount ? columnCount : column + 1;
|
|
19009
19055
|
}
|
|
19010
19056
|
const { startX, endX } = getCellWithCoordByIndexCore(row, column, this.rowHeightAccumulation, this.columnWidthAccumulation, void 0, this.getGapSizeGetter());
|
|
19011
|
-
if (horizontalAlign ===
|
|
19057
|
+
if (horizontalAlign === 2 && column === startColumn) cumWidth += (endX - startX) / 2;
|
|
19012
19058
|
else cumWidth += endX - startX;
|
|
19013
19059
|
if (contentWidth < cumWidth) return column;
|
|
19014
19060
|
}
|
|
@@ -19021,7 +19067,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
19021
19067
|
return column - 1 < 0 ? 0 : column - 1;
|
|
19022
19068
|
}
|
|
19023
19069
|
const { startX, endX } = getCellWithCoordByIndexCore(row, column, this.rowHeightAccumulation, this.columnWidthAccumulation, void 0, this.getGapSizeGetter());
|
|
19024
|
-
if (horizontalAlign ===
|
|
19070
|
+
if (horizontalAlign === 2 && column === startColumn) cumWidth += (endX - startX) / 2;
|
|
19025
19071
|
else cumWidth += endX - startX;
|
|
19026
19072
|
if (contentWidth < cumWidth) return column;
|
|
19027
19073
|
}
|
|
@@ -19037,8 +19083,8 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
19037
19083
|
const { rowData, columnData, defaultRowHeight, defaultColumnWidth, rowCount, columnCount, rowHeader, columnHeader } = this._worksheetData;
|
|
19038
19084
|
const { rowTotalHeight, rowHeightAccumulation } = this._generateRowMatrixCache(rowCount, rowData, defaultRowHeight);
|
|
19039
19085
|
const { columnTotalWidth, columnWidthAccumulation } = this._generateColumnMatrixCache(columnCount, columnData, defaultColumnWidth);
|
|
19040
|
-
this._rowHeaderWidth = rowHeader.hidden !==
|
|
19041
|
-
this._columnHeaderHeight = columnHeader.hidden !==
|
|
19086
|
+
this._rowHeaderWidth = rowHeader.hidden !== 1 ? this._dynamicallyUpdateRowHeaderWidth(rowHeader) : 0;
|
|
19087
|
+
this._columnHeaderHeight = columnHeader.hidden !== 1 ? columnHeader.height : 0;
|
|
19042
19088
|
this._rowTotalHeight = rowTotalHeight;
|
|
19043
19089
|
this._rowHeightAccumulation = rowHeightAccumulation;
|
|
19044
19090
|
this._columnTotalWidth = columnTotalWidth;
|
|
@@ -19869,7 +19915,7 @@ var Univer = class {
|
|
|
19869
19915
|
});
|
|
19870
19916
|
}
|
|
19871
19917
|
_tryProgressToReady() {
|
|
19872
|
-
if (this._injector.get(LifecycleService).stage <
|
|
19918
|
+
if (this._injector.get(LifecycleService).stage < 1) this._injector.get(LifecycleService).stage = 1;
|
|
19873
19919
|
}
|
|
19874
19920
|
/** Register a plugin into univer. */
|
|
19875
19921
|
registerPlugin(plugin, config) {
|
|
@@ -19946,4 +19992,4 @@ function createUniverInjector(parentInjector, override) {
|
|
|
19946
19992
|
installShims();
|
|
19947
19993
|
|
|
19948
19994
|
//#endregion
|
|
19949
|
-
export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentDataModel, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PRESET_LIST_TYPE, PRINT_CHART_COMPONENT_KEY, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextValue, RxDisposable, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TabStopAlignment, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createREGEXFromWildChar, createRowColIter, createSheetGapTestConfig, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBodySlice, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getDocsUpdateBody, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphsSlice, getPlainText, getReverseDirection, getSectionBreakSlice, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, normalizeBody, normalizeTextRuns, numberToABC, numberToListABC, numfmt, queryObjectMatrix, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, textDiff, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, willLoseNumericPrecision };
|
|
19995
|
+
export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentDataModel, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PRESET_LIST_TYPE, PRINT_CHART_COMPONENT_KEY, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextValue, RxDisposable, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TabStopAlignment, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createREGEXFromWildChar, createRowColIter, createSheetGapTestConfig, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBodySlice, getBorderStyleType, getCellCoordByIndexSimple, getCellInfoInMergeData, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getDisplayValueFromCell, getDocsUpdateBody, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getOriginCellValue, getParagraphsSlice, getPlainText, getReverseDirection, getSectionBreakSlice, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, makeCellToSelection, makeCustomRangeStream, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, normalizeBody, normalizeTextRuns, numberToABC, numberToListABC, numfmt, queryObjectMatrix, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, textDiff, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, willLoseNumericPrecision };
|