@univerjs/core 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +6 -6
- package/lib/cjs/index.js +1170 -778
- package/lib/es/facade.js +6 -6
- package/lib/es/index.js +1165 -779
- package/lib/facade.js +6 -6
- package/lib/index.js +1165 -779
- package/lib/types/docs/data-model/document-data-model.d.ts +1 -1
- package/lib/types/docs/data-model/index.d.ts +0 -2
- package/lib/types/docs/data-model/paragraph-style.d.ts +10 -1
- package/lib/types/docs/data-model/rich-text-builder.d.ts +3 -3
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/utils.d.ts +2 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/services/instance/instance.service.d.ts +2 -0
- package/lib/types/services/locale/currency-symbol.d.ts +17 -0
- package/lib/types/services/undoredo/undoredo.service.d.ts +1 -1
- package/lib/types/shared/common.d.ts +8 -5
- package/lib/types/sheets/typedef.d.ts +4 -0
- package/lib/types/sheets/worksheet.d.ts +2 -2
- package/lib/types/types/interfaces/i-document-data.d.ts +137 -9
- package/lib/umd/index.js +26 -26
- package/package.json +6 -6
package/lib/index.js
CHANGED
|
@@ -121,7 +121,7 @@ function installShims() {
|
|
|
121
121
|
installStringAt();
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
// \0@oxc-project+runtime@0.
|
|
124
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/typeof.js
|
|
125
125
|
function _typeof(o) {
|
|
126
126
|
"@babel/helpers - typeof";
|
|
127
127
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -131,7 +131,7 @@ function _typeof(o) {
|
|
|
131
131
|
}, _typeof(o);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
// \0@oxc-project+runtime@0.
|
|
134
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/toPrimitive.js
|
|
135
135
|
function toPrimitive(t, e) {
|
|
136
136
|
if ("object" != _typeof(t) || !t) return t;
|
|
137
137
|
var r;
|
|
@@ -143,13 +143,13 @@ function toPrimitive(t, e) {
|
|
|
143
143
|
return ("string" === e ? String : Number)(t);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
// \0@oxc-project+runtime@0.
|
|
146
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/toPropertyKey.js
|
|
147
147
|
function toPropertyKey(t) {
|
|
148
148
|
var i = toPrimitive(t, "string");
|
|
149
149
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
// \0@oxc-project+runtime@0.
|
|
152
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/defineProperty.js
|
|
153
153
|
function _defineProperty(e, r, t) {
|
|
154
154
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
155
155
|
value: t,
|
|
@@ -1643,7 +1643,7 @@ let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
|
|
|
1643
1643
|
|
|
1644
1644
|
// package.json
|
|
1645
1645
|
var name = "@univerjs/core";
|
|
1646
|
-
var version = "1.
|
|
1646
|
+
var version = "1.6.0";
|
|
1647
1647
|
|
|
1648
1648
|
// src/common/array.ts
|
|
1649
1649
|
/**
|
|
@@ -1981,14 +1981,14 @@ function hashLogContent(...args) {
|
|
|
1981
1981
|
return args.map((a) => JSON.stringify(a)).join("");
|
|
1982
1982
|
}
|
|
1983
1983
|
|
|
1984
|
-
// \0@oxc-project+runtime@0.
|
|
1984
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/decorateParam.js
|
|
1985
1985
|
function __decorateParam(paramIndex, decorator) {
|
|
1986
1986
|
return function(target, key) {
|
|
1987
1987
|
decorator(target, key, paramIndex);
|
|
1988
1988
|
};
|
|
1989
1989
|
}
|
|
1990
1990
|
|
|
1991
|
-
// \0@oxc-project+runtime@0.
|
|
1991
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/decorate.js
|
|
1992
1992
|
function __decorate(decorators, target, key, desc) {
|
|
1993
1993
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1994
1994
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2577,7 +2577,7 @@ const COLORS = {
|
|
|
2577
2577
|
0,
|
|
2578
2578
|
0
|
|
2579
2579
|
],
|
|
2580
|
-
|
|
2580
|
+
blanchedalmond: [
|
|
2581
2581
|
255,
|
|
2582
2582
|
235,
|
|
2583
2583
|
205
|
|
@@ -2654,7 +2654,7 @@ const COLORS = {
|
|
|
2654
2654
|
],
|
|
2655
2655
|
darkgoldenrod: [
|
|
2656
2656
|
184,
|
|
2657
|
-
|
|
2657
|
+
134,
|
|
2658
2658
|
11
|
|
2659
2659
|
],
|
|
2660
2660
|
darkgray: [
|
|
@@ -2774,7 +2774,7 @@ const COLORS = {
|
|
|
2774
2774
|
],
|
|
2775
2775
|
floralwhite: [
|
|
2776
2776
|
255,
|
|
2777
|
-
|
|
2777
|
+
250,
|
|
2778
2778
|
240
|
|
2779
2779
|
],
|
|
2780
2780
|
forestgreen: [
|
|
@@ -3022,7 +3022,7 @@ const COLORS = {
|
|
|
3022
3022
|
21,
|
|
3023
3023
|
133
|
|
3024
3024
|
],
|
|
3025
|
-
|
|
3025
|
+
midnightblue: [
|
|
3026
3026
|
25,
|
|
3027
3027
|
25,
|
|
3028
3028
|
112
|
|
@@ -3125,7 +3125,7 @@ const COLORS = {
|
|
|
3125
3125
|
plum: [
|
|
3126
3126
|
221,
|
|
3127
3127
|
160,
|
|
3128
|
-
|
|
3128
|
+
221
|
|
3129
3129
|
],
|
|
3130
3130
|
powderblue: [
|
|
3131
3131
|
176,
|
|
@@ -3203,18 +3203,18 @@ const COLORS = {
|
|
|
3203
3203
|
205
|
|
3204
3204
|
],
|
|
3205
3205
|
slategray: [
|
|
3206
|
-
|
|
3206
|
+
112,
|
|
3207
3207
|
128,
|
|
3208
3208
|
144
|
|
3209
3209
|
],
|
|
3210
3210
|
slategrey: [
|
|
3211
|
-
|
|
3211
|
+
112,
|
|
3212
3212
|
128,
|
|
3213
3213
|
144
|
|
3214
3214
|
],
|
|
3215
3215
|
snow: [
|
|
3216
3216
|
255,
|
|
3217
|
-
|
|
3217
|
+
250,
|
|
3218
3218
|
250
|
|
3219
3219
|
],
|
|
3220
3220
|
springgreen: [
|
|
@@ -3286,7 +3286,7 @@ const COLORS = {
|
|
|
3286
3286
|
yellowgreen: [
|
|
3287
3287
|
154,
|
|
3288
3288
|
205,
|
|
3289
|
-
|
|
3289
|
+
50
|
|
3290
3290
|
]
|
|
3291
3291
|
};
|
|
3292
3292
|
var ColorKit = class ColorKit {
|
|
@@ -3467,7 +3467,7 @@ const toColor = (color) => {
|
|
|
3467
3467
|
g: Math.round(colorArray[1]),
|
|
3468
3468
|
b: Math.round(colorArray[2])
|
|
3469
3469
|
};
|
|
3470
|
-
rgb.a = colorArray[3]
|
|
3470
|
+
rgb.a = colorArray[3] ?? 1;
|
|
3471
3471
|
return rgb;
|
|
3472
3472
|
}
|
|
3473
3473
|
if (parsedColor.startsWith("#")) return hexToColor(parsedColor);
|
|
@@ -5933,7 +5933,7 @@ function runPart(value, part, options, locale, decimalValue = null) {
|
|
|
5933
5933
|
haveFraction = fixedSlash;
|
|
5934
5934
|
}
|
|
5935
5935
|
} else {
|
|
5936
|
-
const fractionParts = dec2frac(decimal,
|
|
5936
|
+
const fractionParts = dec2frac(decimal, 1e400, section.den_max);
|
|
5937
5937
|
numerator += fractionParts[0];
|
|
5938
5938
|
denominator += fractionParts[1];
|
|
5939
5939
|
if (section.integer && numerator === "0") {
|
|
@@ -7030,6 +7030,7 @@ function parseNumber(value, options = {}) {
|
|
|
7030
7030
|
let sign = 1;
|
|
7031
7031
|
let format = "";
|
|
7032
7032
|
let minus = false;
|
|
7033
|
+
let plus = false;
|
|
7033
7034
|
let openParen = false;
|
|
7034
7035
|
let closeParen = false;
|
|
7035
7036
|
let percent = false;
|
|
@@ -7056,8 +7057,11 @@ function parseNumber(value, options = {}) {
|
|
|
7056
7057
|
if (currency) return null;
|
|
7057
7058
|
currency = true;
|
|
7058
7059
|
currencySymbol = char;
|
|
7060
|
+
} else if (char === "+") {
|
|
7061
|
+
if (openParen) return null;
|
|
7062
|
+
plus = true;
|
|
7059
7063
|
} else if (char === "(") {
|
|
7060
|
-
if (openParen || minus) return null;
|
|
7064
|
+
if (openParen || minus || plus) return null;
|
|
7061
7065
|
openParen = true;
|
|
7062
7066
|
sign = -1;
|
|
7063
7067
|
} else if (char === "%") {
|
|
@@ -7118,6 +7122,7 @@ function parseNumber(value, options = {}) {
|
|
|
7118
7122
|
index++;
|
|
7119
7123
|
}
|
|
7120
7124
|
if (index !== value.length) return null;
|
|
7125
|
+
if (openParen && !closeParen) return null;
|
|
7121
7126
|
let numberValue = Number.parseFloat(number + exponent);
|
|
7122
7127
|
if (!Number.isFinite(numberValue)) return null;
|
|
7123
7128
|
if (exponent) {
|
|
@@ -7965,7 +7970,11 @@ const getNumfmtParseValueFilter = (value, options = {}) => {
|
|
|
7965
7970
|
*/
|
|
7966
7971
|
if (z.includes("#,##0")) {
|
|
7967
7972
|
if (/[.,]$/.test(value)) return null;
|
|
7968
|
-
const
|
|
7973
|
+
const unwrapParens = (input) => {
|
|
7974
|
+
const trimmed = input.trim();
|
|
7975
|
+
return trimmed.startsWith("(") && trimmed.endsWith(")") ? trimmed.slice(1, -1).trim() : trimmed;
|
|
7976
|
+
};
|
|
7977
|
+
const normalized = unwrapParens(unwrapParens(value).replace(CURRENCY_SYMBOL_PREFIX_REG, "").trim());
|
|
7969
7978
|
if (normalized.includes(",")) {
|
|
7970
7979
|
if (!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(normalized)) return null;
|
|
7971
7980
|
}
|
|
@@ -8325,7 +8334,7 @@ var ObjectMatrix = class ObjectMatrix {
|
|
|
8325
8334
|
const rowLength = rows.length;
|
|
8326
8335
|
const startRow = rowLength > 0 ? Number(rows[0]) : 0;
|
|
8327
8336
|
const endRow = rowLength > 0 ? Number(rows[rowLength - 1]) : 0;
|
|
8328
|
-
let startColumn = -
|
|
8337
|
+
let startColumn = -1e400;
|
|
8329
8338
|
let endColumn = 0;
|
|
8330
8339
|
for (const rowKey of rows) {
|
|
8331
8340
|
const row = this.getRow(Number(rowKey));
|
|
@@ -8334,12 +8343,12 @@ var ObjectMatrix = class ObjectMatrix {
|
|
|
8334
8343
|
if (columns.length > 0) {
|
|
8335
8344
|
const rowStartColumn = Number(columns[0]);
|
|
8336
8345
|
const rowEndColumn = Number(columns[columns.length - 1]);
|
|
8337
|
-
if (startColumn === -
|
|
8346
|
+
if (startColumn === -1e400 || rowStartColumn < startColumn) startColumn = rowStartColumn;
|
|
8338
8347
|
if (rowEndColumn > endColumn) endColumn = rowEndColumn;
|
|
8339
8348
|
}
|
|
8340
8349
|
}
|
|
8341
8350
|
}
|
|
8342
|
-
if (startColumn === -
|
|
8351
|
+
if (startColumn === -1e400) startColumn = 0;
|
|
8343
8352
|
return {
|
|
8344
8353
|
startRow,
|
|
8345
8354
|
endRow,
|
|
@@ -8615,6 +8624,7 @@ function isFormulaId(value) {
|
|
|
8615
8624
|
* @param style
|
|
8616
8625
|
* @returns
|
|
8617
8626
|
*/
|
|
8627
|
+
const TEXT_DECORATION_LINE_REGEX = /(text-decoration(?:-line)?:\s*[^;]+)(?=;)/;
|
|
8618
8628
|
function handleStyleToString(style, isCell = false) {
|
|
8619
8629
|
let str = "";
|
|
8620
8630
|
const styleMap = /* @__PURE__ */ new Map([
|
|
@@ -8637,7 +8647,7 @@ function handleStyleToString(style, isCell = false) {
|
|
|
8637
8647
|
["ul", () => {
|
|
8638
8648
|
var _style$ul;
|
|
8639
8649
|
if ((_style$ul = style.ul) === null || _style$ul === void 0 ? void 0 : _style$ul.s) {
|
|
8640
|
-
if (
|
|
8650
|
+
if (TEXT_DECORATION_LINE_REGEX.test(str)) str = str.replace(TEXT_DECORATION_LINE_REGEX, (_, p1) => `${p1} underline`);
|
|
8641
8651
|
else str += "text-decoration: underline; ";
|
|
8642
8652
|
if (style.ul.cl && str.indexOf("text-decoration-color") === -1) str += `text-decoration-color: ${getColorStyle(style.ul.cl)}; `;
|
|
8643
8653
|
if (style.ul.t && str.indexOf("text-decoration-style") === -1) str += `text-decoration-style: ${style.ul.t} `;
|
|
@@ -8646,7 +8656,7 @@ function handleStyleToString(style, isCell = false) {
|
|
|
8646
8656
|
["st", () => {
|
|
8647
8657
|
var _style$st;
|
|
8648
8658
|
if ((_style$st = style.st) === null || _style$st === void 0 ? void 0 : _style$st.s) {
|
|
8649
|
-
if (
|
|
8659
|
+
if (TEXT_DECORATION_LINE_REGEX.test(str)) str = str.replace(TEXT_DECORATION_LINE_REGEX, (_, p1) => `${p1} line-through`);
|
|
8650
8660
|
else str += "text-decoration-line: line-through; ";
|
|
8651
8661
|
if (style.st.cl && str.indexOf("text-decoration-color") === -1) str += `text-decoration-color: ${getColorStyle(style.st.cl)}; `;
|
|
8652
8662
|
if (style.st.t && str.indexOf("text-decoration-style") === -1) str += `text-decoration-style: ${style.st.t} `;
|
|
@@ -8655,7 +8665,7 @@ function handleStyleToString(style, isCell = false) {
|
|
|
8655
8665
|
["ol", () => {
|
|
8656
8666
|
var _style$ol;
|
|
8657
8667
|
if ((_style$ol = style.ol) === null || _style$ol === void 0 ? void 0 : _style$ol.s) {
|
|
8658
|
-
if (
|
|
8668
|
+
if (TEXT_DECORATION_LINE_REGEX.test(str)) str = str.replace(TEXT_DECORATION_LINE_REGEX, (_, p1) => `${p1} overline`);
|
|
8659
8669
|
else str += "text-decoration-line: overline; ";
|
|
8660
8670
|
if (style.ol.cl && str.indexOf("text-decoration-color") === -1) str += `text-decoration-color: ${getColorStyle(style.ol.cl)}; `;
|
|
8661
8671
|
if (style.ol.t && str.indexOf("text-decoration-style") === -1) str += `text-decoration-style: ${style.ol.t} `;
|
|
@@ -8739,6 +8749,28 @@ function handleStyleToString(style, isCell = false) {
|
|
|
8739
8749
|
}
|
|
8740
8750
|
return str;
|
|
8741
8751
|
}
|
|
8752
|
+
/**
|
|
8753
|
+
* Mark every line a `text-decoration` value names on a style object.
|
|
8754
|
+
*
|
|
8755
|
+
* A single `text-decoration` can name several lines at once, e.g. `underline line-through`,
|
|
8756
|
+
* so every line has to be read instead of only the first one. Existing data of a line, such
|
|
8757
|
+
* as its color or line style, is kept.
|
|
8758
|
+
*/
|
|
8759
|
+
function setTextDecorationLines(style, value) {
|
|
8760
|
+
const lines = value.split(/\s+/);
|
|
8761
|
+
if (lines.includes("underline")) style.ul = {
|
|
8762
|
+
...style.ul,
|
|
8763
|
+
s: 1
|
|
8764
|
+
};
|
|
8765
|
+
if (lines.includes("line-through")) style.st = {
|
|
8766
|
+
...style.st,
|
|
8767
|
+
s: 1
|
|
8768
|
+
};
|
|
8769
|
+
if (lines.includes("overline")) style.ol = {
|
|
8770
|
+
...style.ol,
|
|
8771
|
+
s: 1
|
|
8772
|
+
};
|
|
8773
|
+
}
|
|
8742
8774
|
function getBorderStyle(type) {
|
|
8743
8775
|
let str = "";
|
|
8744
8776
|
if (type === 0) str = "none";
|
|
@@ -10481,13 +10513,13 @@ function getIntersectRange(src, target) {
|
|
|
10481
10513
|
* @returns A tuple containing the start and end of the overlap, or null if there is no overlap.
|
|
10482
10514
|
*/
|
|
10483
10515
|
function getOverlap1D(start1, end1, start2, end2) {
|
|
10484
|
-
const s1 = Number.isNaN(start1) ? -
|
|
10485
|
-
const e1 = Number.isNaN(end1) ?
|
|
10486
|
-
const s2 = Number.isNaN(start2) ? -
|
|
10487
|
-
const e2 = Number.isNaN(end2) ?
|
|
10516
|
+
const s1 = Number.isNaN(start1) ? -1e400 : start1;
|
|
10517
|
+
const e1 = Number.isNaN(end1) ? 1e400 : end1;
|
|
10518
|
+
const s2 = Number.isNaN(start2) ? -1e400 : start2;
|
|
10519
|
+
const e2 = Number.isNaN(end2) ? 1e400 : end2;
|
|
10488
10520
|
const start = Math.max(s1, s2);
|
|
10489
10521
|
const end = Math.min(e1, e2);
|
|
10490
|
-
if (start <= end) return [start === -
|
|
10522
|
+
if (start <= end) return [start === -1e400 ? NaN : start, end === 1e400 ? NaN : end];
|
|
10491
10523
|
else return null;
|
|
10492
10524
|
}
|
|
10493
10525
|
/**
|
|
@@ -12250,7 +12282,7 @@ function cloneSectionBreakWithId(sectionBreak, existingIds, preserveId = true) {
|
|
|
12250
12282
|
return cloned;
|
|
12251
12283
|
}
|
|
12252
12284
|
function isValidSectionId(value) {
|
|
12253
|
-
return typeof value === "string" && value.
|
|
12285
|
+
return typeof value === "string" && value.length > 0;
|
|
12254
12286
|
}
|
|
12255
12287
|
|
|
12256
12288
|
// src/docs/data-model/types.ts
|
|
@@ -12529,6 +12561,13 @@ let BulletAlignment = /* @__PURE__ */ function(BulletAlignment) {
|
|
|
12529
12561
|
BulletAlignment[BulletAlignment["BOTH"] = 4] = "BOTH";
|
|
12530
12562
|
return BulletAlignment;
|
|
12531
12563
|
}({});
|
|
12564
|
+
let SpecialCharacterKind = /* @__PURE__ */ function(SpecialCharacterKind) {
|
|
12565
|
+
SpecialCharacterKind["NON_BREAKING_HYPHEN"] = "nonBreakingHyphen";
|
|
12566
|
+
SpecialCharacterKind["OPTIONAL_HYPHEN"] = "optionalHyphen";
|
|
12567
|
+
SpecialCharacterKind["EM_SPACE"] = "emSpace";
|
|
12568
|
+
SpecialCharacterKind["EN_SPACE"] = "enSpace";
|
|
12569
|
+
return SpecialCharacterKind;
|
|
12570
|
+
}({});
|
|
12532
12571
|
let DocumentBlockRangeType = /* @__PURE__ */ function(DocumentBlockRangeType) {
|
|
12533
12572
|
DocumentBlockRangeType["CALLOUT"] = "callout";
|
|
12534
12573
|
DocumentBlockRangeType["QUOTE"] = "quote";
|
|
@@ -13524,8 +13563,9 @@ function normalizeTextRuns(textRuns, reserveEmptyTextRun = false) {
|
|
|
13524
13563
|
* @param currentIndex Determining the index where the content will be inserted into the current content.
|
|
13525
13564
|
*/
|
|
13526
13565
|
function insertTextRuns(body, insertBody, textLength, currentIndex) {
|
|
13527
|
-
|
|
13528
|
-
|
|
13566
|
+
var _insertBody$textRuns;
|
|
13567
|
+
const textRuns = body.textRuns ?? [];
|
|
13568
|
+
if (body.textRuns == null && !((_insertBody$textRuns = insertBody.textRuns) === null || _insertBody$textRuns === void 0 ? void 0 : _insertBody$textRuns.some((run) => run.sId || Object.keys(run.ts ?? {}).length))) return;
|
|
13529
13569
|
const newTextRuns = [];
|
|
13530
13570
|
const len = textRuns.length;
|
|
13531
13571
|
let hasInserted = false;
|
|
@@ -13611,7 +13651,7 @@ function insertParagraphs(body, insertBody, textLength, currentIndex, isUpdate =
|
|
|
13611
13651
|
}
|
|
13612
13652
|
}
|
|
13613
13653
|
function normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs, currentIndex, options) {
|
|
13614
|
-
if (!paragraphs || !(insertParagraphs === null || insertParagraphs === void 0 ? void 0 : insertParagraphs.length)) return;
|
|
13654
|
+
if (!paragraphs || !(insertParagraphs === null || insertParagraphs === void 0 ? void 0 : insertParagraphs.length)) return false;
|
|
13615
13655
|
const splitParagraph = getParagraphSplitByInsert(paragraphs, currentIndex, options.dataStream);
|
|
13616
13656
|
const firstSplitInsertIndex = splitParagraph ? getFirstInsertedParagraphIndex(insertParagraphs) : -1;
|
|
13617
13657
|
const splitParagraphId = splitParagraph === null || splitParagraph === void 0 ? void 0 : splitParagraph.paragraphId;
|
|
@@ -13647,6 +13687,7 @@ function normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs,
|
|
|
13647
13687
|
var _options$reservedPara;
|
|
13648
13688
|
(_options$reservedPara = options.reservedParagraphIds) === null || _options$reservedPara === void 0 || _options$reservedPara.add(insertParagraph.paragraphId);
|
|
13649
13689
|
}
|
|
13690
|
+
return splitParagraph != null;
|
|
13650
13691
|
}
|
|
13651
13692
|
function collectParagraphIds(paragraphs) {
|
|
13652
13693
|
const paragraphIds = /* @__PURE__ */ new Set();
|
|
@@ -13885,7 +13926,10 @@ function mergeContinuousRanges(ranges) {
|
|
|
13885
13926
|
return mergedRanges;
|
|
13886
13927
|
}
|
|
13887
13928
|
function splitCustomRangesByIndex(customRanges, currentIndex) {
|
|
13888
|
-
const matches = customRanges.filter((range) =>
|
|
13929
|
+
const matches = customRanges.filter((range) => {
|
|
13930
|
+
var _range$properties;
|
|
13931
|
+
return range.rangeType !== 1 && range.rangeType !== 2 && range.rangeType !== 3 && !(range.rangeType === 5 && ((_range$properties = range.properties) === null || _range$properties === void 0 ? void 0 : _range$properties.kind) === "docx-permission") && range.startIndex < currentIndex && range.endIndex >= currentIndex;
|
|
13932
|
+
});
|
|
13889
13933
|
for (const matched of matches) {
|
|
13890
13934
|
const index = customRanges.indexOf(matched);
|
|
13891
13935
|
customRanges.splice(index, 1, {
|
|
@@ -13936,9 +13980,10 @@ function insertCustomRanges(body, insertBody, textLength, currentIndex) {
|
|
|
13936
13980
|
const { customRanges } = body;
|
|
13937
13981
|
splitCustomRangesByIndex(customRanges, currentIndex);
|
|
13938
13982
|
for (let i = 0, len = customRanges.length; i < len; i++) {
|
|
13983
|
+
var _customRange$properti;
|
|
13939
13984
|
const customRange = customRanges[i];
|
|
13940
13985
|
const { startIndex } = customRange;
|
|
13941
|
-
if ((customRange.rangeType === 1 || customRange.rangeType === 2 || customRange.rangeType === 3) && startIndex < currentIndex && customRange.endIndex >= currentIndex) {
|
|
13986
|
+
if ((customRange.rangeType === 1 || customRange.rangeType === 2 || customRange.rangeType === 3 || customRange.rangeType === 5 && ((_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.kind) === "docx-permission") && startIndex < currentIndex && customRange.endIndex >= currentIndex) {
|
|
13942
13987
|
customRange.endIndex += textLength;
|
|
13943
13988
|
continue;
|
|
13944
13989
|
}
|
|
@@ -13969,6 +14014,8 @@ function insertCustomRanges(body, insertBody, textLength, currentIndex) {
|
|
|
13969
14014
|
body.customRanges = mergeContinuousRanges(customRanges);
|
|
13970
14015
|
}
|
|
13971
14016
|
function insertCustomDecorations(body, insertBody, textLength, currentIndex) {
|
|
14017
|
+
var _insertBody$customDec;
|
|
14018
|
+
if (body.customDecorations == null && !((_insertBody$customDec = insertBody.customDecorations) === null || _insertBody$customDec === void 0 ? void 0 : _insertBody$customDec.length)) return;
|
|
13972
14019
|
if (!body.customDecorations) body.customDecorations = [];
|
|
13973
14020
|
const { customDecorations } = body;
|
|
13974
14021
|
splitCustomDecoratesByIndex(customDecorations, currentIndex);
|
|
@@ -14316,601 +14363,139 @@ function deleteCustomDecorations(body, textLength, currentIndex, needOffset = tr
|
|
|
14316
14363
|
return removeCustomDecorations;
|
|
14317
14364
|
}
|
|
14318
14365
|
|
|
14319
|
-
// src/docs/data-model/
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
14328
|
-
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
|
|
14335
|
-
|
|
14336
|
-
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
|
|
14340
|
-
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
* Hierarchical ordered list using `A`, `1`, and `i` markers.
|
|
14362
|
-
*/
|
|
14363
|
-
PresetListType["ORDER_LIST_4"] = "ORDER_LIST_4";
|
|
14364
|
-
/**
|
|
14365
|
-
* Zero-padded ordered list using `01`, `a`, and `i` markers.
|
|
14366
|
-
*/
|
|
14367
|
-
PresetListType["ORDER_LIST_5"] = "ORDER_LIST_5";
|
|
14368
|
-
/** Quick ordered list using closing-parenthesis markers. */
|
|
14369
|
-
PresetListType["ORDER_LIST_QUICK_2"] = "ORDER_LIST_QUICK_2";
|
|
14370
|
-
/** Quick ordered list using lowercase letter and period markers. */
|
|
14371
|
-
PresetListType["ORDER_LIST_QUICK_3"] = "ORDER_LIST_QUICK_3";
|
|
14372
|
-
/** Quick ordered list using lowercase Roman numeral markers. */
|
|
14373
|
-
PresetListType["ORDER_LIST_QUICK_4"] = "ORDER_LIST_QUICK_4";
|
|
14374
|
-
/** Quick ordered list using uppercase letter markers. */
|
|
14375
|
-
PresetListType["ORDER_LIST_QUICK_5"] = "ORDER_LIST_QUICK_5";
|
|
14376
|
-
/** Quick ordered list using uppercase Roman numeral markers. */
|
|
14377
|
-
PresetListType["ORDER_LIST_QUICK_6"] = "ORDER_LIST_QUICK_6";
|
|
14378
|
-
/** Unchecked task-list item. */
|
|
14379
|
-
PresetListType["CHECK_LIST"] = "CHECK_LIST";
|
|
14380
|
-
/** Checked task-list item. */
|
|
14381
|
-
PresetListType["CHECK_LIST_CHECKED"] = "CHECK_LIST_CHECKED";
|
|
14382
|
-
return PresetListType;
|
|
14383
|
-
}({});
|
|
14384
|
-
const orderListSymbolMap = {
|
|
14385
|
-
"a)": {
|
|
14386
|
-
glyphFormat: "%1)",
|
|
14387
|
-
glyphType: 2
|
|
14388
|
-
},
|
|
14389
|
-
"1.": {
|
|
14390
|
-
glyphFormat: "%1.",
|
|
14391
|
-
glyphType: 2
|
|
14392
|
-
},
|
|
14393
|
-
"a.": {
|
|
14394
|
-
glyphFormat: "%1.",
|
|
14395
|
-
glyphType: 5
|
|
14396
|
-
},
|
|
14397
|
-
"A.": {
|
|
14398
|
-
glyphFormat: "%1.",
|
|
14399
|
-
glyphType: 4
|
|
14400
|
-
},
|
|
14401
|
-
"i.": {
|
|
14402
|
-
glyphFormat: "%1.",
|
|
14403
|
-
glyphType: 7
|
|
14404
|
-
},
|
|
14405
|
-
"I.": {
|
|
14406
|
-
glyphFormat: "%1.",
|
|
14407
|
-
glyphType: 4
|
|
14366
|
+
// src/docs/data-model/text-x/apply-utils/update-apply.ts
|
|
14367
|
+
function updateAttribute(body, updateBody, textLength, currentIndex, coverType) {
|
|
14368
|
+
return {
|
|
14369
|
+
dataStream: "",
|
|
14370
|
+
textRuns: updateTextRuns(body, updateBody, textLength, currentIndex, coverType),
|
|
14371
|
+
paragraphs: updateParagraphs(body, updateBody, textLength, currentIndex, coverType),
|
|
14372
|
+
sectionBreaks: updateSectionBreaks(body, updateBody, textLength, currentIndex, coverType),
|
|
14373
|
+
customBlocks: updateCustomBlocks(body, updateBody, textLength, currentIndex, coverType),
|
|
14374
|
+
docxRawCustomBlocks: updateDocxRawCustomBlocks(body, updateBody, textLength, currentIndex, coverType),
|
|
14375
|
+
tables: updateTables(body, updateBody, textLength, currentIndex, coverType),
|
|
14376
|
+
columnGroups: updateColumnGroups(body, updateBody, textLength, currentIndex, coverType),
|
|
14377
|
+
blockRanges: updateBlockRanges(body, updateBody, textLength, currentIndex, coverType),
|
|
14378
|
+
customRanges: updateCustomRanges(body, updateBody, textLength, currentIndex, coverType),
|
|
14379
|
+
customDecorations: updateCustomDecorations(body, updateBody, textLength, currentIndex, coverType)
|
|
14380
|
+
};
|
|
14381
|
+
}
|
|
14382
|
+
function updateTextRuns(body, updateBody, textLength, currentIndex, coverType) {
|
|
14383
|
+
const { textRuns: updateTextRuns } = updateBody;
|
|
14384
|
+
if (updateTextRuns == null || body.textRuns == null && !updateTextRuns.some((run) => run.sId || Object.keys(run.ts ?? {}).length)) return;
|
|
14385
|
+
body.textRuns ??= [];
|
|
14386
|
+
const removeTextRuns = deleteTextRuns(body, textLength, currentIndex);
|
|
14387
|
+
if (coverType !== 1) updateBody.textRuns = coverTextRuns(updateTextRuns, removeTextRuns, coverType);
|
|
14388
|
+
insertTextRuns(body, updateBody, textLength, currentIndex);
|
|
14389
|
+
return removeTextRuns;
|
|
14390
|
+
}
|
|
14391
|
+
function coverTextRuns(updateDataTextRuns, originTextRuns, coverType) {
|
|
14392
|
+
if (originTextRuns.length === 0) return updateDataTextRuns;
|
|
14393
|
+
updateDataTextRuns = Tools.deepClone(updateDataTextRuns);
|
|
14394
|
+
originTextRuns = Tools.deepClone(originTextRuns);
|
|
14395
|
+
const newUpdateTextRuns = [];
|
|
14396
|
+
const updateLength = updateDataTextRuns.length;
|
|
14397
|
+
const removeLength = originTextRuns.length;
|
|
14398
|
+
let updateIndex = 0;
|
|
14399
|
+
let removeIndex = 0;
|
|
14400
|
+
let pending = null;
|
|
14401
|
+
function pushPendingAndReturnStatus() {
|
|
14402
|
+
if (pending) {
|
|
14403
|
+
newUpdateTextRuns.push(pending);
|
|
14404
|
+
pending = null;
|
|
14405
|
+
return true;
|
|
14406
|
+
}
|
|
14407
|
+
return false;
|
|
14408
14408
|
}
|
|
14409
|
-
|
|
14410
|
-
const
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14409
|
+
while (updateIndex < updateLength && removeIndex < removeLength) {
|
|
14410
|
+
const { st: updateSt, ed: updateEd, ts: updateStyle } = updateDataTextRuns[updateIndex];
|
|
14411
|
+
const { st: removeSt, ed: removeEd, ts: originStyle, sId } = originTextRuns[removeIndex];
|
|
14412
|
+
let newTs;
|
|
14413
|
+
if (coverType === 0) newTs = {
|
|
14414
|
+
...originStyle,
|
|
14415
|
+
...updateStyle
|
|
14416
|
+
};
|
|
14417
|
+
else newTs = { ...updateStyle };
|
|
14418
|
+
if (updateEd < removeSt) {
|
|
14419
|
+
if (!pushPendingAndReturnStatus()) newUpdateTextRuns.push(updateDataTextRuns[updateIndex]);
|
|
14420
|
+
updateIndex++;
|
|
14421
|
+
} else if (removeEd < updateSt) {
|
|
14422
|
+
if (!pushPendingAndReturnStatus()) newUpdateTextRuns.push(originTextRuns[removeIndex]);
|
|
14423
|
+
removeIndex++;
|
|
14424
|
+
} else {
|
|
14425
|
+
const newTextRun = {
|
|
14426
|
+
st: Math.min(updateSt, removeSt),
|
|
14427
|
+
ed: Math.max(updateSt, removeSt),
|
|
14428
|
+
ts: updateSt < removeSt ? { ...updateStyle } : { ...originStyle },
|
|
14429
|
+
sId: updateSt < removeSt ? void 0 : sId
|
|
14430
|
+
};
|
|
14431
|
+
if (newTextRun.ed > newTextRun.st) newUpdateTextRuns.push(newTextRun);
|
|
14432
|
+
newUpdateTextRuns.push({
|
|
14433
|
+
st: Math.max(updateSt, removeSt),
|
|
14434
|
+
ed: Math.min(updateEd, removeEd),
|
|
14435
|
+
ts: newTs,
|
|
14436
|
+
sId
|
|
14437
|
+
});
|
|
14438
|
+
if (updateEd < removeEd) {
|
|
14439
|
+
updateIndex++;
|
|
14440
|
+
originTextRuns[removeIndex].st = updateEd;
|
|
14441
|
+
if (originTextRuns[removeIndex].st === originTextRuns[removeIndex].ed) removeIndex++;
|
|
14442
|
+
} else {
|
|
14443
|
+
removeIndex++;
|
|
14444
|
+
updateDataTextRuns[updateIndex].st = removeEd;
|
|
14445
|
+
if (updateDataTextRuns[updateIndex].st === updateDataTextRuns[updateIndex].ed) updateIndex++;
|
|
14446
|
+
}
|
|
14447
|
+
const pendingTextRun = {
|
|
14448
|
+
st: Math.min(updateEd, removeEd),
|
|
14449
|
+
ed: Math.max(updateEd, removeEd),
|
|
14450
|
+
ts: updateEd < removeEd ? { ...originStyle } : { ...updateStyle },
|
|
14451
|
+
sId: updateEd < removeEd ? sId : void 0
|
|
14452
|
+
};
|
|
14453
|
+
pending = pendingTextRun.ed > pendingTextRun.st ? pendingTextRun : null;
|
|
14423
14454
|
}
|
|
14424
|
-
}
|
|
14425
|
-
|
|
14426
|
-
const
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
};
|
|
14437
|
-
const
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
|
|
14468
|
-
listType: "BULLET_LIST",
|
|
14469
|
-
nestingLevel: bulletListFactory([
|
|
14470
|
-
"✔",
|
|
14471
|
-
"●",
|
|
14472
|
-
"◆"
|
|
14473
|
-
])
|
|
14474
|
-
},
|
|
14475
|
-
["BULLET_LIST_3"]: {
|
|
14476
|
-
listType: "BULLET_LIST",
|
|
14477
|
-
nestingLevel: bulletListFactory([
|
|
14478
|
-
"■",
|
|
14479
|
-
"◆",
|
|
14480
|
-
"○"
|
|
14481
|
-
])
|
|
14482
|
-
},
|
|
14483
|
-
["BULLET_LIST_4"]: {
|
|
14484
|
-
listType: "BULLET_LIST",
|
|
14485
|
-
nestingLevel: bulletListFactory([
|
|
14486
|
-
"✦",
|
|
14487
|
-
"○",
|
|
14488
|
-
"■"
|
|
14489
|
-
])
|
|
14490
|
-
},
|
|
14491
|
-
["BULLET_LIST_5"]: {
|
|
14492
|
-
listType: "BULLET_LIST",
|
|
14493
|
-
nestingLevel: bulletListFactory([
|
|
14494
|
-
"➢",
|
|
14495
|
-
"○",
|
|
14496
|
-
"◆"
|
|
14497
|
-
])
|
|
14498
|
-
},
|
|
14499
|
-
["ORDER_LIST"]: {
|
|
14500
|
-
listType: "ORDER_LIST",
|
|
14501
|
-
nestingLevel: orderListFactory([
|
|
14502
|
-
{
|
|
14503
|
-
glyphFormat: "%1.",
|
|
14504
|
-
glyphType: 2
|
|
14505
|
-
},
|
|
14506
|
-
{
|
|
14507
|
-
glyphFormat: "%2.",
|
|
14508
|
-
glyphType: 5
|
|
14509
|
-
},
|
|
14510
|
-
{
|
|
14511
|
-
glyphFormat: "%3.",
|
|
14512
|
-
glyphType: 7
|
|
14513
|
-
},
|
|
14514
|
-
{
|
|
14515
|
-
glyphFormat: "%4.",
|
|
14516
|
-
glyphType: 2
|
|
14517
|
-
},
|
|
14518
|
-
{
|
|
14519
|
-
glyphFormat: "%5.",
|
|
14520
|
-
glyphType: 5
|
|
14521
|
-
},
|
|
14522
|
-
{
|
|
14523
|
-
glyphFormat: "%6.",
|
|
14524
|
-
glyphType: 7
|
|
14525
|
-
},
|
|
14526
|
-
{
|
|
14527
|
-
glyphFormat: "%7.",
|
|
14528
|
-
glyphType: 2
|
|
14529
|
-
},
|
|
14530
|
-
{
|
|
14531
|
-
glyphFormat: "%8.",
|
|
14532
|
-
glyphType: 5
|
|
14533
|
-
},
|
|
14534
|
-
{
|
|
14535
|
-
glyphFormat: "%9.",
|
|
14536
|
-
glyphType: 7
|
|
14537
|
-
}
|
|
14538
|
-
])
|
|
14539
|
-
},
|
|
14540
|
-
["ORDER_LIST_1"]: {
|
|
14541
|
-
listType: "ORDER_LIST",
|
|
14542
|
-
nestingLevel: orderListFactory([
|
|
14543
|
-
{
|
|
14544
|
-
glyphFormat: "%1)",
|
|
14545
|
-
glyphType: 2
|
|
14546
|
-
},
|
|
14547
|
-
{
|
|
14548
|
-
glyphFormat: "%2)",
|
|
14549
|
-
glyphType: 5
|
|
14550
|
-
},
|
|
14551
|
-
{
|
|
14552
|
-
glyphFormat: "%3)",
|
|
14553
|
-
glyphType: 7
|
|
14554
|
-
},
|
|
14555
|
-
{
|
|
14556
|
-
glyphFormat: "%4)",
|
|
14557
|
-
glyphType: 2
|
|
14558
|
-
},
|
|
14559
|
-
{
|
|
14560
|
-
glyphFormat: "%5)",
|
|
14561
|
-
glyphType: 5
|
|
14562
|
-
},
|
|
14563
|
-
{
|
|
14564
|
-
glyphFormat: "%6)",
|
|
14565
|
-
glyphType: 7
|
|
14566
|
-
},
|
|
14567
|
-
{
|
|
14568
|
-
glyphFormat: "%7)",
|
|
14569
|
-
glyphType: 2
|
|
14570
|
-
},
|
|
14571
|
-
{
|
|
14572
|
-
glyphFormat: "%8)",
|
|
14573
|
-
glyphType: 5
|
|
14574
|
-
},
|
|
14575
|
-
{
|
|
14576
|
-
glyphFormat: "%9)",
|
|
14577
|
-
glyphType: 7
|
|
14578
|
-
}
|
|
14579
|
-
])
|
|
14580
|
-
},
|
|
14581
|
-
["ORDER_LIST_2"]: {
|
|
14582
|
-
listType: "ORDER_LIST",
|
|
14583
|
-
nestingLevel: orderListFactory([
|
|
14584
|
-
"%1.",
|
|
14585
|
-
"%1.%2.",
|
|
14586
|
-
"%1.%2.%3.",
|
|
14587
|
-
"%1.%2.%3.%4.",
|
|
14588
|
-
"%1.%2.%3.%4.%5.",
|
|
14589
|
-
"%1.%2.%3.%4.%5.%6.",
|
|
14590
|
-
"%1.%2.%3.%4.%5.%6.%7."
|
|
14591
|
-
].map((format) => ({
|
|
14592
|
-
glyphFormat: format,
|
|
14593
|
-
glyphType: 2
|
|
14594
|
-
})))
|
|
14595
|
-
},
|
|
14596
|
-
["ORDER_LIST_3"]: {
|
|
14597
|
-
listType: "ORDER_LIST",
|
|
14598
|
-
nestingLevel: orderListFactory([
|
|
14599
|
-
{
|
|
14600
|
-
glyphFormat: "%1.",
|
|
14601
|
-
glyphType: 4
|
|
14602
|
-
},
|
|
14603
|
-
{
|
|
14604
|
-
glyphFormat: "%2.",
|
|
14605
|
-
glyphType: 5
|
|
14606
|
-
},
|
|
14607
|
-
{
|
|
14608
|
-
glyphFormat: "%3.",
|
|
14609
|
-
glyphType: 7
|
|
14610
|
-
},
|
|
14611
|
-
{
|
|
14612
|
-
glyphFormat: "%4.",
|
|
14613
|
-
glyphType: 4
|
|
14614
|
-
},
|
|
14615
|
-
{
|
|
14616
|
-
glyphFormat: "%5.",
|
|
14617
|
-
glyphType: 5
|
|
14618
|
-
},
|
|
14619
|
-
{
|
|
14620
|
-
glyphFormat: "%6.",
|
|
14621
|
-
glyphType: 7
|
|
14622
|
-
},
|
|
14623
|
-
{
|
|
14624
|
-
glyphFormat: "%7.",
|
|
14625
|
-
glyphType: 4
|
|
14626
|
-
},
|
|
14627
|
-
{
|
|
14628
|
-
glyphFormat: "%8.",
|
|
14629
|
-
glyphType: 5
|
|
14630
|
-
},
|
|
14631
|
-
{
|
|
14632
|
-
glyphFormat: "%9.",
|
|
14633
|
-
glyphType: 7
|
|
14634
|
-
}
|
|
14635
|
-
])
|
|
14636
|
-
},
|
|
14637
|
-
["ORDER_LIST_4"]: {
|
|
14638
|
-
listType: "ORDER_LIST",
|
|
14639
|
-
nestingLevel: orderListFactory([
|
|
14640
|
-
{
|
|
14641
|
-
glyphFormat: "%1.",
|
|
14642
|
-
glyphType: 4
|
|
14643
|
-
},
|
|
14644
|
-
{
|
|
14645
|
-
glyphFormat: "%2.",
|
|
14646
|
-
glyphType: 2
|
|
14647
|
-
},
|
|
14648
|
-
{
|
|
14649
|
-
glyphFormat: "%3.",
|
|
14650
|
-
glyphType: 7
|
|
14651
|
-
},
|
|
14652
|
-
{
|
|
14653
|
-
glyphFormat: "%4.",
|
|
14654
|
-
glyphType: 4
|
|
14655
|
-
},
|
|
14656
|
-
{
|
|
14657
|
-
glyphFormat: "%5.",
|
|
14658
|
-
glyphType: 2
|
|
14659
|
-
},
|
|
14660
|
-
{
|
|
14661
|
-
glyphFormat: "%6.",
|
|
14662
|
-
glyphType: 7
|
|
14663
|
-
},
|
|
14664
|
-
{
|
|
14665
|
-
glyphFormat: "%7.",
|
|
14666
|
-
glyphType: 4
|
|
14667
|
-
},
|
|
14668
|
-
{
|
|
14669
|
-
glyphFormat: "%8.",
|
|
14670
|
-
glyphType: 2
|
|
14671
|
-
},
|
|
14672
|
-
{
|
|
14673
|
-
glyphFormat: "%9.",
|
|
14674
|
-
glyphType: 7
|
|
14675
|
-
}
|
|
14676
|
-
])
|
|
14677
|
-
},
|
|
14678
|
-
["ORDER_LIST_5"]: {
|
|
14679
|
-
listType: "ORDER_LIST",
|
|
14680
|
-
nestingLevel: orderListFactory([
|
|
14681
|
-
{
|
|
14682
|
-
glyphFormat: "%1.",
|
|
14683
|
-
glyphType: 3
|
|
14684
|
-
},
|
|
14685
|
-
{
|
|
14686
|
-
glyphFormat: "%2.",
|
|
14687
|
-
glyphType: 5
|
|
14688
|
-
},
|
|
14689
|
-
{
|
|
14690
|
-
glyphFormat: "%3.",
|
|
14691
|
-
glyphType: 7
|
|
14692
|
-
},
|
|
14693
|
-
{
|
|
14694
|
-
glyphFormat: "%4.",
|
|
14695
|
-
glyphType: 3
|
|
14696
|
-
},
|
|
14697
|
-
{
|
|
14698
|
-
glyphFormat: "%5.",
|
|
14699
|
-
glyphType: 5
|
|
14700
|
-
},
|
|
14701
|
-
{
|
|
14702
|
-
glyphFormat: "%6.",
|
|
14703
|
-
glyphType: 7
|
|
14704
|
-
},
|
|
14705
|
-
{
|
|
14706
|
-
glyphFormat: "%7.",
|
|
14707
|
-
glyphType: 3
|
|
14708
|
-
},
|
|
14709
|
-
{
|
|
14710
|
-
glyphFormat: "%8.",
|
|
14711
|
-
glyphType: 5
|
|
14712
|
-
},
|
|
14713
|
-
{
|
|
14714
|
-
glyphFormat: "%9.",
|
|
14715
|
-
glyphType: 7
|
|
14716
|
-
}
|
|
14717
|
-
])
|
|
14718
|
-
},
|
|
14719
|
-
["CHECK_LIST"]: {
|
|
14720
|
-
listType: "CHECK_LIST",
|
|
14721
|
-
nestingLevel: checkListFactory("☐")
|
|
14722
|
-
},
|
|
14723
|
-
["CHECK_LIST_CHECKED"]: {
|
|
14724
|
-
listType: "CHECK_LIST_CHECKED",
|
|
14725
|
-
nestingLevel: checkListFactory("☑", { st: { s: 1 } })
|
|
14726
|
-
}
|
|
14727
|
-
};
|
|
14728
|
-
const generateOrderList = (opt) => {
|
|
14729
|
-
const { glyphFormat, glyphType } = opt;
|
|
14730
|
-
const data = Tools.deepClone(PRESET_LIST_TYPE["ORDER_LIST"]);
|
|
14731
|
-
data.nestingLevel[0].glyphFormat = glyphFormat;
|
|
14732
|
-
data.nestingLevel[0].glyphType = glyphType;
|
|
14733
|
-
return data;
|
|
14734
|
-
};
|
|
14735
|
-
const QUICK_LIST_TYPE = {
|
|
14736
|
-
["ORDER_LIST_QUICK_2"]: generateOrderList(orderListSymbolMap["a)"]),
|
|
14737
|
-
["ORDER_LIST_QUICK_3"]: generateOrderList(orderListSymbolMap["a."]),
|
|
14738
|
-
["ORDER_LIST_QUICK_4"]: generateOrderList(orderListSymbolMap["i."]),
|
|
14739
|
-
["ORDER_LIST_QUICK_6"]: generateOrderList(orderListSymbolMap["I."])
|
|
14740
|
-
};
|
|
14741
|
-
Object.assign(PRESET_LIST_TYPE, QUICK_LIST_TYPE);
|
|
14742
|
-
const QuickListTypeMap = {
|
|
14743
|
-
["1."]: "ORDER_LIST",
|
|
14744
|
-
["a)"]: "ORDER_LIST_QUICK_2",
|
|
14745
|
-
["a."]: "ORDER_LIST_QUICK_3",
|
|
14746
|
-
["i."]: "ORDER_LIST_QUICK_4",
|
|
14747
|
-
["A."]: "ORDER_LIST_3",
|
|
14748
|
-
["I."]: "ORDER_LIST_QUICK_6",
|
|
14749
|
-
["01."]: "ORDER_LIST_5",
|
|
14750
|
-
["*"]: "BULLET_LIST"
|
|
14751
|
-
};
|
|
14752
|
-
|
|
14753
|
-
// src/docs/data-model/text-x/apply-utils/update-apply.ts
|
|
14754
|
-
function updateAttribute(body, updateBody, textLength, currentIndex, coverType) {
|
|
14755
|
-
return {
|
|
14756
|
-
dataStream: "",
|
|
14757
|
-
textRuns: updateTextRuns(body, updateBody, textLength, currentIndex, coverType),
|
|
14758
|
-
paragraphs: updateParagraphs(body, updateBody, textLength, currentIndex, coverType),
|
|
14759
|
-
sectionBreaks: updateSectionBreaks(body, updateBody, textLength, currentIndex, coverType),
|
|
14760
|
-
customBlocks: updateCustomBlocks(body, updateBody, textLength, currentIndex, coverType),
|
|
14761
|
-
docxRawCustomBlocks: updateDocxRawCustomBlocks(body, updateBody, textLength, currentIndex, coverType),
|
|
14762
|
-
tables: updateTables(body, updateBody, textLength, currentIndex, coverType),
|
|
14763
|
-
columnGroups: updateColumnGroups(body, updateBody, textLength, currentIndex, coverType),
|
|
14764
|
-
blockRanges: updateBlockRanges(body, updateBody, textLength, currentIndex, coverType),
|
|
14765
|
-
customRanges: updateCustomRanges(body, updateBody, textLength, currentIndex, coverType),
|
|
14766
|
-
customDecorations: updateCustomDecorations(body, updateBody, textLength, currentIndex, coverType)
|
|
14767
|
-
};
|
|
14768
|
-
}
|
|
14769
|
-
function updateTextRuns(body, updateBody, textLength, currentIndex, coverType) {
|
|
14770
|
-
const { textRuns } = body;
|
|
14771
|
-
const { textRuns: updateTextRuns } = updateBody;
|
|
14772
|
-
if (textRuns == null || updateTextRuns == null) return;
|
|
14773
|
-
const removeTextRuns = deleteTextRuns(body, textLength, currentIndex);
|
|
14774
|
-
if (coverType !== 1) updateBody.textRuns = coverTextRuns(updateTextRuns, removeTextRuns, coverType);
|
|
14775
|
-
insertTextRuns(body, updateBody, textLength, currentIndex);
|
|
14776
|
-
return removeTextRuns;
|
|
14777
|
-
}
|
|
14778
|
-
function coverTextRuns(updateDataTextRuns, originTextRuns, coverType) {
|
|
14779
|
-
if (originTextRuns.length === 0) return updateDataTextRuns;
|
|
14780
|
-
updateDataTextRuns = Tools.deepClone(updateDataTextRuns);
|
|
14781
|
-
originTextRuns = Tools.deepClone(originTextRuns);
|
|
14782
|
-
const newUpdateTextRuns = [];
|
|
14783
|
-
const updateLength = updateDataTextRuns.length;
|
|
14784
|
-
const removeLength = originTextRuns.length;
|
|
14785
|
-
let updateIndex = 0;
|
|
14786
|
-
let removeIndex = 0;
|
|
14787
|
-
let pending = null;
|
|
14788
|
-
function pushPendingAndReturnStatus() {
|
|
14789
|
-
if (pending) {
|
|
14790
|
-
newUpdateTextRuns.push(pending);
|
|
14791
|
-
pending = null;
|
|
14792
|
-
return true;
|
|
14793
|
-
}
|
|
14794
|
-
return false;
|
|
14795
|
-
}
|
|
14796
|
-
while (updateIndex < updateLength && removeIndex < removeLength) {
|
|
14797
|
-
const { st: updateSt, ed: updateEd, ts: updateStyle } = updateDataTextRuns[updateIndex];
|
|
14798
|
-
const { st: removeSt, ed: removeEd, ts: originStyle, sId } = originTextRuns[removeIndex];
|
|
14799
|
-
let newTs;
|
|
14800
|
-
if (coverType === 0) newTs = {
|
|
14801
|
-
...originStyle,
|
|
14802
|
-
...updateStyle
|
|
14803
|
-
};
|
|
14804
|
-
else newTs = { ...updateStyle };
|
|
14805
|
-
if (updateEd < removeSt) {
|
|
14806
|
-
if (!pushPendingAndReturnStatus()) newUpdateTextRuns.push(updateDataTextRuns[updateIndex]);
|
|
14807
|
-
updateIndex++;
|
|
14808
|
-
} else if (removeEd < updateSt) {
|
|
14809
|
-
if (!pushPendingAndReturnStatus()) newUpdateTextRuns.push(originTextRuns[removeIndex]);
|
|
14810
|
-
removeIndex++;
|
|
14811
|
-
} else {
|
|
14812
|
-
const newTextRun = {
|
|
14813
|
-
st: Math.min(updateSt, removeSt),
|
|
14814
|
-
ed: Math.max(updateSt, removeSt),
|
|
14815
|
-
ts: updateSt < removeSt ? { ...updateStyle } : { ...originStyle },
|
|
14816
|
-
sId: updateSt < removeSt ? void 0 : sId
|
|
14817
|
-
};
|
|
14818
|
-
if (newTextRun.ed > newTextRun.st) newUpdateTextRuns.push(newTextRun);
|
|
14819
|
-
newUpdateTextRuns.push({
|
|
14820
|
-
st: Math.max(updateSt, removeSt),
|
|
14821
|
-
ed: Math.min(updateEd, removeEd),
|
|
14822
|
-
ts: newTs,
|
|
14823
|
-
sId
|
|
14824
|
-
});
|
|
14825
|
-
if (updateEd < removeEd) {
|
|
14826
|
-
updateIndex++;
|
|
14827
|
-
originTextRuns[removeIndex].st = updateEd;
|
|
14828
|
-
if (originTextRuns[removeIndex].st === originTextRuns[removeIndex].ed) removeIndex++;
|
|
14829
|
-
} else {
|
|
14830
|
-
removeIndex++;
|
|
14831
|
-
updateDataTextRuns[updateIndex].st = removeEd;
|
|
14832
|
-
if (updateDataTextRuns[updateIndex].st === updateDataTextRuns[updateIndex].ed) updateIndex++;
|
|
14833
|
-
}
|
|
14834
|
-
const pendingTextRun = {
|
|
14835
|
-
st: Math.min(updateEd, removeEd),
|
|
14836
|
-
ed: Math.max(updateEd, removeEd),
|
|
14837
|
-
ts: updateEd < removeEd ? { ...originStyle } : { ...updateStyle },
|
|
14838
|
-
sId: updateEd < removeEd ? sId : void 0
|
|
14839
|
-
};
|
|
14840
|
-
pending = pendingTextRun.ed > pendingTextRun.st ? pendingTextRun : null;
|
|
14841
|
-
}
|
|
14842
|
-
}
|
|
14843
|
-
pushPendingAndReturnStatus();
|
|
14844
|
-
const tempTopTextRun = newUpdateTextRuns[newUpdateTextRuns.length - 1];
|
|
14845
|
-
const updateLastTextRun = updateDataTextRuns[updateLength - 1];
|
|
14846
|
-
const removeLastTextRun = originTextRuns[removeLength - 1];
|
|
14847
|
-
if (tempTopTextRun && tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed)) {
|
|
14848
|
-
if (updateLastTextRun.ed > removeLastTextRun.ed) newUpdateTextRuns.push(updateLastTextRun);
|
|
14849
|
-
else newUpdateTextRuns.push(removeLastTextRun);
|
|
14850
|
-
}
|
|
14851
|
-
return normalizeTextRuns(newUpdateTextRuns);
|
|
14852
|
-
}
|
|
14853
|
-
function updateParagraphs(body, updateBody, textLength, currentIndex, coverType) {
|
|
14854
|
-
const { paragraphs } = body;
|
|
14855
|
-
const { paragraphs: updateDataParagraphs } = updateBody;
|
|
14856
|
-
if (paragraphs == null || updateDataParagraphs == null) return;
|
|
14857
|
-
const removeParagraphs = deleteParagraphs(body, textLength, currentIndex);
|
|
14858
|
-
if (coverType !== 1) {
|
|
14859
|
-
const newUpdateParagraphs = [];
|
|
14860
|
-
for (const updateParagraph of updateDataParagraphs) {
|
|
14861
|
-
const { startIndex: updateStartIndex, paragraphId: updateParagraphId, paragraphStyle: updateParagraphStyle, bullet: updateBullet } = updateParagraph;
|
|
14862
|
-
let splitUpdateParagraphs = [];
|
|
14863
|
-
for (const removeParagraph of removeParagraphs) {
|
|
14864
|
-
const { startIndex: removeStartIndex, paragraphId: removeParagraphId, paragraphStyle: removeParagraphStyle, bullet: removeBullet } = removeParagraph;
|
|
14865
|
-
let newParagraphStyle;
|
|
14866
|
-
let newBullet;
|
|
14867
|
-
const paragraphAttributes = coverType === 0 ? {
|
|
14868
|
-
...removeParagraph,
|
|
14869
|
-
...updateParagraph
|
|
14870
|
-
} : {
|
|
14871
|
-
...updateParagraph,
|
|
14872
|
-
...removeParagraph
|
|
14873
|
-
};
|
|
14874
|
-
if (coverType === 0) {
|
|
14875
|
-
newParagraphStyle = {
|
|
14876
|
-
...removeParagraphStyle,
|
|
14877
|
-
...updateParagraphStyle
|
|
14878
|
-
};
|
|
14879
|
-
newBullet = {
|
|
14880
|
-
listId: "",
|
|
14881
|
-
listType: "BULLET_LIST",
|
|
14882
|
-
nestingLevel: 0,
|
|
14883
|
-
textStyle: {},
|
|
14884
|
-
...removeBullet,
|
|
14885
|
-
...updateBullet
|
|
14886
|
-
};
|
|
14887
|
-
} else {
|
|
14888
|
-
newParagraphStyle = {
|
|
14889
|
-
...updateParagraphStyle,
|
|
14890
|
-
...removeParagraphStyle
|
|
14891
|
-
};
|
|
14892
|
-
newBullet = {
|
|
14893
|
-
listId: "",
|
|
14894
|
-
listType: "BULLET_LIST",
|
|
14895
|
-
nestingLevel: 0,
|
|
14896
|
-
textStyle: {},
|
|
14897
|
-
...updateBullet,
|
|
14898
|
-
...removeBullet
|
|
14899
|
-
};
|
|
14900
|
-
}
|
|
14901
|
-
if (updateStartIndex === removeStartIndex) {
|
|
14902
|
-
splitUpdateParagraphs.push({
|
|
14903
|
-
...paragraphAttributes,
|
|
14904
|
-
startIndex: updateStartIndex,
|
|
14905
|
-
paragraphId: updateParagraphId ?? removeParagraphId,
|
|
14906
|
-
paragraphStyle: newParagraphStyle,
|
|
14907
|
-
bullet: removeBullet == null && updateBullet == null ? void 0 : newBullet
|
|
14908
|
-
});
|
|
14909
|
-
break;
|
|
14910
|
-
}
|
|
14911
|
-
}
|
|
14912
|
-
newUpdateParagraphs.push(...splitUpdateParagraphs);
|
|
14913
|
-
splitUpdateParagraphs = [];
|
|
14455
|
+
}
|
|
14456
|
+
pushPendingAndReturnStatus();
|
|
14457
|
+
const tempTopTextRun = newUpdateTextRuns[newUpdateTextRuns.length - 1];
|
|
14458
|
+
const updateLastTextRun = updateDataTextRuns[updateLength - 1];
|
|
14459
|
+
const removeLastTextRun = originTextRuns[removeLength - 1];
|
|
14460
|
+
if (tempTopTextRun && tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed)) {
|
|
14461
|
+
if (updateLastTextRun.ed > removeLastTextRun.ed) newUpdateTextRuns.push(updateLastTextRun);
|
|
14462
|
+
else newUpdateTextRuns.push(removeLastTextRun);
|
|
14463
|
+
}
|
|
14464
|
+
return normalizeTextRuns(newUpdateTextRuns);
|
|
14465
|
+
}
|
|
14466
|
+
function updateParagraphs(body, updateBody, textLength, currentIndex, coverType) {
|
|
14467
|
+
const { paragraphs } = body;
|
|
14468
|
+
const { paragraphs: updateDataParagraphs } = updateBody;
|
|
14469
|
+
if (paragraphs == null || updateDataParagraphs == null) return;
|
|
14470
|
+
const removeParagraphs = deleteParagraphs(body, textLength, currentIndex);
|
|
14471
|
+
if (coverType !== 1) {
|
|
14472
|
+
const newUpdateParagraphs = [];
|
|
14473
|
+
for (const updateParagraph of updateDataParagraphs) {
|
|
14474
|
+
const { startIndex: updateStartIndex, paragraphId: updateParagraphId } = updateParagraph;
|
|
14475
|
+
for (const removeParagraph of removeParagraphs) {
|
|
14476
|
+
if (updateStartIndex !== removeParagraph.startIndex) continue;
|
|
14477
|
+
const [lower, higher] = coverType === 0 ? [removeParagraph, updateParagraph] : [updateParagraph, removeParagraph];
|
|
14478
|
+
let bullet = lower.bullet == null ? lower.bullet : { ...lower.bullet };
|
|
14479
|
+
if (higher.bullet === null) bullet = null;
|
|
14480
|
+
else if (higher.bullet !== void 0) bullet = {
|
|
14481
|
+
...bullet,
|
|
14482
|
+
...higher.bullet
|
|
14483
|
+
};
|
|
14484
|
+
const paragraph = {
|
|
14485
|
+
...lower,
|
|
14486
|
+
...higher,
|
|
14487
|
+
startIndex: updateStartIndex,
|
|
14488
|
+
paragraphId: updateParagraphId ?? removeParagraph.paragraphId,
|
|
14489
|
+
paragraphStyle: {
|
|
14490
|
+
...lower.paragraphStyle,
|
|
14491
|
+
...higher.paragraphStyle
|
|
14492
|
+
}
|
|
14493
|
+
};
|
|
14494
|
+
if (bullet === void 0) delete paragraph.bullet;
|
|
14495
|
+
else paragraph.bullet = bullet;
|
|
14496
|
+
newUpdateParagraphs.push(paragraph);
|
|
14497
|
+
break;
|
|
14498
|
+
}
|
|
14914
14499
|
}
|
|
14915
14500
|
updateBody.paragraphs = newUpdateParagraphs;
|
|
14916
14501
|
} else for (const updateParagraph of updateDataParagraphs) {
|
|
@@ -15146,49 +14731,775 @@ function updateCustomRanges(body, updateBody, textLength, currentIndex, _coverTy
|
|
|
15146
14731
|
newCustomRanges[position] = ordered[index];
|
|
15147
14732
|
});
|
|
15148
14733
|
}
|
|
15149
|
-
body.customRanges = mergeContinuousRanges(newCustomRanges);
|
|
15150
|
-
return removeCustomRanges;
|
|
15151
|
-
}
|
|
15152
|
-
function updateCustomDecorations(body, updateBody, textLength, currentIndex, coverType) {
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
const
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
14734
|
+
body.customRanges = mergeContinuousRanges(newCustomRanges);
|
|
14735
|
+
return removeCustomRanges;
|
|
14736
|
+
}
|
|
14737
|
+
function updateCustomDecorations(body, updateBody, textLength, currentIndex, coverType) {
|
|
14738
|
+
var _updateBody$customDec;
|
|
14739
|
+
if (body.customDecorations == null && !((_updateBody$customDec = updateBody.customDecorations) === null || _updateBody$customDec === void 0 ? void 0 : _updateBody$customDec.length)) return;
|
|
14740
|
+
if (!body.customDecorations) body.customDecorations = [];
|
|
14741
|
+
splitCustomDecoratesByIndex(body.customDecorations, currentIndex);
|
|
14742
|
+
splitCustomDecoratesByIndex(body.customDecorations, currentIndex + textLength);
|
|
14743
|
+
const removeCustomDecorations = [];
|
|
14744
|
+
const { customDecorations } = body;
|
|
14745
|
+
const { customDecorations: updateDataCustomDecorations = [] } = updateBody;
|
|
14746
|
+
if (coverType === 1) {
|
|
14747
|
+
for (let index = 0; index < customDecorations.length; index++) {
|
|
14748
|
+
const customDecoration = customDecorations[index];
|
|
14749
|
+
const { startIndex, endIndex } = customDecoration;
|
|
14750
|
+
if (startIndex >= currentIndex && endIndex <= currentIndex + textLength - 1) removeCustomDecorations.push(customDecoration);
|
|
14751
|
+
}
|
|
14752
|
+
updateDataCustomDecorations.forEach((customDecoration) => {
|
|
14753
|
+
const { startIndex, endIndex } = customDecoration;
|
|
14754
|
+
customDecorations.push({
|
|
14755
|
+
...customDecoration,
|
|
14756
|
+
startIndex: startIndex + currentIndex,
|
|
14757
|
+
endIndex: endIndex + currentIndex
|
|
14758
|
+
});
|
|
14759
|
+
});
|
|
14760
|
+
} else for (const updateCustomDecoration of updateDataCustomDecorations) {
|
|
14761
|
+
const { id } = updateCustomDecoration;
|
|
14762
|
+
if (updateCustomDecoration.type === 9999) {
|
|
14763
|
+
const oldCustomDecorations = customDecorations.filter((d) => d.id === id);
|
|
14764
|
+
if (oldCustomDecorations.length) removeCustomDecorations.push(...oldCustomDecorations);
|
|
14765
|
+
} else customDecorations.push({
|
|
14766
|
+
...updateCustomDecoration,
|
|
14767
|
+
startIndex: updateCustomDecoration.startIndex + currentIndex,
|
|
14768
|
+
endIndex: updateCustomDecoration.endIndex + currentIndex
|
|
14769
|
+
});
|
|
14770
|
+
}
|
|
14771
|
+
for (const removeCustomDecoration of removeCustomDecorations) {
|
|
14772
|
+
const { id } = removeCustomDecoration;
|
|
14773
|
+
const index = customDecorations.findIndex((d) => d.id === id);
|
|
14774
|
+
if (index !== -1) customDecorations.splice(index, 1);
|
|
14775
|
+
}
|
|
14776
|
+
body.customDecorations = mergeContinuousDecorations(customDecorations);
|
|
14777
|
+
return removeCustomDecorations;
|
|
14778
|
+
}
|
|
14779
|
+
|
|
14780
|
+
// src/docs/data-model/paragraph-style.ts
|
|
14781
|
+
/** Resolves style numbering and partial direct overrides without changing persisted paragraph data. */
|
|
14782
|
+
function resolveDocumentParagraphBullet(document, paragraph) {
|
|
14783
|
+
var _document$documentSty;
|
|
14784
|
+
if (paragraph.bullet === null) return;
|
|
14785
|
+
const chain = [];
|
|
14786
|
+
const visited = /* @__PURE__ */ new Set();
|
|
14787
|
+
let styleId = paragraph.styleId ?? ((_document$documentSty = document.documentStyle) === null || _document$documentSty === void 0 ? void 0 : _document$documentSty.defaultParagraphStyleId);
|
|
14788
|
+
while (styleId && !visited.has(styleId)) {
|
|
14789
|
+
var _document$styles;
|
|
14790
|
+
visited.add(styleId);
|
|
14791
|
+
const style = (_document$styles = document.styles) === null || _document$styles === void 0 ? void 0 : _document$styles[styleId];
|
|
14792
|
+
if (!style || style.type !== 1) break;
|
|
14793
|
+
chain.unshift(style);
|
|
14794
|
+
styleId = style.basedOn;
|
|
14795
|
+
}
|
|
14796
|
+
let resolved = {};
|
|
14797
|
+
for (const bullet of [...chain.map((style) => style.bullet), paragraph.bullet]) {
|
|
14798
|
+
if (bullet === null) {
|
|
14799
|
+
resolved = {};
|
|
14800
|
+
continue;
|
|
14801
|
+
}
|
|
14802
|
+
if ((bullet === null || bullet === void 0 ? void 0 : bullet.listId) != null && bullet.listId !== resolved.listId && bullet.listType == null) delete resolved.listType;
|
|
14803
|
+
resolved = {
|
|
14804
|
+
...resolved,
|
|
14805
|
+
...bullet
|
|
14806
|
+
};
|
|
14807
|
+
}
|
|
14808
|
+
const { listId, nestingLevel = 0 } = resolved;
|
|
14809
|
+
if (listId == null || listId === "0") return;
|
|
14810
|
+
const definition = Object.keys(document.lists ?? {}).find((key) => {
|
|
14811
|
+
var _document$lists;
|
|
14812
|
+
return (_document$lists = document.lists) === null || _document$lists === void 0 || (_document$lists = _document$lists[key].counterIds) === null || _document$lists === void 0 ? void 0 : _document$lists.includes(listId);
|
|
14813
|
+
});
|
|
14814
|
+
const listType = resolved.listType ?? definition ?? listId;
|
|
14815
|
+
return {
|
|
14816
|
+
...resolved,
|
|
14817
|
+
listId,
|
|
14818
|
+
listType,
|
|
14819
|
+
nestingLevel
|
|
14820
|
+
};
|
|
14821
|
+
}
|
|
14822
|
+
function _definedStyle(style) {
|
|
14823
|
+
if (style == null) return {};
|
|
14824
|
+
const definedStyle = Tools.deepClone(style);
|
|
14825
|
+
Tools.removeNull(definedStyle);
|
|
14826
|
+
for (const key of ["textStyle", "paragraphMarkTextStyle"]) {
|
|
14827
|
+
var _style$key;
|
|
14828
|
+
if (((_style$key = style[key]) === null || _style$key === void 0 ? void 0 : _style$key.eastAsiaFontTheme) === null) (definedStyle[key] ??= {}).eastAsiaFontTheme = null;
|
|
14829
|
+
}
|
|
14830
|
+
return definedStyle;
|
|
14831
|
+
}
|
|
14832
|
+
function _mergeWordLength(previous, next, relativeUnit) {
|
|
14833
|
+
if (next.u === relativeUnit) {
|
|
14834
|
+
const fallback = next.fallback ?? ((previous === null || previous === void 0 ? void 0 : previous.u) === relativeUnit ? previous.fallback : previous === null || previous === void 0 ? void 0 : previous.v);
|
|
14835
|
+
return fallback == null ? { ...next } : {
|
|
14836
|
+
...next,
|
|
14837
|
+
fallback
|
|
14838
|
+
};
|
|
14839
|
+
}
|
|
14840
|
+
if ((previous === null || previous === void 0 ? void 0 : previous.u) === relativeUnit) return {
|
|
14841
|
+
...previous,
|
|
14842
|
+
fallback: next.v
|
|
14843
|
+
};
|
|
14844
|
+
return { ...next };
|
|
14845
|
+
}
|
|
14846
|
+
function _assignWordIndents(result, style) {
|
|
14847
|
+
for (const key of [
|
|
14848
|
+
"indentStart",
|
|
14849
|
+
"indentEnd",
|
|
14850
|
+
...["indentFirstLine", "hanging"]
|
|
14851
|
+
]) {
|
|
14852
|
+
const value = style[key];
|
|
14853
|
+
if (value == null) continue;
|
|
14854
|
+
if (key === "indentFirstLine" || key === "hanging") {
|
|
14855
|
+
var _result$opposite;
|
|
14856
|
+
const opposite = key === "hanging" ? "indentFirstLine" : "hanging";
|
|
14857
|
+
if (value.u === 2 && ((_result$opposite = result[opposite]) === null || _result$opposite === void 0 ? void 0 : _result$opposite.u) === 2) result[opposite] = {
|
|
14858
|
+
...result[opposite],
|
|
14859
|
+
v: 0
|
|
14860
|
+
};
|
|
14861
|
+
if (value.u !== 2 || value.fallback != null) {
|
|
14862
|
+
var _result$opposite2;
|
|
14863
|
+
if (((_result$opposite2 = result[opposite]) === null || _result$opposite2 === void 0 ? void 0 : _result$opposite2.u) === 2) {
|
|
14864
|
+
result[opposite] = { ...result[opposite] };
|
|
14865
|
+
delete result[opposite].fallback;
|
|
14866
|
+
} else delete result[opposite];
|
|
14867
|
+
}
|
|
14868
|
+
}
|
|
14869
|
+
result[key] = _mergeWordLength(result[key], value, 2);
|
|
14870
|
+
}
|
|
14871
|
+
}
|
|
14872
|
+
function _assignParagraphStyle(result, style, useWordIndents = false) {
|
|
14873
|
+
var _style$indentFirstLin;
|
|
14874
|
+
const zeroCharacterFirstLine = (style === null || style === void 0 || (_style$indentFirstLin = style.indentFirstLine) === null || _style$indentFirstLin === void 0 ? void 0 : _style$indentFirstLin.u) === 2 && style.indentFirstLine.v === 0;
|
|
14875
|
+
if (!useWordIndents && (style === null || style === void 0 ? void 0 : style.indentFirstLine) != null && style.hanging == null && !zeroCharacterFirstLine) delete result.hanging;
|
|
14876
|
+
else if (!useWordIndents && (style === null || style === void 0 ? void 0 : style.hanging) != null && style.indentFirstLine == null) delete result.indentFirstLine;
|
|
14877
|
+
const inheritedTabs = result.tabStops;
|
|
14878
|
+
const inheritedIndents = {
|
|
14879
|
+
indentStart: result.indentStart,
|
|
14880
|
+
indentEnd: result.indentEnd,
|
|
14881
|
+
indentFirstLine: result.indentFirstLine,
|
|
14882
|
+
hanging: result.hanging,
|
|
14883
|
+
spaceAbove: result.spaceAbove,
|
|
14884
|
+
spaceBelow: result.spaceBelow
|
|
14885
|
+
};
|
|
14886
|
+
Object.assign(result, style);
|
|
14887
|
+
if (useWordIndents && style) {
|
|
14888
|
+
Object.assign(result, inheritedIndents);
|
|
14889
|
+
_assignWordIndents(result, style);
|
|
14890
|
+
for (const key of ["spaceAbove", "spaceBelow"]) {
|
|
14891
|
+
const value = style[key];
|
|
14892
|
+
if (value != null) result[key] = _mergeWordLength(result[key], value, 1);
|
|
14893
|
+
}
|
|
14894
|
+
}
|
|
14895
|
+
if (inheritedTabs && (style === null || style === void 0 ? void 0 : style.tabStops)) {
|
|
14896
|
+
const tabs = new Map(inheritedTabs.map((tab) => [tab.offset, tab]));
|
|
14897
|
+
for (const tab of style.tabStops) tabs.set(tab.offset, tab);
|
|
14898
|
+
result.tabStops = [...tabs.values()].sort((left, right) => left.offset - right.offset);
|
|
14899
|
+
}
|
|
14900
|
+
}
|
|
14901
|
+
function resolveDocumentTextStyle(styles, styleId) {
|
|
14902
|
+
const chain = [];
|
|
14903
|
+
const visited = /* @__PURE__ */ new Set();
|
|
14904
|
+
let currentId = styleId;
|
|
14905
|
+
while (currentId && !visited.has(currentId)) {
|
|
14906
|
+
visited.add(currentId);
|
|
14907
|
+
const style = styles === null || styles === void 0 ? void 0 : styles[currentId];
|
|
14908
|
+
if (!style) break;
|
|
14909
|
+
chain.unshift(style.textStyle ?? {});
|
|
14910
|
+
currentId = style.basedOn ?? (style.type === 0 ? style.link : void 0);
|
|
14911
|
+
}
|
|
14912
|
+
return Object.assign({}, ...chain);
|
|
14913
|
+
}
|
|
14914
|
+
function _resolveNamedParagraphStyle(styles, styleId, useWordIndents) {
|
|
14915
|
+
if (!styles || !styleId) return {};
|
|
14916
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
14917
|
+
const resolve = (currentStyleId) => {
|
|
14918
|
+
if (visiting.has(currentStyleId)) return {};
|
|
14919
|
+
const style = styles[currentStyleId];
|
|
14920
|
+
if (!style || style.type !== 1) return {};
|
|
14921
|
+
visiting.add(currentStyleId);
|
|
14922
|
+
const base = style.basedOn ? resolve(style.basedOn) : {};
|
|
14923
|
+
visiting.delete(currentStyleId);
|
|
14924
|
+
const own = _definedStyle(style.paragraphStyle);
|
|
14925
|
+
const result = { ...base };
|
|
14926
|
+
_assignParagraphStyle(result, own, useWordIndents);
|
|
14927
|
+
const textStyle = {
|
|
14928
|
+
...base.textStyle,
|
|
14929
|
+
...style.textStyle,
|
|
14930
|
+
...own.textStyle
|
|
14931
|
+
};
|
|
14932
|
+
if (Object.keys(textStyle).length) result.textStyle = textStyle;
|
|
14933
|
+
return result;
|
|
14934
|
+
};
|
|
14935
|
+
return resolve(styleId);
|
|
14936
|
+
}
|
|
14937
|
+
function resolveDocumentParagraphStyle(documentStyle, paragraphStyle, options = {}) {
|
|
14938
|
+
var _options$lists, _options$styles;
|
|
14939
|
+
const legacyStyle = options.useLegacyModernDefaults ?? (documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 2 ? {
|
|
14940
|
+
lineSpacing: DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING,
|
|
14941
|
+
spaceAbove: { v: 0 },
|
|
14942
|
+
spaceBelow: { v: 12 }
|
|
14943
|
+
} : {};
|
|
14944
|
+
const documentDefaults = {
|
|
14945
|
+
...(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 1 ? { widowControl: 1 } : {},
|
|
14946
|
+
...legacyStyle,
|
|
14947
|
+
..._definedStyle(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.defaultParagraphStyle)
|
|
14948
|
+
};
|
|
14949
|
+
if (options.excludeDocumentOuterSpacing) {
|
|
14950
|
+
delete documentDefaults.spaceAbove;
|
|
14951
|
+
delete documentDefaults.spaceBelow;
|
|
14952
|
+
}
|
|
14953
|
+
const definedParagraphStyle = _definedStyle(paragraphStyle);
|
|
14954
|
+
const paragraphStyleId = options.paragraphStyleId ?? (definedParagraphStyle.namedStyleType == null || definedParagraphStyle.namedStyleType === 0 || definedParagraphStyle.namedStyleType === 1 ? documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.defaultParagraphStyleId : void 0);
|
|
14955
|
+
const referencedParagraphStyle = _resolveNamedParagraphStyle(options.styles, paragraphStyleId, (documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 1);
|
|
14956
|
+
const bullet = resolveDocumentParagraphBullet({
|
|
14957
|
+
styles: options.styles,
|
|
14958
|
+
lists: options.lists
|
|
14959
|
+
}, {
|
|
14960
|
+
styleId: paragraphStyleId,
|
|
14961
|
+
bullet: options.bullet
|
|
14962
|
+
});
|
|
14963
|
+
const listProperties = bullet && ((_options$lists = options.lists) === null || _options$lists === void 0 || (_options$lists = _options$lists[bullet.listType]) === null || _options$lists === void 0 || (_options$lists = _options$lists.nestingLevel[bullet.nestingLevel]) === null || _options$lists === void 0 ? void 0 : _options$lists.paragraphProperties);
|
|
14964
|
+
const useWordNumberingPriority = (documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 1;
|
|
14965
|
+
const listIndents = {};
|
|
14966
|
+
for (const key of [
|
|
14967
|
+
"indentStart",
|
|
14968
|
+
"indentEnd",
|
|
14969
|
+
"indentFirstLine",
|
|
14970
|
+
"hanging"
|
|
14971
|
+
]) {
|
|
14972
|
+
const value = listProperties === null || listProperties === void 0 ? void 0 : listProperties[key];
|
|
14973
|
+
if (useWordNumberingPriority && value != null) listIndents[key] = value;
|
|
14974
|
+
}
|
|
14975
|
+
const directNumberingIndents = useWordNumberingPriority && options.bullet != null ? listIndents : {};
|
|
14976
|
+
if (useWordNumberingPriority && options.bullet === null) Object.assign(directNumberingIndents, {
|
|
14977
|
+
indentStart: { v: 0 },
|
|
14978
|
+
indentFirstLine: { v: 0 },
|
|
14979
|
+
hanging: { v: 0 }
|
|
14980
|
+
});
|
|
14981
|
+
const namedStyleType = definedParagraphStyle.namedStyleType ?? referencedParagraphStyle.namedStyleType;
|
|
14982
|
+
const hasReferencedDefinition = paragraphStyleId != null && ((_options$styles = options.styles) === null || _options$styles === void 0 || (_options$styles = _options$styles[paragraphStyleId]) === null || _options$styles === void 0 ? void 0 : _options$styles.type) === 1;
|
|
14983
|
+
const namedStyle = namedStyleType == null || hasReferencedDefinition && referencedParagraphStyle.namedStyleType == null ? null : NAMED_STYLE_SPACE_MAP[namedStyleType];
|
|
14984
|
+
const result = {};
|
|
14985
|
+
for (const style of [
|
|
14986
|
+
documentDefaults,
|
|
14987
|
+
namedStyle,
|
|
14988
|
+
listIndents,
|
|
14989
|
+
referencedParagraphStyle,
|
|
14990
|
+
directNumberingIndents,
|
|
14991
|
+
definedParagraphStyle
|
|
14992
|
+
]) _assignParagraphStyle(result, style, useWordNumberingPriority);
|
|
14993
|
+
if (useWordNumberingPriority) {
|
|
14994
|
+
var _result$indentFirstLi, _result$hanging;
|
|
14995
|
+
if (((_result$indentFirstLi = result.indentFirstLine) === null || _result$indentFirstLi === void 0 ? void 0 : _result$indentFirstLi.u) === 2 && result.indentFirstLine.v !== 0) delete result.hanging;
|
|
14996
|
+
else if (((_result$hanging = result.hanging) === null || _result$hanging === void 0 ? void 0 : _result$hanging.u) === 2 && result.hanging.v !== 0) delete result.indentFirstLine;
|
|
14997
|
+
}
|
|
14998
|
+
const textStyle = {
|
|
14999
|
+
...documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.textStyle,
|
|
15000
|
+
...documentDefaults.textStyle,
|
|
15001
|
+
..._definedStyle(namedStyle).textStyle,
|
|
15002
|
+
...referencedParagraphStyle.textStyle,
|
|
15003
|
+
...definedParagraphStyle.textStyle
|
|
15004
|
+
};
|
|
15005
|
+
if (Object.keys(textStyle).length) result.textStyle = textStyle;
|
|
15006
|
+
if (result.paragraphMarkStyleId != null) {
|
|
15007
|
+
const markTextStyle = resolveDocumentTextStyle(options.styles, result.paragraphMarkStyleId);
|
|
15008
|
+
if (Object.keys(markTextStyle).length) result.paragraphMarkTextStyle = {
|
|
15009
|
+
...markTextStyle,
|
|
15010
|
+
...result.paragraphMarkTextStyle
|
|
15011
|
+
};
|
|
15012
|
+
}
|
|
15013
|
+
return Tools.deepClone(result);
|
|
15014
|
+
}
|
|
15015
|
+
/** Applies absolute edits while clearing Word's inherited relative components. */
|
|
15016
|
+
function getDocumentParagraphStyleForUpdate(document, paragraph, update) {
|
|
15017
|
+
var _document$documentSty2;
|
|
15018
|
+
const result = Tools.deepClone({
|
|
15019
|
+
...paragraph.paragraphStyle,
|
|
15020
|
+
...update
|
|
15021
|
+
});
|
|
15022
|
+
if (((_document$documentSty2 = document.documentStyle) === null || _document$documentSty2 === void 0 ? void 0 : _document$documentSty2.documentFlavor) !== 1) return result;
|
|
15023
|
+
const resolved = resolveDocumentParagraphStyle(document.documentStyle, paragraph.paragraphStyle, {
|
|
15024
|
+
styles: document.styles,
|
|
15025
|
+
lists: document.lists,
|
|
15026
|
+
paragraphStyleId: paragraph.styleId,
|
|
15027
|
+
bullet: paragraph.bullet
|
|
15028
|
+
});
|
|
15029
|
+
for (const key of [
|
|
15030
|
+
"indentStart",
|
|
15031
|
+
"indentEnd",
|
|
15032
|
+
"indentFirstLine",
|
|
15033
|
+
"hanging"
|
|
15034
|
+
]) {
|
|
15035
|
+
var _resolved$key;
|
|
15036
|
+
const value = update[key];
|
|
15037
|
+
const related = key === "hanging" ? resolved.indentFirstLine : resolved.hanging;
|
|
15038
|
+
const hasCharacterIndent = ((_resolved$key = resolved[key]) === null || _resolved$key === void 0 ? void 0 : _resolved$key.u) === 2 || (key === "indentFirstLine" || key === "hanging") && (related === null || related === void 0 ? void 0 : related.u) === 2;
|
|
15039
|
+
if (value != null && value.u !== 2 && hasCharacterIndent) {
|
|
15040
|
+
result[key] = {
|
|
15041
|
+
v: 0,
|
|
15042
|
+
u: 2,
|
|
15043
|
+
fallback: value.v
|
|
15044
|
+
};
|
|
15045
|
+
if (key === "indentFirstLine" && update.hanging == null) delete result.hanging;
|
|
15046
|
+
else if (key === "hanging" && update.indentFirstLine == null) delete result.indentFirstLine;
|
|
15047
|
+
}
|
|
15048
|
+
}
|
|
15049
|
+
for (const key of ["spaceAbove", "spaceBelow"]) {
|
|
15050
|
+
var _resolved$key2;
|
|
15051
|
+
const value = update[key];
|
|
15052
|
+
if (value != null && value.u !== 1 && ((_resolved$key2 = resolved[key]) === null || _resolved$key2 === void 0 ? void 0 : _resolved$key2.u) === 1) result[key] = {
|
|
15053
|
+
v: 0,
|
|
15054
|
+
u: 1,
|
|
15055
|
+
fallback: value.v
|
|
15056
|
+
};
|
|
15057
|
+
}
|
|
15058
|
+
return result;
|
|
15059
|
+
}
|
|
15060
|
+
/** Resolves word splitting without materializing inherited defaults in the snapshot. */
|
|
15061
|
+
function resolveDocumentParagraphWordWrap(document, paragraph) {
|
|
15062
|
+
const { documentStyle } = document;
|
|
15063
|
+
const { wordWrap } = resolveDocumentParagraphStyle(documentStyle, paragraph === null || paragraph === void 0 ? void 0 : paragraph.paragraphStyle, {
|
|
15064
|
+
styles: document.styles,
|
|
15065
|
+
paragraphStyleId: paragraph === null || paragraph === void 0 ? void 0 : paragraph.styleId
|
|
15066
|
+
});
|
|
15067
|
+
return wordWrap ?? 0;
|
|
15068
|
+
}
|
|
15069
|
+
|
|
15070
|
+
// src/docs/data-model/preset-list-type.ts
|
|
15071
|
+
let QuickListType = /* @__PURE__ */ function(QuickListType) {
|
|
15072
|
+
QuickListType["ORDER_LIST_QUICK_1"] = "1.";
|
|
15073
|
+
QuickListType["ORDER_LIST_QUICK_2"] = "a)";
|
|
15074
|
+
QuickListType["ORDER_LIST_QUICK_3"] = "a.";
|
|
15075
|
+
QuickListType["ORDER_LIST_QUICK_4"] = "i.";
|
|
15076
|
+
QuickListType["ORDER_LIST_QUICK_5"] = "A.";
|
|
15077
|
+
QuickListType["ORDER_LIST_QUICK_6"] = "I.";
|
|
15078
|
+
QuickListType["ORDER_LIST_QUICK_7"] = "01.";
|
|
15079
|
+
QuickListType["BULLET_LIST"] = "*";
|
|
15080
|
+
return QuickListType;
|
|
15081
|
+
}({});
|
|
15082
|
+
let PresetListType = /* @__PURE__ */ function(PresetListType) {
|
|
15083
|
+
/** Standard filled-circle bullet list. */
|
|
15084
|
+
PresetListType["BULLET_LIST"] = "BULLET_LIST";
|
|
15085
|
+
/** Decorative diamond and arrow bullet list. */
|
|
15086
|
+
PresetListType["BULLET_LIST_1"] = "BULLET_LIST_1";
|
|
15087
|
+
/** Checkmark-led bullet list for completed-item style content. */
|
|
15088
|
+
PresetListType["BULLET_LIST_2"] = "BULLET_LIST_2";
|
|
15089
|
+
/** Square and diamond bullet list. */
|
|
15090
|
+
PresetListType["BULLET_LIST_3"] = "BULLET_LIST_3";
|
|
15091
|
+
/** Star-like decorative bullet list. */
|
|
15092
|
+
PresetListType["BULLET_LIST_4"] = "BULLET_LIST_4";
|
|
15093
|
+
/** Arrow-led bullet list. */
|
|
15094
|
+
PresetListType["BULLET_LIST_5"] = "BULLET_LIST_5";
|
|
15095
|
+
/**
|
|
15096
|
+
* Hierarchical ordered list using `1`, `a`, and `i` markers.
|
|
15097
|
+
*/
|
|
15098
|
+
PresetListType["ORDER_LIST"] = "ORDER_LIST";
|
|
15099
|
+
/**
|
|
15100
|
+
* Hierarchical ordered list using `1)`, `a)`, and `i)` markers.
|
|
15101
|
+
*/
|
|
15102
|
+
PresetListType["ORDER_LIST_1"] = "ORDER_LIST_1";
|
|
15103
|
+
/**
|
|
15104
|
+
* Outline list using compound markers such as `1.`, `1.1.`, and `1.1.1.`.
|
|
15105
|
+
*/
|
|
15106
|
+
PresetListType["ORDER_LIST_2"] = "ORDER_LIST_2";
|
|
15107
|
+
/**
|
|
15108
|
+
* Hierarchical ordered list using `A`, `a`, and `i` markers.
|
|
15109
|
+
*/
|
|
15110
|
+
PresetListType["ORDER_LIST_3"] = "ORDER_LIST_3";
|
|
15111
|
+
/**
|
|
15112
|
+
* Hierarchical ordered list using `A`, `1`, and `i` markers.
|
|
15113
|
+
*/
|
|
15114
|
+
PresetListType["ORDER_LIST_4"] = "ORDER_LIST_4";
|
|
15115
|
+
/**
|
|
15116
|
+
* Zero-padded ordered list using `01`, `a`, and `i` markers.
|
|
15117
|
+
*/
|
|
15118
|
+
PresetListType["ORDER_LIST_5"] = "ORDER_LIST_5";
|
|
15119
|
+
/** Quick ordered list using closing-parenthesis markers. */
|
|
15120
|
+
PresetListType["ORDER_LIST_QUICK_2"] = "ORDER_LIST_QUICK_2";
|
|
15121
|
+
/** Quick ordered list using lowercase letter and period markers. */
|
|
15122
|
+
PresetListType["ORDER_LIST_QUICK_3"] = "ORDER_LIST_QUICK_3";
|
|
15123
|
+
/** Quick ordered list using lowercase Roman numeral markers. */
|
|
15124
|
+
PresetListType["ORDER_LIST_QUICK_4"] = "ORDER_LIST_QUICK_4";
|
|
15125
|
+
/** Quick ordered list using uppercase letter markers. */
|
|
15126
|
+
PresetListType["ORDER_LIST_QUICK_5"] = "ORDER_LIST_QUICK_5";
|
|
15127
|
+
/** Quick ordered list using uppercase Roman numeral markers. */
|
|
15128
|
+
PresetListType["ORDER_LIST_QUICK_6"] = "ORDER_LIST_QUICK_6";
|
|
15129
|
+
/** Unchecked task-list item. */
|
|
15130
|
+
PresetListType["CHECK_LIST"] = "CHECK_LIST";
|
|
15131
|
+
/** Checked task-list item. */
|
|
15132
|
+
PresetListType["CHECK_LIST_CHECKED"] = "CHECK_LIST_CHECKED";
|
|
15133
|
+
return PresetListType;
|
|
15134
|
+
}({});
|
|
15135
|
+
const orderListSymbolMap = {
|
|
15136
|
+
"a)": {
|
|
15137
|
+
glyphFormat: "%1)",
|
|
15138
|
+
glyphType: 2
|
|
15139
|
+
},
|
|
15140
|
+
"1.": {
|
|
15141
|
+
glyphFormat: "%1.",
|
|
15142
|
+
glyphType: 2
|
|
15143
|
+
},
|
|
15144
|
+
"a.": {
|
|
15145
|
+
glyphFormat: "%1.",
|
|
15146
|
+
glyphType: 5
|
|
15147
|
+
},
|
|
15148
|
+
"A.": {
|
|
15149
|
+
glyphFormat: "%1.",
|
|
15150
|
+
glyphType: 4
|
|
15151
|
+
},
|
|
15152
|
+
"i.": {
|
|
15153
|
+
glyphFormat: "%1.",
|
|
15154
|
+
glyphType: 7
|
|
15155
|
+
},
|
|
15156
|
+
"I.": {
|
|
15157
|
+
glyphFormat: "%1.",
|
|
15158
|
+
glyphType: 4
|
|
15159
|
+
}
|
|
15160
|
+
};
|
|
15161
|
+
const bulletListFactory = (symbols) => {
|
|
15162
|
+
return [
|
|
15163
|
+
...symbols,
|
|
15164
|
+
...symbols,
|
|
15165
|
+
...symbols
|
|
15166
|
+
].map((templateSymbol, i) => ({
|
|
15167
|
+
glyphFormat: ` %${i + 1}`,
|
|
15168
|
+
glyphSymbol: templateSymbol,
|
|
15169
|
+
bulletAlignment: 1,
|
|
15170
|
+
startNumber: 0,
|
|
15171
|
+
paragraphProperties: {
|
|
15172
|
+
hanging: { v: 21 },
|
|
15173
|
+
indentStart: { v: 21 * (i + 1) }
|
|
15164
15174
|
}
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15175
|
+
}));
|
|
15176
|
+
};
|
|
15177
|
+
const orderListFactory = (options) => {
|
|
15178
|
+
return options.map((format, i) => ({
|
|
15179
|
+
...format,
|
|
15180
|
+
bulletAlignment: 1,
|
|
15181
|
+
startNumber: 0,
|
|
15182
|
+
paragraphProperties: {
|
|
15183
|
+
hanging: { v: 21 },
|
|
15184
|
+
indentStart: { v: 21 * (i + 1) }
|
|
15185
|
+
}
|
|
15186
|
+
}));
|
|
15187
|
+
};
|
|
15188
|
+
const checkListFactory = (symbol, textStyle) => {
|
|
15189
|
+
return new Array(9).fill(0).map((_, i) => ({
|
|
15190
|
+
glyphFormat: ` %${i + 1}`,
|
|
15191
|
+
glyphSymbol: symbol,
|
|
15192
|
+
bulletAlignment: 1,
|
|
15193
|
+
startNumber: 0,
|
|
15194
|
+
paragraphProperties: {
|
|
15195
|
+
hanging: { v: 21 },
|
|
15196
|
+
indentStart: { v: 21 * (i + 1) },
|
|
15197
|
+
textStyle
|
|
15198
|
+
}
|
|
15199
|
+
}));
|
|
15200
|
+
};
|
|
15201
|
+
const PRESET_LIST_TYPE = {
|
|
15202
|
+
["BULLET_LIST"]: {
|
|
15203
|
+
listType: "BULLET_LIST",
|
|
15204
|
+
nestingLevel: bulletListFactory([
|
|
15205
|
+
"●",
|
|
15206
|
+
"○",
|
|
15207
|
+
"■"
|
|
15208
|
+
])
|
|
15209
|
+
},
|
|
15210
|
+
["BULLET_LIST_1"]: {
|
|
15211
|
+
listType: "BULLET_LIST",
|
|
15212
|
+
nestingLevel: bulletListFactory([
|
|
15213
|
+
"❖",
|
|
15214
|
+
"➢",
|
|
15215
|
+
"■"
|
|
15216
|
+
])
|
|
15217
|
+
},
|
|
15218
|
+
["BULLET_LIST_2"]: {
|
|
15219
|
+
listType: "BULLET_LIST",
|
|
15220
|
+
nestingLevel: bulletListFactory([
|
|
15221
|
+
"✔",
|
|
15222
|
+
"●",
|
|
15223
|
+
"◆"
|
|
15224
|
+
])
|
|
15225
|
+
},
|
|
15226
|
+
["BULLET_LIST_3"]: {
|
|
15227
|
+
listType: "BULLET_LIST",
|
|
15228
|
+
nestingLevel: bulletListFactory([
|
|
15229
|
+
"■",
|
|
15230
|
+
"◆",
|
|
15231
|
+
"○"
|
|
15232
|
+
])
|
|
15233
|
+
},
|
|
15234
|
+
["BULLET_LIST_4"]: {
|
|
15235
|
+
listType: "BULLET_LIST",
|
|
15236
|
+
nestingLevel: bulletListFactory([
|
|
15237
|
+
"✦",
|
|
15238
|
+
"○",
|
|
15239
|
+
"■"
|
|
15240
|
+
])
|
|
15241
|
+
},
|
|
15242
|
+
["BULLET_LIST_5"]: {
|
|
15243
|
+
listType: "BULLET_LIST",
|
|
15244
|
+
nestingLevel: bulletListFactory([
|
|
15245
|
+
"➢",
|
|
15246
|
+
"○",
|
|
15247
|
+
"◆"
|
|
15248
|
+
])
|
|
15249
|
+
},
|
|
15250
|
+
["ORDER_LIST"]: {
|
|
15251
|
+
listType: "ORDER_LIST",
|
|
15252
|
+
nestingLevel: orderListFactory([
|
|
15253
|
+
{
|
|
15254
|
+
glyphFormat: "%1.",
|
|
15255
|
+
glyphType: 2
|
|
15256
|
+
},
|
|
15257
|
+
{
|
|
15258
|
+
glyphFormat: "%2.",
|
|
15259
|
+
glyphType: 5
|
|
15260
|
+
},
|
|
15261
|
+
{
|
|
15262
|
+
glyphFormat: "%3.",
|
|
15263
|
+
glyphType: 7
|
|
15264
|
+
},
|
|
15265
|
+
{
|
|
15266
|
+
glyphFormat: "%4.",
|
|
15267
|
+
glyphType: 2
|
|
15268
|
+
},
|
|
15269
|
+
{
|
|
15270
|
+
glyphFormat: "%5.",
|
|
15271
|
+
glyphType: 5
|
|
15272
|
+
},
|
|
15273
|
+
{
|
|
15274
|
+
glyphFormat: "%6.",
|
|
15275
|
+
glyphType: 7
|
|
15276
|
+
},
|
|
15277
|
+
{
|
|
15278
|
+
glyphFormat: "%7.",
|
|
15279
|
+
glyphType: 2
|
|
15280
|
+
},
|
|
15281
|
+
{
|
|
15282
|
+
glyphFormat: "%8.",
|
|
15283
|
+
glyphType: 5
|
|
15284
|
+
},
|
|
15285
|
+
{
|
|
15286
|
+
glyphFormat: "%9.",
|
|
15287
|
+
glyphType: 7
|
|
15288
|
+
}
|
|
15289
|
+
])
|
|
15290
|
+
},
|
|
15291
|
+
["ORDER_LIST_1"]: {
|
|
15292
|
+
listType: "ORDER_LIST",
|
|
15293
|
+
nestingLevel: orderListFactory([
|
|
15294
|
+
{
|
|
15295
|
+
glyphFormat: "%1)",
|
|
15296
|
+
glyphType: 2
|
|
15297
|
+
},
|
|
15298
|
+
{
|
|
15299
|
+
glyphFormat: "%2)",
|
|
15300
|
+
glyphType: 5
|
|
15301
|
+
},
|
|
15302
|
+
{
|
|
15303
|
+
glyphFormat: "%3)",
|
|
15304
|
+
glyphType: 7
|
|
15305
|
+
},
|
|
15306
|
+
{
|
|
15307
|
+
glyphFormat: "%4)",
|
|
15308
|
+
glyphType: 2
|
|
15309
|
+
},
|
|
15310
|
+
{
|
|
15311
|
+
glyphFormat: "%5)",
|
|
15312
|
+
glyphType: 5
|
|
15313
|
+
},
|
|
15314
|
+
{
|
|
15315
|
+
glyphFormat: "%6)",
|
|
15316
|
+
glyphType: 7
|
|
15317
|
+
},
|
|
15318
|
+
{
|
|
15319
|
+
glyphFormat: "%7)",
|
|
15320
|
+
glyphType: 2
|
|
15321
|
+
},
|
|
15322
|
+
{
|
|
15323
|
+
glyphFormat: "%8)",
|
|
15324
|
+
glyphType: 5
|
|
15325
|
+
},
|
|
15326
|
+
{
|
|
15327
|
+
glyphFormat: "%9)",
|
|
15328
|
+
glyphType: 7
|
|
15329
|
+
}
|
|
15330
|
+
])
|
|
15331
|
+
},
|
|
15332
|
+
["ORDER_LIST_2"]: {
|
|
15333
|
+
listType: "ORDER_LIST",
|
|
15334
|
+
nestingLevel: orderListFactory([
|
|
15335
|
+
"%1.",
|
|
15336
|
+
"%1.%2.",
|
|
15337
|
+
"%1.%2.%3.",
|
|
15338
|
+
"%1.%2.%3.%4.",
|
|
15339
|
+
"%1.%2.%3.%4.%5.",
|
|
15340
|
+
"%1.%2.%3.%4.%5.%6.",
|
|
15341
|
+
"%1.%2.%3.%4.%5.%6.%7."
|
|
15342
|
+
].map((format) => ({
|
|
15343
|
+
glyphFormat: format,
|
|
15344
|
+
glyphType: 2
|
|
15345
|
+
})))
|
|
15346
|
+
},
|
|
15347
|
+
["ORDER_LIST_3"]: {
|
|
15348
|
+
listType: "ORDER_LIST",
|
|
15349
|
+
nestingLevel: orderListFactory([
|
|
15350
|
+
{
|
|
15351
|
+
glyphFormat: "%1.",
|
|
15352
|
+
glyphType: 4
|
|
15353
|
+
},
|
|
15354
|
+
{
|
|
15355
|
+
glyphFormat: "%2.",
|
|
15356
|
+
glyphType: 5
|
|
15357
|
+
},
|
|
15358
|
+
{
|
|
15359
|
+
glyphFormat: "%3.",
|
|
15360
|
+
glyphType: 7
|
|
15361
|
+
},
|
|
15362
|
+
{
|
|
15363
|
+
glyphFormat: "%4.",
|
|
15364
|
+
glyphType: 4
|
|
15365
|
+
},
|
|
15366
|
+
{
|
|
15367
|
+
glyphFormat: "%5.",
|
|
15368
|
+
glyphType: 5
|
|
15369
|
+
},
|
|
15370
|
+
{
|
|
15371
|
+
glyphFormat: "%6.",
|
|
15372
|
+
glyphType: 7
|
|
15373
|
+
},
|
|
15374
|
+
{
|
|
15375
|
+
glyphFormat: "%7.",
|
|
15376
|
+
glyphType: 4
|
|
15377
|
+
},
|
|
15378
|
+
{
|
|
15379
|
+
glyphFormat: "%8.",
|
|
15380
|
+
glyphType: 5
|
|
15381
|
+
},
|
|
15382
|
+
{
|
|
15383
|
+
glyphFormat: "%9.",
|
|
15384
|
+
glyphType: 7
|
|
15385
|
+
}
|
|
15386
|
+
])
|
|
15387
|
+
},
|
|
15388
|
+
["ORDER_LIST_4"]: {
|
|
15389
|
+
listType: "ORDER_LIST",
|
|
15390
|
+
nestingLevel: orderListFactory([
|
|
15391
|
+
{
|
|
15392
|
+
glyphFormat: "%1.",
|
|
15393
|
+
glyphType: 4
|
|
15394
|
+
},
|
|
15395
|
+
{
|
|
15396
|
+
glyphFormat: "%2.",
|
|
15397
|
+
glyphType: 2
|
|
15398
|
+
},
|
|
15399
|
+
{
|
|
15400
|
+
glyphFormat: "%3.",
|
|
15401
|
+
glyphType: 7
|
|
15402
|
+
},
|
|
15403
|
+
{
|
|
15404
|
+
glyphFormat: "%4.",
|
|
15405
|
+
glyphType: 4
|
|
15406
|
+
},
|
|
15407
|
+
{
|
|
15408
|
+
glyphFormat: "%5.",
|
|
15409
|
+
glyphType: 2
|
|
15410
|
+
},
|
|
15411
|
+
{
|
|
15412
|
+
glyphFormat: "%6.",
|
|
15413
|
+
glyphType: 7
|
|
15414
|
+
},
|
|
15415
|
+
{
|
|
15416
|
+
glyphFormat: "%7.",
|
|
15417
|
+
glyphType: 4
|
|
15418
|
+
},
|
|
15419
|
+
{
|
|
15420
|
+
glyphFormat: "%8.",
|
|
15421
|
+
glyphType: 2
|
|
15422
|
+
},
|
|
15423
|
+
{
|
|
15424
|
+
glyphFormat: "%9.",
|
|
15425
|
+
glyphType: 7
|
|
15426
|
+
}
|
|
15427
|
+
])
|
|
15428
|
+
},
|
|
15429
|
+
["ORDER_LIST_5"]: {
|
|
15430
|
+
listType: "ORDER_LIST",
|
|
15431
|
+
nestingLevel: orderListFactory([
|
|
15432
|
+
{
|
|
15433
|
+
glyphFormat: "%1.",
|
|
15434
|
+
glyphType: 3
|
|
15435
|
+
},
|
|
15436
|
+
{
|
|
15437
|
+
glyphFormat: "%2.",
|
|
15438
|
+
glyphType: 5
|
|
15439
|
+
},
|
|
15440
|
+
{
|
|
15441
|
+
glyphFormat: "%3.",
|
|
15442
|
+
glyphType: 7
|
|
15443
|
+
},
|
|
15444
|
+
{
|
|
15445
|
+
glyphFormat: "%4.",
|
|
15446
|
+
glyphType: 3
|
|
15447
|
+
},
|
|
15448
|
+
{
|
|
15449
|
+
glyphFormat: "%5.",
|
|
15450
|
+
glyphType: 5
|
|
15451
|
+
},
|
|
15452
|
+
{
|
|
15453
|
+
glyphFormat: "%6.",
|
|
15454
|
+
glyphType: 7
|
|
15455
|
+
},
|
|
15456
|
+
{
|
|
15457
|
+
glyphFormat: "%7.",
|
|
15458
|
+
glyphType: 3
|
|
15459
|
+
},
|
|
15460
|
+
{
|
|
15461
|
+
glyphFormat: "%8.",
|
|
15462
|
+
glyphType: 5
|
|
15463
|
+
},
|
|
15464
|
+
{
|
|
15465
|
+
glyphFormat: "%9.",
|
|
15466
|
+
glyphType: 7
|
|
15467
|
+
}
|
|
15468
|
+
])
|
|
15469
|
+
},
|
|
15470
|
+
["CHECK_LIST"]: {
|
|
15471
|
+
listType: "CHECK_LIST",
|
|
15472
|
+
nestingLevel: checkListFactory("☐")
|
|
15473
|
+
},
|
|
15474
|
+
["CHECK_LIST_CHECKED"]: {
|
|
15475
|
+
listType: "CHECK_LIST_CHECKED",
|
|
15476
|
+
nestingLevel: checkListFactory("☑", { st: { s: 1 } })
|
|
15188
15477
|
}
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
}
|
|
15478
|
+
};
|
|
15479
|
+
const generateOrderList = (opt) => {
|
|
15480
|
+
const { glyphFormat, glyphType } = opt;
|
|
15481
|
+
const data = Tools.deepClone(PRESET_LIST_TYPE["ORDER_LIST"]);
|
|
15482
|
+
data.nestingLevel[0].glyphFormat = glyphFormat;
|
|
15483
|
+
data.nestingLevel[0].glyphType = glyphType;
|
|
15484
|
+
return data;
|
|
15485
|
+
};
|
|
15486
|
+
const QUICK_LIST_TYPE = {
|
|
15487
|
+
["ORDER_LIST_QUICK_2"]: generateOrderList(orderListSymbolMap["a)"]),
|
|
15488
|
+
["ORDER_LIST_QUICK_3"]: generateOrderList(orderListSymbolMap["a."]),
|
|
15489
|
+
["ORDER_LIST_QUICK_4"]: generateOrderList(orderListSymbolMap["i."]),
|
|
15490
|
+
["ORDER_LIST_QUICK_6"]: generateOrderList(orderListSymbolMap["I."])
|
|
15491
|
+
};
|
|
15492
|
+
Object.assign(PRESET_LIST_TYPE, QUICK_LIST_TYPE);
|
|
15493
|
+
const QuickListTypeMap = {
|
|
15494
|
+
["1."]: "ORDER_LIST",
|
|
15495
|
+
["a)"]: "ORDER_LIST_QUICK_2",
|
|
15496
|
+
["a."]: "ORDER_LIST_QUICK_3",
|
|
15497
|
+
["i."]: "ORDER_LIST_QUICK_4",
|
|
15498
|
+
["A."]: "ORDER_LIST_3",
|
|
15499
|
+
["I."]: "ORDER_LIST_QUICK_6",
|
|
15500
|
+
["01."]: "ORDER_LIST_5",
|
|
15501
|
+
["*"]: "BULLET_LIST"
|
|
15502
|
+
};
|
|
15192
15503
|
|
|
15193
15504
|
// src/docs/data-model/text-x/build-utils/selection.ts
|
|
15194
15505
|
function makeSelection(startOffset, endOffset) {
|
|
@@ -15268,28 +15579,45 @@ const switchParagraphBullet = (params) => {
|
|
|
15268
15579
|
const { paragraphs: currentParagraphs, segmentId, document: docDataModel } = params;
|
|
15269
15580
|
let listType = params.listType;
|
|
15270
15581
|
const paragraphs = ((_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf === void 0 || (_docDataModel$getSelf = _docDataModel$getSelf.getBody()) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.paragraphs) ?? [];
|
|
15582
|
+
const snapshot = docDataModel.getSnapshot();
|
|
15271
15583
|
const isAlreadyList = currentParagraphs.every((paragraph) => {
|
|
15272
|
-
var
|
|
15273
|
-
return ((
|
|
15584
|
+
var _resolveDocumentParag;
|
|
15585
|
+
return ((_resolveDocumentParag = resolveDocumentParagraphBullet(snapshot, paragraph)) === null || _resolveDocumentParag === void 0 ? void 0 : _resolveDocumentParag.listType.indexOf(listType)) === 0;
|
|
15274
15586
|
});
|
|
15275
15587
|
let listId = generateRandomId(6);
|
|
15276
15588
|
if (currentParagraphs.length === 1) {
|
|
15277
15589
|
const curIndex = paragraphs.indexOf(currentParagraphs[0]);
|
|
15278
15590
|
const prevParagraph = paragraphs[curIndex - 1];
|
|
15279
15591
|
const nextParagraph = paragraphs[curIndex + 1];
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15592
|
+
const previousBullet = prevParagraph && resolveDocumentParagraphBullet(snapshot, prevParagraph);
|
|
15593
|
+
const nextBullet = nextParagraph && resolveDocumentParagraphBullet(snapshot, nextParagraph);
|
|
15594
|
+
if (previousBullet && previousBullet.listType.indexOf(listType) === 0) {
|
|
15595
|
+
listId = previousBullet.listId;
|
|
15596
|
+
if (listType !== "CHECK_LIST") listType = previousBullet.listType;
|
|
15597
|
+
} else if (nextBullet && nextBullet.listType.indexOf(listType) === 0) {
|
|
15598
|
+
listId = nextBullet.listId;
|
|
15599
|
+
if (listType !== "CHECK_LIST") listType = nextBullet.listType;
|
|
15286
15600
|
}
|
|
15287
15601
|
}
|
|
15288
15602
|
const memoryCursor = new MemoryCursor();
|
|
15289
15603
|
memoryCursor.reset();
|
|
15290
15604
|
const textX = new TextX();
|
|
15291
15605
|
for (const paragraph of currentParagraphs) {
|
|
15292
|
-
const { startIndex
|
|
15606
|
+
const { startIndex } = paragraph;
|
|
15607
|
+
const bullet = resolveDocumentParagraphBullet(snapshot, paragraph);
|
|
15608
|
+
const update = {
|
|
15609
|
+
...paragraph,
|
|
15610
|
+
startIndex: 0,
|
|
15611
|
+
paragraphStyle: paragraph.paragraphStyle ?? {}
|
|
15612
|
+
};
|
|
15613
|
+
if (isAlreadyList) {
|
|
15614
|
+
if (resolveDocumentParagraphBullet(snapshot, { styleId: paragraph.styleId })) update.bullet = null;
|
|
15615
|
+
else delete update.bullet;
|
|
15616
|
+
} else update.bullet = {
|
|
15617
|
+
nestingLevel: (bullet === null || bullet === void 0 ? void 0 : bullet.nestingLevel) ?? 0,
|
|
15618
|
+
listType,
|
|
15619
|
+
listId
|
|
15620
|
+
};
|
|
15293
15621
|
textX.push({
|
|
15294
15622
|
t: "r",
|
|
15295
15623
|
len: startIndex - memoryCursor.cursor
|
|
@@ -15299,20 +15627,7 @@ const switchParagraphBullet = (params) => {
|
|
|
15299
15627
|
len: 1,
|
|
15300
15628
|
body: {
|
|
15301
15629
|
dataStream: "",
|
|
15302
|
-
paragraphs: [
|
|
15303
|
-
paragraphId,
|
|
15304
|
-
paragraphStyle,
|
|
15305
|
-
startIndex: 0
|
|
15306
|
-
} : {
|
|
15307
|
-
startIndex: 0,
|
|
15308
|
-
paragraphId,
|
|
15309
|
-
paragraphStyle: { ...paragraphStyle },
|
|
15310
|
-
bullet: {
|
|
15311
|
-
nestingLevel: (bullet === null || bullet === void 0 ? void 0 : bullet.nestingLevel) ?? 0,
|
|
15312
|
-
listType,
|
|
15313
|
-
listId
|
|
15314
|
-
}
|
|
15315
|
-
}]
|
|
15630
|
+
paragraphs: [update]
|
|
15316
15631
|
},
|
|
15317
15632
|
coverType: 1
|
|
15318
15633
|
});
|
|
@@ -15326,12 +15641,13 @@ const toggleChecklistParagraph = (params) => {
|
|
|
15326
15641
|
const paragraphs = (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 || (_docDataModel$getSelf2 = _docDataModel$getSelf2.getBody()) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.paragraphs;
|
|
15327
15642
|
if (paragraphs == null) return false;
|
|
15328
15643
|
const currentParagraph = paragraphs.find((p) => p.startIndex === paragraphIndex);
|
|
15329
|
-
|
|
15644
|
+
const bullet = currentParagraph && resolveDocumentParagraphBullet(docDataModel.getSnapshot(), currentParagraph);
|
|
15645
|
+
if (!currentParagraph || !bullet || bullet.listType.indexOf("CHECK_LIST") === -1) return false;
|
|
15330
15646
|
const memoryCursor = new MemoryCursor();
|
|
15331
15647
|
memoryCursor.reset();
|
|
15332
15648
|
const textX = new TextX();
|
|
15333
15649
|
const { startIndex, paragraphStyle = {} } = currentParagraph;
|
|
15334
|
-
const listType =
|
|
15650
|
+
const listType = bullet.listType === "CHECK_LIST" ? "CHECK_LIST_CHECKED" : "CHECK_LIST";
|
|
15335
15651
|
textX.push({
|
|
15336
15652
|
t: "r",
|
|
15337
15653
|
len: startIndex - memoryCursor.cursor
|
|
@@ -15365,7 +15681,8 @@ const setParagraphBullet = (params) => {
|
|
|
15365
15681
|
memoryCursor.reset();
|
|
15366
15682
|
const textX = new TextX();
|
|
15367
15683
|
for (const paragraph of currentParagraphs) {
|
|
15368
|
-
const { startIndex,
|
|
15684
|
+
const { startIndex, paragraphStyle = {} } = paragraph;
|
|
15685
|
+
const bullet = resolveDocumentParagraphBullet(docDataModel.getSnapshot(), paragraph);
|
|
15369
15686
|
textX.push({
|
|
15370
15687
|
t: "r",
|
|
15371
15688
|
len: startIndex - memoryCursor.cursor
|
|
@@ -15376,8 +15693,8 @@ const setParagraphBullet = (params) => {
|
|
|
15376
15693
|
body: {
|
|
15377
15694
|
dataStream: "",
|
|
15378
15695
|
paragraphs: [{
|
|
15696
|
+
...paragraph,
|
|
15379
15697
|
startIndex: 0,
|
|
15380
|
-
paragraphId,
|
|
15381
15698
|
paragraphStyle,
|
|
15382
15699
|
bullet: {
|
|
15383
15700
|
nestingLevel: (bullet === null || bullet === void 0 ? void 0 : bullet.nestingLevel) ?? 0,
|
|
@@ -15452,7 +15769,8 @@ const changeParagraphBulletNestLevel = (params) => {
|
|
|
15452
15769
|
...customLists
|
|
15453
15770
|
};
|
|
15454
15771
|
for (const paragraph of currentParagraphs) {
|
|
15455
|
-
const { startIndex,
|
|
15772
|
+
const { startIndex, paragraphStyle = {} } = paragraph;
|
|
15773
|
+
const bullet = resolveDocumentParagraphBullet(docDataModel.getSnapshot(), paragraph);
|
|
15456
15774
|
const isInTable = hasParagraphInTable(paragraph, tables);
|
|
15457
15775
|
textX.push({
|
|
15458
15776
|
t: "r",
|
|
@@ -15467,11 +15785,11 @@ const changeParagraphBulletNestLevel = (params) => {
|
|
|
15467
15785
|
body: {
|
|
15468
15786
|
dataStream: "",
|
|
15469
15787
|
paragraphs: [{
|
|
15788
|
+
...paragraph,
|
|
15470
15789
|
startIndex: 0,
|
|
15471
|
-
paragraphId,
|
|
15472
15790
|
paragraphStyle: { ...paragraphStyle },
|
|
15473
15791
|
bullet: {
|
|
15474
|
-
...bullet,
|
|
15792
|
+
...paragraph.bullet,
|
|
15475
15793
|
nestingLevel: Math.max(Math.min(bullet.nestingLevel + type, maxLevel), 0)
|
|
15476
15794
|
}
|
|
15477
15795
|
}]
|
|
@@ -15934,8 +16252,8 @@ function isUselessRetainAction(action) {
|
|
|
15934
16252
|
if ((_action$rangeUpdates = action.rangeUpdates) === null || _action$rangeUpdates === void 0 ? void 0 : _action$rangeUpdates.length) return false;
|
|
15935
16253
|
const { body } = action;
|
|
15936
16254
|
if (body == null) return true;
|
|
15937
|
-
const { textRuns, paragraphs, customRanges, customBlocks, docxRawCustomBlocks, docxRawBlocks, docxExportExcludedRanges, customDecorations, tables, columnGroups, blockRanges } = body;
|
|
15938
|
-
if (textRuns == null && paragraphs == null && customRanges == null && customBlocks == null && docxRawCustomBlocks == null && docxRawBlocks == null && docxExportExcludedRanges == null && customDecorations == null && tables == null && columnGroups == null && blockRanges == null) return true;
|
|
16255
|
+
const { textRuns, paragraphs, sectionBreaks, customRanges, customBlocks, docxRawCustomBlocks, docxRawBlocks, docxExportExcludedRanges, customDecorations, tables, columnGroups, blockRanges } = body;
|
|
16256
|
+
if (textRuns == null && paragraphs == null && sectionBreaks == null && customRanges == null && customBlocks == null && docxRawCustomBlocks == null && docxRawBlocks == null && docxExportExcludedRanges == null && customDecorations == null && tables == null && columnGroups == null && blockRanges == null) return true;
|
|
15939
16257
|
return false;
|
|
15940
16258
|
}
|
|
15941
16259
|
function getRichTextEditPath(docDataModel, segmentId = "") {
|
|
@@ -16624,6 +16942,64 @@ function withoutValueRangeMetadata(actions, suppressed) {
|
|
|
16624
16942
|
};
|
|
16625
16943
|
});
|
|
16626
16944
|
}
|
|
16945
|
+
function restoreComposedFieldRanges(inserted, changes, composed) {
|
|
16946
|
+
const complete = /* @__PURE__ */ new Map();
|
|
16947
|
+
for (const actions of [inserted, changes]) for (const action of actions) {
|
|
16948
|
+
if (action.t !== "i") continue;
|
|
16949
|
+
for (const range of action.body.customRanges ?? []) if (range.rangeType === 1 && action.body.dataStream[range.startIndex] === "" && action.body.dataStream[range.endIndex] === "") complete.set(range.rangeId, (complete.get(range.rangeId) ?? 0) + 1);
|
|
16950
|
+
}
|
|
16951
|
+
if (!complete.size) return composed;
|
|
16952
|
+
const fragments = /* @__PURE__ */ new Map();
|
|
16953
|
+
let offset = 0;
|
|
16954
|
+
for (const action of composed) {
|
|
16955
|
+
if (action.t === "i") for (const range of action.body.customRanges ?? []) {
|
|
16956
|
+
if (complete.get(range.rangeId) !== 1) continue;
|
|
16957
|
+
const startIndex = offset + range.startIndex;
|
|
16958
|
+
const endIndex = offset + range.endIndex;
|
|
16959
|
+
const previous = fragments.get(range.rangeId);
|
|
16960
|
+
if (previous) {
|
|
16961
|
+
previous.range.endIndex = endIndex;
|
|
16962
|
+
previous.endToken = action.body.dataStream[range.endIndex];
|
|
16963
|
+
previous.count++;
|
|
16964
|
+
} else fragments.set(range.rangeId, {
|
|
16965
|
+
range: {
|
|
16966
|
+
...Tools.deepClone(range),
|
|
16967
|
+
startIndex,
|
|
16968
|
+
endIndex
|
|
16969
|
+
},
|
|
16970
|
+
count: 1,
|
|
16971
|
+
startToken: action.body.dataStream[range.startIndex],
|
|
16972
|
+
endToken: action.body.dataStream[range.endIndex]
|
|
16973
|
+
});
|
|
16974
|
+
}
|
|
16975
|
+
if (action.t !== "d") offset += action.len;
|
|
16976
|
+
}
|
|
16977
|
+
const restored = [...fragments.values()].filter((item) => item.count > 1 && item.startToken === "" && item.endToken === "");
|
|
16978
|
+
if (!restored.length) return composed;
|
|
16979
|
+
const updates = new Map(getRangeUpdates(composed).map((update) => [update.rangeId, update]));
|
|
16980
|
+
const ids = new Set(restored.map(({ range }) => range.rangeId));
|
|
16981
|
+
const pending = new Set(ids);
|
|
16982
|
+
const actions = composed.map((action) => {
|
|
16983
|
+
var _action$body2;
|
|
16984
|
+
if (!((_action$body2 = action.body) === null || _action$body2 === void 0 || (_action$body2 = _action$body2.customRanges) === null || _action$body2 === void 0 ? void 0 : _action$body2.some((range) => ids.has(range.rangeId)))) return action;
|
|
16985
|
+
const body = {
|
|
16986
|
+
...action.body,
|
|
16987
|
+
customRanges: action.body.customRanges.filter((range) => !ids.has(range.rangeId) || pending.delete(range.rangeId))
|
|
16988
|
+
};
|
|
16989
|
+
if (!body.customRanges.length) Reflect.deleteProperty(body, "customRanges");
|
|
16990
|
+
return {
|
|
16991
|
+
...action,
|
|
16992
|
+
body
|
|
16993
|
+
};
|
|
16994
|
+
});
|
|
16995
|
+
return appendRangeUpdates(actions, restored.map(({ range }) => updates.has(range.rangeId) ? composeRangeUpdate({
|
|
16996
|
+
rangeId: range.rangeId,
|
|
16997
|
+
range
|
|
16998
|
+
}, updates.get(range.rangeId)) : {
|
|
16999
|
+
rangeId: range.rangeId,
|
|
17000
|
+
range
|
|
17001
|
+
}));
|
|
17002
|
+
}
|
|
16627
17003
|
function insertedAnchorPriority(first, second, priority) {
|
|
16628
17004
|
if ((first === null || first === void 0 ? void 0 : first.t) !== "i" || (second === null || second === void 0 ? void 0 : second.t) !== "i") return priority === "left";
|
|
16629
17005
|
const firstText = first.body.dataStream;
|
|
@@ -16634,12 +17010,14 @@ function insertedAnchorPriority(first, second, priority) {
|
|
|
16634
17010
|
return priority === "left";
|
|
16635
17011
|
}
|
|
16636
17012
|
function normalizeInsertActionParagraphIds(body, doc, currentIndex, reservedParagraphIds) {
|
|
16637
|
-
|
|
17013
|
+
var _body$paragraphs;
|
|
17014
|
+
const splitsParagraph = normalizeInsertedParagraphIdsForDocument(doc.paragraphs, body.paragraphs, currentIndex, {
|
|
16638
17015
|
freshenSplitParagraph: false,
|
|
16639
17016
|
preserveExplicitParagraphIds: Boolean(body[PRESERVE_INSERTED_PARAGRAPH_IDS]),
|
|
16640
17017
|
reservedParagraphIds,
|
|
16641
17018
|
dataStream: doc.dataStream
|
|
16642
17019
|
});
|
|
17020
|
+
if (((_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 ? void 0 : _body$paragraphs.length) && !splitsParagraph) Reflect.set(body, PRESERVE_INSERTED_PARAGRAPH_IDS, true);
|
|
16643
17021
|
}
|
|
16644
17022
|
var TextX = class TextX {
|
|
16645
17023
|
constructor() {
|
|
@@ -16656,7 +17034,7 @@ var TextX = class TextX {
|
|
|
16656
17034
|
const otherText = withoutRangeUpdates(otherActions);
|
|
16657
17035
|
const updates = new Map(moveRangeUpdates(thisUpdates, otherText).map((update) => [update.rangeId, update]));
|
|
16658
17036
|
for (const update of otherUpdates) updates.set(update.rangeId, composeRangeUpdate(updates.get(update.rangeId), update));
|
|
16659
|
-
return appendRangeUpdates(TextX.compose(thisText, otherText), Array.from(updates.values()));
|
|
17037
|
+
return restoreComposedFieldRanges(thisActions, otherActions, appendRangeUpdates(TextX.compose(thisText, otherText), Array.from(updates.values())));
|
|
16660
17038
|
}
|
|
16661
17039
|
const thisIter = new ActionIterator(thisActions);
|
|
16662
17040
|
const otherIter = new ActionIterator(otherActions);
|
|
@@ -16688,7 +17066,7 @@ var TextX = class TextX {
|
|
|
16688
17066
|
else if (thisAction.t === "i" && otherAction.t === "d") {}
|
|
16689
17067
|
}
|
|
16690
17068
|
textX.trimEndUselessRetainAction();
|
|
16691
|
-
return textX.serialize();
|
|
17069
|
+
return restoreComposedFieldRanges(thisActions, otherActions, textX.serialize());
|
|
16692
17070
|
}
|
|
16693
17071
|
/**
|
|
16694
17072
|
* |(this↓ \| other→) | **insert** | **retain** | **delete** |
|
|
@@ -16754,7 +17132,10 @@ var TextX = class TextX {
|
|
|
16754
17132
|
textX.push(otherAction);
|
|
16755
17133
|
continue;
|
|
16756
17134
|
}
|
|
16757
|
-
if (thisAction.body == null || otherAction.body == null) textX.push(
|
|
17135
|
+
if (thisAction.body == null || otherAction.body == null) textX.push({
|
|
17136
|
+
...otherAction,
|
|
17137
|
+
len: length
|
|
17138
|
+
});
|
|
16758
17139
|
else {
|
|
16759
17140
|
const { coverType, body } = transformBody(thisAction, otherAction, priority === "left");
|
|
16760
17141
|
textX.push({
|
|
@@ -16861,8 +17242,8 @@ var TextX = class TextX {
|
|
|
16861
17242
|
for (const field of Object.keys(body)) if (field !== "dataStream" && field !== "paragraphs" && action.body[field] == null) Reflect.deleteProperty(body, field);
|
|
16862
17243
|
if (action.body.paragraphs == null) delete body.paragraphs;
|
|
16863
17244
|
else {
|
|
16864
|
-
var _body$
|
|
16865
|
-
const previousParagraphs = new Map((_body$
|
|
17245
|
+
var _body$paragraphs2;
|
|
17246
|
+
const previousParagraphs = new Map((_body$paragraphs2 = body.paragraphs) === null || _body$paragraphs2 === void 0 ? void 0 : _body$paragraphs2.map((paragraph) => [paragraph.startIndex, paragraph]));
|
|
16866
17247
|
action.body.paragraphs = action.body.paragraphs.map((paragraph) => {
|
|
16867
17248
|
const previous = previousParagraphs.get(paragraph.startIndex);
|
|
16868
17249
|
if (!previous || paragraph.paragraphId != null && paragraph.paragraphId !== previous.paragraphId) return paragraph;
|
|
@@ -17112,6 +17493,21 @@ const fromPlainText = (text) => {
|
|
|
17112
17493
|
};
|
|
17113
17494
|
|
|
17114
17495
|
// src/docs/data-model/document-data-model.ts
|
|
17496
|
+
/**
|
|
17497
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
17498
|
+
*
|
|
17499
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17500
|
+
* you may not use this file except in compliance with the License.
|
|
17501
|
+
* You may obtain a copy of the License at
|
|
17502
|
+
*
|
|
17503
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17504
|
+
*
|
|
17505
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17506
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17507
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17508
|
+
* See the License for the specific language governing permissions and
|
|
17509
|
+
* limitations under the License.
|
|
17510
|
+
*/
|
|
17115
17511
|
const DEFAULT_DOC = {
|
|
17116
17512
|
id: "default_doc",
|
|
17117
17513
|
documentStyle: {}
|
|
@@ -17254,6 +17650,7 @@ var DocumentDataModelSimple = class extends UnitModel {
|
|
|
17254
17650
|
this._markMutation();
|
|
17255
17651
|
return;
|
|
17256
17652
|
}
|
|
17653
|
+
if ((width === void 0 || width === documentStyle.pageSize.width) && (height === void 0 || height === documentStyle.pageSize.height)) return;
|
|
17257
17654
|
if (width !== void 0) documentStyle.pageSize.width = width;
|
|
17258
17655
|
if (height !== void 0) documentStyle.pageSize.height = height;
|
|
17259
17656
|
this._markMutation();
|
|
@@ -17362,7 +17759,7 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
|
|
|
17362
17759
|
if (path[0] === "notes" && typeof path[1] === "string") changedNotes.add(path[1]);
|
|
17363
17760
|
if (path[0] === "styles" || path[0] === "documentStyle") changedInheritedNoteStyles = true;
|
|
17364
17761
|
});
|
|
17365
|
-
this.snapshot = JSONX.apply(this.snapshot, actions);
|
|
17762
|
+
this.snapshot = JSONX.apply(this.snapshot, Tools.deepClone(actions));
|
|
17366
17763
|
this._markMutation();
|
|
17367
17764
|
if (changedInheritedNoteStyles || previousNotes !== this.snapshot.notes || changedNotes.size > 0) this._initializeNoteModels(changedInheritedNoteStyles ? void 0 : previousNotes, changedNotes);
|
|
17368
17765
|
if (actions === null || actions === void 0 ? void 0 : actions.some((a) => Array.isArray(a) && ((a === null || a === void 0 ? void 0 : a[0]) === "headers" || (a === null || a === void 0 ? void 0 : a[0]) === "footers"))) {
|
|
@@ -17383,12 +17780,20 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
|
|
|
17383
17780
|
const { headers, footers } = this.getSnapshot();
|
|
17384
17781
|
if (headers) for (const headerId in headers) {
|
|
17385
17782
|
const header = headers[headerId];
|
|
17386
|
-
this.headerModelMap.set(headerId, new DocumentDataModel(
|
|
17783
|
+
this.headerModelMap.set(headerId, new DocumentDataModel({
|
|
17784
|
+
...header,
|
|
17785
|
+
documentStyle: this.snapshot.documentStyle,
|
|
17786
|
+
styles: this.snapshot.styles
|
|
17787
|
+
}));
|
|
17387
17788
|
this.headerModelMap.get(headerId).updateDocumentId(this.getUnitId());
|
|
17388
17789
|
}
|
|
17389
17790
|
if (footers) for (const footerId in footers) {
|
|
17390
17791
|
const footer = footers[footerId];
|
|
17391
|
-
this.footerModelMap.set(footerId, new DocumentDataModel(
|
|
17792
|
+
this.footerModelMap.set(footerId, new DocumentDataModel({
|
|
17793
|
+
...footer,
|
|
17794
|
+
documentStyle: this.snapshot.documentStyle,
|
|
17795
|
+
styles: this.snapshot.styles
|
|
17796
|
+
}));
|
|
17392
17797
|
this.footerModelMap.get(footerId).updateDocumentId(this.getUnitId());
|
|
17393
17798
|
}
|
|
17394
17799
|
}
|
|
@@ -17429,66 +17834,6 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
|
|
|
17429
17834
|
}
|
|
17430
17835
|
};
|
|
17431
17836
|
|
|
17432
|
-
// src/docs/data-model/paragraph-style.ts
|
|
17433
|
-
function _definedStyle(style) {
|
|
17434
|
-
if (style == null) return {};
|
|
17435
|
-
const definedStyle = Tools.deepClone(style);
|
|
17436
|
-
Tools.removeNull(definedStyle);
|
|
17437
|
-
return definedStyle;
|
|
17438
|
-
}
|
|
17439
|
-
function _resolveNamedParagraphStyle(styles, styleId) {
|
|
17440
|
-
if (!styles || !styleId) return {};
|
|
17441
|
-
const visiting = /* @__PURE__ */ new Set();
|
|
17442
|
-
const resolve = (currentStyleId) => {
|
|
17443
|
-
if (visiting.has(currentStyleId)) return {};
|
|
17444
|
-
const style = styles[currentStyleId];
|
|
17445
|
-
if (!style || style.type !== 1) return {};
|
|
17446
|
-
visiting.add(currentStyleId);
|
|
17447
|
-
const base = style.basedOn ? resolve(style.basedOn) : {};
|
|
17448
|
-
visiting.delete(currentStyleId);
|
|
17449
|
-
return {
|
|
17450
|
-
...base,
|
|
17451
|
-
..._definedStyle(style.paragraphStyle)
|
|
17452
|
-
};
|
|
17453
|
-
};
|
|
17454
|
-
return resolve(styleId);
|
|
17455
|
-
}
|
|
17456
|
-
function resolveDocumentParagraphStyle(documentStyle, paragraphStyle, options = {}) {
|
|
17457
|
-
const legacyStyle = options.useLegacyModernDefaults ?? (documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 2 ? {
|
|
17458
|
-
lineSpacing: DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING,
|
|
17459
|
-
spaceAbove: { v: 0 },
|
|
17460
|
-
spaceBelow: { v: 12 }
|
|
17461
|
-
} : {};
|
|
17462
|
-
const documentDefaults = {
|
|
17463
|
-
...(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 1 ? { widowControl: 1 } : {},
|
|
17464
|
-
...legacyStyle,
|
|
17465
|
-
..._definedStyle(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.defaultParagraphStyle)
|
|
17466
|
-
};
|
|
17467
|
-
if (options.excludeDocumentOuterSpacing) {
|
|
17468
|
-
delete documentDefaults.spaceAbove;
|
|
17469
|
-
delete documentDefaults.spaceBelow;
|
|
17470
|
-
}
|
|
17471
|
-
const definedParagraphStyle = _definedStyle(paragraphStyle);
|
|
17472
|
-
const referencedParagraphStyle = _resolveNamedParagraphStyle(options.styles, options.paragraphStyleId);
|
|
17473
|
-
const namedStyleType = definedParagraphStyle.namedStyleType ?? referencedParagraphStyle.namedStyleType;
|
|
17474
|
-
const namedStyle = namedStyleType == null ? null : NAMED_STYLE_SPACE_MAP[namedStyleType];
|
|
17475
|
-
return Tools.deepClone({
|
|
17476
|
-
...documentDefaults,
|
|
17477
|
-
...namedStyle,
|
|
17478
|
-
...referencedParagraphStyle,
|
|
17479
|
-
...definedParagraphStyle
|
|
17480
|
-
});
|
|
17481
|
-
}
|
|
17482
|
-
/** Resolves word splitting without materializing inherited defaults in the snapshot. */
|
|
17483
|
-
function resolveDocumentParagraphWordWrap(document, paragraph) {
|
|
17484
|
-
const { documentStyle } = document;
|
|
17485
|
-
const { wordWrap } = resolveDocumentParagraphStyle(documentStyle, paragraph === null || paragraph === void 0 ? void 0 : paragraph.paragraphStyle, {
|
|
17486
|
-
styles: document.styles,
|
|
17487
|
-
paragraphStyleId: paragraph === null || paragraph === void 0 ? void 0 : paragraph.styleId
|
|
17488
|
-
});
|
|
17489
|
-
return wordWrap ?? 0;
|
|
17490
|
-
}
|
|
17491
|
-
|
|
17492
17837
|
// src/docs/data-model/replacement.ts
|
|
17493
17838
|
function replaceInDocumentBody(body, query, target, caseSensitive) {
|
|
17494
17839
|
if (query === "") return body;
|
|
@@ -17507,6 +17852,7 @@ function replaceInDocumentBody(body, query, target, caseSensitive) {
|
|
|
17507
17852
|
if (index > 0) textX.retain(index);
|
|
17508
17853
|
if (target.length > 0) {
|
|
17509
17854
|
var _sliceBody$customRang;
|
|
17855
|
+
documentDataModel.getBody().customDecorations ??= [];
|
|
17510
17856
|
const sliceBody = documentDataModel.sliceBody(index, index + queryLen);
|
|
17511
17857
|
const replaceBody = { dataStream: target };
|
|
17512
17858
|
if (Array.isArray(sliceBody === null || sliceBody === void 0 ? void 0 : sliceBody.textRuns) && sliceBody.textRuns.length) replaceBody.textRuns = [{
|
|
@@ -17647,8 +17993,8 @@ function getIntersectingCustomRanges(startIndex, endIndex, customRanges, rangeTy
|
|
|
17647
17993
|
function getSelectionForAddCustomRange(range, body) {
|
|
17648
17994
|
var _ranges$, _ranges;
|
|
17649
17995
|
const ranges = getIntersectingCustomRanges(range.startOffset, range.collapsed ? range.startOffset : range.endOffset - 1, body.customRanges ?? []);
|
|
17650
|
-
const startOffset = Math.min(range.startOffset, ((_ranges$ = ranges[0]) === null || _ranges$ === void 0 ? void 0 : _ranges$.startIndex) ??
|
|
17651
|
-
const endOffset = Math.max(range.endOffset, (((_ranges = ranges[ranges.length - 1]) === null || _ranges === void 0 ? void 0 : _ranges.endIndex) ?? -
|
|
17996
|
+
const startOffset = Math.min(range.startOffset, ((_ranges$ = ranges[0]) === null || _ranges$ === void 0 ? void 0 : _ranges$.startIndex) ?? 1e400);
|
|
17997
|
+
const endOffset = Math.max(range.endOffset, (((_ranges = ranges[ranges.length - 1]) === null || _ranges === void 0 ? void 0 : _ranges.endIndex) ?? -1e400) + 1);
|
|
17652
17998
|
return {
|
|
17653
17999
|
startOffset,
|
|
17654
18000
|
endOffset,
|
|
@@ -17704,8 +18050,8 @@ function addCustomRangeTextX(param) {
|
|
|
17704
18050
|
const addCustomRange = (startIndex, endIndex, index) => {
|
|
17705
18051
|
var _relativeCustomRanges, _relativeCustomRanges2;
|
|
17706
18052
|
const relativeCustomRanges = getIntersectingCustomRanges(startIndex, endIndex, customRanges, rangeType);
|
|
17707
|
-
const rangeStartIndex = Math.min(((_relativeCustomRanges = relativeCustomRanges[0]) === null || _relativeCustomRanges === void 0 ? void 0 : _relativeCustomRanges.startIndex) ??
|
|
17708
|
-
const rangeEndIndex = Math.max(((_relativeCustomRanges2 = relativeCustomRanges[relativeCustomRanges.length - 1]) === null || _relativeCustomRanges2 === void 0 ? void 0 : _relativeCustomRanges2.endIndex) ?? -
|
|
18053
|
+
const rangeStartIndex = Math.min(((_relativeCustomRanges = relativeCustomRanges[0]) === null || _relativeCustomRanges === void 0 ? void 0 : _relativeCustomRanges.startIndex) ?? 1e400, startIndex);
|
|
18054
|
+
const rangeEndIndex = Math.max(((_relativeCustomRanges2 = relativeCustomRanges[relativeCustomRanges.length - 1]) === null || _relativeCustomRanges2 === void 0 ? void 0 : _relativeCustomRanges2.endIndex) ?? -1e400, endIndex);
|
|
17709
18055
|
const customRange = {
|
|
17710
18056
|
rangeId: index ? `${rangeId}$${index}` : rangeId,
|
|
17711
18057
|
rangeType,
|
|
@@ -24306,8 +24652,8 @@ var Worksheet = class {
|
|
|
24306
24652
|
return this._columnManager.getVisibleCols(0, columnCount - 1);
|
|
24307
24653
|
}
|
|
24308
24654
|
/**
|
|
24309
|
-
*
|
|
24310
|
-
* @returns
|
|
24655
|
+
* Get the worksheet right-to-left view flag.
|
|
24656
|
+
* @returns {BooleanNumber} `BooleanNumber.TRUE` when the flag is enabled, otherwise `BooleanNumber.FALSE`.
|
|
24311
24657
|
*/
|
|
24312
24658
|
isRightToLeft() {
|
|
24313
24659
|
const { _snapshot: _config } = this;
|
|
@@ -25333,6 +25679,32 @@ function getLifecycleStagesAndBefore(lifecycleStage) {
|
|
|
25333
25679
|
*/
|
|
25334
25680
|
const ILocalStorageService = createIdentifier("ILocalStorageService");
|
|
25335
25681
|
|
|
25682
|
+
// src/services/locale/currency-symbol.ts
|
|
25683
|
+
const localeCurrencySymbolMap = /* @__PURE__ */ new Map([
|
|
25684
|
+
["enUS", "$"],
|
|
25685
|
+
["ruRU", "₽"],
|
|
25686
|
+
["viVN", "₫"],
|
|
25687
|
+
["zhCN", "¥"],
|
|
25688
|
+
["zhTW", "NT$"],
|
|
25689
|
+
["zhHK", "HK$"],
|
|
25690
|
+
["frFR", "€"],
|
|
25691
|
+
["faIR", "﷼"],
|
|
25692
|
+
["koKR", "₩"],
|
|
25693
|
+
["esES", "€"],
|
|
25694
|
+
["caES", "€"],
|
|
25695
|
+
["skSK", "€"],
|
|
25696
|
+
["jaJP", "¥"],
|
|
25697
|
+
["ptBR", "R$"],
|
|
25698
|
+
["deDE", "€"],
|
|
25699
|
+
["itIT", "€"],
|
|
25700
|
+
["idID", "Rp"],
|
|
25701
|
+
["plPL", "zł"],
|
|
25702
|
+
["arSA", "﷼"]
|
|
25703
|
+
]);
|
|
25704
|
+
function getCurrencySymbolByLocale(locale) {
|
|
25705
|
+
return localeCurrencySymbolMap.get(locale) || "$";
|
|
25706
|
+
}
|
|
25707
|
+
|
|
25336
25708
|
// src/services/locale/locale.service.ts
|
|
25337
25709
|
/**
|
|
25338
25710
|
* This service provides i18n and timezone / location features to other modules.
|
|
@@ -25605,6 +25977,20 @@ let LocalUndoRedoService = class LocalUndoRedoService extends Disposable {
|
|
|
25605
25977
|
this.disposeWithMe(this._commandService.registerCommand(RedoCommand));
|
|
25606
25978
|
this.disposeWithMe(toDisposable(() => this._undoRedoStatus$.complete()));
|
|
25607
25979
|
this.disposeWithMe(toDisposable(this._univerInstanceService.focused$.subscribe(() => this._updateStatus())));
|
|
25980
|
+
this.disposeWithMe(toDisposable(this._univerInstanceService.unitDisposed$.subscribe((unit) => {
|
|
25981
|
+
const unitId = unit.getUnitId();
|
|
25982
|
+
this._undoStacks.delete(unitId);
|
|
25983
|
+
this._redoStacks.delete(unitId);
|
|
25984
|
+
this._batchingStatus.delete(unitId);
|
|
25985
|
+
this._activeGroups.delete(unitId);
|
|
25986
|
+
this._updateStatus();
|
|
25987
|
+
})));
|
|
25988
|
+
this.disposeWithMe(toDisposable(() => {
|
|
25989
|
+
this._undoStacks.clear();
|
|
25990
|
+
this._redoStacks.clear();
|
|
25991
|
+
this._batchingStatus.clear();
|
|
25992
|
+
this._activeGroups.clear();
|
|
25993
|
+
}));
|
|
25608
25994
|
}
|
|
25609
25995
|
getUndoRedoStatus(unitId) {
|
|
25610
25996
|
var _this$_undoStacks$get, _this$_redoStacks$get;
|
|
@@ -28743,4 +29129,4 @@ function createUniverInjector(parentInjector, override) {
|
|
|
28743
29129
|
*/
|
|
28744
29130
|
installShims();
|
|
28745
29131
|
|
|
28746
|
-
export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BASE_RECORD_ID_FIELD_ID, BASE_RECORD_ID_FIELD_NAME, BORDER_KEYS, BORDER_STYLE_KEYS, BaseConditionalColorOperator, BaseConditionalColorTarget, BaseConditionalDateMode, BaseDataModel, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseHierarchyInvalidReason, BaseRecordLinkRole, BaseSortDirection, BaseViewType, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnLayoutType, ColumnResponsiveType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DateSystem, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, EDITOR_ACTIVATED, EMU_PER_CSS_PX, EXCEL_1904_OFFSET, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_BOARD, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FilterSelectionMode, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, FormulaType, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LOCALE_META, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ITERATION_COUNT, MAX_ROW_COUNT, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, OBJECT_PERMISSION_CONFIG_KEY, ObjectMatrix, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PARAGRAPH_ID_PREFIX, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RESTORE_INSERTED_PARAGRAPH_IDS, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, RecordValueType, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, RegionService, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextParagraphBuilder, RichTextRunBuilder, RichTextValue, RxDisposable, SECTION_ID_PREFIX, SHEET_EDITOR_UNITS, SHEET_TEXT_LINE_GAP, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TabStopAlignment, TabStopLeader, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WorksheetHiddenState, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, allocateBaseFormulaTableName, assertBaseTableRecordIdentity, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneBodyWithFreshParagraphIds, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneParagraphWithId, cloneSectionBreakWithId, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, containsInteriorInsertionOffset, containsStreamIndex, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createBaseFormulaTableNameMap, createBaseFormulaTableReferenceNormalizer, createBaseRecordIdField, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, cssPxToEmu, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, emuToCssPx, excelDateSerial, excelDateTimePartsToSerial, excelDateTimeSerial, excelSerialToDate, excelSerialToDateTime, excelSerialToDateTimeParts, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBaseFormulaTableName, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCustomBlockIdsInSelections, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDateSystemMaxSerial, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getDrawingOrderIndex, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, getNumfmtLocaleTag, getNumfmtParseValueFilter, getOriginCellValue, getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset, getParagraphsSlice, getPlainText, getRecordValueKey, getReverseDirection, getRichTextEditPath, getSdtBindingKey, getSdtBindingValue, getSectionBreakSlice, getSectionHeaderFooterReferenceKey, getEmptySnapshot$2 as getSheetsEmptySnapshot, getSingleDataStreamChange, getTableCellTokenInterval, getTableRangeInterval, getTableRowTokenInterval, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, intersectsOperationalIntervals, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBaseRecordIdFieldName, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSafeUrl, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidBaseRecordId, isValidColumnDimensions, isValidRange, isValidRowDimensions, isValidSheetDimension, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, migrateBaseFormulaTableNames, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBaseFormulaTableName, normalizeBaseFormulaTableReferences, normalizeBody, normalizeDrawingOrderIndex, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, normalizeWorkbookCalculationSettings, numberToABC, numberToListABC, api_exports as numfmt, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveDocumentParagraphWordWrap, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, setWith, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };
|
|
29132
|
+
export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BASE_RECORD_ID_FIELD_ID, BASE_RECORD_ID_FIELD_NAME, BORDER_KEYS, BORDER_STYLE_KEYS, BaseConditionalColorOperator, BaseConditionalColorTarget, BaseConditionalDateMode, BaseDataModel, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseHierarchyInvalidReason, BaseRecordLinkRole, BaseSortDirection, BaseViewType, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnLayoutType, ColumnResponsiveType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DateSystem, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, EDITOR_ACTIVATED, EMU_PER_CSS_PX, EXCEL_1904_OFFSET, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_BOARD, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FilterSelectionMode, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, FormulaType, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LOCALE_META, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ITERATION_COUNT, MAX_ROW_COUNT, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, OBJECT_PERMISSION_CONFIG_KEY, ObjectMatrix, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PARAGRAPH_ID_PREFIX, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RESTORE_INSERTED_PARAGRAPH_IDS, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, RecordValueType, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, RegionService, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextParagraphBuilder, RichTextRunBuilder, RichTextValue, RxDisposable, SECTION_ID_PREFIX, SHEET_EDITOR_UNITS, SHEET_TEXT_LINE_GAP, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, SpecialCharacterKind, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TabStopAlignment, TabStopLeader, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WorksheetHiddenState, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, allocateBaseFormulaTableName, assertBaseTableRecordIdentity, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneBodyWithFreshParagraphIds, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneParagraphWithId, cloneSectionBreakWithId, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, containsInteriorInsertionOffset, containsStreamIndex, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createBaseFormulaTableNameMap, createBaseFormulaTableReferenceNormalizer, createBaseRecordIdField, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, cssPxToEmu, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, emuToCssPx, excelDateSerial, excelDateTimePartsToSerial, excelDateTimeSerial, excelSerialToDate, excelSerialToDateTime, excelSerialToDateTimeParts, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBaseFormulaTableName, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCurrencySymbolByLocale, getCustomBlockIdsInSelections, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDateSystemMaxSerial, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getDocumentParagraphStyleForUpdate, getDrawingOrderIndex, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, getNumfmtLocaleTag, getNumfmtParseValueFilter, getOriginCellValue, getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset, getParagraphsSlice, getPlainText, getRecordValueKey, getReverseDirection, getRichTextEditPath, getSdtBindingKey, getSdtBindingValue, getSectionBreakSlice, getSectionHeaderFooterReferenceKey, getEmptySnapshot$2 as getSheetsEmptySnapshot, getSingleDataStreamChange, getTableCellTokenInterval, getTableRangeInterval, getTableRowTokenInterval, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, intersectsOperationalIntervals, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBaseRecordIdFieldName, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSafeUrl, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidBaseRecordId, isValidColumnDimensions, isValidRange, isValidRowDimensions, isValidSheetDimension, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, migrateBaseFormulaTableNames, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBaseFormulaTableName, normalizeBaseFormulaTableReferences, normalizeBody, normalizeDrawingOrderIndex, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, normalizeWorkbookCalculationSettings, numberToABC, numberToListABC, api_exports as numfmt, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphBullet, resolveDocumentParagraphStyle, resolveDocumentParagraphWordWrap, resolveDocumentTextStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, setTextDecorationLines, setWith, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };
|