@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/cjs/index.js
CHANGED
|
@@ -424,7 +424,7 @@ function throttle(fn, wait = 16) {
|
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
//#endregion
|
|
427
|
-
//#region \0@oxc-project+runtime@0.
|
|
427
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
428
428
|
function _typeof(o) {
|
|
429
429
|
"@babel/helpers - typeof";
|
|
430
430
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -435,7 +435,7 @@ function _typeof(o) {
|
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
//#endregion
|
|
438
|
-
//#region \0@oxc-project+runtime@0.
|
|
438
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
439
439
|
function toPrimitive(t, r) {
|
|
440
440
|
if ("object" != _typeof(t) || !t) return t;
|
|
441
441
|
var e = t[Symbol.toPrimitive];
|
|
@@ -448,14 +448,14 @@ function toPrimitive(t, r) {
|
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
//#endregion
|
|
451
|
-
//#region \0@oxc-project+runtime@0.
|
|
451
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
452
452
|
function toPropertyKey(t) {
|
|
453
453
|
var i = toPrimitive(t, "string");
|
|
454
454
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
//#endregion
|
|
458
|
-
//#region \0@oxc-project+runtime@0.
|
|
458
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
459
459
|
function _defineProperty(e, r, t) {
|
|
460
460
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
461
461
|
value: t,
|
|
@@ -2049,10 +2049,10 @@ let Direction = /* @__PURE__ */ function(Direction) {
|
|
|
2049
2049
|
}({});
|
|
2050
2050
|
function getReverseDirection(direction) {
|
|
2051
2051
|
switch (direction) {
|
|
2052
|
-
case
|
|
2053
|
-
case
|
|
2054
|
-
case
|
|
2055
|
-
case
|
|
2052
|
+
case 3: return 1;
|
|
2053
|
+
case 1: return 3;
|
|
2054
|
+
case 0: return 2;
|
|
2055
|
+
case 2: return 0;
|
|
2056
2056
|
}
|
|
2057
2057
|
}
|
|
2058
2058
|
|
|
@@ -2817,17 +2817,17 @@ let PaperType = /* @__PURE__ */ function(PaperType) {
|
|
|
2817
2817
|
return PaperType;
|
|
2818
2818
|
}({});
|
|
2819
2819
|
const PAPER_TYPES = [
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2820
|
+
"A3",
|
|
2821
|
+
"A4",
|
|
2822
|
+
"A5",
|
|
2823
|
+
"B4",
|
|
2824
|
+
"B5",
|
|
2825
|
+
"Letter",
|
|
2826
|
+
"Tabloid",
|
|
2827
|
+
"Legal",
|
|
2828
|
+
"Statement",
|
|
2829
|
+
"Executive",
|
|
2830
|
+
"Folio"
|
|
2831
2831
|
];
|
|
2832
2832
|
|
|
2833
2833
|
//#endregion
|
|
@@ -2978,7 +2978,7 @@ const STYLE_KEYS = defineExactKeys()([
|
|
|
2978
2978
|
|
|
2979
2979
|
//#endregion
|
|
2980
2980
|
//#region src/docs/data-model/empty-snapshot.ts
|
|
2981
|
-
function getEmptySnapshot$1(unitID = generateRandomId(6), locale =
|
|
2981
|
+
function getEmptySnapshot$1(unitID = generateRandomId(6), locale = "enUS", title = "") {
|
|
2982
2982
|
return {
|
|
2983
2983
|
id: unitID,
|
|
2984
2984
|
locale,
|
|
@@ -3008,19 +3008,19 @@ function getEmptySnapshot$1(unitID = generateRandomId(6), locale = LocaleType.EN
|
|
|
3008
3008
|
width: 595 / .75,
|
|
3009
3009
|
height: 842 / .75
|
|
3010
3010
|
},
|
|
3011
|
-
documentFlavor:
|
|
3011
|
+
documentFlavor: 1,
|
|
3012
3012
|
marginTop: 50,
|
|
3013
3013
|
marginBottom: 50,
|
|
3014
3014
|
marginRight: 50,
|
|
3015
3015
|
marginLeft: 50,
|
|
3016
3016
|
renderConfig: {
|
|
3017
|
-
zeroWidthParagraphBreak:
|
|
3017
|
+
zeroWidthParagraphBreak: 0,
|
|
3018
3018
|
vertexAngle: 0,
|
|
3019
3019
|
centerAngle: 0,
|
|
3020
3020
|
background: { rgb: "#ccc" }
|
|
3021
3021
|
},
|
|
3022
|
-
autoHyphenation:
|
|
3023
|
-
doNotHyphenateCaps:
|
|
3022
|
+
autoHyphenation: 1,
|
|
3023
|
+
doNotHyphenateCaps: 0,
|
|
3024
3024
|
consecutiveHyphenLimit: 2,
|
|
3025
3025
|
defaultHeaderId: "",
|
|
3026
3026
|
defaultFooterId: "",
|
|
@@ -3028,8 +3028,8 @@ function getEmptySnapshot$1(unitID = generateRandomId(6), locale = LocaleType.EN
|
|
|
3028
3028
|
evenPageFooterId: "",
|
|
3029
3029
|
firstPageHeaderId: "",
|
|
3030
3030
|
firstPageFooterId: "",
|
|
3031
|
-
evenAndOddHeaders:
|
|
3032
|
-
useFirstPageHeaderFooter:
|
|
3031
|
+
evenAndOddHeaders: 0,
|
|
3032
|
+
useFirstPageHeaderFooter: 0,
|
|
3033
3033
|
marginHeader: 30,
|
|
3034
3034
|
marginFooter: 30
|
|
3035
3035
|
},
|
|
@@ -3185,28 +3185,28 @@ const ILogService = (0, _wendellhu_redi.createIdentifier)("univer.log");
|
|
|
3185
3185
|
var DesktopLogService = class extends Disposable {
|
|
3186
3186
|
constructor(..._args) {
|
|
3187
3187
|
super(..._args);
|
|
3188
|
-
_defineProperty(this, "_logLevel",
|
|
3188
|
+
_defineProperty(this, "_logLevel", 3);
|
|
3189
3189
|
_defineProperty(this, "_deduction", /* @__PURE__ */ new Set());
|
|
3190
3190
|
}
|
|
3191
3191
|
dispose() {
|
|
3192
3192
|
super.dispose();
|
|
3193
|
-
this._logLevel =
|
|
3193
|
+
this._logLevel = 3;
|
|
3194
3194
|
this._deduction.clear();
|
|
3195
3195
|
}
|
|
3196
3196
|
debug(...args) {
|
|
3197
|
-
if (this._logLevel >=
|
|
3197
|
+
if (this._logLevel >= 4) this._log(console.debug, ...args);
|
|
3198
3198
|
}
|
|
3199
3199
|
log(...args) {
|
|
3200
|
-
if (this._logLevel >=
|
|
3200
|
+
if (this._logLevel >= 3) this._log(console.log, ...args);
|
|
3201
3201
|
}
|
|
3202
3202
|
warn(...args) {
|
|
3203
|
-
if (this._logLevel >=
|
|
3203
|
+
if (this._logLevel >= 2) this._log(console.warn, ...args);
|
|
3204
3204
|
}
|
|
3205
3205
|
error(...args) {
|
|
3206
|
-
if (this._logLevel >=
|
|
3206
|
+
if (this._logLevel >= 1) this._log(console.error, ...args);
|
|
3207
3207
|
}
|
|
3208
3208
|
deprecate(...args) {
|
|
3209
|
-
if (this._logLevel >=
|
|
3209
|
+
if (this._logLevel >= 2) this._logWithDeduplication(console.error, ...args);
|
|
3210
3210
|
}
|
|
3211
3211
|
setLogLevel(logLevel) {
|
|
3212
3212
|
this._logLevel = logLevel;
|
|
@@ -3228,7 +3228,7 @@ function hashLogContent(...args) {
|
|
|
3228
3228
|
}
|
|
3229
3229
|
|
|
3230
3230
|
//#endregion
|
|
3231
|
-
//#region \0@oxc-project+runtime@0.
|
|
3231
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
3232
3232
|
function __decorateParam(paramIndex, decorator) {
|
|
3233
3233
|
return function(target, key) {
|
|
3234
3234
|
decorator(target, key, paramIndex);
|
|
@@ -3236,7 +3236,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
3236
3236
|
}
|
|
3237
3237
|
|
|
3238
3238
|
//#endregion
|
|
3239
|
-
//#region \0@oxc-project+runtime@0.
|
|
3239
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
3240
3240
|
function __decorate(decorators, target, key, desc) {
|
|
3241
3241
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3242
3242
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3309,7 +3309,7 @@ var CommandRegistry = class {
|
|
|
3309
3309
|
};
|
|
3310
3310
|
const NilCommand = {
|
|
3311
3311
|
id: "nil",
|
|
3312
|
-
type:
|
|
3312
|
+
type: 0,
|
|
3313
3313
|
handler: () => true
|
|
3314
3314
|
};
|
|
3315
3315
|
let CommandService = class CommandService extends Disposable {
|
|
@@ -3396,10 +3396,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3396
3396
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3397
3397
|
const result = await this._execute(command, params, _options);
|
|
3398
3398
|
if (_options.syncOnly) {
|
|
3399
|
-
if (command.type ===
|
|
3399
|
+
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3400
3400
|
} else {
|
|
3401
3401
|
this._commandExecutedListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3402
|
-
if (command.type ===
|
|
3402
|
+
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3403
3403
|
}
|
|
3404
3404
|
stackItemDisposable.dispose();
|
|
3405
3405
|
return result;
|
|
@@ -3420,8 +3420,8 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3420
3420
|
type: command.type,
|
|
3421
3421
|
params
|
|
3422
3422
|
};
|
|
3423
|
-
if (command.type ===
|
|
3424
|
-
const triggerCommand = findLast(this._commandExecutionStack, (item) => item.type ===
|
|
3423
|
+
if (command.type === 2) {
|
|
3424
|
+
const triggerCommand = findLast(this._commandExecutionStack, (item) => item.type === 0);
|
|
3425
3425
|
if (triggerCommand) {
|
|
3426
3426
|
var _commandInfo$params;
|
|
3427
3427
|
commandInfo.params = (_commandInfo$params = commandInfo.params) !== null && _commandInfo$params !== void 0 ? _commandInfo$params : {};
|
|
@@ -3433,10 +3433,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3433
3433
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3434
3434
|
const result = this._syncExecute(command, params, _options);
|
|
3435
3435
|
if (_options.syncOnly) {
|
|
3436
|
-
if (command.type ===
|
|
3436
|
+
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3437
3437
|
} else {
|
|
3438
3438
|
this._commandExecutedListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3439
|
-
if (command.type ===
|
|
3439
|
+
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3440
3440
|
}
|
|
3441
3441
|
stackItemDisposable.dispose();
|
|
3442
3442
|
return result;
|
|
@@ -3515,7 +3515,7 @@ var MultiCommand = class {
|
|
|
3515
3515
|
this.id = id;
|
|
3516
3516
|
_defineProperty(this, "name", void 0);
|
|
3517
3517
|
_defineProperty(this, "multi", true);
|
|
3518
|
-
_defineProperty(this, "type",
|
|
3518
|
+
_defineProperty(this, "type", 0);
|
|
3519
3519
|
_defineProperty(this, "priority", 0);
|
|
3520
3520
|
_defineProperty(this, "_implementations", []);
|
|
3521
3521
|
_defineProperty(this, "handler", async (accessor, params) => {
|
|
@@ -3611,7 +3611,7 @@ function convertObservableToBehaviorSubject(observable, initValue) {
|
|
|
3611
3611
|
const afterInitApply = (commandService) => {
|
|
3612
3612
|
return new Promise((res) => {
|
|
3613
3613
|
(0, rxjs.merge)(fromCallback(commandService.onCommandExecuted.bind(commandService)).pipe((0, rxjs_operators.filter)(([info]) => {
|
|
3614
|
-
return info.type ===
|
|
3614
|
+
return info.type === 2;
|
|
3615
3615
|
})), (0, rxjs.timer)(300)).pipe((0, rxjs_operators.debounceTime)(16), (0, rxjs_operators.first)()).subscribe(() => {
|
|
3616
3616
|
res();
|
|
3617
3617
|
});
|
|
@@ -4942,9 +4942,9 @@ function isICellData(value) {
|
|
|
4942
4942
|
}
|
|
4943
4943
|
function getCellValueType(cell) {
|
|
4944
4944
|
if (cell.t !== void 0) return cell.t;
|
|
4945
|
-
if (typeof cell.v === "string") return
|
|
4946
|
-
if (typeof cell.v === "number") return
|
|
4947
|
-
if (typeof cell.v === "boolean") return
|
|
4945
|
+
if (typeof cell.v === "string") return 1;
|
|
4946
|
+
if (typeof cell.v === "number") return 2;
|
|
4947
|
+
if (typeof cell.v === "boolean") return 3;
|
|
4948
4948
|
}
|
|
4949
4949
|
function isNullCell(cell) {
|
|
4950
4950
|
if (cell == null) return true;
|
|
@@ -5062,34 +5062,19 @@ let CellModeEnum = /* @__PURE__ */ function(CellModeEnum) {
|
|
|
5062
5062
|
|
|
5063
5063
|
//#endregion
|
|
5064
5064
|
//#region src/types/const/theme-color-map.ts
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
* limitations under the License.
|
|
5079
|
-
*/
|
|
5080
|
-
const THEME_COLORS = { [ThemeColors.OFFICE]: {
|
|
5081
|
-
[ThemeColorType.ACCENT1]: "#4472C4",
|
|
5082
|
-
[ThemeColorType.ACCENT2]: "#ED7D31",
|
|
5083
|
-
[ThemeColorType.ACCENT3]: "#A5A5A5",
|
|
5084
|
-
[ThemeColorType.ACCENT4]: "#70AD47",
|
|
5085
|
-
[ThemeColorType.ACCENT5]: "#5B9BD5",
|
|
5086
|
-
[ThemeColorType.ACCENT6]: "#70AD47",
|
|
5087
|
-
[ThemeColorType.DARK1]: "#000000",
|
|
5088
|
-
[ThemeColorType.DARK2]: "#44546A",
|
|
5089
|
-
[ThemeColorType.LIGHT1]: "#FFFFFF",
|
|
5090
|
-
[ThemeColorType.LIGHT2]: "#E7E6E6",
|
|
5091
|
-
[ThemeColorType.HYPERLINK]: "#0563C1",
|
|
5092
|
-
[ThemeColorType.FOLLOWED_HYPERLINK]: "#954F72"
|
|
5065
|
+
const THEME_COLORS = { ["Office"]: {
|
|
5066
|
+
[4]: "#4472C4",
|
|
5067
|
+
[5]: "#ED7D31",
|
|
5068
|
+
[6]: "#A5A5A5",
|
|
5069
|
+
[7]: "#70AD47",
|
|
5070
|
+
[8]: "#5B9BD5",
|
|
5071
|
+
[9]: "#70AD47",
|
|
5072
|
+
[0]: "#000000",
|
|
5073
|
+
[2]: "#44546A",
|
|
5074
|
+
[1]: "#FFFFFF",
|
|
5075
|
+
[3]: "#E7E6E6",
|
|
5076
|
+
[10]: "#0563C1",
|
|
5077
|
+
[11]: "#954F72"
|
|
5093
5078
|
} };
|
|
5094
5079
|
|
|
5095
5080
|
//#endregion
|
|
@@ -5832,7 +5817,7 @@ function getColorStyle(color) {
|
|
|
5832
5817
|
if (color.rgb) return new ColorKit(color.rgb).toHexString();
|
|
5833
5818
|
if (color.th != null) {
|
|
5834
5819
|
var _THEME_COLORS$ThemeCo;
|
|
5835
|
-
const themeColor = (_THEME_COLORS$ThemeCo = THEME_COLORS[
|
|
5820
|
+
const themeColor = (_THEME_COLORS$ThemeCo = THEME_COLORS["Office"]) === null || _THEME_COLORS$ThemeCo === void 0 ? void 0 : _THEME_COLORS$ThemeCo[color.th];
|
|
5836
5821
|
if (themeColor) return new ColorKit(themeColor).toRgbString();
|
|
5837
5822
|
}
|
|
5838
5823
|
}
|
|
@@ -5931,12 +5916,12 @@ function handleStyleToString(style, isCell = false) {
|
|
|
5931
5916
|
if (style.cl) str += `color: ${getColorStyle(style.cl)}; `;
|
|
5932
5917
|
}],
|
|
5933
5918
|
["va", () => {
|
|
5934
|
-
if (style.va ===
|
|
5935
|
-
else if (style.va ===
|
|
5919
|
+
if (style.va === 2) str += "vertical-align: sub; ";
|
|
5920
|
+
else if (style.va === 3) str += "vertical-align: super; ";
|
|
5936
5921
|
}],
|
|
5937
5922
|
["td", () => {
|
|
5938
|
-
if (style.td ===
|
|
5939
|
-
else if (style.td ===
|
|
5923
|
+
if (style.td === 1) str += "direction: ltr; ";
|
|
5924
|
+
else if (style.td === 2) str += "direction: rtl; ";
|
|
5940
5925
|
}],
|
|
5941
5926
|
["tr", () => {
|
|
5942
5927
|
if (style.tr) {
|
|
@@ -5945,19 +5930,19 @@ function handleStyleToString(style, isCell = false) {
|
|
|
5945
5930
|
}
|
|
5946
5931
|
}],
|
|
5947
5932
|
["ht", () => {
|
|
5948
|
-
if (style.ht ===
|
|
5949
|
-
else if (style.ht ===
|
|
5950
|
-
else if (style.ht ===
|
|
5951
|
-
else if (style.ht ===
|
|
5933
|
+
if (style.ht === 1) str += "text-align: left; ";
|
|
5934
|
+
else if (style.ht === 3) str += "text-align: right; ";
|
|
5935
|
+
else if (style.ht === 2) str += "text-align: center; ";
|
|
5936
|
+
else if (style.ht === 4) str += "text-align: justify; ";
|
|
5952
5937
|
}],
|
|
5953
5938
|
["vt", () => {
|
|
5954
|
-
if (style.vt ===
|
|
5955
|
-
else if (style.vt ===
|
|
5956
|
-
else if (style.vt ===
|
|
5939
|
+
if (style.vt === 3) str += "vertical-align: bottom; ";
|
|
5940
|
+
else if (style.vt === 1) str += "vertical-align: top; ";
|
|
5941
|
+
else if (style.vt === 2) str += "vertical-align: middle; ";
|
|
5957
5942
|
}],
|
|
5958
5943
|
["tb", () => {
|
|
5959
|
-
if (style.tb ===
|
|
5960
|
-
else if (style.tb ===
|
|
5944
|
+
if (style.tb === 2) str += "white-space: nowrap; overflow-x: hidden; ";
|
|
5945
|
+
else if (style.tb === 3) str += "white-space: normal;";
|
|
5961
5946
|
}],
|
|
5962
5947
|
["pd", () => {
|
|
5963
5948
|
var _style$pd, _style$pd2, _style$pd3, _style$pd4, _style$pd5, _style$pd6, _style$pd7, _style$pd8;
|
|
@@ -5985,36 +5970,36 @@ function handleStyleToString(style, isCell = false) {
|
|
|
5985
5970
|
}
|
|
5986
5971
|
function getBorderStyle(type) {
|
|
5987
5972
|
let str = "";
|
|
5988
|
-
if (type ===
|
|
5989
|
-
else if (type ===
|
|
5990
|
-
else if (type ===
|
|
5991
|
-
else if (type ===
|
|
5992
|
-
else if (type ===
|
|
5993
|
-
else if (type ===
|
|
5994
|
-
else if (type ===
|
|
5995
|
-
else if (type ===
|
|
5996
|
-
else if (type ===
|
|
5997
|
-
else if (type ===
|
|
5998
|
-
else if (type ===
|
|
5999
|
-
else if (type ===
|
|
6000
|
-
else if (type ===
|
|
6001
|
-
else if (type ===
|
|
5973
|
+
if (type === 0) str = "none";
|
|
5974
|
+
else if (type === 1) str = "0.5pt solid";
|
|
5975
|
+
else if (type === 2) str = "0.5pt double";
|
|
5976
|
+
else if (type === 3) str = "0.5pt dotted";
|
|
5977
|
+
else if (type === 4) str = "0.5pt dashed";
|
|
5978
|
+
else if (type === 5) str = "0.5pt dashed";
|
|
5979
|
+
else if (type === 6) str = "0.5pt dotted";
|
|
5980
|
+
else if (type === 7) str = "0.5pt double";
|
|
5981
|
+
else if (type === 8) str = "1pt solid";
|
|
5982
|
+
else if (type === 9) str = "1pt dashed";
|
|
5983
|
+
else if (type === 10) str = "1pt dashed";
|
|
5984
|
+
else if (type === 11) str = "1pt dotted";
|
|
5985
|
+
else if (type === 12) str = "0.5pt dashed";
|
|
5986
|
+
else if (type === 13) str = "1.5pt solid";
|
|
6002
5987
|
return str;
|
|
6003
5988
|
}
|
|
6004
5989
|
function getBorderStyleType(type) {
|
|
6005
5990
|
let str = 0;
|
|
6006
5991
|
type = type.trim();
|
|
6007
|
-
if (type === "none") str =
|
|
6008
|
-
else if (type === "0.5pt solid") str =
|
|
6009
|
-
else if (type === "0.5pt double") str =
|
|
6010
|
-
else if (type === "0.5pt dotted") str =
|
|
6011
|
-
else if (type === "0.5pt dashed") str =
|
|
6012
|
-
else if (type === "1pt solid") str =
|
|
6013
|
-
else if (type === "1pt dashed") str =
|
|
6014
|
-
else if (type === "1pt dotted") str =
|
|
6015
|
-
else if (type === "1.5pt solid") str =
|
|
6016
|
-
else if (!type.includes("none")) str =
|
|
6017
|
-
else return
|
|
5992
|
+
if (type === "none") str = 0;
|
|
5993
|
+
else if (type === "0.5pt solid") str = 1;
|
|
5994
|
+
else if (type === "0.5pt double") str = 2;
|
|
5995
|
+
else if (type === "0.5pt dotted") str = 3;
|
|
5996
|
+
else if (type === "0.5pt dashed") str = 4;
|
|
5997
|
+
else if (type === "1pt solid") str = 8;
|
|
5998
|
+
else if (type === "1pt dashed") str = 9;
|
|
5999
|
+
else if (type === "1pt dotted") str = 11;
|
|
6000
|
+
else if (type === "1.5pt solid") str = 13;
|
|
6001
|
+
else if (!type.includes("none")) str = 1;
|
|
6002
|
+
else return 0;
|
|
6018
6003
|
return str;
|
|
6019
6004
|
}
|
|
6020
6005
|
function getDocsUpdateBody(model, segmentId) {
|
|
@@ -6029,9 +6014,9 @@ function getDocsUpdateBody(model, segmentId) {
|
|
|
6029
6014
|
function isValidRange(range, worksheet) {
|
|
6030
6015
|
const { startRow, endRow, startColumn, endColumn, rangeType } = range;
|
|
6031
6016
|
if (startRow < 0 || startColumn < 0 || endRow < 0 || endColumn < 0) return false;
|
|
6032
|
-
if (!(Number.isNaN(startRow) && Number.isNaN(endRow)) && rangeType ===
|
|
6033
|
-
if (!(Number.isNaN(startColumn) && Number.isNaN(endColumn)) && rangeType ===
|
|
6034
|
-
if (rangeType !==
|
|
6017
|
+
if (!(Number.isNaN(startRow) && Number.isNaN(endRow)) && rangeType === 2) return false;
|
|
6018
|
+
if (!(Number.isNaN(startColumn) && Number.isNaN(endColumn)) && rangeType === 1) return false;
|
|
6019
|
+
if (rangeType !== 1 && rangeType !== 2 && (Number.isNaN(startColumn) || Number.isNaN(startRow) || Number.isNaN(endColumn) || Number.isNaN(endRow))) return false;
|
|
6035
6020
|
if (worksheet) {
|
|
6036
6021
|
const rowCount = worksheet.getRowCount();
|
|
6037
6022
|
const colCount = worksheet.getColumnCount();
|
|
@@ -7071,23 +7056,76 @@ const DEFAULT_CELL = {
|
|
|
7071
7056
|
* Default styles.
|
|
7072
7057
|
*/
|
|
7073
7058
|
const DEFAULT_STYLES = {
|
|
7059
|
+
/**
|
|
7060
|
+
* fontFamily
|
|
7061
|
+
*/
|
|
7074
7062
|
ff: "Arial",
|
|
7063
|
+
/**
|
|
7064
|
+
* fontSize
|
|
7065
|
+
*/
|
|
7075
7066
|
fs: 11,
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7067
|
+
/**
|
|
7068
|
+
* italic
|
|
7069
|
+
* 0: false
|
|
7070
|
+
* 1: true
|
|
7071
|
+
*/
|
|
7072
|
+
it: 0,
|
|
7073
|
+
/**
|
|
7074
|
+
* bold
|
|
7075
|
+
* 0: false
|
|
7076
|
+
* 1: true
|
|
7077
|
+
*/
|
|
7078
|
+
bl: 0,
|
|
7079
|
+
/**
|
|
7080
|
+
* underline
|
|
7081
|
+
*/
|
|
7082
|
+
ul: { s: 0 },
|
|
7083
|
+
/**
|
|
7084
|
+
* strikethrough
|
|
7085
|
+
*/
|
|
7086
|
+
st: { s: 0 },
|
|
7087
|
+
/**
|
|
7088
|
+
* overline
|
|
7089
|
+
*/
|
|
7090
|
+
ol: { s: 0 },
|
|
7091
|
+
/**
|
|
7092
|
+
* textRotation
|
|
7093
|
+
*/
|
|
7081
7094
|
tr: {
|
|
7082
7095
|
a: 0,
|
|
7083
|
-
|
|
7096
|
+
/**
|
|
7097
|
+
* true : 1
|
|
7098
|
+
* false : 0
|
|
7099
|
+
*/
|
|
7100
|
+
v: 0
|
|
7084
7101
|
},
|
|
7085
|
-
|
|
7102
|
+
/**
|
|
7103
|
+
* textDirection
|
|
7104
|
+
*/
|
|
7105
|
+
td: 0,
|
|
7106
|
+
/**
|
|
7107
|
+
* color
|
|
7108
|
+
*/
|
|
7086
7109
|
cl: { rgb: "#000000" },
|
|
7110
|
+
/**
|
|
7111
|
+
* background
|
|
7112
|
+
*/
|
|
7087
7113
|
bg: { rgb: "#fff" },
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7114
|
+
/**
|
|
7115
|
+
* horizontalAlignment
|
|
7116
|
+
*/
|
|
7117
|
+
ht: 0,
|
|
7118
|
+
/**
|
|
7119
|
+
* verticalAlignment
|
|
7120
|
+
*/
|
|
7121
|
+
vt: 0,
|
|
7122
|
+
/**
|
|
7123
|
+
* wrapStrategy
|
|
7124
|
+
*/
|
|
7125
|
+
tb: 0,
|
|
7126
|
+
/**
|
|
7127
|
+
* padding
|
|
7128
|
+
*/
|
|
7091
7129
|
pd: {
|
|
7092
7130
|
t: 0,
|
|
7093
7131
|
r: 0,
|
|
@@ -7095,6 +7133,9 @@ const DEFAULT_STYLES = {
|
|
|
7095
7133
|
l: 0
|
|
7096
7134
|
},
|
|
7097
7135
|
n: null,
|
|
7136
|
+
/**
|
|
7137
|
+
* border
|
|
7138
|
+
*/
|
|
7098
7139
|
bd: {
|
|
7099
7140
|
b: null,
|
|
7100
7141
|
l: null,
|
|
@@ -7108,72 +7149,72 @@ const SHEET_EDITOR_UNITS = [
|
|
|
7108
7149
|
DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY
|
|
7109
7150
|
];
|
|
7110
7151
|
const NAMED_STYLE_MAP = {
|
|
7111
|
-
[
|
|
7152
|
+
[4]: {
|
|
7112
7153
|
fs: 20,
|
|
7113
7154
|
bl: 1
|
|
7114
7155
|
},
|
|
7115
|
-
[
|
|
7156
|
+
[5]: {
|
|
7116
7157
|
fs: 18,
|
|
7117
7158
|
bl: 1
|
|
7118
7159
|
},
|
|
7119
|
-
[
|
|
7160
|
+
[6]: {
|
|
7120
7161
|
fs: 16,
|
|
7121
7162
|
bl: 1
|
|
7122
7163
|
},
|
|
7123
|
-
[
|
|
7164
|
+
[7]: {
|
|
7124
7165
|
fs: 14,
|
|
7125
7166
|
bl: 1
|
|
7126
7167
|
},
|
|
7127
|
-
[
|
|
7168
|
+
[8]: {
|
|
7128
7169
|
fs: 12,
|
|
7129
7170
|
bl: 1
|
|
7130
7171
|
},
|
|
7131
|
-
[
|
|
7132
|
-
[
|
|
7172
|
+
[1]: null,
|
|
7173
|
+
[2]: {
|
|
7133
7174
|
fs: 26,
|
|
7134
7175
|
bl: 1
|
|
7135
7176
|
},
|
|
7136
|
-
[
|
|
7177
|
+
[3]: {
|
|
7137
7178
|
fs: 15,
|
|
7138
7179
|
cl: { rgb: "#999999" }
|
|
7139
7180
|
},
|
|
7140
|
-
[
|
|
7181
|
+
[0]: null
|
|
7141
7182
|
};
|
|
7142
7183
|
const BOTTOM_P = 4;
|
|
7143
7184
|
const NAMED_STYLE_SPACE_MAP = {
|
|
7144
|
-
[
|
|
7185
|
+
[4]: {
|
|
7145
7186
|
spaceAbove: { v: 20 },
|
|
7146
7187
|
spaceBelow: { v: 6 + BOTTOM_P }
|
|
7147
7188
|
},
|
|
7148
|
-
[
|
|
7189
|
+
[5]: {
|
|
7149
7190
|
spaceAbove: { v: 18 },
|
|
7150
7191
|
spaceBelow: { v: 6 + BOTTOM_P }
|
|
7151
7192
|
},
|
|
7152
|
-
[
|
|
7193
|
+
[6]: {
|
|
7153
7194
|
spaceAbove: { v: 16 },
|
|
7154
7195
|
spaceBelow: { v: 6 + BOTTOM_P }
|
|
7155
7196
|
},
|
|
7156
|
-
[
|
|
7197
|
+
[7]: {
|
|
7157
7198
|
spaceAbove: { v: 14 },
|
|
7158
7199
|
spaceBelow: { v: 4 + BOTTOM_P }
|
|
7159
7200
|
},
|
|
7160
|
-
[
|
|
7201
|
+
[8]: {
|
|
7161
7202
|
spaceAbove: { v: 12 },
|
|
7162
7203
|
spaceBelow: { v: 4 + BOTTOM_P }
|
|
7163
7204
|
},
|
|
7164
|
-
[
|
|
7205
|
+
[1]: {
|
|
7165
7206
|
spaceAbove: { v: 0 },
|
|
7166
7207
|
spaceBelow: { v: 0 }
|
|
7167
7208
|
},
|
|
7168
|
-
[
|
|
7209
|
+
[2]: {
|
|
7169
7210
|
spaceAbove: { v: 0 },
|
|
7170
7211
|
spaceBelow: { v: 3 + BOTTOM_P }
|
|
7171
7212
|
},
|
|
7172
|
-
[
|
|
7213
|
+
[3]: {
|
|
7173
7214
|
spaceAbove: { v: 0 },
|
|
7174
7215
|
spaceBelow: { v: 16 }
|
|
7175
7216
|
},
|
|
7176
|
-
[
|
|
7217
|
+
[0]: null
|
|
7177
7218
|
};
|
|
7178
7219
|
const PRINT_CHART_COMPONENT_KEY = "univer-sheets-chart-print-chart";
|
|
7179
7220
|
const DOC_DRAWING_PRINTING_COMPONENT_KEY = "univer-docs-drawing-printing";
|
|
@@ -7204,47 +7245,47 @@ let EXTENSION_NAMES = /* @__PURE__ */ function(EXTENSION_NAMES) {
|
|
|
7204
7245
|
//#endregion
|
|
7205
7246
|
//#region src/types/const/page-size.ts
|
|
7206
7247
|
const PAGE_SIZE = {
|
|
7207
|
-
[
|
|
7248
|
+
["A3"]: {
|
|
7208
7249
|
width: 1123,
|
|
7209
7250
|
height: 1587
|
|
7210
7251
|
},
|
|
7211
|
-
[
|
|
7252
|
+
["A4"]: {
|
|
7212
7253
|
width: 794,
|
|
7213
7254
|
height: 1124
|
|
7214
7255
|
},
|
|
7215
|
-
[
|
|
7256
|
+
["A5"]: {
|
|
7216
7257
|
width: 559,
|
|
7217
7258
|
height: 794
|
|
7218
7259
|
},
|
|
7219
|
-
[
|
|
7260
|
+
["B4"]: {
|
|
7220
7261
|
width: 944,
|
|
7221
7262
|
height: 1344
|
|
7222
7263
|
},
|
|
7223
|
-
[
|
|
7264
|
+
["B5"]: {
|
|
7224
7265
|
width: 665,
|
|
7225
7266
|
height: 944
|
|
7226
7267
|
},
|
|
7227
|
-
[
|
|
7268
|
+
["Executive"]: {
|
|
7228
7269
|
width: 696,
|
|
7229
7270
|
height: 1008
|
|
7230
7271
|
},
|
|
7231
|
-
[
|
|
7272
|
+
["Folio"]: {
|
|
7232
7273
|
width: 816,
|
|
7233
7274
|
height: 1248
|
|
7234
7275
|
},
|
|
7235
|
-
[
|
|
7276
|
+
["Legal"]: {
|
|
7236
7277
|
width: 816,
|
|
7237
7278
|
height: 1344
|
|
7238
7279
|
},
|
|
7239
|
-
[
|
|
7280
|
+
["Letter"]: {
|
|
7240
7281
|
width: 816,
|
|
7241
7282
|
height: 1056
|
|
7242
7283
|
},
|
|
7243
|
-
[
|
|
7284
|
+
["Statement"]: {
|
|
7244
7285
|
width: 528,
|
|
7245
7286
|
height: 816
|
|
7246
7287
|
},
|
|
7247
|
-
[
|
|
7288
|
+
["Tabloid"]: {
|
|
7248
7289
|
width: 1056,
|
|
7249
7290
|
height: 1632
|
|
7250
7291
|
}
|
|
@@ -7257,21 +7298,21 @@ function isAllFormatInTextRuns(key, body) {
|
|
|
7257
7298
|
let len = 0;
|
|
7258
7299
|
for (const textRun of textRuns) {
|
|
7259
7300
|
const { ts = {}, st, ed } = textRun;
|
|
7260
|
-
if (ts[key] == null) return
|
|
7301
|
+
if (ts[key] == null) return 0;
|
|
7261
7302
|
switch (key) {
|
|
7262
7303
|
case "bl":
|
|
7263
7304
|
case "it":
|
|
7264
|
-
if (ts[key] ===
|
|
7305
|
+
if (ts[key] === 0) return 0;
|
|
7265
7306
|
break;
|
|
7266
7307
|
case "ul":
|
|
7267
7308
|
case "st":
|
|
7268
|
-
if (ts[key].s ===
|
|
7309
|
+
if (ts[key].s === 0) return 0;
|
|
7269
7310
|
break;
|
|
7270
7311
|
default: throw new Error(`unknown style key: ${key} in IStyleBase`);
|
|
7271
7312
|
}
|
|
7272
7313
|
len += ed - st;
|
|
7273
7314
|
}
|
|
7274
|
-
return body.dataStream.indexOf("\r\n") === len ?
|
|
7315
|
+
return body.dataStream.indexOf("\r\n") === len ? 1 : 0;
|
|
7275
7316
|
}
|
|
7276
7317
|
/**
|
|
7277
7318
|
* Access and modify spreadsheet ranges.
|
|
@@ -7490,7 +7531,7 @@ var Range = class Range {
|
|
|
7490
7531
|
getUnderline() {
|
|
7491
7532
|
var _this$getValue, _p$body;
|
|
7492
7533
|
const { p } = (_this$getValue = this.getValue()) !== null && _this$getValue !== void 0 ? _this$getValue : {};
|
|
7493
|
-
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) ===
|
|
7534
|
+
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 };
|
|
7494
7535
|
return this.getUnderlines()[0][0];
|
|
7495
7536
|
}
|
|
7496
7537
|
/**
|
|
@@ -7511,7 +7552,7 @@ var Range = class Range {
|
|
|
7511
7552
|
getStrikeThrough() {
|
|
7512
7553
|
var _this$getValue2, _p$body2;
|
|
7513
7554
|
const { p } = (_this$getValue2 = this.getValue()) !== null && _this$getValue2 !== void 0 ? _this$getValue2 : {};
|
|
7514
|
-
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) ===
|
|
7555
|
+
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 };
|
|
7515
7556
|
return this.getStrikeThroughs()[0][0];
|
|
7516
7557
|
}
|
|
7517
7558
|
/**
|
|
@@ -7557,7 +7598,7 @@ var Range = class Range {
|
|
|
7557
7598
|
getFontStyle() {
|
|
7558
7599
|
var _this$getValue4, _p$body4;
|
|
7559
7600
|
const { p } = (_this$getValue4 = this.getValue()) !== null && _this$getValue4 !== void 0 ? _this$getValue4 : {};
|
|
7560
|
-
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) ===
|
|
7601
|
+
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;
|
|
7561
7602
|
return this._getFontStyles()[0][0];
|
|
7562
7603
|
}
|
|
7563
7604
|
/**
|
|
@@ -7575,7 +7616,7 @@ var Range = class Range {
|
|
|
7575
7616
|
getFontWeight() {
|
|
7576
7617
|
var _this$getValue5, _p$body5;
|
|
7577
7618
|
const { p } = (_this$getValue5 = this.getValue()) !== null && _this$getValue5 !== void 0 ? _this$getValue5 : {};
|
|
7578
|
-
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) ===
|
|
7619
|
+
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;
|
|
7579
7620
|
return this._getFontWeights()[0][0];
|
|
7580
7621
|
}
|
|
7581
7622
|
/**
|
|
@@ -7728,7 +7769,7 @@ var Range = class Range {
|
|
|
7728
7769
|
* Returns whether the text in the cell wraps.
|
|
7729
7770
|
*/
|
|
7730
7771
|
getWrap() {
|
|
7731
|
-
return this.getWrapStrategy() ===
|
|
7772
|
+
return this.getWrapStrategy() === 3 ? 1 : 0;
|
|
7732
7773
|
}
|
|
7733
7774
|
/**
|
|
7734
7775
|
* Returns the text wrapping strategies for the cells in the range.
|
|
@@ -7761,19 +7802,19 @@ var Range = class Range {
|
|
|
7761
7802
|
_defineProperty(Range, "transformRange", (range, worksheet) => {
|
|
7762
7803
|
const maxColumns = worksheet.getMaxColumns() - 1;
|
|
7763
7804
|
const maxRows = worksheet.getMaxRows() - 1;
|
|
7764
|
-
if (range.rangeType ===
|
|
7805
|
+
if (range.rangeType === 3) return {
|
|
7765
7806
|
startColumn: 0,
|
|
7766
7807
|
startRow: 0,
|
|
7767
7808
|
endColumn: maxColumns,
|
|
7768
7809
|
endRow: maxRows
|
|
7769
7810
|
};
|
|
7770
|
-
if (range.rangeType ===
|
|
7811
|
+
if (range.rangeType === 2) return {
|
|
7771
7812
|
startRow: 0,
|
|
7772
7813
|
endRow: maxRows,
|
|
7773
7814
|
startColumn: range.startColumn,
|
|
7774
7815
|
endColumn: range.endColumn
|
|
7775
7816
|
};
|
|
7776
|
-
if (range.rangeType ===
|
|
7817
|
+
if (range.rangeType === 1) return {
|
|
7777
7818
|
startColumn: 0,
|
|
7778
7819
|
endColumn: maxColumns,
|
|
7779
7820
|
startRow: range.startRow,
|
|
@@ -7792,57 +7833,57 @@ _defineProperty(Range, "transformRange", (range, worksheet) => {
|
|
|
7792
7833
|
function moveRangeByOffset(range, refOffsetX, refOffsetY, ignoreAbsolute = false) {
|
|
7793
7834
|
if (refOffsetX === 0 && refOffsetY === 0) return range;
|
|
7794
7835
|
let newRange = { ...range };
|
|
7795
|
-
const startAbsoluteRefType = newRange.startAbsoluteRefType ||
|
|
7796
|
-
const endAbsoluteRefType = newRange.endAbsoluteRefType ||
|
|
7797
|
-
const rangeType = newRange.rangeType ||
|
|
7798
|
-
if (!ignoreAbsolute && startAbsoluteRefType ===
|
|
7836
|
+
const startAbsoluteRefType = newRange.startAbsoluteRefType || 0;
|
|
7837
|
+
const endAbsoluteRefType = newRange.endAbsoluteRefType || 0;
|
|
7838
|
+
const rangeType = newRange.rangeType || 0;
|
|
7839
|
+
if (!ignoreAbsolute && startAbsoluteRefType === 3 && endAbsoluteRefType === 3) return newRange;
|
|
7799
7840
|
const start = moveRangeByRangeType(newRange.startRow, refOffsetY, newRange.startColumn, refOffsetX, rangeType);
|
|
7800
7841
|
const end = moveRangeByRangeType(newRange.endRow, refOffsetY, newRange.endColumn, refOffsetX, rangeType);
|
|
7801
|
-
if (ignoreAbsolute || startAbsoluteRefType ===
|
|
7842
|
+
if (ignoreAbsolute || startAbsoluteRefType === 0 && endAbsoluteRefType === 0) return newRange = {
|
|
7802
7843
|
...newRange,
|
|
7803
7844
|
startRow: start.row,
|
|
7804
7845
|
startColumn: start.column,
|
|
7805
7846
|
endRow: end.row,
|
|
7806
7847
|
endColumn: end.column
|
|
7807
7848
|
};
|
|
7808
|
-
if (startAbsoluteRefType ===
|
|
7849
|
+
if (startAbsoluteRefType === 0) newRange = {
|
|
7809
7850
|
...newRange,
|
|
7810
7851
|
startRow: start.row,
|
|
7811
7852
|
startColumn: start.column
|
|
7812
7853
|
};
|
|
7813
|
-
else if (startAbsoluteRefType ===
|
|
7854
|
+
else if (startAbsoluteRefType === 2) newRange = {
|
|
7814
7855
|
...newRange,
|
|
7815
7856
|
startRow: start.row
|
|
7816
7857
|
};
|
|
7817
|
-
else if (startAbsoluteRefType ===
|
|
7858
|
+
else if (startAbsoluteRefType === 1) newRange = {
|
|
7818
7859
|
...newRange,
|
|
7819
7860
|
startColumn: start.column
|
|
7820
7861
|
};
|
|
7821
|
-
if (endAbsoluteRefType ===
|
|
7862
|
+
if (endAbsoluteRefType === 0) newRange = {
|
|
7822
7863
|
...newRange,
|
|
7823
7864
|
endRow: end.row,
|
|
7824
7865
|
endColumn: end.column
|
|
7825
7866
|
};
|
|
7826
|
-
else if (endAbsoluteRefType ===
|
|
7867
|
+
else if (endAbsoluteRefType === 2) newRange = {
|
|
7827
7868
|
...newRange,
|
|
7828
7869
|
endRow: end.row
|
|
7829
7870
|
};
|
|
7830
|
-
else if (endAbsoluteRefType ===
|
|
7871
|
+
else if (endAbsoluteRefType === 1) newRange = {
|
|
7831
7872
|
...newRange,
|
|
7832
7873
|
endColumn: end.column
|
|
7833
7874
|
};
|
|
7834
7875
|
return newRange;
|
|
7835
7876
|
}
|
|
7836
7877
|
function moveRangeByRangeType(row, rowOffset, column, columnOffset, rangeType) {
|
|
7837
|
-
if (rangeType ===
|
|
7878
|
+
if (rangeType === 0) return {
|
|
7838
7879
|
row: row + rowOffset,
|
|
7839
7880
|
column: column + columnOffset
|
|
7840
7881
|
};
|
|
7841
|
-
else if (rangeType ===
|
|
7882
|
+
else if (rangeType === 1) return {
|
|
7842
7883
|
row: row + rowOffset,
|
|
7843
7884
|
column
|
|
7844
7885
|
};
|
|
7845
|
-
else if (rangeType ===
|
|
7886
|
+
else if (rangeType === 2) return {
|
|
7846
7887
|
row,
|
|
7847
7888
|
column: column + columnOffset
|
|
7848
7889
|
};
|
|
@@ -8020,12 +8061,12 @@ function getOverlap1D(start1, end1, start2, end2) {
|
|
|
8020
8061
|
function determineRangeType(srcType, targetType, startRow, endRow, startColumn, endColumn) {
|
|
8021
8062
|
const resolvedSrcType = srcType !== void 0 ? srcType : inferRangeType(startRow, endRow, startColumn, endColumn);
|
|
8022
8063
|
const resolvedTargetType = targetType !== void 0 ? targetType : inferRangeType(startRow, endRow, startColumn, endColumn);
|
|
8023
|
-
if (resolvedSrcType ===
|
|
8064
|
+
if (resolvedSrcType === 3 || resolvedTargetType === 3) {
|
|
8024
8065
|
if (resolvedSrcType === resolvedTargetType) return resolvedSrcType;
|
|
8025
|
-
return resolvedSrcType ===
|
|
8066
|
+
return resolvedSrcType === 3 ? resolvedTargetType : resolvedSrcType;
|
|
8026
8067
|
} else if (resolvedSrcType === resolvedTargetType) return resolvedSrcType;
|
|
8027
|
-
else if (resolvedSrcType ===
|
|
8028
|
-
else return
|
|
8068
|
+
else if (resolvedSrcType === 0 || resolvedTargetType === 0) return 0;
|
|
8069
|
+
else return 0;
|
|
8029
8070
|
}
|
|
8030
8071
|
/**
|
|
8031
8072
|
* Infers the rangeType based on whether start and end rows or columns are NaN (unbounded).
|
|
@@ -8040,10 +8081,10 @@ function determineRangeType(srcType, targetType, startRow, endRow, startColumn,
|
|
|
8040
8081
|
function inferRangeType(startRow, endRow, startColumn, endColumn) {
|
|
8041
8082
|
const hasRow = !isNaN(startRow) && !isNaN(endRow);
|
|
8042
8083
|
const hasColumn = !isNaN(startColumn) && !isNaN(endColumn);
|
|
8043
|
-
if (hasRow && hasColumn) return
|
|
8044
|
-
else if (hasRow) return
|
|
8045
|
-
else if (hasColumn) return
|
|
8046
|
-
else return
|
|
8084
|
+
if (hasRow && hasColumn) return 0;
|
|
8085
|
+
else if (hasRow) return 1;
|
|
8086
|
+
else if (hasColumn) return 2;
|
|
8087
|
+
else return 3;
|
|
8047
8088
|
}
|
|
8048
8089
|
|
|
8049
8090
|
//#endregion
|
|
@@ -8102,7 +8143,7 @@ var Rectangle = class Rectangle {
|
|
|
8102
8143
|
*/
|
|
8103
8144
|
static equals(src, target) {
|
|
8104
8145
|
if (src == null || target == null) return false;
|
|
8105
|
-
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 ===
|
|
8146
|
+
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);
|
|
8106
8147
|
}
|
|
8107
8148
|
/**
|
|
8108
8149
|
* Quickly checks if two normal ranges intersect. For specialized range types,
|
|
@@ -8141,10 +8182,10 @@ var Rectangle = class Rectangle {
|
|
|
8141
8182
|
* ```
|
|
8142
8183
|
*/
|
|
8143
8184
|
static intersects(src, target) {
|
|
8144
|
-
if (src.rangeType ===
|
|
8145
|
-
if (src.rangeType ===
|
|
8146
|
-
if (src.rangeType ===
|
|
8147
|
-
if (src.rangeType ===
|
|
8185
|
+
if (src.rangeType === 1 && target.rangeType === 2) return true;
|
|
8186
|
+
if (src.rangeType === 2 && target.rangeType === 1) return true;
|
|
8187
|
+
if (src.rangeType === 1 && target.rangeType === 1) return src.startRow <= target.endRow && src.endRow >= target.startRow;
|
|
8188
|
+
if (src.rangeType === 2 && target.rangeType === 2) return src.startColumn <= target.endColumn && src.endColumn >= target.startColumn;
|
|
8148
8189
|
const currentStartRow = Number.isNaN(src.startRow) ? 0 : src.startRow;
|
|
8149
8190
|
const currentEndRow = Number.isNaN(src.endRow) ? MAX_ROW_COUNT - 1 : src.endRow;
|
|
8150
8191
|
const currentStartColumn = Number.isNaN(src.startColumn) ? 0 : src.startColumn;
|
|
@@ -8235,7 +8276,7 @@ var Rectangle = class Rectangle {
|
|
|
8235
8276
|
endRow,
|
|
8236
8277
|
startColumn,
|
|
8237
8278
|
endColumn,
|
|
8238
|
-
rangeType:
|
|
8279
|
+
rangeType: 0
|
|
8239
8280
|
};
|
|
8240
8281
|
}
|
|
8241
8282
|
/**
|
|
@@ -8283,7 +8324,7 @@ var Rectangle = class Rectangle {
|
|
|
8283
8324
|
startColumn: Math.min(acc.startColumn, current.startColumn),
|
|
8284
8325
|
endRow: Math.max(acc.endRow, current.endRow),
|
|
8285
8326
|
endColumn: Math.max(acc.endColumn, current.endColumn),
|
|
8286
|
-
rangeType:
|
|
8327
|
+
rangeType: 0
|
|
8287
8328
|
}), ranges[0]);
|
|
8288
8329
|
}
|
|
8289
8330
|
/**
|
|
@@ -8304,15 +8345,15 @@ var Rectangle = class Rectangle {
|
|
|
8304
8345
|
* ```
|
|
8305
8346
|
*/
|
|
8306
8347
|
static realUnion(...ranges) {
|
|
8307
|
-
const hasColRange = ranges.some((range) => range.rangeType ===
|
|
8308
|
-
const hasRowRange = ranges.some((range) => range.rangeType ===
|
|
8348
|
+
const hasColRange = ranges.some((range) => range.rangeType === 2);
|
|
8349
|
+
const hasRowRange = ranges.some((range) => range.rangeType === 1);
|
|
8309
8350
|
const res = Rectangle.union(...ranges);
|
|
8310
8351
|
return {
|
|
8311
8352
|
startColumn: hasRowRange ? NaN : res.startColumn,
|
|
8312
8353
|
endColumn: hasRowRange ? NaN : res.endColumn,
|
|
8313
8354
|
startRow: hasColRange ? NaN : res.startRow,
|
|
8314
8355
|
endRow: hasColRange ? NaN : res.endRow,
|
|
8315
|
-
rangeType: hasRowRange ?
|
|
8356
|
+
rangeType: hasRowRange ? 1 : hasColRange ? 2 : 0
|
|
8316
8357
|
};
|
|
8317
8358
|
}
|
|
8318
8359
|
/**
|
|
@@ -8480,10 +8521,10 @@ _defineProperty(Rectangle, "getRelativeRange", (range, originRange) => ({
|
|
|
8480
8521
|
}));
|
|
8481
8522
|
_defineProperty(Rectangle, "getPositionRange", (relativeRange, originRange, absoluteRange) => ({
|
|
8482
8523
|
...absoluteRange || {},
|
|
8483
|
-
startRow: absoluteRange ? [
|
|
8484
|
-
endRow: absoluteRange ? [
|
|
8485
|
-
startColumn: absoluteRange ? [
|
|
8486
|
-
endColumn: absoluteRange ? [
|
|
8524
|
+
startRow: absoluteRange ? [1, 3].includes(absoluteRange.startAbsoluteRefType || 0) ? absoluteRange.startRow : relativeRange.startRow + originRange.startRow : relativeRange.startRow + originRange.startRow,
|
|
8525
|
+
endRow: absoluteRange ? [1, 3].includes(absoluteRange.endAbsoluteRefType || 0) ? absoluteRange.endRow : relativeRange.endRow + relativeRange.startRow + originRange.startRow : relativeRange.endRow + relativeRange.startRow + originRange.startRow,
|
|
8526
|
+
startColumn: absoluteRange ? [2, 3].includes(absoluteRange.startAbsoluteRefType || 0) ? absoluteRange.startColumn : relativeRange.startColumn + originRange.startColumn : relativeRange.startColumn + originRange.startColumn,
|
|
8527
|
+
endColumn: absoluteRange ? [2, 3].includes(absoluteRange.endAbsoluteRefType || 0) ? absoluteRange.endColumn : relativeRange.endColumn + relativeRange.startColumn + originRange.startColumn : relativeRange.endColumn + relativeRange.startColumn + originRange.startColumn
|
|
8487
8528
|
}));
|
|
8488
8529
|
_defineProperty(Rectangle, "moveHorizontal", (range, step = 0, length = 0) => ({
|
|
8489
8530
|
...range,
|
|
@@ -8498,28 +8539,28 @@ _defineProperty(Rectangle, "moveVertical", (range, step = 0, length = 0) => ({
|
|
|
8498
8539
|
_defineProperty(Rectangle, "moveOffset", (range, offsetX, offsetY) => {
|
|
8499
8540
|
const _range = { ...range };
|
|
8500
8541
|
switch (range.startAbsoluteRefType) {
|
|
8501
|
-
case
|
|
8542
|
+
case 1:
|
|
8502
8543
|
_range.startColumn += offsetX;
|
|
8503
8544
|
break;
|
|
8504
|
-
case
|
|
8545
|
+
case 2:
|
|
8505
8546
|
_range.startRow += offsetY;
|
|
8506
8547
|
break;
|
|
8507
|
-
case
|
|
8508
|
-
case
|
|
8548
|
+
case 3: break;
|
|
8549
|
+
case 0:
|
|
8509
8550
|
default:
|
|
8510
8551
|
_range.startRow += offsetY;
|
|
8511
8552
|
_range.startColumn += offsetX;
|
|
8512
8553
|
break;
|
|
8513
8554
|
}
|
|
8514
8555
|
switch (range.endAbsoluteRefType) {
|
|
8515
|
-
case
|
|
8556
|
+
case 1:
|
|
8516
8557
|
_range.endColumn += offsetX;
|
|
8517
8558
|
break;
|
|
8518
|
-
case
|
|
8559
|
+
case 2:
|
|
8519
8560
|
_range.endRow += offsetY;
|
|
8520
8561
|
break;
|
|
8521
|
-
case
|
|
8522
|
-
case
|
|
8562
|
+
case 3: break;
|
|
8563
|
+
case 0:
|
|
8523
8564
|
default:
|
|
8524
8565
|
_range.endRow += offsetY;
|
|
8525
8566
|
_range.endColumn += offsetX;
|
|
@@ -9426,27 +9467,27 @@ let PresetListType = /* @__PURE__ */ function(PresetListType) {
|
|
|
9426
9467
|
const orderListSymbolMap = {
|
|
9427
9468
|
"a)": {
|
|
9428
9469
|
glyphFormat: "%1)",
|
|
9429
|
-
glyphType:
|
|
9470
|
+
glyphType: 2
|
|
9430
9471
|
},
|
|
9431
9472
|
"1.": {
|
|
9432
9473
|
glyphFormat: "%1.",
|
|
9433
|
-
glyphType:
|
|
9474
|
+
glyphType: 2
|
|
9434
9475
|
},
|
|
9435
9476
|
"a.": {
|
|
9436
9477
|
glyphFormat: "%1.",
|
|
9437
|
-
glyphType:
|
|
9478
|
+
glyphType: 5
|
|
9438
9479
|
},
|
|
9439
9480
|
"A.": {
|
|
9440
9481
|
glyphFormat: "%1.",
|
|
9441
|
-
glyphType:
|
|
9482
|
+
glyphType: 4
|
|
9442
9483
|
},
|
|
9443
9484
|
"i.": {
|
|
9444
9485
|
glyphFormat: "%1.",
|
|
9445
|
-
glyphType:
|
|
9486
|
+
glyphType: 7
|
|
9446
9487
|
},
|
|
9447
9488
|
"I.": {
|
|
9448
9489
|
glyphFormat: "%1.",
|
|
9449
|
-
glyphType:
|
|
9490
|
+
glyphType: 4
|
|
9450
9491
|
}
|
|
9451
9492
|
};
|
|
9452
9493
|
const bulletListFactory = (symbols) => {
|
|
@@ -9457,7 +9498,7 @@ const bulletListFactory = (symbols) => {
|
|
|
9457
9498
|
].map((templateSymbol, i) => ({
|
|
9458
9499
|
glyphFormat: ` %${i + 1}`,
|
|
9459
9500
|
glyphSymbol: templateSymbol,
|
|
9460
|
-
bulletAlignment:
|
|
9501
|
+
bulletAlignment: 1,
|
|
9461
9502
|
textStyle: { fs: 12 },
|
|
9462
9503
|
startNumber: 0,
|
|
9463
9504
|
paragraphProperties: {
|
|
@@ -9469,7 +9510,7 @@ const bulletListFactory = (symbols) => {
|
|
|
9469
9510
|
const orderListFactory = (options) => {
|
|
9470
9511
|
return options.map((format, i) => ({
|
|
9471
9512
|
...format,
|
|
9472
|
-
bulletAlignment:
|
|
9513
|
+
bulletAlignment: 1,
|
|
9473
9514
|
textStyle: { fs: 12 },
|
|
9474
9515
|
startNumber: 0,
|
|
9475
9516
|
paragraphProperties: {
|
|
@@ -9482,7 +9523,7 @@ const checkListFactory = (symbol, textStyle) => {
|
|
|
9482
9523
|
return new Array(9).fill(0).map((_, i) => ({
|
|
9483
9524
|
glyphFormat: ` %${i + 1}`,
|
|
9484
9525
|
glyphSymbol: symbol,
|
|
9485
|
-
bulletAlignment:
|
|
9526
|
+
bulletAlignment: 1,
|
|
9486
9527
|
textStyle: { fs: 16 },
|
|
9487
9528
|
startNumber: 0,
|
|
9488
9529
|
paragraphProperties: {
|
|
@@ -9493,138 +9534,138 @@ const checkListFactory = (symbol, textStyle) => {
|
|
|
9493
9534
|
}));
|
|
9494
9535
|
};
|
|
9495
9536
|
const PRESET_LIST_TYPE = {
|
|
9496
|
-
[
|
|
9497
|
-
listType:
|
|
9537
|
+
["BULLET_LIST"]: {
|
|
9538
|
+
listType: "BULLET_LIST",
|
|
9498
9539
|
nestingLevel: bulletListFactory([
|
|
9499
9540
|
"●",
|
|
9500
9541
|
"○",
|
|
9501
9542
|
"■"
|
|
9502
9543
|
])
|
|
9503
9544
|
},
|
|
9504
|
-
[
|
|
9505
|
-
listType:
|
|
9545
|
+
["BULLET_LIST_1"]: {
|
|
9546
|
+
listType: "BULLET_LIST",
|
|
9506
9547
|
nestingLevel: bulletListFactory([
|
|
9507
9548
|
"❖",
|
|
9508
9549
|
"➢",
|
|
9509
9550
|
"■"
|
|
9510
9551
|
])
|
|
9511
9552
|
},
|
|
9512
|
-
[
|
|
9513
|
-
listType:
|
|
9553
|
+
["BULLET_LIST_2"]: {
|
|
9554
|
+
listType: "BULLET_LIST",
|
|
9514
9555
|
nestingLevel: bulletListFactory([
|
|
9515
9556
|
"✔",
|
|
9516
9557
|
"●",
|
|
9517
9558
|
"◆"
|
|
9518
9559
|
])
|
|
9519
9560
|
},
|
|
9520
|
-
[
|
|
9521
|
-
listType:
|
|
9561
|
+
["BULLET_LIST_3"]: {
|
|
9562
|
+
listType: "BULLET_LIST",
|
|
9522
9563
|
nestingLevel: bulletListFactory([
|
|
9523
9564
|
"■",
|
|
9524
9565
|
"◆",
|
|
9525
9566
|
"○"
|
|
9526
9567
|
])
|
|
9527
9568
|
},
|
|
9528
|
-
[
|
|
9529
|
-
listType:
|
|
9569
|
+
["BULLET_LIST_4"]: {
|
|
9570
|
+
listType: "BULLET_LIST",
|
|
9530
9571
|
nestingLevel: bulletListFactory([
|
|
9531
9572
|
"✧",
|
|
9532
9573
|
"○",
|
|
9533
9574
|
"■"
|
|
9534
9575
|
])
|
|
9535
9576
|
},
|
|
9536
|
-
[
|
|
9537
|
-
listType:
|
|
9577
|
+
["BULLET_LIST_5"]: {
|
|
9578
|
+
listType: "BULLET_LIST",
|
|
9538
9579
|
nestingLevel: bulletListFactory([
|
|
9539
9580
|
"➢",
|
|
9540
9581
|
"○",
|
|
9541
9582
|
"◆"
|
|
9542
9583
|
])
|
|
9543
9584
|
},
|
|
9544
|
-
[
|
|
9545
|
-
listType:
|
|
9585
|
+
["ORDER_LIST"]: {
|
|
9586
|
+
listType: "ORDER_LIST",
|
|
9546
9587
|
nestingLevel: orderListFactory([
|
|
9547
9588
|
{
|
|
9548
9589
|
glyphFormat: "%1.",
|
|
9549
|
-
glyphType:
|
|
9590
|
+
glyphType: 2
|
|
9550
9591
|
},
|
|
9551
9592
|
{
|
|
9552
9593
|
glyphFormat: "%2.",
|
|
9553
|
-
glyphType:
|
|
9594
|
+
glyphType: 5
|
|
9554
9595
|
},
|
|
9555
9596
|
{
|
|
9556
9597
|
glyphFormat: "%3.",
|
|
9557
|
-
glyphType:
|
|
9598
|
+
glyphType: 7
|
|
9558
9599
|
},
|
|
9559
9600
|
{
|
|
9560
9601
|
glyphFormat: "%4.",
|
|
9561
|
-
glyphType:
|
|
9602
|
+
glyphType: 2
|
|
9562
9603
|
},
|
|
9563
9604
|
{
|
|
9564
9605
|
glyphFormat: "%5.",
|
|
9565
|
-
glyphType:
|
|
9606
|
+
glyphType: 5
|
|
9566
9607
|
},
|
|
9567
9608
|
{
|
|
9568
9609
|
glyphFormat: "%6.",
|
|
9569
|
-
glyphType:
|
|
9610
|
+
glyphType: 7
|
|
9570
9611
|
},
|
|
9571
9612
|
{
|
|
9572
9613
|
glyphFormat: "%7.",
|
|
9573
|
-
glyphType:
|
|
9614
|
+
glyphType: 2
|
|
9574
9615
|
},
|
|
9575
9616
|
{
|
|
9576
9617
|
glyphFormat: "%8.",
|
|
9577
|
-
glyphType:
|
|
9618
|
+
glyphType: 5
|
|
9578
9619
|
},
|
|
9579
9620
|
{
|
|
9580
9621
|
glyphFormat: "%9.",
|
|
9581
|
-
glyphType:
|
|
9622
|
+
glyphType: 7
|
|
9582
9623
|
}
|
|
9583
9624
|
])
|
|
9584
9625
|
},
|
|
9585
|
-
[
|
|
9586
|
-
listType:
|
|
9626
|
+
["ORDER_LIST_1"]: {
|
|
9627
|
+
listType: "ORDER_LIST",
|
|
9587
9628
|
nestingLevel: orderListFactory([
|
|
9588
9629
|
{
|
|
9589
9630
|
glyphFormat: "%1)",
|
|
9590
|
-
glyphType:
|
|
9631
|
+
glyphType: 2
|
|
9591
9632
|
},
|
|
9592
9633
|
{
|
|
9593
9634
|
glyphFormat: "%2)",
|
|
9594
|
-
glyphType:
|
|
9635
|
+
glyphType: 5
|
|
9595
9636
|
},
|
|
9596
9637
|
{
|
|
9597
9638
|
glyphFormat: "%3)",
|
|
9598
|
-
glyphType:
|
|
9639
|
+
glyphType: 7
|
|
9599
9640
|
},
|
|
9600
9641
|
{
|
|
9601
9642
|
glyphFormat: "%4)",
|
|
9602
|
-
glyphType:
|
|
9643
|
+
glyphType: 2
|
|
9603
9644
|
},
|
|
9604
9645
|
{
|
|
9605
9646
|
glyphFormat: "%5)",
|
|
9606
|
-
glyphType:
|
|
9647
|
+
glyphType: 5
|
|
9607
9648
|
},
|
|
9608
9649
|
{
|
|
9609
9650
|
glyphFormat: "%6)",
|
|
9610
|
-
glyphType:
|
|
9651
|
+
glyphType: 7
|
|
9611
9652
|
},
|
|
9612
9653
|
{
|
|
9613
9654
|
glyphFormat: "%7)",
|
|
9614
|
-
glyphType:
|
|
9655
|
+
glyphType: 2
|
|
9615
9656
|
},
|
|
9616
9657
|
{
|
|
9617
9658
|
glyphFormat: "%8)",
|
|
9618
|
-
glyphType:
|
|
9659
|
+
glyphType: 5
|
|
9619
9660
|
},
|
|
9620
9661
|
{
|
|
9621
9662
|
glyphFormat: "%9)",
|
|
9622
|
-
glyphType:
|
|
9663
|
+
glyphType: 7
|
|
9623
9664
|
}
|
|
9624
9665
|
])
|
|
9625
9666
|
},
|
|
9626
|
-
[
|
|
9627
|
-
listType:
|
|
9667
|
+
["ORDER_LIST_2"]: {
|
|
9668
|
+
listType: "ORDER_LIST",
|
|
9628
9669
|
nestingLevel: orderListFactory([
|
|
9629
9670
|
"%1.",
|
|
9630
9671
|
"%1.%2.",
|
|
@@ -9635,164 +9676,164 @@ const PRESET_LIST_TYPE = {
|
|
|
9635
9676
|
"%1.%2.%3.%4.%5.%6.%7."
|
|
9636
9677
|
].map((format) => ({
|
|
9637
9678
|
glyphFormat: format,
|
|
9638
|
-
glyphType:
|
|
9679
|
+
glyphType: 2
|
|
9639
9680
|
})))
|
|
9640
9681
|
},
|
|
9641
|
-
[
|
|
9642
|
-
listType:
|
|
9682
|
+
["ORDER_LIST_3"]: {
|
|
9683
|
+
listType: "ORDER_LIST",
|
|
9643
9684
|
nestingLevel: orderListFactory([
|
|
9644
9685
|
{
|
|
9645
9686
|
glyphFormat: "%1.",
|
|
9646
|
-
glyphType:
|
|
9687
|
+
glyphType: 4
|
|
9647
9688
|
},
|
|
9648
9689
|
{
|
|
9649
9690
|
glyphFormat: "%2.",
|
|
9650
|
-
glyphType:
|
|
9691
|
+
glyphType: 5
|
|
9651
9692
|
},
|
|
9652
9693
|
{
|
|
9653
9694
|
glyphFormat: "%3.",
|
|
9654
|
-
glyphType:
|
|
9695
|
+
glyphType: 7
|
|
9655
9696
|
},
|
|
9656
9697
|
{
|
|
9657
9698
|
glyphFormat: "%4.",
|
|
9658
|
-
glyphType:
|
|
9699
|
+
glyphType: 4
|
|
9659
9700
|
},
|
|
9660
9701
|
{
|
|
9661
9702
|
glyphFormat: "%5.",
|
|
9662
|
-
glyphType:
|
|
9703
|
+
glyphType: 5
|
|
9663
9704
|
},
|
|
9664
9705
|
{
|
|
9665
9706
|
glyphFormat: "%6.",
|
|
9666
|
-
glyphType:
|
|
9707
|
+
glyphType: 7
|
|
9667
9708
|
},
|
|
9668
9709
|
{
|
|
9669
9710
|
glyphFormat: "%7.",
|
|
9670
|
-
glyphType:
|
|
9711
|
+
glyphType: 4
|
|
9671
9712
|
},
|
|
9672
9713
|
{
|
|
9673
9714
|
glyphFormat: "%8.",
|
|
9674
|
-
glyphType:
|
|
9715
|
+
glyphType: 5
|
|
9675
9716
|
},
|
|
9676
9717
|
{
|
|
9677
9718
|
glyphFormat: "%9.",
|
|
9678
|
-
glyphType:
|
|
9719
|
+
glyphType: 7
|
|
9679
9720
|
}
|
|
9680
9721
|
])
|
|
9681
9722
|
},
|
|
9682
|
-
[
|
|
9683
|
-
listType:
|
|
9723
|
+
["ORDER_LIST_4"]: {
|
|
9724
|
+
listType: "ORDER_LIST",
|
|
9684
9725
|
nestingLevel: orderListFactory([
|
|
9685
9726
|
{
|
|
9686
9727
|
glyphFormat: "%1.",
|
|
9687
|
-
glyphType:
|
|
9728
|
+
glyphType: 4
|
|
9688
9729
|
},
|
|
9689
9730
|
{
|
|
9690
9731
|
glyphFormat: "%2.",
|
|
9691
|
-
glyphType:
|
|
9732
|
+
glyphType: 2
|
|
9692
9733
|
},
|
|
9693
9734
|
{
|
|
9694
9735
|
glyphFormat: "%3.",
|
|
9695
|
-
glyphType:
|
|
9736
|
+
glyphType: 7
|
|
9696
9737
|
},
|
|
9697
9738
|
{
|
|
9698
9739
|
glyphFormat: "%4.",
|
|
9699
|
-
glyphType:
|
|
9740
|
+
glyphType: 4
|
|
9700
9741
|
},
|
|
9701
9742
|
{
|
|
9702
9743
|
glyphFormat: "%5.",
|
|
9703
|
-
glyphType:
|
|
9744
|
+
glyphType: 2
|
|
9704
9745
|
},
|
|
9705
9746
|
{
|
|
9706
9747
|
glyphFormat: "%6.",
|
|
9707
|
-
glyphType:
|
|
9748
|
+
glyphType: 7
|
|
9708
9749
|
},
|
|
9709
9750
|
{
|
|
9710
9751
|
glyphFormat: "%7.",
|
|
9711
|
-
glyphType:
|
|
9752
|
+
glyphType: 4
|
|
9712
9753
|
},
|
|
9713
9754
|
{
|
|
9714
9755
|
glyphFormat: "%8.",
|
|
9715
|
-
glyphType:
|
|
9756
|
+
glyphType: 2
|
|
9716
9757
|
},
|
|
9717
9758
|
{
|
|
9718
9759
|
glyphFormat: "%9.",
|
|
9719
|
-
glyphType:
|
|
9760
|
+
glyphType: 7
|
|
9720
9761
|
}
|
|
9721
9762
|
])
|
|
9722
9763
|
},
|
|
9723
|
-
[
|
|
9724
|
-
listType:
|
|
9764
|
+
["ORDER_LIST_5"]: {
|
|
9765
|
+
listType: "ORDER_LIST",
|
|
9725
9766
|
nestingLevel: orderListFactory([
|
|
9726
9767
|
{
|
|
9727
9768
|
glyphFormat: "%1.",
|
|
9728
|
-
glyphType:
|
|
9769
|
+
glyphType: 3
|
|
9729
9770
|
},
|
|
9730
9771
|
{
|
|
9731
9772
|
glyphFormat: "%2.",
|
|
9732
|
-
glyphType:
|
|
9773
|
+
glyphType: 5
|
|
9733
9774
|
},
|
|
9734
9775
|
{
|
|
9735
9776
|
glyphFormat: "%3.",
|
|
9736
|
-
glyphType:
|
|
9777
|
+
glyphType: 7
|
|
9737
9778
|
},
|
|
9738
9779
|
{
|
|
9739
9780
|
glyphFormat: "%4.",
|
|
9740
|
-
glyphType:
|
|
9781
|
+
glyphType: 3
|
|
9741
9782
|
},
|
|
9742
9783
|
{
|
|
9743
9784
|
glyphFormat: "%5.",
|
|
9744
|
-
glyphType:
|
|
9785
|
+
glyphType: 5
|
|
9745
9786
|
},
|
|
9746
9787
|
{
|
|
9747
9788
|
glyphFormat: "%6.",
|
|
9748
|
-
glyphType:
|
|
9789
|
+
glyphType: 7
|
|
9749
9790
|
},
|
|
9750
9791
|
{
|
|
9751
9792
|
glyphFormat: "%7.",
|
|
9752
|
-
glyphType:
|
|
9793
|
+
glyphType: 3
|
|
9753
9794
|
},
|
|
9754
9795
|
{
|
|
9755
9796
|
glyphFormat: "%8.",
|
|
9756
|
-
glyphType:
|
|
9797
|
+
glyphType: 5
|
|
9757
9798
|
},
|
|
9758
9799
|
{
|
|
9759
9800
|
glyphFormat: "%9.",
|
|
9760
|
-
glyphType:
|
|
9801
|
+
glyphType: 7
|
|
9761
9802
|
}
|
|
9762
9803
|
])
|
|
9763
9804
|
},
|
|
9764
|
-
[
|
|
9765
|
-
listType:
|
|
9805
|
+
["CHECK_LIST"]: {
|
|
9806
|
+
listType: "CHECK_LIST",
|
|
9766
9807
|
nestingLevel: checkListFactory("☐")
|
|
9767
9808
|
},
|
|
9768
|
-
[
|
|
9769
|
-
listType:
|
|
9770
|
-
nestingLevel: checkListFactory("☑", { st: { s:
|
|
9809
|
+
["CHECK_LIST_CHECKED"]: {
|
|
9810
|
+
listType: "CHECK_LIST_CHECKED",
|
|
9811
|
+
nestingLevel: checkListFactory("☑", { st: { s: 1 } })
|
|
9771
9812
|
}
|
|
9772
9813
|
};
|
|
9773
9814
|
const generateOrderList = (opt) => {
|
|
9774
9815
|
const { glyphFormat, glyphType } = opt;
|
|
9775
|
-
const data = Tools.deepClone(PRESET_LIST_TYPE[
|
|
9816
|
+
const data = Tools.deepClone(PRESET_LIST_TYPE["ORDER_LIST"]);
|
|
9776
9817
|
data.nestingLevel[0].glyphFormat = glyphFormat;
|
|
9777
9818
|
data.nestingLevel[0].glyphType = glyphType;
|
|
9778
9819
|
return data;
|
|
9779
9820
|
};
|
|
9780
9821
|
const QUICK_LIST_TYPE = {
|
|
9781
|
-
[
|
|
9782
|
-
[
|
|
9783
|
-
[
|
|
9784
|
-
[
|
|
9822
|
+
["ORDER_LIST_QUICK_2"]: generateOrderList(orderListSymbolMap["a)"]),
|
|
9823
|
+
["ORDER_LIST_QUICK_3"]: generateOrderList(orderListSymbolMap["a."]),
|
|
9824
|
+
["ORDER_LIST_QUICK_4"]: generateOrderList(orderListSymbolMap["i."]),
|
|
9825
|
+
["ORDER_LIST_QUICK_6"]: generateOrderList(orderListSymbolMap["I."])
|
|
9785
9826
|
};
|
|
9786
9827
|
Object.assign(PRESET_LIST_TYPE, QUICK_LIST_TYPE);
|
|
9787
9828
|
const QuickListTypeMap = {
|
|
9788
|
-
[
|
|
9789
|
-
[
|
|
9790
|
-
[
|
|
9791
|
-
[
|
|
9792
|
-
[
|
|
9793
|
-
[
|
|
9794
|
-
[
|
|
9795
|
-
[
|
|
9829
|
+
["1."]: "ORDER_LIST",
|
|
9830
|
+
["a)"]: "ORDER_LIST_QUICK_2",
|
|
9831
|
+
["a."]: "ORDER_LIST_QUICK_3",
|
|
9832
|
+
["i."]: "ORDER_LIST_QUICK_4",
|
|
9833
|
+
["A."]: "ORDER_LIST_3",
|
|
9834
|
+
["I."]: "ORDER_LIST_QUICK_6",
|
|
9835
|
+
["01."]: "ORDER_LIST_5",
|
|
9836
|
+
["*"]: "BULLET_LIST"
|
|
9796
9837
|
};
|
|
9797
9838
|
|
|
9798
9839
|
//#endregion
|
|
@@ -9814,7 +9855,7 @@ function updateTextRuns(body, updateBody, textLength, currentIndex, coverType) {
|
|
|
9814
9855
|
const { textRuns: updateTextRuns } = updateBody;
|
|
9815
9856
|
if (textRuns == null || updateTextRuns == null) return;
|
|
9816
9857
|
const removeTextRuns = deleteTextRuns(body, textLength, currentIndex);
|
|
9817
|
-
if (coverType !==
|
|
9858
|
+
if (coverType !== 1) updateBody.textRuns = coverTextRuns(updateTextRuns, removeTextRuns, coverType);
|
|
9818
9859
|
insertTextRuns(body, updateBody, textLength, currentIndex);
|
|
9819
9860
|
return removeTextRuns;
|
|
9820
9861
|
}
|
|
@@ -9840,7 +9881,7 @@ function coverTextRuns(updateDataTextRuns, originTextRuns, coverType) {
|
|
|
9840
9881
|
const { st: updateSt, ed: updateEd, ts: updateStyle } = updateDataTextRuns[updateIndex];
|
|
9841
9882
|
const { st: removeSt, ed: removeEd, ts: originStyle, sId } = originTextRuns[removeIndex];
|
|
9842
9883
|
let newTs;
|
|
9843
|
-
if (coverType ===
|
|
9884
|
+
if (coverType === 0) newTs = {
|
|
9844
9885
|
...originStyle,
|
|
9845
9886
|
...updateStyle
|
|
9846
9887
|
};
|
|
@@ -9896,7 +9937,7 @@ function updateParagraphs(body, updateBody, textLength, currentIndex, coverType)
|
|
|
9896
9937
|
const { paragraphs: updateDataParagraphs } = updateBody;
|
|
9897
9938
|
if (paragraphs == null || updateDataParagraphs == null) return;
|
|
9898
9939
|
const removeParagraphs = deleteParagraphs(body, textLength, currentIndex);
|
|
9899
|
-
if (coverType !==
|
|
9940
|
+
if (coverType !== 1) {
|
|
9900
9941
|
const newUpdateParagraphs = [];
|
|
9901
9942
|
for (const updateParagraph of updateDataParagraphs) {
|
|
9902
9943
|
const { startIndex: updateStartIndex, paragraphStyle: updateParagraphStyle, bullet: updateBullet } = updateParagraph;
|
|
@@ -9905,14 +9946,14 @@ function updateParagraphs(body, updateBody, textLength, currentIndex, coverType)
|
|
|
9905
9946
|
const { startIndex: removeStartIndex, paragraphStyle: removeParagraphStyle, bullet: removeBullet } = removeParagraph;
|
|
9906
9947
|
let newParagraphStyle;
|
|
9907
9948
|
let newBullet;
|
|
9908
|
-
if (coverType ===
|
|
9949
|
+
if (coverType === 0) {
|
|
9909
9950
|
newParagraphStyle = {
|
|
9910
9951
|
...removeParagraphStyle,
|
|
9911
9952
|
...updateParagraphStyle
|
|
9912
9953
|
};
|
|
9913
9954
|
newBullet = {
|
|
9914
9955
|
listId: "",
|
|
9915
|
-
listType:
|
|
9956
|
+
listType: "BULLET_LIST",
|
|
9916
9957
|
nestingLevel: 0,
|
|
9917
9958
|
textStyle: {},
|
|
9918
9959
|
...removeBullet,
|
|
@@ -9925,7 +9966,7 @@ function updateParagraphs(body, updateBody, textLength, currentIndex, coverType)
|
|
|
9925
9966
|
};
|
|
9926
9967
|
newBullet = {
|
|
9927
9968
|
listId: "",
|
|
9928
|
-
listType:
|
|
9969
|
+
listType: "BULLET_LIST",
|
|
9929
9970
|
nestingLevel: 0,
|
|
9930
9971
|
textStyle: {},
|
|
9931
9972
|
...updateBullet,
|
|
@@ -9954,7 +9995,7 @@ function updateSectionBreaks(body, updateBody, textLength, currentIndex, coverTy
|
|
|
9954
9995
|
const { sectionBreaks: updateDataSectionBreaks } = updateBody;
|
|
9955
9996
|
if (sectionBreaks == null || updateDataSectionBreaks == null) return;
|
|
9956
9997
|
const removeSectionBreaks = deleteSectionBreaks(body, textLength, currentIndex);
|
|
9957
|
-
if (coverType !==
|
|
9998
|
+
if (coverType !== 1) {
|
|
9958
9999
|
const newUpdateSectionBreaks = [];
|
|
9959
10000
|
for (const updateSectionBreak of updateDataSectionBreaks) {
|
|
9960
10001
|
const { startIndex: updateStartIndex } = updateSectionBreak;
|
|
@@ -9962,7 +10003,7 @@ function updateSectionBreaks(body, updateBody, textLength, currentIndex, coverTy
|
|
|
9962
10003
|
for (const removeSectionBreak of removeSectionBreaks) {
|
|
9963
10004
|
const { startIndex: removeStartIndex } = removeSectionBreak;
|
|
9964
10005
|
if (updateStartIndex === removeStartIndex) {
|
|
9965
|
-
if (coverType ===
|
|
10006
|
+
if (coverType === 0) splitUpdateSectionBreaks.push({
|
|
9966
10007
|
...removeSectionBreak,
|
|
9967
10008
|
...updateSectionBreak
|
|
9968
10009
|
});
|
|
@@ -9986,7 +10027,7 @@ function updateCustomBlocks(body, updateBody, textLength, currentIndex, coverTyp
|
|
|
9986
10027
|
const { customBlocks: updateDataCustomBlocks } = updateBody;
|
|
9987
10028
|
if (customBlocks == null || updateDataCustomBlocks == null) return;
|
|
9988
10029
|
const removeCustomBlocks = deleteCustomBlocks(body, textLength, currentIndex);
|
|
9989
|
-
if (coverType !==
|
|
10030
|
+
if (coverType !== 1) {
|
|
9990
10031
|
const newUpdateCustomBlocks = [];
|
|
9991
10032
|
for (const updateCustomBlock of updateDataCustomBlocks) {
|
|
9992
10033
|
const { startIndex: updateStartIndex } = updateCustomBlock;
|
|
@@ -9994,7 +10035,7 @@ function updateCustomBlocks(body, updateBody, textLength, currentIndex, coverTyp
|
|
|
9994
10035
|
for (const removeCustomBlock of removeCustomBlocks) {
|
|
9995
10036
|
const { startIndex: removeStartIndex } = removeCustomBlock;
|
|
9996
10037
|
if (updateStartIndex === removeStartIndex) {
|
|
9997
|
-
if (coverType ===
|
|
10038
|
+
if (coverType === 0) splitUpdateCustomBlocks.push({
|
|
9998
10039
|
...removeCustomBlock,
|
|
9999
10040
|
...updateCustomBlock
|
|
10000
10041
|
});
|
|
@@ -10019,7 +10060,7 @@ function updateTables(body, updateBody, textLength, currentIndex, coverType) {
|
|
|
10019
10060
|
const { tables: updateDataTables } = updateBody;
|
|
10020
10061
|
if (tables == null || updateDataTables == null) return;
|
|
10021
10062
|
const removeTables = deleteTables(body, textLength, currentIndex);
|
|
10022
|
-
if (coverType !==
|
|
10063
|
+
if (coverType !== 1) {
|
|
10023
10064
|
const newUpdateTables = [];
|
|
10024
10065
|
for (const updateTable of updateDataTables) {
|
|
10025
10066
|
const { startIndex: updateStartIndex, endIndex: updateEndIndex } = updateTable;
|
|
@@ -10027,7 +10068,7 @@ function updateTables(body, updateBody, textLength, currentIndex, coverType) {
|
|
|
10027
10068
|
for (const removeTable of removeTables) {
|
|
10028
10069
|
const { startIndex: removeStartIndex, endIndex: removeEndIndex } = removeTable;
|
|
10029
10070
|
if (removeStartIndex >= updateStartIndex && removeEndIndex <= updateEndIndex) {
|
|
10030
|
-
if (coverType ===
|
|
10071
|
+
if (coverType === 0) splitUpdateTables.push({
|
|
10031
10072
|
...removeTable,
|
|
10032
10073
|
...updateTable
|
|
10033
10074
|
});
|
|
@@ -10080,7 +10121,7 @@ function updateCustomDecorations(body, updateBody, textLength, currentIndex, cov
|
|
|
10080
10121
|
const removeCustomDecorations = [];
|
|
10081
10122
|
const { customDecorations } = body;
|
|
10082
10123
|
const { customDecorations: updateDataCustomDecorations = [] } = updateBody;
|
|
10083
|
-
if (coverType ===
|
|
10124
|
+
if (coverType === 1) {
|
|
10084
10125
|
for (let index = 0; index < customDecorations.length; index++) {
|
|
10085
10126
|
const customDecoration = customDecorations[index];
|
|
10086
10127
|
const { startIndex, endIndex } = customDecoration;
|
|
@@ -10096,7 +10137,7 @@ function updateCustomDecorations(body, updateBody, textLength, currentIndex, cov
|
|
|
10096
10137
|
});
|
|
10097
10138
|
} else for (const updateCustomDecoration of updateDataCustomDecorations) {
|
|
10098
10139
|
const { id } = updateCustomDecoration;
|
|
10099
|
-
if (updateCustomDecoration.type ===
|
|
10140
|
+
if (updateCustomDecoration.type === 9999) {
|
|
10100
10141
|
const oldCustomDecorations = customDecorations.filter((d) => d.id === id);
|
|
10101
10142
|
if (oldCustomDecorations.length) removeCustomDecorations.push(...oldCustomDecorations);
|
|
10102
10143
|
} else customDecorations.push({
|
|
@@ -10207,14 +10248,14 @@ function getCustomBlockSlice(body, startOffset, endOffset) {
|
|
|
10207
10248
|
startIndex: b.startIndex - startOffset
|
|
10208
10249
|
}));
|
|
10209
10250
|
}
|
|
10210
|
-
function getBodySlice(body, startOffset, endOffset, returnEmptyArray = true, type =
|
|
10251
|
+
function getBodySlice(body, startOffset, endOffset, returnEmptyArray = true, type = 1) {
|
|
10211
10252
|
const { dataStream } = body;
|
|
10212
10253
|
const docBody = { dataStream: dataStream.slice(startOffset, endOffset) };
|
|
10213
10254
|
docBody.textRuns = getTextRunSlice(body, startOffset, endOffset, returnEmptyArray);
|
|
10214
10255
|
const newTables = getTableSlice(body, startOffset, endOffset);
|
|
10215
10256
|
if (newTables.length) docBody.tables = newTables;
|
|
10216
10257
|
docBody.paragraphs = getParagraphsSlice(body, startOffset, endOffset);
|
|
10217
|
-
if (type ===
|
|
10258
|
+
if (type === 1) {
|
|
10218
10259
|
const customDecorations = getCustomDecorationSlice(body, startOffset, endOffset);
|
|
10219
10260
|
if (customDecorations) docBody.customDecorations = customDecorations;
|
|
10220
10261
|
else if (returnEmptyArray) docBody.customDecorations = [];
|
|
@@ -10308,7 +10349,7 @@ function composeCustomRanges(updateDataCustomRanges, originCustomRanges, coverTy
|
|
|
10308
10349
|
if (updateDataCustomRanges == null || originCustomRanges == null) return updateDataCustomRanges !== null && updateDataCustomRanges !== void 0 ? updateDataCustomRanges : originCustomRanges;
|
|
10309
10350
|
if (originCustomRanges.length === 0 || updateDataCustomRanges.length === 0) return updateDataCustomRanges;
|
|
10310
10351
|
if (originCustomRanges.length > 1 || updateDataCustomRanges.length > 1) throw new Error("Cannot cover multiple customRanges");
|
|
10311
|
-
if (coverType ===
|
|
10352
|
+
if (coverType === 1) return [{ ...updateDataCustomRanges[0] }];
|
|
10312
10353
|
else return [{
|
|
10313
10354
|
...originCustomRanges[0],
|
|
10314
10355
|
...updateDataCustomRanges[0]
|
|
@@ -10316,14 +10357,14 @@ function composeCustomRanges(updateDataCustomRanges, originCustomRanges, coverTy
|
|
|
10316
10357
|
}
|
|
10317
10358
|
function composeCustomDecorations(updateDataCustomDecorations, originCustomDecorations, coverType) {
|
|
10318
10359
|
if (originCustomDecorations.length === 0 || updateDataCustomDecorations.length === 0) return updateDataCustomDecorations;
|
|
10319
|
-
if (coverType ===
|
|
10360
|
+
if (coverType === 1) return updateDataCustomDecorations;
|
|
10320
10361
|
else return [...updateDataCustomDecorations, ...originCustomDecorations.filter((originCustomDecoration) => {
|
|
10321
10362
|
return !updateDataCustomDecorations.some((updateDataCustomDecoration) => {
|
|
10322
10363
|
return originCustomDecoration.id === updateDataCustomDecoration.id;
|
|
10323
10364
|
});
|
|
10324
10365
|
})];
|
|
10325
10366
|
}
|
|
10326
|
-
function composeBody(thisBody, otherBody, coverType =
|
|
10367
|
+
function composeBody(thisBody, otherBody, coverType = 0) {
|
|
10327
10368
|
if (otherBody.dataStream !== "") throw new Error("Cannot compose other body with non-empty dataStream");
|
|
10328
10369
|
const retBody = { dataStream: thisBody.dataStream };
|
|
10329
10370
|
const { textRuns: thisTextRuns, paragraphs: thisParagraphs = [], customRanges: thisCustomRanges, customDecorations: thisCustomDecorations = [] } = thisBody;
|
|
@@ -10396,7 +10437,7 @@ var ActionIterator = class {
|
|
|
10396
10437
|
* 2) Slice the body and slice the range [offset, length]
|
|
10397
10438
|
* 3) Reassemble the returned action
|
|
10398
10439
|
*/
|
|
10399
|
-
if (nextAction.t ===
|
|
10440
|
+
if (nextAction.t === "d" || nextAction.t === "r" && nextAction.body == null) return Tools.deepClone({
|
|
10400
10441
|
...nextAction,
|
|
10401
10442
|
len: length
|
|
10402
10443
|
});
|
|
@@ -10406,7 +10447,7 @@ var ActionIterator = class {
|
|
|
10406
10447
|
body: getBodySlice(nextAction.body, offset, offset + length, false)
|
|
10407
10448
|
});
|
|
10408
10449
|
} else return {
|
|
10409
|
-
t:
|
|
10450
|
+
t: "r",
|
|
10410
10451
|
len: Number.POSITIVE_INFINITY
|
|
10411
10452
|
};
|
|
10412
10453
|
}
|
|
@@ -10420,7 +10461,7 @@ var ActionIterator = class {
|
|
|
10420
10461
|
peekType() {
|
|
10421
10462
|
const action = this._actions[this._index];
|
|
10422
10463
|
if (action) return action.t;
|
|
10423
|
-
return
|
|
10464
|
+
return "r";
|
|
10424
10465
|
}
|
|
10425
10466
|
rest() {
|
|
10426
10467
|
if (!this.hasNext()) return [];
|
|
@@ -10482,7 +10523,7 @@ function updateAttributeByInsert(body, insertBody, textLength, currentIndex) {
|
|
|
10482
10523
|
|
|
10483
10524
|
//#endregion
|
|
10484
10525
|
//#region src/docs/data-model/text-x/apply.ts
|
|
10485
|
-
function updateApply(doc, updateBody, textLength, currentIndex, coverType =
|
|
10526
|
+
function updateApply(doc, updateBody, textLength, currentIndex, coverType = 0) {
|
|
10486
10527
|
return updateAttribute(doc, updateBody, textLength, currentIndex, coverType);
|
|
10487
10528
|
}
|
|
10488
10529
|
function deleteApply(doc, textLength, currentIndex) {
|
|
@@ -10499,19 +10540,19 @@ function textXApply(doc, actions) {
|
|
|
10499
10540
|
actions.forEach((action) => {
|
|
10500
10541
|
const clonedAction = Tools.deepClone(action);
|
|
10501
10542
|
switch (clonedAction.t) {
|
|
10502
|
-
case
|
|
10543
|
+
case "r": {
|
|
10503
10544
|
const { coverType, body, len } = clonedAction;
|
|
10504
10545
|
if (body != null) updateApply(doc, body, len, memoryCursor.cursor, coverType);
|
|
10505
10546
|
memoryCursor.moveCursor(len);
|
|
10506
10547
|
break;
|
|
10507
10548
|
}
|
|
10508
|
-
case
|
|
10549
|
+
case "i": {
|
|
10509
10550
|
const { body, len } = clonedAction;
|
|
10510
10551
|
insertApply(doc, body, len, memoryCursor.cursor);
|
|
10511
10552
|
memoryCursor.moveCursor(len);
|
|
10512
10553
|
break;
|
|
10513
10554
|
}
|
|
10514
|
-
case
|
|
10555
|
+
case "d": {
|
|
10515
10556
|
const { len } = clonedAction;
|
|
10516
10557
|
deleteApply(doc, len, memoryCursor.cursor);
|
|
10517
10558
|
break;
|
|
@@ -10524,11 +10565,6 @@ function textXApply(doc, actions) {
|
|
|
10524
10565
|
|
|
10525
10566
|
//#endregion
|
|
10526
10567
|
//#region src/docs/data-model/text-x/transform-utils.ts
|
|
10527
|
-
var TextXTransformType = /* @__PURE__ */ function(TextXTransformType) {
|
|
10528
|
-
TextXTransformType[TextXTransformType["COVER"] = 0] = "COVER";
|
|
10529
|
-
TextXTransformType[TextXTransformType["COVER_ONLY_NOT_EXISTED"] = 1] = "COVER_ONLY_NOT_EXISTED";
|
|
10530
|
-
return TextXTransformType;
|
|
10531
|
-
}(TextXTransformType || {});
|
|
10532
10568
|
function transformTextRuns(originTextRuns, targetTextRuns, originCoverType, targetCoverType, transformType) {
|
|
10533
10569
|
if (originTextRuns == null || targetTextRuns == null) return targetTextRuns;
|
|
10534
10570
|
if (originTextRuns.length === 0 || targetTextRuns.length === 0) return [];
|
|
@@ -10552,18 +10588,18 @@ function transformTextRuns(originTextRuns, targetTextRuns, originCoverType, targ
|
|
|
10552
10588
|
const { st: updateSt, ed: updateEd, ts: targetStyle } = targetTextRuns[updateIndex];
|
|
10553
10589
|
const { st: removeSt, ed: removeEd, ts: originStyle, sId } = originTextRuns[removeIndex];
|
|
10554
10590
|
let newTs = {};
|
|
10555
|
-
if (transformType ===
|
|
10591
|
+
if (transformType === 0) {
|
|
10556
10592
|
newTs = { ...targetStyle };
|
|
10557
|
-
if (originCoverType ===
|
|
10593
|
+
if (originCoverType === 0 && targetCoverType === 1 && originStyle) newTs = Object.assign({}, originStyle, newTs);
|
|
10558
10594
|
} else {
|
|
10559
10595
|
newTs = { ...targetStyle };
|
|
10560
|
-
if (originCoverType ===
|
|
10561
|
-
if (targetCoverType ===
|
|
10596
|
+
if (originCoverType === 1) {
|
|
10597
|
+
if (targetCoverType === 1) newTs = { ...originStyle };
|
|
10562
10598
|
else if (targetStyle && originStyle) {
|
|
10563
10599
|
const keys = Object.keys(targetStyle);
|
|
10564
10600
|
for (const key of keys) if (originStyle[key]) delete newTs[key];
|
|
10565
10601
|
}
|
|
10566
|
-
} else if (targetCoverType ===
|
|
10602
|
+
} else if (targetCoverType === 1) {
|
|
10567
10603
|
if (originStyle) {
|
|
10568
10604
|
const keys = Object.keys(originStyle);
|
|
10569
10605
|
for (const key of keys) if (originStyle[key] !== void 0) newTs[key] = originStyle[key];
|
|
@@ -10625,14 +10661,14 @@ function transformCustomRanges(originCustomRanges, targetCustomRanges, originCov
|
|
|
10625
10661
|
if (originCustomRanges.length > 1 || targetCustomRanges.length > 1) throw new Error("CustomRanges is only supported transform for length one now.");
|
|
10626
10662
|
const originCustomRange = originCustomRanges[0];
|
|
10627
10663
|
const targetCustomRange = targetCustomRanges[0];
|
|
10628
|
-
if (originCoverType ===
|
|
10629
|
-
else if (targetCoverType ===
|
|
10664
|
+
if (originCoverType === 1) return transformType === 1 ? [Tools.deepClone(originCustomRange)] : [Tools.deepClone(targetCustomRange)];
|
|
10665
|
+
else if (targetCoverType === 1) {
|
|
10630
10666
|
const customRange = Tools.deepClone(targetCustomRange);
|
|
10631
|
-
if (transformType ===
|
|
10667
|
+
if (transformType === 1) Object.assign(customRange, Tools.deepClone(originCustomRange));
|
|
10632
10668
|
return [customRange];
|
|
10633
10669
|
} else {
|
|
10634
10670
|
const customRange = Tools.deepClone(targetCustomRange);
|
|
10635
|
-
if (transformType ===
|
|
10671
|
+
if (transformType === 1) Object.assign(customRange, Tools.deepClone(originCustomRange));
|
|
10636
10672
|
return [customRange];
|
|
10637
10673
|
}
|
|
10638
10674
|
}
|
|
@@ -10641,32 +10677,32 @@ function transformParagraph(originParagraph, targetParagraph, originCoverType, t
|
|
|
10641
10677
|
if (targetParagraph.paragraphStyle) {
|
|
10642
10678
|
paragraph.paragraphStyle = Tools.deepClone(targetParagraph.paragraphStyle);
|
|
10643
10679
|
if (originParagraph.paragraphStyle) {
|
|
10644
|
-
if (originCoverType ===
|
|
10645
|
-
if (transformType ===
|
|
10646
|
-
} else if (transformType ===
|
|
10680
|
+
if (originCoverType === 1) if (targetCoverType === 1) {
|
|
10681
|
+
if (transformType === 1) paragraph.paragraphStyle = { ...originParagraph.paragraphStyle };
|
|
10682
|
+
} else if (transformType === 1) {
|
|
10647
10683
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10648
10684
|
for (const key of keys) if (originParagraph.paragraphStyle[key] !== void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
10649
10685
|
} else {
|
|
10650
10686
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10651
10687
|
for (const key of keys) if (paragraph.paragraphStyle[key] === void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
10652
10688
|
}
|
|
10653
|
-
else if (targetCoverType ===
|
|
10689
|
+
else if (targetCoverType === 1) if (transformType === 1) {
|
|
10654
10690
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10655
10691
|
for (const key of keys) if (originParagraph.paragraphStyle[key] !== void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
10656
10692
|
} else {
|
|
10657
10693
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10658
10694
|
for (const key of keys) if (paragraph.paragraphStyle[key] === void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
10659
10695
|
}
|
|
10660
|
-
else if (transformType ===
|
|
10696
|
+
else if (transformType === 1) {
|
|
10661
10697
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
10662
10698
|
for (const key of keys) if (paragraph.paragraphStyle[key]) delete paragraph.paragraphStyle[key];
|
|
10663
10699
|
}
|
|
10664
10700
|
}
|
|
10665
10701
|
}
|
|
10666
|
-
if (originCoverType ===
|
|
10702
|
+
if (originCoverType === 1 && targetCoverType === 1) paragraph.bullet = transformType === 1 ? Tools.deepClone(originParagraph.bullet) : Tools.deepClone(targetParagraph.bullet);
|
|
10667
10703
|
else if (originParagraph.bullet === void 0) paragraph.bullet = Tools.deepClone(targetParagraph.bullet);
|
|
10668
|
-
else if (originCoverType ===
|
|
10669
|
-
else if (transformType ===
|
|
10704
|
+
else if (originCoverType === 1 || targetCoverType === 1) paragraph.bullet = transformType === 0 && targetParagraph.bullet ? Tools.deepClone(targetParagraph.bullet) : Tools.deepClone(originParagraph.bullet);
|
|
10705
|
+
else if (transformType === 0 && targetParagraph.bullet !== void 0) paragraph.bullet = Tools.deepClone(targetParagraph.bullet);
|
|
10670
10706
|
return paragraph;
|
|
10671
10707
|
}
|
|
10672
10708
|
function transformCustomDecorations(originCustomDecorations, targetCustomDecorations) {
|
|
@@ -10677,11 +10713,11 @@ function transformCustomDecorations(originCustomDecorations, targetCustomDecorat
|
|
|
10677
10713
|
const { id, type } = decoration;
|
|
10678
10714
|
let pushed = false;
|
|
10679
10715
|
for (const originDecoration of originCustomDecorations) if (originDecoration.id === id) {
|
|
10680
|
-
if (originDecoration.type ===
|
|
10716
|
+
if (originDecoration.type === 9999 || type === 9999) {
|
|
10681
10717
|
pushed = true;
|
|
10682
10718
|
customDecorations.push({
|
|
10683
10719
|
...decoration,
|
|
10684
|
-
type:
|
|
10720
|
+
type: 9999
|
|
10685
10721
|
});
|
|
10686
10722
|
}
|
|
10687
10723
|
break;
|
|
@@ -10691,16 +10727,16 @@ function transformCustomDecorations(originCustomDecorations, targetCustomDecorat
|
|
|
10691
10727
|
return customDecorations;
|
|
10692
10728
|
}
|
|
10693
10729
|
function transformBody(thisAction, otherAction, priority = false) {
|
|
10694
|
-
const { body: thisBody, coverType: thisCoverType =
|
|
10695
|
-
const { body: otherBody, coverType: otherCoverType =
|
|
10730
|
+
const { body: thisBody, coverType: thisCoverType = 0 } = thisAction;
|
|
10731
|
+
const { body: otherBody, coverType: otherCoverType = 0 } = otherAction;
|
|
10696
10732
|
if (thisBody == null || thisBody.dataStream !== "" || otherBody == null || otherBody.dataStream !== "") throw new Error("Data stream is not supported in retain transform.");
|
|
10697
10733
|
const retBody = { dataStream: "" };
|
|
10698
10734
|
const coverType = otherCoverType;
|
|
10699
10735
|
const { textRuns: thisTextRuns, paragraphs: thisParagraphs = [], customRanges: thisCustomRanges, customDecorations: thisCustomDecorations } = thisBody;
|
|
10700
10736
|
const { textRuns: otherTextRuns, paragraphs: otherParagraphs = [], customRanges: otherCustomRanges, customDecorations: otherCustomDecorations } = otherBody;
|
|
10701
|
-
const textRuns = transformTextRuns(thisTextRuns, otherTextRuns, thisCoverType, otherCoverType, priority ?
|
|
10737
|
+
const textRuns = transformTextRuns(thisTextRuns, otherTextRuns, thisCoverType, otherCoverType, priority ? 1 : 0);
|
|
10702
10738
|
if (textRuns) retBody.textRuns = textRuns;
|
|
10703
|
-
const customRanges = transformCustomRanges(thisCustomRanges, otherCustomRanges, thisCoverType, otherCoverType, priority ?
|
|
10739
|
+
const customRanges = transformCustomRanges(thisCustomRanges, otherCustomRanges, thisCoverType, otherCoverType, priority ? 1 : 0);
|
|
10704
10740
|
if (customRanges) retBody.customRanges = customRanges;
|
|
10705
10741
|
const customDecorations = transformCustomDecorations(thisCustomDecorations, otherCustomDecorations);
|
|
10706
10742
|
if (customDecorations) retBody.customDecorations = customDecorations;
|
|
@@ -10714,8 +10750,8 @@ function transformBody(thisAction, otherAction, priority = false) {
|
|
|
10714
10750
|
const { startIndex: otherStart } = otherParagraph;
|
|
10715
10751
|
if (thisStart === otherStart) {
|
|
10716
10752
|
let paragraph = { startIndex: thisStart };
|
|
10717
|
-
if (priority) paragraph = transformParagraph(thisParagraph, otherParagraph, thisCoverType, otherCoverType,
|
|
10718
|
-
else paragraph = transformParagraph(thisParagraph, otherParagraph, thisCoverType, otherCoverType,
|
|
10753
|
+
if (priority) paragraph = transformParagraph(thisParagraph, otherParagraph, thisCoverType, otherCoverType, 1);
|
|
10754
|
+
else paragraph = transformParagraph(thisParagraph, otherParagraph, thisCoverType, otherCoverType, 0);
|
|
10719
10755
|
paragraphs.push(paragraph);
|
|
10720
10756
|
thisIndex++;
|
|
10721
10757
|
otherIndex++;
|
|
@@ -10749,29 +10785,29 @@ var TextX = class TextX {
|
|
|
10749
10785
|
const thisIter = new ActionIterator(thisActions);
|
|
10750
10786
|
const otherIter = new ActionIterator(otherActions);
|
|
10751
10787
|
const textX = new TextX();
|
|
10752
|
-
while (thisIter.hasNext() || otherIter.hasNext()) if (otherIter.peekType() ===
|
|
10753
|
-
else if (thisIter.peekType() ===
|
|
10788
|
+
while (thisIter.hasNext() || otherIter.hasNext()) if (otherIter.peekType() === "i") textX.push(otherIter.next());
|
|
10789
|
+
else if (thisIter.peekType() === "d") textX.push(thisIter.next());
|
|
10754
10790
|
else {
|
|
10755
10791
|
const length = Math.min(thisIter.peekLength(), otherIter.peekLength());
|
|
10756
10792
|
const thisAction = thisIter.next(length);
|
|
10757
10793
|
const otherAction = otherIter.next(length);
|
|
10758
|
-
if (thisAction.t ===
|
|
10794
|
+
if (thisAction.t === "i" && otherAction.t === "r") if (otherAction.body == null) textX.push(thisAction);
|
|
10759
10795
|
else textX.push({
|
|
10760
10796
|
...thisAction,
|
|
10761
10797
|
body: composeBody(thisAction.body, otherAction.body, otherAction.coverType)
|
|
10762
10798
|
});
|
|
10763
|
-
else if (thisAction.t ===
|
|
10799
|
+
else if (thisAction.t === "r" && otherAction.t === "r") if (thisAction.body == null && otherAction.body == null) textX.push(thisAction.len !== Number.POSITIVE_INFINITY ? thisAction : otherAction);
|
|
10764
10800
|
else if (thisAction.body && otherAction.body) {
|
|
10765
|
-
const coverType = thisAction.coverType ===
|
|
10801
|
+
const coverType = thisAction.coverType === 1 || otherAction.coverType === 1 ? 1 : 0;
|
|
10766
10802
|
textX.push({
|
|
10767
10803
|
...thisAction,
|
|
10768
|
-
t:
|
|
10804
|
+
t: "r",
|
|
10769
10805
|
coverType,
|
|
10770
10806
|
body: composeBody(thisAction.body, otherAction.body, otherAction.coverType)
|
|
10771
10807
|
});
|
|
10772
10808
|
} else textX.push(thisAction.body ? thisAction : otherAction);
|
|
10773
|
-
else if (thisAction.t ===
|
|
10774
|
-
else if (thisAction.t ===
|
|
10809
|
+
else if (thisAction.t === "r" && otherAction.t === "d") textX.push(otherAction);
|
|
10810
|
+
else if (thisAction.t === "i" && otherAction.t === "d") {}
|
|
10775
10811
|
}
|
|
10776
10812
|
textX.trimEndUselessRetainAction();
|
|
10777
10813
|
return textX.serialize();
|
|
@@ -10807,16 +10843,16 @@ var TextX = class TextX {
|
|
|
10807
10843
|
const thisIter = new ActionIterator(thisActions);
|
|
10808
10844
|
const otherIter = new ActionIterator(otherActions);
|
|
10809
10845
|
const textX = new TextX();
|
|
10810
|
-
while (thisIter.hasNext() || otherIter.hasNext()) if (thisIter.peekType() ===
|
|
10846
|
+
while (thisIter.hasNext() || otherIter.hasNext()) if (thisIter.peekType() === "i" && (priority === "left" || otherIter.peekType() !== "i")) {
|
|
10811
10847
|
const thisAction = thisIter.next();
|
|
10812
10848
|
textX.retain(thisAction.len);
|
|
10813
|
-
} else if (otherIter.peekType() ===
|
|
10849
|
+
} else if (otherIter.peekType() === "i") textX.push(otherIter.next());
|
|
10814
10850
|
else {
|
|
10815
10851
|
const length = Math.min(thisIter.peekLength(), otherIter.peekLength());
|
|
10816
10852
|
const thisAction = thisIter.next(length);
|
|
10817
10853
|
const otherAction = otherIter.next(length);
|
|
10818
|
-
if (thisAction.t ===
|
|
10819
|
-
if (otherAction.t ===
|
|
10854
|
+
if (thisAction.t === "d") continue;
|
|
10855
|
+
if (otherAction.t === "d") {
|
|
10820
10856
|
textX.push(otherAction);
|
|
10821
10857
|
continue;
|
|
10822
10858
|
}
|
|
@@ -10825,7 +10861,7 @@ var TextX = class TextX {
|
|
|
10825
10861
|
const { coverType, body } = transformBody(thisAction, otherAction, priority === "left");
|
|
10826
10862
|
textX.push({
|
|
10827
10863
|
...otherAction,
|
|
10828
|
-
t:
|
|
10864
|
+
t: "r",
|
|
10829
10865
|
coverType,
|
|
10830
10866
|
body
|
|
10831
10867
|
});
|
|
@@ -10845,10 +10881,10 @@ var TextX = class TextX {
|
|
|
10845
10881
|
const length = thisIter.peekLength();
|
|
10846
10882
|
const nextType = thisIter.peekType();
|
|
10847
10883
|
thisIter.next();
|
|
10848
|
-
if (nextType ===
|
|
10884
|
+
if (nextType === "d") {
|
|
10849
10885
|
index -= Math.min(length, index - offset);
|
|
10850
10886
|
continue;
|
|
10851
|
-
} else if (nextType ===
|
|
10887
|
+
} else if (nextType === "i" && (offset < index || !priority)) index += length;
|
|
10852
10888
|
offset += length;
|
|
10853
10889
|
}
|
|
10854
10890
|
return index;
|
|
@@ -10858,26 +10894,26 @@ var TextX = class TextX {
|
|
|
10858
10894
|
}
|
|
10859
10895
|
static invert(actions) {
|
|
10860
10896
|
const invertedActions = [];
|
|
10861
|
-
for (const action of actions) if (action.t ===
|
|
10862
|
-
t:
|
|
10897
|
+
for (const action of actions) if (action.t === "i") invertedActions.push({
|
|
10898
|
+
t: "d",
|
|
10863
10899
|
len: action.len,
|
|
10864
10900
|
body: action.body
|
|
10865
10901
|
});
|
|
10866
|
-
else if (action.t ===
|
|
10902
|
+
else if (action.t === "d") {
|
|
10867
10903
|
if (action.body == null) throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");
|
|
10868
10904
|
invertedActions.push({
|
|
10869
|
-
t:
|
|
10905
|
+
t: "i",
|
|
10870
10906
|
body: action.body,
|
|
10871
10907
|
len: action.len
|
|
10872
10908
|
});
|
|
10873
10909
|
} else if (action.body != null) {
|
|
10874
10910
|
if (action.oldBody == null) throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");
|
|
10875
10911
|
invertedActions.push({
|
|
10876
|
-
t:
|
|
10912
|
+
t: "r",
|
|
10877
10913
|
body: action.oldBody,
|
|
10878
10914
|
oldBody: action.body,
|
|
10879
10915
|
len: action.len,
|
|
10880
|
-
coverType:
|
|
10916
|
+
coverType: 1
|
|
10881
10917
|
});
|
|
10882
10918
|
} else invertedActions.push(action);
|
|
10883
10919
|
return invertedActions;
|
|
@@ -10886,12 +10922,12 @@ var TextX = class TextX {
|
|
|
10886
10922
|
const invertibleActions = [];
|
|
10887
10923
|
let index = 0;
|
|
10888
10924
|
for (const action of actions) {
|
|
10889
|
-
if (action.t ===
|
|
10925
|
+
if (action.t === "d" && (action.body == null || action.body && action.body.dataStream.length !== action.len)) {
|
|
10890
10926
|
const body = getBodySlice(doc, index, index + action.len, false);
|
|
10891
10927
|
action.len = body.dataStream.length;
|
|
10892
10928
|
action.body = body;
|
|
10893
10929
|
}
|
|
10894
|
-
if (action.t ===
|
|
10930
|
+
if (action.t === "r" && action.body != null) {
|
|
10895
10931
|
const body = getBodySlice(doc, index, index + action.len, true);
|
|
10896
10932
|
action.oldBody = {
|
|
10897
10933
|
...body,
|
|
@@ -10900,13 +10936,13 @@ var TextX = class TextX {
|
|
|
10900
10936
|
action.len = body.dataStream.length;
|
|
10901
10937
|
}
|
|
10902
10938
|
invertibleActions.push(action);
|
|
10903
|
-
if (action.t !==
|
|
10939
|
+
if (action.t !== "i") index += action.len;
|
|
10904
10940
|
}
|
|
10905
10941
|
return invertibleActions;
|
|
10906
10942
|
}
|
|
10907
10943
|
insert(len, body) {
|
|
10908
10944
|
const insertAction = {
|
|
10909
|
-
t:
|
|
10945
|
+
t: "i",
|
|
10910
10946
|
body,
|
|
10911
10947
|
len
|
|
10912
10948
|
};
|
|
@@ -10915,7 +10951,7 @@ var TextX = class TextX {
|
|
|
10915
10951
|
}
|
|
10916
10952
|
retain(len, body, coverType) {
|
|
10917
10953
|
const retainAction = {
|
|
10918
|
-
t:
|
|
10954
|
+
t: "r",
|
|
10919
10955
|
len
|
|
10920
10956
|
};
|
|
10921
10957
|
if (body != null) retainAction.body = body;
|
|
@@ -10925,7 +10961,7 @@ var TextX = class TextX {
|
|
|
10925
10961
|
}
|
|
10926
10962
|
delete(len) {
|
|
10927
10963
|
const deleteAction = {
|
|
10928
|
-
t:
|
|
10964
|
+
t: "d",
|
|
10929
10965
|
len
|
|
10930
10966
|
};
|
|
10931
10967
|
this.push(deleteAction);
|
|
@@ -10946,13 +10982,13 @@ var TextX = class TextX {
|
|
|
10946
10982
|
let index = this._actions.length;
|
|
10947
10983
|
let lastAction = this._actions[index - 1];
|
|
10948
10984
|
const newAction = Tools.deepClone(args[0]);
|
|
10949
|
-
if (newAction.t ===
|
|
10985
|
+
if (newAction.t === "r" && newAction.len === 0 && newAction.body == null) return this;
|
|
10950
10986
|
if (typeof lastAction === "object") {
|
|
10951
|
-
if (lastAction.t ===
|
|
10987
|
+
if (lastAction.t === "d" && newAction.t === "d") {
|
|
10952
10988
|
lastAction.len += newAction.len;
|
|
10953
10989
|
return this;
|
|
10954
10990
|
}
|
|
10955
|
-
if (lastAction.t ===
|
|
10991
|
+
if (lastAction.t === "d" && newAction.t === "i") {
|
|
10956
10992
|
index -= 1;
|
|
10957
10993
|
lastAction = this._actions[index - 1];
|
|
10958
10994
|
if (lastAction == null) {
|
|
@@ -10960,11 +10996,11 @@ var TextX = class TextX {
|
|
|
10960
10996
|
return this;
|
|
10961
10997
|
}
|
|
10962
10998
|
}
|
|
10963
|
-
if (lastAction.t ===
|
|
10999
|
+
if (lastAction.t === "r" && newAction.t === "r" && lastAction.body == null && newAction.body == null) {
|
|
10964
11000
|
lastAction.len += newAction.len;
|
|
10965
11001
|
return this;
|
|
10966
11002
|
}
|
|
10967
|
-
if (lastAction.t ===
|
|
11003
|
+
if (lastAction.t === "i" && onlyHasDataStream(lastAction.body) && newAction.t === "i" && onlyHasDataStream(newAction.body)) {
|
|
10968
11004
|
lastAction.len += newAction.len;
|
|
10969
11005
|
lastAction.body.dataStream += newAction.body.dataStream;
|
|
10970
11006
|
return this;
|
|
@@ -10976,7 +11012,7 @@ var TextX = class TextX {
|
|
|
10976
11012
|
}
|
|
10977
11013
|
trimEndUselessRetainAction() {
|
|
10978
11014
|
let lastAction = this._actions[this._actions.length - 1];
|
|
10979
|
-
while (lastAction && lastAction.t ===
|
|
11015
|
+
while (lastAction && lastAction.t === "r" && isUselessRetainAction(lastAction)) {
|
|
10980
11016
|
this._actions.pop();
|
|
10981
11017
|
lastAction = this._actions[this._actions.length - 1];
|
|
10982
11018
|
}
|
|
@@ -11101,12 +11137,12 @@ function makeCustomRangeStream(stream) {
|
|
|
11101
11137
|
//#endregion
|
|
11102
11138
|
//#region src/docs/data-model/text-x/build-utils/parse.ts
|
|
11103
11139
|
const tags = [
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11140
|
+
"",
|
|
11141
|
+
"\x1B",
|
|
11142
|
+
"",
|
|
11143
|
+
"",
|
|
11144
|
+
"",
|
|
11145
|
+
""
|
|
11110
11146
|
];
|
|
11111
11147
|
const getPlainText = (dataStream) => {
|
|
11112
11148
|
const text = dataStream.endsWith("\r\n") ? dataStream.slice(0, -2) : dataStream;
|
|
@@ -11131,7 +11167,7 @@ const fromPlainText = (text) => {
|
|
|
11131
11167
|
startIndex: cursor,
|
|
11132
11168
|
endIndex: cursor + urlText.length - 1,
|
|
11133
11169
|
rangeId: id,
|
|
11134
|
-
rangeType:
|
|
11170
|
+
rangeType: 0,
|
|
11135
11171
|
properties: { url: text }
|
|
11136
11172
|
};
|
|
11137
11173
|
customRanges.push(range);
|
|
@@ -11302,7 +11338,8 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
|
|
|
11302
11338
|
_defineProperty(this, "headerModelMap", /* @__PURE__ */ new Map());
|
|
11303
11339
|
_defineProperty(this, "footerModelMap", /* @__PURE__ */ new Map());
|
|
11304
11340
|
_defineProperty(this, "change$", new rxjs.BehaviorSubject(0));
|
|
11305
|
-
|
|
11341
|
+
const UNIT_ID_LENGTH = 6;
|
|
11342
|
+
this._unitId = (_this$snapshot$id = this.snapshot.id) !== null && _this$snapshot$id !== void 0 ? _this$snapshot$id : generateRandomId(UNIT_ID_LENGTH);
|
|
11306
11343
|
this._initializeHeaderFooterModel();
|
|
11307
11344
|
this._name$.next((_this$snapshot$title2 = this.snapshot.title) !== null && _this$snapshot$title2 !== void 0 ? _this$snapshot$title2 : "");
|
|
11308
11345
|
}
|
|
@@ -11363,7 +11400,7 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
|
|
|
11363
11400
|
this.change$.next(this.change$.value + 1);
|
|
11364
11401
|
return this.snapshot;
|
|
11365
11402
|
}
|
|
11366
|
-
sliceBody(startOffset, endOffset, type =
|
|
11403
|
+
sliceBody(startOffset, endOffset, type = 0) {
|
|
11367
11404
|
const body = this.getBody();
|
|
11368
11405
|
if (body == null) return;
|
|
11369
11406
|
return getBodySlice(body, startOffset, endOffset, false, type);
|
|
@@ -11400,11 +11437,11 @@ function addCustomDecorationTextX(param) {
|
|
|
11400
11437
|
for (let i = 0; i < ranges.length; i++) {
|
|
11401
11438
|
const { startOffset: start, endOffset: end } = ranges[i];
|
|
11402
11439
|
if (start > 0) textX.push({
|
|
11403
|
-
t:
|
|
11440
|
+
t: "r",
|
|
11404
11441
|
len: start - cursor
|
|
11405
11442
|
});
|
|
11406
11443
|
textX.push({
|
|
11407
|
-
t:
|
|
11444
|
+
t: "r",
|
|
11408
11445
|
body: {
|
|
11409
11446
|
dataStream: "",
|
|
11410
11447
|
customDecorations: [{
|
|
@@ -11431,11 +11468,11 @@ function deleteCustomDecorationTextX(params) {
|
|
|
11431
11468
|
const { startIndex, endIndex } = decoration;
|
|
11432
11469
|
const len = endIndex - startIndex + 1;
|
|
11433
11470
|
textX.push({
|
|
11434
|
-
t:
|
|
11471
|
+
t: "r",
|
|
11435
11472
|
len: startIndex
|
|
11436
11473
|
});
|
|
11437
11474
|
textX.push({
|
|
11438
|
-
t:
|
|
11475
|
+
t: "r",
|
|
11439
11476
|
len,
|
|
11440
11477
|
body: {
|
|
11441
11478
|
dataStream: "",
|
|
@@ -11443,7 +11480,7 @@ function deleteCustomDecorationTextX(params) {
|
|
|
11443
11480
|
startIndex: 0,
|
|
11444
11481
|
endIndex: len - 1,
|
|
11445
11482
|
id,
|
|
11446
|
-
type:
|
|
11483
|
+
type: 9999
|
|
11447
11484
|
}]
|
|
11448
11485
|
}
|
|
11449
11486
|
});
|
|
@@ -11523,11 +11560,11 @@ function deleteCustomRangeTextX(params) {
|
|
|
11523
11560
|
const textX = new TextX();
|
|
11524
11561
|
const len = endIndex - startIndex + 1;
|
|
11525
11562
|
textX.push({
|
|
11526
|
-
t:
|
|
11563
|
+
t: "r",
|
|
11527
11564
|
len: startIndex
|
|
11528
11565
|
});
|
|
11529
11566
|
textX.push({
|
|
11530
|
-
t:
|
|
11567
|
+
t: "r",
|
|
11531
11568
|
len,
|
|
11532
11569
|
body: {
|
|
11533
11570
|
dataStream: "",
|
|
@@ -11535,7 +11572,7 @@ function deleteCustomRangeTextX(params) {
|
|
|
11535
11572
|
}
|
|
11536
11573
|
});
|
|
11537
11574
|
if (insert) textX.push({
|
|
11538
|
-
t:
|
|
11575
|
+
t: "i",
|
|
11539
11576
|
body: insert,
|
|
11540
11577
|
len: insert.dataStream.length
|
|
11541
11578
|
});
|
|
@@ -11573,17 +11610,17 @@ function addCustomRangeTextX(param) {
|
|
|
11573
11610
|
properties: { ...properties }
|
|
11574
11611
|
};
|
|
11575
11612
|
textX.push({
|
|
11576
|
-
t:
|
|
11613
|
+
t: "r",
|
|
11577
11614
|
len: rangeStartIndex - cursor
|
|
11578
11615
|
});
|
|
11579
11616
|
textX.push({
|
|
11580
|
-
t:
|
|
11617
|
+
t: "r",
|
|
11581
11618
|
len: rangeEndIndex - rangeStartIndex + 1,
|
|
11582
11619
|
body: {
|
|
11583
11620
|
dataStream: "",
|
|
11584
11621
|
customRanges: [customRange]
|
|
11585
11622
|
},
|
|
11586
|
-
coverType:
|
|
11623
|
+
coverType: 0
|
|
11587
11624
|
});
|
|
11588
11625
|
cursor = rangeEndIndex + 1;
|
|
11589
11626
|
};
|
|
@@ -11609,21 +11646,21 @@ function deleteSelectionTextX(selections, body, memoryCursor = 0, insertBody = n
|
|
|
11609
11646
|
const { startOffset, endOffset } = selection;
|
|
11610
11647
|
if (startOffset > cursor) {
|
|
11611
11648
|
dos.push({
|
|
11612
|
-
t:
|
|
11649
|
+
t: "r",
|
|
11613
11650
|
len: startOffset - cursor
|
|
11614
11651
|
});
|
|
11615
11652
|
cursor = startOffset;
|
|
11616
11653
|
}
|
|
11617
11654
|
if (cursor < endOffset) {
|
|
11618
11655
|
dos.push({
|
|
11619
|
-
t:
|
|
11656
|
+
t: "d",
|
|
11620
11657
|
len: endOffset - cursor
|
|
11621
11658
|
});
|
|
11622
11659
|
cursor = endOffset;
|
|
11623
11660
|
}
|
|
11624
11661
|
});
|
|
11625
11662
|
if (insertBody) dos.push({
|
|
11626
|
-
t:
|
|
11663
|
+
t: "i",
|
|
11627
11664
|
body: insertBody,
|
|
11628
11665
|
len: insertBody.dataStream.length
|
|
11629
11666
|
});
|
|
@@ -11632,13 +11669,13 @@ function deleteSelectionTextX(selections, body, memoryCursor = 0, insertBody = n
|
|
|
11632
11669
|
if (nextParagraph) {
|
|
11633
11670
|
if (nextParagraph.startIndex > cursor) {
|
|
11634
11671
|
dos.push({
|
|
11635
|
-
t:
|
|
11672
|
+
t: "r",
|
|
11636
11673
|
len: nextParagraph.startIndex - cursor
|
|
11637
11674
|
});
|
|
11638
11675
|
cursor = nextParagraph.startIndex;
|
|
11639
11676
|
}
|
|
11640
11677
|
dos.push({
|
|
11641
|
-
t:
|
|
11678
|
+
t: "r",
|
|
11642
11679
|
len: 1,
|
|
11643
11680
|
body: {
|
|
11644
11681
|
dataStream: "",
|
|
@@ -11648,7 +11685,7 @@ function deleteSelectionTextX(selections, body, memoryCursor = 0, insertBody = n
|
|
|
11648
11685
|
bullet: paragraphInRange === null || paragraphInRange === void 0 ? void 0 : paragraphInRange.bullet
|
|
11649
11686
|
}]
|
|
11650
11687
|
},
|
|
11651
|
-
coverType:
|
|
11688
|
+
coverType: 1
|
|
11652
11689
|
});
|
|
11653
11690
|
}
|
|
11654
11691
|
}
|
|
@@ -11661,14 +11698,14 @@ function retainSelectionTextX(selections, body, memoryCursor = 0) {
|
|
|
11661
11698
|
const { startOffset, endOffset } = selection;
|
|
11662
11699
|
if (startOffset > cursor) {
|
|
11663
11700
|
dos.push({
|
|
11664
|
-
t:
|
|
11701
|
+
t: "r",
|
|
11665
11702
|
len: startOffset - cursor
|
|
11666
11703
|
});
|
|
11667
11704
|
cursor = startOffset;
|
|
11668
11705
|
}
|
|
11669
11706
|
if (endOffset > cursor) {
|
|
11670
11707
|
dos.push({
|
|
11671
|
-
t:
|
|
11708
|
+
t: "r",
|
|
11672
11709
|
len: endOffset - cursor,
|
|
11673
11710
|
body: {
|
|
11674
11711
|
...Tools.deepClone(body),
|
|
@@ -11693,7 +11730,7 @@ const replaceSelectionTextX = (params) => {
|
|
|
11693
11730
|
switch (type) {
|
|
11694
11731
|
case 0: {
|
|
11695
11732
|
const action = {
|
|
11696
|
-
t:
|
|
11733
|
+
t: "r",
|
|
11697
11734
|
body: {
|
|
11698
11735
|
...getBodySlice(insertBody, cursor, cursor + text.length, false),
|
|
11699
11736
|
dataStream: ""
|
|
@@ -11705,7 +11742,7 @@ const replaceSelectionTextX = (params) => {
|
|
|
11705
11742
|
}
|
|
11706
11743
|
case 1: {
|
|
11707
11744
|
const action = {
|
|
11708
|
-
t:
|
|
11745
|
+
t: "i",
|
|
11709
11746
|
body: getBodySlice(insertBody, cursor, cursor + text.length),
|
|
11710
11747
|
len: text.length
|
|
11711
11748
|
};
|
|
@@ -11713,14 +11750,14 @@ const replaceSelectionTextX = (params) => {
|
|
|
11713
11750
|
return action;
|
|
11714
11751
|
}
|
|
11715
11752
|
default: return {
|
|
11716
|
-
t:
|
|
11753
|
+
t: "d",
|
|
11717
11754
|
len: text.length
|
|
11718
11755
|
};
|
|
11719
11756
|
}
|
|
11720
11757
|
});
|
|
11721
11758
|
const textX = new TextX();
|
|
11722
11759
|
textX.push({
|
|
11723
|
-
t:
|
|
11760
|
+
t: "r",
|
|
11724
11761
|
len: selection.startOffset
|
|
11725
11762
|
});
|
|
11726
11763
|
textX.push(...actions);
|
|
@@ -11745,7 +11782,7 @@ const replaceSelectionTextRuns = (params) => {
|
|
|
11745
11782
|
const textRunsSlice = getTextRunSlice(insertBody, cursor, cursor + text.length, false);
|
|
11746
11783
|
const oldTextRunsSlice = getTextRunSlice(oldBody, cursor, cursor + text.length, false);
|
|
11747
11784
|
const action = {
|
|
11748
|
-
t:
|
|
11785
|
+
t: "r",
|
|
11749
11786
|
body: isTextRunsEqual(textRunsSlice, oldTextRunsSlice) ? void 0 : {
|
|
11750
11787
|
textRuns: textRunsSlice === null || textRunsSlice === void 0 ? void 0 : textRunsSlice.map((textRun) => {
|
|
11751
11788
|
var _textRun$ts, _textRun$ts$cl$rgb, _textRun$ts2, _textRun$ts3;
|
|
@@ -11766,7 +11803,7 @@ const replaceSelectionTextRuns = (params) => {
|
|
|
11766
11803
|
}
|
|
11767
11804
|
case 1: {
|
|
11768
11805
|
const action = {
|
|
11769
|
-
t:
|
|
11806
|
+
t: "i",
|
|
11770
11807
|
body: getBodySlice(insertBody, cursor, cursor + text.length),
|
|
11771
11808
|
len: text.length
|
|
11772
11809
|
};
|
|
@@ -11774,15 +11811,15 @@ const replaceSelectionTextRuns = (params) => {
|
|
|
11774
11811
|
return action;
|
|
11775
11812
|
}
|
|
11776
11813
|
default: return {
|
|
11777
|
-
t:
|
|
11814
|
+
t: "d",
|
|
11778
11815
|
len: text.length
|
|
11779
11816
|
};
|
|
11780
11817
|
}
|
|
11781
11818
|
});
|
|
11782
|
-
if (actions.every((action) => action.t ===
|
|
11819
|
+
if (actions.every((action) => action.t === "r" && !action.body)) return false;
|
|
11783
11820
|
const textX = new TextX();
|
|
11784
11821
|
textX.push({
|
|
11785
|
-
t:
|
|
11822
|
+
t: "r",
|
|
11786
11823
|
len: selection.startOffset
|
|
11787
11824
|
});
|
|
11788
11825
|
textX.push(...actions);
|
|
@@ -11833,7 +11870,7 @@ const addDrawing = (param) => {
|
|
|
11833
11870
|
let removeDrawingLen = 0;
|
|
11834
11871
|
if (collapsed) {
|
|
11835
11872
|
if (startOffset > 0) textX.push({
|
|
11836
|
-
t:
|
|
11873
|
+
t: "r",
|
|
11837
11874
|
len: startOffset
|
|
11838
11875
|
});
|
|
11839
11876
|
} else {
|
|
@@ -11860,7 +11897,7 @@ const addDrawing = (param) => {
|
|
|
11860
11897
|
}
|
|
11861
11898
|
}
|
|
11862
11899
|
textX.push({
|
|
11863
|
-
t:
|
|
11900
|
+
t: "i",
|
|
11864
11901
|
body: {
|
|
11865
11902
|
dataStream: "\b".repeat(drawings.length),
|
|
11866
11903
|
customBlocks: drawings.map((drawing, i) => ({
|
|
@@ -11935,12 +11972,12 @@ function getParagraphsInRanges(ranges, paragraphs, dataStream) {
|
|
|
11935
11972
|
return results;
|
|
11936
11973
|
}
|
|
11937
11974
|
const NOT_PARAGRAPH_TOKENS = [
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11975
|
+
"\r",
|
|
11976
|
+
"",
|
|
11977
|
+
"",
|
|
11978
|
+
"\x1B",
|
|
11979
|
+
"",
|
|
11980
|
+
""
|
|
11944
11981
|
];
|
|
11945
11982
|
function transformParagraphs(paragraphs, dataStream) {
|
|
11946
11983
|
const results = [];
|
|
@@ -11976,10 +12013,10 @@ const switchParagraphBullet = (params) => {
|
|
|
11976
12013
|
const nextParagraph = paragraphs[curIndex + 1];
|
|
11977
12014
|
if (prevParagraph && prevParagraph.bullet && prevParagraph.bullet.listType.indexOf(listType) === 0) {
|
|
11978
12015
|
listId = prevParagraph.bullet.listId;
|
|
11979
|
-
if (listType !==
|
|
12016
|
+
if (listType !== "CHECK_LIST") listType = prevParagraph.bullet.listType;
|
|
11980
12017
|
} else if (nextParagraph && nextParagraph.bullet && nextParagraph.bullet.listType.indexOf(listType) === 0) {
|
|
11981
12018
|
listId = nextParagraph.bullet.listId;
|
|
11982
|
-
if (listType !==
|
|
12019
|
+
if (listType !== "CHECK_LIST") listType = nextParagraph.bullet.listType;
|
|
11983
12020
|
}
|
|
11984
12021
|
}
|
|
11985
12022
|
const memoryCursor = new MemoryCursor();
|
|
@@ -11989,11 +12026,11 @@ const switchParagraphBullet = (params) => {
|
|
|
11989
12026
|
var _bullet$nestingLevel;
|
|
11990
12027
|
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
11991
12028
|
textX.push({
|
|
11992
|
-
t:
|
|
12029
|
+
t: "r",
|
|
11993
12030
|
len: startIndex - memoryCursor.cursor
|
|
11994
12031
|
});
|
|
11995
12032
|
textX.push({
|
|
11996
|
-
t:
|
|
12033
|
+
t: "r",
|
|
11997
12034
|
len: 1,
|
|
11998
12035
|
body: {
|
|
11999
12036
|
dataStream: "",
|
|
@@ -12011,7 +12048,7 @@ const switchParagraphBullet = (params) => {
|
|
|
12011
12048
|
}
|
|
12012
12049
|
}]
|
|
12013
12050
|
},
|
|
12014
|
-
coverType:
|
|
12051
|
+
coverType: 1
|
|
12015
12052
|
});
|
|
12016
12053
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
12017
12054
|
}
|
|
@@ -12023,18 +12060,18 @@ const toggleChecklistParagraph = (params) => {
|
|
|
12023
12060
|
const paragraphs = (_docDataModel$getSelf3 = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) === null || _docDataModel$getSelf3 === void 0 ? void 0 : _docDataModel$getSelf3.paragraphs;
|
|
12024
12061
|
if (paragraphs == null) return false;
|
|
12025
12062
|
const currentParagraph = paragraphs.find((p) => p.startIndex === paragraphIndex);
|
|
12026
|
-
if (!(currentParagraph === null || currentParagraph === void 0 ? void 0 : currentParagraph.bullet) || currentParagraph.bullet.listType.indexOf(
|
|
12063
|
+
if (!(currentParagraph === null || currentParagraph === void 0 ? void 0 : currentParagraph.bullet) || currentParagraph.bullet.listType.indexOf("CHECK_LIST") === -1) return false;
|
|
12027
12064
|
const memoryCursor = new MemoryCursor();
|
|
12028
12065
|
memoryCursor.reset();
|
|
12029
12066
|
const textX = new TextX();
|
|
12030
12067
|
const { startIndex, paragraphStyle = {} } = currentParagraph;
|
|
12031
|
-
const listType = currentParagraph.bullet.listType ===
|
|
12068
|
+
const listType = currentParagraph.bullet.listType === "CHECK_LIST" ? "CHECK_LIST_CHECKED" : "CHECK_LIST";
|
|
12032
12069
|
textX.push({
|
|
12033
|
-
t:
|
|
12070
|
+
t: "r",
|
|
12034
12071
|
len: startIndex - memoryCursor.cursor
|
|
12035
12072
|
});
|
|
12036
12073
|
textX.push({
|
|
12037
|
-
t:
|
|
12074
|
+
t: "r",
|
|
12038
12075
|
len: 1,
|
|
12039
12076
|
body: {
|
|
12040
12077
|
dataStream: "",
|
|
@@ -12048,7 +12085,7 @@ const toggleChecklistParagraph = (params) => {
|
|
|
12048
12085
|
}
|
|
12049
12086
|
}]
|
|
12050
12087
|
},
|
|
12051
|
-
coverType:
|
|
12088
|
+
coverType: 1
|
|
12052
12089
|
});
|
|
12053
12090
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
12054
12091
|
return textX;
|
|
@@ -12065,11 +12102,11 @@ const setParagraphBullet = (params) => {
|
|
|
12065
12102
|
var _bullet$nestingLevel2;
|
|
12066
12103
|
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
12067
12104
|
textX.push({
|
|
12068
|
-
t:
|
|
12105
|
+
t: "r",
|
|
12069
12106
|
len: startIndex - memoryCursor.cursor
|
|
12070
12107
|
});
|
|
12071
12108
|
textX.push({
|
|
12072
|
-
t:
|
|
12109
|
+
t: "r",
|
|
12073
12110
|
len: 1,
|
|
12074
12111
|
body: {
|
|
12075
12112
|
dataStream: "",
|
|
@@ -12084,7 +12121,7 @@ const setParagraphBullet = (params) => {
|
|
|
12084
12121
|
}
|
|
12085
12122
|
}]
|
|
12086
12123
|
},
|
|
12087
|
-
coverType:
|
|
12124
|
+
coverType: 1
|
|
12088
12125
|
});
|
|
12089
12126
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
12090
12127
|
}
|
|
@@ -12109,14 +12146,14 @@ const changeParagraphBulletNestLevel = (params) => {
|
|
|
12109
12146
|
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
12110
12147
|
const isInTable = hasParagraphInTable(paragraph, tables);
|
|
12111
12148
|
textX.push({
|
|
12112
|
-
t:
|
|
12149
|
+
t: "r",
|
|
12113
12150
|
len: startIndex - memoryCursor.cursor
|
|
12114
12151
|
});
|
|
12115
12152
|
if (bullet) {
|
|
12116
12153
|
let maxLevel = lists[bullet.listType].nestingLevel.length - 1;
|
|
12117
12154
|
if (isInTable) maxLevel = Math.min(maxLevel, 2);
|
|
12118
12155
|
textX.push({
|
|
12119
|
-
t:
|
|
12156
|
+
t: "r",
|
|
12120
12157
|
len: 1,
|
|
12121
12158
|
body: {
|
|
12122
12159
|
dataStream: "",
|
|
@@ -12129,10 +12166,10 @@ const changeParagraphBulletNestLevel = (params) => {
|
|
|
12129
12166
|
}
|
|
12130
12167
|
}]
|
|
12131
12168
|
},
|
|
12132
|
-
coverType:
|
|
12169
|
+
coverType: 1
|
|
12133
12170
|
});
|
|
12134
12171
|
} else textX.push({
|
|
12135
|
-
t:
|
|
12172
|
+
t: "r",
|
|
12136
12173
|
len: 1
|
|
12137
12174
|
});
|
|
12138
12175
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
@@ -12151,20 +12188,20 @@ const setParagraphStyle = (params) => {
|
|
|
12151
12188
|
const start = Math.max(0, currentParagraphs[0].paragraphStart - 1);
|
|
12152
12189
|
if (start > memoryCursor.cursor) {
|
|
12153
12190
|
textX.push({
|
|
12154
|
-
t:
|
|
12191
|
+
t: "r",
|
|
12155
12192
|
len: start - memoryCursor.cursor
|
|
12156
12193
|
});
|
|
12157
12194
|
memoryCursor.moveCursorTo(start);
|
|
12158
12195
|
}
|
|
12159
12196
|
if (deleteLen) textX.push({
|
|
12160
|
-
t:
|
|
12197
|
+
t: "d",
|
|
12161
12198
|
len: deleteLen
|
|
12162
12199
|
});
|
|
12163
12200
|
for (const paragraph of currentParagraphs) {
|
|
12164
12201
|
const { startIndex, paragraphStyle = {} } = paragraph;
|
|
12165
12202
|
const len = startIndex - memoryCursor.cursor;
|
|
12166
12203
|
textX.push({
|
|
12167
|
-
t:
|
|
12204
|
+
t: "r",
|
|
12168
12205
|
len,
|
|
12169
12206
|
...paragraphTextRun ? {
|
|
12170
12207
|
body: {
|
|
@@ -12175,11 +12212,11 @@ const setParagraphStyle = (params) => {
|
|
|
12175
12212
|
ed: len
|
|
12176
12213
|
}]
|
|
12177
12214
|
},
|
|
12178
|
-
coverType:
|
|
12215
|
+
coverType: 1
|
|
12179
12216
|
} : null
|
|
12180
12217
|
});
|
|
12181
12218
|
textX.push({
|
|
12182
|
-
t:
|
|
12219
|
+
t: "r",
|
|
12183
12220
|
len: 1,
|
|
12184
12221
|
body: {
|
|
12185
12222
|
dataStream: "",
|
|
@@ -12191,7 +12228,7 @@ const setParagraphStyle = (params) => {
|
|
|
12191
12228
|
}
|
|
12192
12229
|
}]
|
|
12193
12230
|
},
|
|
12194
|
-
coverType:
|
|
12231
|
+
coverType: 1
|
|
12195
12232
|
});
|
|
12196
12233
|
memoryCursor.moveCursorTo(startIndex + 1);
|
|
12197
12234
|
}
|
|
@@ -12388,7 +12425,7 @@ var TextStyleValue = class TextStyleValue {
|
|
|
12388
12425
|
* ```
|
|
12389
12426
|
*/
|
|
12390
12427
|
get italic() {
|
|
12391
|
-
return this._style.it ===
|
|
12428
|
+
return this._style.it === 1;
|
|
12392
12429
|
}
|
|
12393
12430
|
/**
|
|
12394
12431
|
* Gets whether the text is bold
|
|
@@ -12400,7 +12437,7 @@ var TextStyleValue = class TextStyleValue {
|
|
|
12400
12437
|
* ```
|
|
12401
12438
|
*/
|
|
12402
12439
|
get bold() {
|
|
12403
|
-
return this._style.bl ===
|
|
12440
|
+
return this._style.bl === 1;
|
|
12404
12441
|
}
|
|
12405
12442
|
/**
|
|
12406
12443
|
* Gets the underline decoration
|
|
@@ -12760,14 +12797,14 @@ var TextDecorationBuilder = class TextDecorationBuilder {
|
|
|
12760
12797
|
* @returns {boolean} True if the decoration is shown
|
|
12761
12798
|
*/
|
|
12762
12799
|
get show() {
|
|
12763
|
-
return this._decoration.s ===
|
|
12800
|
+
return this._decoration.s === 1;
|
|
12764
12801
|
}
|
|
12765
12802
|
/**
|
|
12766
12803
|
* Gets whether the decoration color follows the font color
|
|
12767
12804
|
* @returns {boolean} True if the decoration color follows the font color
|
|
12768
12805
|
*/
|
|
12769
12806
|
get followFontColor() {
|
|
12770
|
-
return this._decoration.c ===
|
|
12807
|
+
return this._decoration.c === 1;
|
|
12771
12808
|
}
|
|
12772
12809
|
/**
|
|
12773
12810
|
* Gets the decoration color
|
|
@@ -13125,7 +13162,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13125
13162
|
* ```
|
|
13126
13163
|
*/
|
|
13127
13164
|
get keepLines() {
|
|
13128
|
-
return this._style.keepLines ===
|
|
13165
|
+
return this._style.keepLines === 1;
|
|
13129
13166
|
}
|
|
13130
13167
|
/**
|
|
13131
13168
|
* Gets the keep next
|
|
@@ -13137,7 +13174,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13137
13174
|
* ```
|
|
13138
13175
|
*/
|
|
13139
13176
|
get keepNext() {
|
|
13140
|
-
return this._style.keepNext ===
|
|
13177
|
+
return this._style.keepNext === 1;
|
|
13141
13178
|
}
|
|
13142
13179
|
/**
|
|
13143
13180
|
* Gets the word wrap
|
|
@@ -13149,7 +13186,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13149
13186
|
* ```
|
|
13150
13187
|
*/
|
|
13151
13188
|
get wordWrap() {
|
|
13152
|
-
return this._style.wordWrap ===
|
|
13189
|
+
return this._style.wordWrap === 1;
|
|
13153
13190
|
}
|
|
13154
13191
|
/**
|
|
13155
13192
|
* Gets the widow control
|
|
@@ -13161,7 +13198,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13161
13198
|
* ```
|
|
13162
13199
|
*/
|
|
13163
13200
|
get widowControl() {
|
|
13164
|
-
return this._style.widowControl ===
|
|
13201
|
+
return this._style.widowControl === 1;
|
|
13165
13202
|
}
|
|
13166
13203
|
/**
|
|
13167
13204
|
* Gets the shading
|
|
@@ -13185,7 +13222,7 @@ var ParagraphStyleValue = class ParagraphStyleValue {
|
|
|
13185
13222
|
* ```
|
|
13186
13223
|
*/
|
|
13187
13224
|
get suppressHyphenation() {
|
|
13188
|
-
return this._style.suppressHyphenation ===
|
|
13225
|
+
return this._style.suppressHyphenation === 1;
|
|
13189
13226
|
}
|
|
13190
13227
|
/**
|
|
13191
13228
|
* Creates a copy of the paragraph style
|
|
@@ -13799,7 +13836,7 @@ var RichTextValue = class RichTextValue {
|
|
|
13799
13836
|
*/
|
|
13800
13837
|
getLinks() {
|
|
13801
13838
|
var _this$_data$body$cust, _this$_data$body6;
|
|
13802
|
-
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 ===
|
|
13839
|
+
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 : [];
|
|
13803
13840
|
}
|
|
13804
13841
|
/**
|
|
13805
13842
|
* Gets the data of the current RichTextValue instance
|
|
@@ -13959,7 +13996,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
13959
13996
|
*/
|
|
13960
13997
|
setLink(start, end, link) {
|
|
13961
13998
|
const textX = BuildTextUtils.customRange.add({
|
|
13962
|
-
rangeType:
|
|
13999
|
+
rangeType: 0,
|
|
13963
14000
|
rangeId: generateRandomId(),
|
|
13964
14001
|
properties: { url: link },
|
|
13965
14002
|
ranges: [{
|
|
@@ -14041,7 +14078,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
14041
14078
|
const rich = RichTextBuilder.createByBody({
|
|
14042
14079
|
dataStream: textStr,
|
|
14043
14080
|
customRanges: [{
|
|
14044
|
-
rangeType:
|
|
14081
|
+
rangeType: 0,
|
|
14045
14082
|
rangeId: generateRandomId(),
|
|
14046
14083
|
properties: { url: textUrl },
|
|
14047
14084
|
startIndex: 0,
|
|
@@ -14721,11 +14758,11 @@ const IURLImageService = (0, _wendellhu_redi.createIdentifier)("core.url-image.s
|
|
|
14721
14758
|
//#endregion
|
|
14722
14759
|
//#region package.json
|
|
14723
14760
|
var name = "@univerjs/core";
|
|
14724
|
-
var version = "0.
|
|
14761
|
+
var version = "0.22.0";
|
|
14725
14762
|
|
|
14726
14763
|
//#endregion
|
|
14727
14764
|
//#region src/sheets/empty-snapshot.ts
|
|
14728
|
-
function getEmptySnapshot(unitID = "", locale =
|
|
14765
|
+
function getEmptySnapshot(unitID = "", locale = "zhCN", name = "") {
|
|
14729
14766
|
return {
|
|
14730
14767
|
id: unitID,
|
|
14731
14768
|
sheetOrder: [],
|
|
@@ -14844,7 +14881,7 @@ const getDefaultBaselineOffset = (fontSize) => ({
|
|
|
14844
14881
|
});
|
|
14845
14882
|
function createDocumentModelWithStyle(content, textStyle, config = {}) {
|
|
14846
14883
|
const contentLength = content.length;
|
|
14847
|
-
const { textRotation, paddingData, horizontalAlign =
|
|
14884
|
+
const { textRotation, paddingData, horizontalAlign = 0, verticalAlign = 0, wrapStrategy = 0, cellValueType } = config;
|
|
14848
14885
|
const { t: marginTop, r: marginRight, b: marginBottom, l: marginLeft } = paddingData || DEFAULT_PADDING_DATA;
|
|
14849
14886
|
const { vertexAngle, centerAngle } = convertTextRotation(textRotation);
|
|
14850
14887
|
return new DocumentDataModel({
|
|
@@ -14919,7 +14956,7 @@ function getFontFormat(format) {
|
|
|
14919
14956
|
function addLinkToDocumentModel(documentModel, linkUrl, linkId) {
|
|
14920
14957
|
var _body$customRanges;
|
|
14921
14958
|
const body = documentModel.getBody();
|
|
14922
|
-
if ((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.some((range) => range.rangeType ===
|
|
14959
|
+
if ((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.some((range) => range.rangeType === 0)) return;
|
|
14923
14960
|
const textX = BuildTextUtils.customRange.add({
|
|
14924
14961
|
ranges: [{
|
|
14925
14962
|
startOffset: 0,
|
|
@@ -14927,7 +14964,7 @@ function addLinkToDocumentModel(documentModel, linkUrl, linkId) {
|
|
|
14927
14964
|
collapsed: false
|
|
14928
14965
|
}],
|
|
14929
14966
|
rangeId: linkId,
|
|
14930
|
-
rangeType:
|
|
14967
|
+
rangeType: 0,
|
|
14931
14968
|
body,
|
|
14932
14969
|
properties: {
|
|
14933
14970
|
url: linkUrl,
|
|
@@ -14969,10 +15006,10 @@ function getFontStyleString(textStyle) {
|
|
|
14969
15006
|
fontFamily: defaultFont
|
|
14970
15007
|
};
|
|
14971
15008
|
}
|
|
14972
|
-
let italic =
|
|
14973
|
-
if (textStyle.it === 0 || textStyle.it === void 0) italic =
|
|
14974
|
-
let bold =
|
|
14975
|
-
if (textStyle.bl === 0 || textStyle.bl === void 0) bold =
|
|
15009
|
+
let italic = "italic";
|
|
15010
|
+
if (textStyle.it === 0 || textStyle.it === void 0) italic = "normal";
|
|
15011
|
+
let bold = "bold";
|
|
15012
|
+
if (textStyle.bl === 0 || textStyle.bl === void 0) bold = "normal";
|
|
14976
15013
|
let originFontSize = defaultFontSize;
|
|
14977
15014
|
if (textStyle.fs) originFontSize = Math.ceil(textStyle.fs);
|
|
14978
15015
|
let fontFamilyResult = defaultFont;
|
|
@@ -14985,9 +15022,9 @@ function getFontStyleString(textStyle) {
|
|
|
14985
15022
|
}
|
|
14986
15023
|
const { va: baselineOffset } = textStyle;
|
|
14987
15024
|
let fontSize = originFontSize;
|
|
14988
|
-
if (baselineOffset ===
|
|
15025
|
+
if (baselineOffset === 2 || baselineOffset === 3) {
|
|
14989
15026
|
const { sbr, spr } = getBaselineOffsetInfo(fontFamilyResult, fontSize);
|
|
14990
|
-
fontSize *= baselineOffset ===
|
|
15027
|
+
fontSize *= baselineOffset === 2 ? sbr : spr;
|
|
14991
15028
|
}
|
|
14992
15029
|
const fontStringPure = `${italic} ${bold} ${fontSize}pt ${fontFamilyResult}`;
|
|
14993
15030
|
return {
|
|
@@ -15002,13 +15039,13 @@ function getBaselineOffsetInfo(_fontFamily, fontSize) {
|
|
|
15002
15039
|
return getDefaultBaselineOffset(fontSize);
|
|
15003
15040
|
}
|
|
15004
15041
|
function convertTextRotation(textRotation) {
|
|
15005
|
-
const { a: angle = 0, v: isVertical =
|
|
15042
|
+
const { a: angle = 0, v: isVertical = 0 } = textRotation || {
|
|
15006
15043
|
a: 0,
|
|
15007
|
-
v:
|
|
15044
|
+
v: 0
|
|
15008
15045
|
};
|
|
15009
15046
|
let centerAngle = 0;
|
|
15010
15047
|
let vertexAngle = angle;
|
|
15011
|
-
if (isVertical ===
|
|
15048
|
+
if (isVertical === 1) {
|
|
15012
15049
|
centerAngle = 90;
|
|
15013
15050
|
vertexAngle = 90;
|
|
15014
15051
|
}
|
|
@@ -15232,7 +15269,7 @@ var ColumnManager = class {
|
|
|
15232
15269
|
const { _columnData } = this;
|
|
15233
15270
|
const col = _columnData[colPos];
|
|
15234
15271
|
if (!col) return true;
|
|
15235
|
-
return col.hd !==
|
|
15272
|
+
return col.hd !== 1;
|
|
15236
15273
|
}
|
|
15237
15274
|
/**
|
|
15238
15275
|
* Get the column style
|
|
@@ -15267,7 +15304,7 @@ var ColumnManager = class {
|
|
|
15267
15304
|
if (inHiddenRange && visible) {
|
|
15268
15305
|
inHiddenRange = false;
|
|
15269
15306
|
hiddenCols.push({
|
|
15270
|
-
rangeType:
|
|
15307
|
+
rangeType: 2,
|
|
15271
15308
|
startColumn,
|
|
15272
15309
|
endColumn: i - 1,
|
|
15273
15310
|
startRow: 0,
|
|
@@ -15283,7 +15320,7 @@ var ColumnManager = class {
|
|
|
15283
15320
|
endRow: 0,
|
|
15284
15321
|
startColumn,
|
|
15285
15322
|
endColumn: end,
|
|
15286
|
-
rangeType:
|
|
15323
|
+
rangeType: 2
|
|
15287
15324
|
});
|
|
15288
15325
|
return hiddenCols;
|
|
15289
15326
|
}
|
|
@@ -15302,7 +15339,7 @@ var ColumnManager = class {
|
|
|
15302
15339
|
if (inVisibleRange && !visible) {
|
|
15303
15340
|
inVisibleRange = false;
|
|
15304
15341
|
visibleCols.push({
|
|
15305
|
-
rangeType:
|
|
15342
|
+
rangeType: 2,
|
|
15306
15343
|
startColumn,
|
|
15307
15344
|
endColumn: i - 1,
|
|
15308
15345
|
startRow: 0,
|
|
@@ -15318,7 +15355,7 @@ var ColumnManager = class {
|
|
|
15318
15355
|
endRow: 0,
|
|
15319
15356
|
startColumn,
|
|
15320
15357
|
endColumn: end,
|
|
15321
|
-
rangeType:
|
|
15358
|
+
rangeType: 2
|
|
15322
15359
|
});
|
|
15323
15360
|
return visibleCols;
|
|
15324
15361
|
}
|
|
@@ -15329,7 +15366,7 @@ var ColumnManager = class {
|
|
|
15329
15366
|
const data = this.getColumn(i);
|
|
15330
15367
|
columnData[index] = data !== null && data !== void 0 ? data : {
|
|
15331
15368
|
w: this._config.defaultColumnWidth,
|
|
15332
|
-
hd:
|
|
15369
|
+
hd: 0
|
|
15333
15370
|
};
|
|
15334
15371
|
index++;
|
|
15335
15372
|
}
|
|
@@ -15473,7 +15510,7 @@ var RowManager = class {
|
|
|
15473
15510
|
const data = this.getRow(i);
|
|
15474
15511
|
rowData[index] = data !== null && data !== void 0 ? data : {
|
|
15475
15512
|
h: this._config.defaultRowHeight,
|
|
15476
|
-
hd:
|
|
15513
|
+
hd: 0
|
|
15477
15514
|
};
|
|
15478
15515
|
index++;
|
|
15479
15516
|
}
|
|
@@ -15485,10 +15522,10 @@ var RowManager = class {
|
|
|
15485
15522
|
let height = 0;
|
|
15486
15523
|
for (let i = 0; i < count; i++) {
|
|
15487
15524
|
const { ia, ah, h = config.defaultRowHeight } = _rowData[i + rowPos] || {
|
|
15488
|
-
hd:
|
|
15525
|
+
hd: 0,
|
|
15489
15526
|
h: config.defaultRowHeight
|
|
15490
15527
|
};
|
|
15491
|
-
height += (ia == null || ia ===
|
|
15528
|
+
height += (ia == null || ia === 1) && typeof ah === "number" ? ah : h;
|
|
15492
15529
|
}
|
|
15493
15530
|
return height;
|
|
15494
15531
|
}
|
|
@@ -15582,7 +15619,7 @@ var RowManager = class {
|
|
|
15582
15619
|
endRow: i - 1,
|
|
15583
15620
|
startColumn: 0,
|
|
15584
15621
|
endColumn: 0,
|
|
15585
|
-
rangeType:
|
|
15622
|
+
rangeType: 1
|
|
15586
15623
|
});
|
|
15587
15624
|
} else if (!inHiddenRange && !visible) {
|
|
15588
15625
|
inHiddenRange = true;
|
|
@@ -15594,7 +15631,7 @@ var RowManager = class {
|
|
|
15594
15631
|
endRow: end,
|
|
15595
15632
|
startColumn: 0,
|
|
15596
15633
|
endColumn: 0,
|
|
15597
|
-
rangeType:
|
|
15634
|
+
rangeType: 1
|
|
15598
15635
|
});
|
|
15599
15636
|
return hiddenRows;
|
|
15600
15637
|
}
|
|
@@ -15617,7 +15654,7 @@ var RowManager = class {
|
|
|
15617
15654
|
endRow: i - 1,
|
|
15618
15655
|
startColumn: 0,
|
|
15619
15656
|
endColumn: 0,
|
|
15620
|
-
rangeType:
|
|
15657
|
+
rangeType: 1
|
|
15621
15658
|
});
|
|
15622
15659
|
} else if (!inVisibleRange && visible) {
|
|
15623
15660
|
inVisibleRange = true;
|
|
@@ -15629,14 +15666,14 @@ var RowManager = class {
|
|
|
15629
15666
|
endRow: end,
|
|
15630
15667
|
startColumn: 0,
|
|
15631
15668
|
endColumn: 0,
|
|
15632
|
-
rangeType:
|
|
15669
|
+
rangeType: 1
|
|
15633
15670
|
});
|
|
15634
15671
|
return visibleRows;
|
|
15635
15672
|
}
|
|
15636
15673
|
getRowRawVisible(row) {
|
|
15637
15674
|
const rowData = this.getRow(row);
|
|
15638
15675
|
if (!rowData) return true;
|
|
15639
|
-
return rowData.hd !==
|
|
15676
|
+
return rowData.hd !== 1;
|
|
15640
15677
|
}
|
|
15641
15678
|
/**
|
|
15642
15679
|
* Get count of row in the sheet
|
|
@@ -15681,7 +15718,7 @@ function mergeWorksheetSnapshotWithDefault(snapshot) {
|
|
|
15681
15718
|
name: "Sheet1",
|
|
15682
15719
|
id: "sheet-01",
|
|
15683
15720
|
tabColor: "",
|
|
15684
|
-
hidden:
|
|
15721
|
+
hidden: 0,
|
|
15685
15722
|
rowCount: DEFAULT_WORKSHEET_ROW_COUNT,
|
|
15686
15723
|
columnCount: 20,
|
|
15687
15724
|
zoomRatio: 1,
|
|
@@ -15699,16 +15736,16 @@ function mergeWorksheetSnapshotWithDefault(snapshot) {
|
|
|
15699
15736
|
cellData: {},
|
|
15700
15737
|
rowData: {},
|
|
15701
15738
|
columnData: {},
|
|
15702
|
-
showGridlines:
|
|
15739
|
+
showGridlines: 1,
|
|
15703
15740
|
rowHeader: {
|
|
15704
15741
|
width: 46,
|
|
15705
|
-
hidden:
|
|
15742
|
+
hidden: 0
|
|
15706
15743
|
},
|
|
15707
15744
|
columnHeader: {
|
|
15708
15745
|
height: 20,
|
|
15709
|
-
hidden:
|
|
15746
|
+
hidden: 0
|
|
15710
15747
|
},
|
|
15711
|
-
rightToLeft:
|
|
15748
|
+
rightToLeft: 0
|
|
15712
15749
|
};
|
|
15713
15750
|
Object.keys(defaultSnapshot).forEach((_key) => {
|
|
15714
15751
|
const key = _key;
|
|
@@ -15751,9 +15788,9 @@ var SpanModel = class extends Disposable {
|
|
|
15751
15788
|
let index = 0;
|
|
15752
15789
|
for (const range of mergeData) {
|
|
15753
15790
|
const { rangeType } = range;
|
|
15754
|
-
if (rangeType ===
|
|
15755
|
-
else if (rangeType ===
|
|
15756
|
-
else if (rangeType ===
|
|
15791
|
+
if (rangeType === 1) this._createRowCache(range, index);
|
|
15792
|
+
else if (rangeType === 2) this._createColumnCache(range, index);
|
|
15793
|
+
else if (rangeType === 3) this._createCellAllCache(index);
|
|
15757
15794
|
else this._createCellCache(range, index);
|
|
15758
15795
|
index++;
|
|
15759
15796
|
}
|
|
@@ -15900,15 +15937,15 @@ var SheetViewModel = class extends Disposable {
|
|
|
15900
15937
|
this._rowFilteredInterceptor = null;
|
|
15901
15938
|
}
|
|
15902
15939
|
getCell(row, col, key, filter) {
|
|
15903
|
-
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col,
|
|
15940
|
+
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col, 2 | 1, key, filter);
|
|
15904
15941
|
return this.getRawCell(row, col);
|
|
15905
15942
|
}
|
|
15906
15943
|
getCellValueOnly(row, col) {
|
|
15907
|
-
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col,
|
|
15944
|
+
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col, 2);
|
|
15908
15945
|
return this.getRawCell(row, col);
|
|
15909
15946
|
}
|
|
15910
15947
|
getCellStyleOnly(row, col) {
|
|
15911
|
-
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col,
|
|
15948
|
+
if (this._cellContentInterceptor) return this._cellContentInterceptor.getCell(row, col, 1);
|
|
15912
15949
|
return this.getRawCell(row, col);
|
|
15913
15950
|
}
|
|
15914
15951
|
getRowFiltered(row) {
|
|
@@ -16363,15 +16400,15 @@ var Worksheet = class Worksheet {
|
|
|
16363
16400
|
for (let r = range.startRow; r <= range.endRow; r++) if (this.getRowFiltered(r)) rangeFilteredRows.push(r);
|
|
16364
16401
|
return rangeFilteredRows;
|
|
16365
16402
|
}
|
|
16366
|
-
getMatrixWithMergedCells(row, col, endRow, endCol, dataMode =
|
|
16403
|
+
getMatrixWithMergedCells(row, col, endRow, endCol, dataMode = "raw") {
|
|
16367
16404
|
const matrix = this.getCellMatrix();
|
|
16368
16405
|
const mergedCellsInRange = this._spanModel.getMergedCellRange(row, col, endRow, endCol);
|
|
16369
16406
|
const returnCellMatrix = new ObjectMatrix();
|
|
16370
16407
|
createRowColIter(row, endRow, col, endCol).forEach((row, col) => {
|
|
16371
16408
|
let cellData;
|
|
16372
|
-
if (dataMode ===
|
|
16373
|
-
else if (dataMode ===
|
|
16374
|
-
else if (dataMode ===
|
|
16409
|
+
if (dataMode === "raw") cellData = this.getCellRaw(row, col);
|
|
16410
|
+
else if (dataMode === "intercepted") cellData = this.getCell(row, col);
|
|
16411
|
+
else if (dataMode === "both") {
|
|
16375
16412
|
const cellDataRaw = this.getCellRaw(row, col);
|
|
16376
16413
|
if (cellDataRaw) {
|
|
16377
16414
|
var _this$getCell;
|
|
@@ -16773,7 +16810,7 @@ var Worksheet = class Worksheet {
|
|
|
16773
16810
|
const textStyle = getFontFormat(style);
|
|
16774
16811
|
fontString = getFontStyleString(textStyle).fontCache;
|
|
16775
16812
|
let cellText = extractPureTextFromCell(cell);
|
|
16776
|
-
if (cell.t ===
|
|
16813
|
+
if (cell.t === 4 && displayRawFormula) cellText = `'${cellText}`;
|
|
16777
16814
|
documentModel = createDocumentModelWithStyle(cellText, textStyle, {
|
|
16778
16815
|
...cellOtherConfig,
|
|
16779
16816
|
textRotation,
|
|
@@ -16893,16 +16930,30 @@ function extractPureTextFromCell(cell) {
|
|
|
16893
16930
|
if (richTextValue) return BuildTextUtils.transform.getPlainText(richTextValue);
|
|
16894
16931
|
const rawValue = cell.v;
|
|
16895
16932
|
if (typeof rawValue === "string") {
|
|
16896
|
-
if (cell.t ===
|
|
16933
|
+
if (cell.t === 3) return rawValue.toUpperCase();
|
|
16897
16934
|
return rawValue.replace(/[\r\n]/g, "");
|
|
16898
16935
|
}
|
|
16899
16936
|
if (typeof rawValue === "number") {
|
|
16900
|
-
if (cell.t ===
|
|
16937
|
+
if (cell.t === 3) return rawValue ? "TRUE" : "FALSE";
|
|
16901
16938
|
return rawValue.toString();
|
|
16902
16939
|
}
|
|
16903
16940
|
if (typeof rawValue === "boolean") return rawValue ? "TRUE" : "FALSE";
|
|
16904
16941
|
return "";
|
|
16905
16942
|
}
|
|
16943
|
+
function getDisplayValueFromCell(cell) {
|
|
16944
|
+
var _cell$p2;
|
|
16945
|
+
if (!cell) return "";
|
|
16946
|
+
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;
|
|
16947
|
+
if (richTextValue) return BuildTextUtils.transform.getPlainText(richTextValue);
|
|
16948
|
+
const displayValue = cell.v;
|
|
16949
|
+
if (displayValue === null || displayValue === void 0) return "";
|
|
16950
|
+
if (cell.t === 3) {
|
|
16951
|
+
if (typeof displayValue === "string") return displayValue.toUpperCase();
|
|
16952
|
+
if (typeof displayValue === "number") return displayValue ? "TRUE" : "FALSE";
|
|
16953
|
+
}
|
|
16954
|
+
if (typeof displayValue === "boolean") return displayValue ? "TRUE" : "FALSE";
|
|
16955
|
+
return String(displayValue);
|
|
16956
|
+
}
|
|
16906
16957
|
function getOriginCellValue(cell) {
|
|
16907
16958
|
if (cell === null) return "";
|
|
16908
16959
|
if (cell === null || cell === void 0 ? void 0 : cell.p) {
|
|
@@ -17078,7 +17129,7 @@ let Workbook = class Workbook extends UnitModel {
|
|
|
17078
17129
|
const sheetOrder = this._snapshot.sheetOrder;
|
|
17079
17130
|
for (let i = 0, len = sheetOrder.length; i < len; i++) {
|
|
17080
17131
|
const worksheet = this._worksheets.get(sheetOrder[i]);
|
|
17081
|
-
if (worksheet && worksheet.isSheetHidden() !==
|
|
17132
|
+
if (worksheet && worksheet.isSheetHidden() !== 1) {
|
|
17082
17133
|
this.setActiveSheet(worksheet);
|
|
17083
17134
|
return worksheet;
|
|
17084
17135
|
}
|
|
@@ -17153,10 +17204,10 @@ let Workbook = class Workbook extends UnitModel {
|
|
|
17153
17204
|
return this._worksheets.get(sheetOrder[index]);
|
|
17154
17205
|
}
|
|
17155
17206
|
getHiddenWorksheets() {
|
|
17156
|
-
return this.getSheets().filter((s) => s.getConfig().hidden ===
|
|
17207
|
+
return this.getSheets().filter((s) => s.getConfig().hidden === 1).map((s) => s.getConfig().id);
|
|
17157
17208
|
}
|
|
17158
17209
|
getUnhiddenWorksheets() {
|
|
17159
|
-
return this.getSheets().filter((s) => s.getConfig().hidden !==
|
|
17210
|
+
return this.getSheets().filter((s) => s.getConfig().hidden !== 1).map((s) => s.getConfig().id);
|
|
17160
17211
|
}
|
|
17161
17212
|
load(config) {
|
|
17162
17213
|
this._snapshot = config;
|
|
@@ -17478,10 +17529,10 @@ let LifecycleStages = /* @__PURE__ */ function(LifecycleStages) {
|
|
|
17478
17529
|
return LifecycleStages;
|
|
17479
17530
|
}({});
|
|
17480
17531
|
const LifecycleNameMap = {
|
|
17481
|
-
[
|
|
17482
|
-
[
|
|
17483
|
-
[
|
|
17484
|
-
[
|
|
17532
|
+
[0]: "Starting",
|
|
17533
|
+
[1]: "Ready",
|
|
17534
|
+
[2]: "Rendered",
|
|
17535
|
+
[3]: "Steady"
|
|
17485
17536
|
};
|
|
17486
17537
|
|
|
17487
17538
|
//#endregion
|
|
@@ -17500,10 +17551,10 @@ let LifecycleService = class LifecycleService extends Disposable {
|
|
|
17500
17551
|
constructor(_logService) {
|
|
17501
17552
|
super();
|
|
17502
17553
|
this._logService = _logService;
|
|
17503
|
-
_defineProperty(this, "_lifecycle$", new rxjs.BehaviorSubject(
|
|
17554
|
+
_defineProperty(this, "_lifecycle$", new rxjs.BehaviorSubject(0));
|
|
17504
17555
|
_defineProperty(this, "lifecycle$", this._lifecycle$.asObservable());
|
|
17505
17556
|
_defineProperty(this, "_lock", false);
|
|
17506
|
-
this._reportProgress(
|
|
17557
|
+
this._reportProgress(0);
|
|
17507
17558
|
}
|
|
17508
17559
|
get stage() {
|
|
17509
17560
|
return this._lifecycle$.getValue();
|
|
@@ -17542,7 +17593,7 @@ let LifecycleService = class LifecycleService extends Disposable {
|
|
|
17542
17593
|
* @returns An observable that emits the lifecycle stages, including the current
|
|
17543
17594
|
*/
|
|
17544
17595
|
subscribeWithPrevious() {
|
|
17545
|
-
return (0, rxjs.merge)(getLifecycleStagesAndBefore(this.stage), this._lifecycle$.pipe((0, rxjs.skip)(1))).pipe(takeAfter((s) => s ===
|
|
17596
|
+
return (0, rxjs.merge)(getLifecycleStagesAndBefore(this.stage), this._lifecycle$.pipe((0, rxjs.skip)(1))).pipe(takeAfter((s) => s === 3));
|
|
17546
17597
|
}
|
|
17547
17598
|
_reportProgress(stage) {
|
|
17548
17599
|
this._logService.debug("[LifecycleService]", `lifecycle progressed to "${LifecycleNameMap[stage]}".`);
|
|
@@ -17551,10 +17602,10 @@ let LifecycleService = class LifecycleService extends Disposable {
|
|
|
17551
17602
|
LifecycleService = __decorate([__decorateParam(0, ILogService)], LifecycleService);
|
|
17552
17603
|
function getLifecycleStagesAndBefore(lifecycleStage) {
|
|
17553
17604
|
switch (lifecycleStage) {
|
|
17554
|
-
case
|
|
17555
|
-
case
|
|
17556
|
-
case
|
|
17557
|
-
default: return (0, rxjs.of)(
|
|
17605
|
+
case 0: return (0, rxjs.of)(0);
|
|
17606
|
+
case 1: return (0, rxjs.of)(0, 1);
|
|
17607
|
+
case 2: return (0, rxjs.of)(0, 1, 2);
|
|
17608
|
+
default: return (0, rxjs.of)(0, 1, 2, 3);
|
|
17558
17609
|
}
|
|
17559
17610
|
}
|
|
17560
17611
|
|
|
@@ -17588,7 +17639,7 @@ var LocaleService = class extends Disposable {
|
|
|
17588
17639
|
}
|
|
17589
17640
|
constructor() {
|
|
17590
17641
|
super();
|
|
17591
|
-
_defineProperty(this, "_currentLocale$", new rxjs.BehaviorSubject(
|
|
17642
|
+
_defineProperty(this, "_currentLocale$", new rxjs.BehaviorSubject("zhCN"));
|
|
17592
17643
|
_defineProperty(this, "currentLocale$", this._currentLocale$.asObservable());
|
|
17593
17644
|
_defineProperty(this, "_locales", null);
|
|
17594
17645
|
_defineProperty(this, "localeChanged$", new rxjs.Subject());
|
|
@@ -17679,9 +17730,9 @@ let MentionIOLocalService = class MentionIOLocalService {
|
|
|
17679
17730
|
async list(params) {
|
|
17680
17731
|
return {
|
|
17681
17732
|
list: [{
|
|
17682
|
-
type:
|
|
17733
|
+
type: 0,
|
|
17683
17734
|
mentions: [{
|
|
17684
|
-
objectType:
|
|
17735
|
+
objectType: 0,
|
|
17685
17736
|
objectId: this._userManagerService.getCurrentUser().userID,
|
|
17686
17737
|
label: this._userManagerService.getCurrentUser().name,
|
|
17687
17738
|
metadata: { icon: this._userManagerService.getCurrentUser().avatar }
|
|
@@ -17751,7 +17802,7 @@ var PermissionService = class extends Disposable {
|
|
|
17751
17802
|
if (!permissionPoint) return;
|
|
17752
17803
|
const subject = permissionPoint.getValue();
|
|
17753
17804
|
subject.value = value;
|
|
17754
|
-
subject.status =
|
|
17805
|
+
subject.status = "done";
|
|
17755
17806
|
permissionPoint.next(subject);
|
|
17756
17807
|
this._permissionPointUpdate$.next(subject);
|
|
17757
17808
|
}
|
|
@@ -17963,26 +18014,26 @@ let PluginService = class PluginService {
|
|
|
17963
18014
|
_pluginsRunLifecycle(plugins) {
|
|
17964
18015
|
const currentStage = this._lifecycleService.stage;
|
|
17965
18016
|
getLifecycleStagesAndBefore(currentStage).subscribe((stage) => this._runStage(plugins, stage));
|
|
17966
|
-
if (currentStage !==
|
|
18017
|
+
if (currentStage !== 3) {
|
|
17967
18018
|
const subscription = this._lifecycleService.lifecycle$.pipe((0, rxjs.skip)(1)).subscribe((stage) => {
|
|
17968
18019
|
this._runStage(plugins, stage);
|
|
17969
|
-
if (stage ===
|
|
18020
|
+
if (stage === 3) subscription.unsubscribe();
|
|
17970
18021
|
});
|
|
17971
18022
|
}
|
|
17972
18023
|
}
|
|
17973
18024
|
_runStage(plugins, stage) {
|
|
17974
18025
|
plugins.forEach((p) => {
|
|
17975
18026
|
switch (stage) {
|
|
17976
|
-
case
|
|
18027
|
+
case 0:
|
|
17977
18028
|
p.onStarting();
|
|
17978
18029
|
break;
|
|
17979
|
-
case
|
|
18030
|
+
case 1:
|
|
17980
18031
|
p.onReady();
|
|
17981
18032
|
break;
|
|
17982
|
-
case
|
|
18033
|
+
case 2:
|
|
17983
18034
|
p.onRendered();
|
|
17984
18035
|
break;
|
|
17985
|
-
case
|
|
18036
|
+
case 3:
|
|
17986
18037
|
p.onSteady();
|
|
17987
18038
|
break;
|
|
17988
18039
|
}
|
|
@@ -18148,11 +18199,6 @@ var ThemeService = class extends Disposable {
|
|
|
18148
18199
|
|
|
18149
18200
|
//#endregion
|
|
18150
18201
|
//#region src/services/undoredo/undoredo.service.ts
|
|
18151
|
-
var BatchingStatus = /* @__PURE__ */ function(BatchingStatus) {
|
|
18152
|
-
BatchingStatus[BatchingStatus["WAITING"] = 0] = "WAITING";
|
|
18153
|
-
BatchingStatus[BatchingStatus["CREATED"] = 1] = "CREATED";
|
|
18154
|
-
return BatchingStatus;
|
|
18155
|
-
}(BatchingStatus || {});
|
|
18156
18202
|
const IUndoRedoService = (0, _wendellhu_redi.createIdentifier)("univer.undo-redo.service");
|
|
18157
18203
|
const STACK_CAPACITY = 20;
|
|
18158
18204
|
var MultiImplementationCommand = class {
|
|
@@ -18166,7 +18212,7 @@ const UndoCommandId = "univer.command.undo";
|
|
|
18166
18212
|
const UndoCommand = new class extends MultiImplementationCommand {
|
|
18167
18213
|
constructor(..._args) {
|
|
18168
18214
|
super(..._args);
|
|
18169
|
-
_defineProperty(this, "type",
|
|
18215
|
+
_defineProperty(this, "type", 0);
|
|
18170
18216
|
_defineProperty(this, "id", UndoCommandId);
|
|
18171
18217
|
}
|
|
18172
18218
|
handler(accessor) {
|
|
@@ -18174,7 +18220,7 @@ const UndoCommand = new class extends MultiImplementationCommand {
|
|
|
18174
18220
|
const element = undoRedoService.pitchTopUndoElement();
|
|
18175
18221
|
if (!element) return false;
|
|
18176
18222
|
const commandService = accessor.get(ICommandService);
|
|
18177
|
-
if (sequenceExecute(element.undoMutations, commandService)) {
|
|
18223
|
+
if (sequenceExecute(element.undoMutations, commandService).result) {
|
|
18178
18224
|
undoRedoService.popUndoToRedo();
|
|
18179
18225
|
return true;
|
|
18180
18226
|
}
|
|
@@ -18184,7 +18230,7 @@ const UndoCommand = new class extends MultiImplementationCommand {
|
|
|
18184
18230
|
const RedoCommand = new class extends MultiImplementationCommand {
|
|
18185
18231
|
constructor(..._args2) {
|
|
18186
18232
|
super(..._args2);
|
|
18187
|
-
_defineProperty(this, "type",
|
|
18233
|
+
_defineProperty(this, "type", 0);
|
|
18188
18234
|
_defineProperty(this, "id", RedoCommandId);
|
|
18189
18235
|
}
|
|
18190
18236
|
handler(accessor) {
|
|
@@ -18192,7 +18238,7 @@ const RedoCommand = new class extends MultiImplementationCommand {
|
|
|
18192
18238
|
const element = undoRedoService.pitchTopRedoElement();
|
|
18193
18239
|
if (!element) return false;
|
|
18194
18240
|
const commandService = accessor.get(ICommandService);
|
|
18195
|
-
if (sequenceExecute(element.redoMutations, commandService)) {
|
|
18241
|
+
if (sequenceExecute(element.redoMutations, commandService).result) {
|
|
18196
18242
|
undoRedoService.popRedoToUndo();
|
|
18197
18243
|
return true;
|
|
18198
18244
|
}
|
|
@@ -18227,9 +18273,9 @@ let LocalUndoRedoService = class LocalUndoRedoService extends Disposable {
|
|
|
18227
18273
|
if (this._batchingStatus.has(item.unitID)) {
|
|
18228
18274
|
const batchingStatus = this._batchingStatus.get(item.unitID);
|
|
18229
18275
|
const lastItem = this._pitchUndoElement(item.unitID);
|
|
18230
|
-
if (batchingStatus ===
|
|
18276
|
+
if (batchingStatus === 0 || !lastItem) {
|
|
18231
18277
|
appendNewItem(item);
|
|
18232
|
-
this._batchingStatus.set(item.unitID,
|
|
18278
|
+
this._batchingStatus.set(item.unitID, 1);
|
|
18233
18279
|
} else this._tryBatchingElements(lastItem, item);
|
|
18234
18280
|
} else appendNewItem(item);
|
|
18235
18281
|
function appendNewItem(item) {
|
|
@@ -18286,7 +18332,7 @@ let LocalUndoRedoService = class LocalUndoRedoService extends Disposable {
|
|
|
18286
18332
|
}
|
|
18287
18333
|
__tempBatchingUndoRedo(unitId) {
|
|
18288
18334
|
if (this._batchingStatus.has(unitId)) throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");
|
|
18289
|
-
this._batchingStatus.set(unitId,
|
|
18335
|
+
this._batchingStatus.set(unitId, 0);
|
|
18290
18336
|
return toDisposable(() => this._batchingStatus.delete(unitId));
|
|
18291
18337
|
}
|
|
18292
18338
|
_updateStatus() {
|
|
@@ -18373,12 +18419,12 @@ var ImageCacheMap = class {
|
|
|
18373
18419
|
const newImageElement = new Image();
|
|
18374
18420
|
const imageIoService = this._injector.has(IImageIoService) ? this._injector.get(IImageIoService) : null;
|
|
18375
18421
|
const urlImageService = this._injector.has(IURLImageService) ? this._injector.get(IURLImageService) : null;
|
|
18376
|
-
if (imageSourceType ===
|
|
18422
|
+
if (imageSourceType === "UUID") try {
|
|
18377
18423
|
newImageElement.src = await (imageIoService === null || imageIoService === void 0 ? void 0 : imageIoService.getImage(source)) || "";
|
|
18378
18424
|
} catch (error) {
|
|
18379
18425
|
console.error(error);
|
|
18380
18426
|
}
|
|
18381
|
-
else if (imageSourceType ===
|
|
18427
|
+
else if (imageSourceType === "URL") try {
|
|
18382
18428
|
newImageElement.src = await (urlImageService === null || urlImageService === void 0 ? void 0 : urlImageService.getImage(source)) || source;
|
|
18383
18429
|
} catch (error) {
|
|
18384
18430
|
newImageElement.src = source;
|
|
@@ -18987,9 +19033,9 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
18987
19033
|
const rowDataItem = data[r];
|
|
18988
19034
|
if (!rowDataItem) continue;
|
|
18989
19035
|
const { h = defaultRowHeight, ah, ia } = rowDataItem;
|
|
18990
|
-
if ((ia == null || ia ===
|
|
19036
|
+
if ((ia == null || ia === 1) && typeof ah === "number" && ah > 0) rowHeight = ah;
|
|
18991
19037
|
else rowHeight = h;
|
|
18992
|
-
if (rowDataItem.hd ===
|
|
19038
|
+
if (rowDataItem.hd === 1) rowHeight = 0;
|
|
18993
19039
|
}
|
|
18994
19040
|
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;
|
|
18995
19041
|
rowTotalHeight += gapSize;
|
|
@@ -19015,7 +19061,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
19015
19061
|
const columnDataItem = data[c];
|
|
19016
19062
|
if (!columnDataItem) continue;
|
|
19017
19063
|
if (columnDataItem.w != null) columnWidth = columnDataItem.w;
|
|
19018
|
-
if (columnDataItem.hd ===
|
|
19064
|
+
if (columnDataItem.hd === 1) columnWidth = 0;
|
|
19019
19065
|
}
|
|
19020
19066
|
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;
|
|
19021
19067
|
columnTotalWidth += gapSize;
|
|
@@ -19031,7 +19077,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
19031
19077
|
const mergedData = this.worksheet.getMergedCell(row, column);
|
|
19032
19078
|
return Boolean(mergedData);
|
|
19033
19079
|
}
|
|
19034
|
-
_getOverflowBound(row, startColumn, endColumn, contentWidth, horizontalAlign =
|
|
19080
|
+
_getOverflowBound(row, startColumn, endColumn, contentWidth, horizontalAlign = 1) {
|
|
19035
19081
|
let cumWidth = 0;
|
|
19036
19082
|
if (startColumn > endColumn) {
|
|
19037
19083
|
const columnCount = this._columnWidthAccumulation.length - 1;
|
|
@@ -19042,7 +19088,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
19042
19088
|
return column + 1 > columnCount ? columnCount : column + 1;
|
|
19043
19089
|
}
|
|
19044
19090
|
const { startX, endX } = getCellWithCoordByIndexCore(row, column, this.rowHeightAccumulation, this.columnWidthAccumulation, void 0, this.getGapSizeGetter());
|
|
19045
|
-
if (horizontalAlign ===
|
|
19091
|
+
if (horizontalAlign === 2 && column === startColumn) cumWidth += (endX - startX) / 2;
|
|
19046
19092
|
else cumWidth += endX - startX;
|
|
19047
19093
|
if (contentWidth < cumWidth) return column;
|
|
19048
19094
|
}
|
|
@@ -19055,7 +19101,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
19055
19101
|
return column - 1 < 0 ? 0 : column - 1;
|
|
19056
19102
|
}
|
|
19057
19103
|
const { startX, endX } = getCellWithCoordByIndexCore(row, column, this.rowHeightAccumulation, this.columnWidthAccumulation, void 0, this.getGapSizeGetter());
|
|
19058
|
-
if (horizontalAlign ===
|
|
19104
|
+
if (horizontalAlign === 2 && column === startColumn) cumWidth += (endX - startX) / 2;
|
|
19059
19105
|
else cumWidth += endX - startX;
|
|
19060
19106
|
if (contentWidth < cumWidth) return column;
|
|
19061
19107
|
}
|
|
@@ -19071,8 +19117,8 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
19071
19117
|
const { rowData, columnData, defaultRowHeight, defaultColumnWidth, rowCount, columnCount, rowHeader, columnHeader } = this._worksheetData;
|
|
19072
19118
|
const { rowTotalHeight, rowHeightAccumulation } = this._generateRowMatrixCache(rowCount, rowData, defaultRowHeight);
|
|
19073
19119
|
const { columnTotalWidth, columnWidthAccumulation } = this._generateColumnMatrixCache(columnCount, columnData, defaultColumnWidth);
|
|
19074
|
-
this._rowHeaderWidth = rowHeader.hidden !==
|
|
19075
|
-
this._columnHeaderHeight = columnHeader.hidden !==
|
|
19120
|
+
this._rowHeaderWidth = rowHeader.hidden !== 1 ? this._dynamicallyUpdateRowHeaderWidth(rowHeader) : 0;
|
|
19121
|
+
this._columnHeaderHeight = columnHeader.hidden !== 1 ? columnHeader.height : 0;
|
|
19076
19122
|
this._rowTotalHeight = rowTotalHeight;
|
|
19077
19123
|
this._rowHeightAccumulation = rowHeightAccumulation;
|
|
19078
19124
|
this._columnTotalWidth = columnTotalWidth;
|
|
@@ -19903,7 +19949,7 @@ var Univer = class {
|
|
|
19903
19949
|
});
|
|
19904
19950
|
}
|
|
19905
19951
|
_tryProgressToReady() {
|
|
19906
|
-
if (this._injector.get(LifecycleService).stage <
|
|
19952
|
+
if (this._injector.get(LifecycleService).stage < 1) this._injector.get(LifecycleService).stage = 1;
|
|
19907
19953
|
}
|
|
19908
19954
|
/** Register a plugin into univer. */
|
|
19909
19955
|
registerPlugin(plugin, config) {
|
|
@@ -20437,6 +20483,7 @@ exports.getColorStyle = getColorStyle;
|
|
|
20437
20483
|
exports.getCustomBlockSlice = getCustomBlockSlice;
|
|
20438
20484
|
exports.getCustomDecorationSlice = getCustomDecorationSlice;
|
|
20439
20485
|
exports.getCustomRangeSlice = getCustomRangeSlice;
|
|
20486
|
+
exports.getDisplayValueFromCell = getDisplayValueFromCell;
|
|
20440
20487
|
exports.getDocsUpdateBody = getDocsUpdateBody;
|
|
20441
20488
|
exports.getEmptyCell = getEmptyCell;
|
|
20442
20489
|
exports.getIntersectRange = getIntersectRange;
|