@univerjs/core 0.4.1 → 0.4.2
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/index.js +5 -5
- package/lib/es/index.js +618 -278
- package/lib/types/common/const.d.ts +1 -0
- package/lib/types/docs/data-model/json-x/json-x.d.ts +2 -2
- package/lib/types/docs/data-model/text-x/__tests__/apply.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/action-types.d.ts +0 -5
- package/lib/types/docs/data-model/text-x/build-utils/custom-range.d.ts +9 -1
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +3 -3
- package/lib/types/docs/data-model/text-x/text-x.d.ts +4 -4
- package/lib/types/index.d.ts +1 -1
- package/lib/types/services/config/config.service.d.ts +10 -1
- package/lib/types/services/permission/permission.service.d.ts +3 -0
- package/lib/types/services/permission/type.d.ts +2 -0
- package/lib/types/shared/__tests__/compose.spec.d.ts +16 -0
- package/lib/types/shared/lifecycle.d.ts +1 -1
- package/lib/types/shared/r-tree.d.ts +21 -4
- package/lib/types/shared/rectangle.d.ts +1 -0
- package/lib/types/shared/tools.d.ts +9 -2
- package/lib/types/sheets/column-manager.d.ts +19 -2
- package/lib/types/sheets/row-manager.d.ts +22 -4
- package/lib/types/sheets/typedef.d.ts +32 -2
- package/lib/types/sheets/view-model.d.ts +2 -2
- package/lib/types/sheets/worksheet.d.ts +47 -1
- package/lib/types/types/enum/data-validation-type.d.ts +2 -1
- package/lib/types/types/interfaces/i-document-data.d.ts +3 -2
- package/lib/umd/index.js +5 -5
- package/package.json +4 -3
package/lib/es/index.js
CHANGED
|
@@ -877,7 +877,7 @@ function isBooleanString(str) {
|
|
|
877
877
|
}
|
|
878
878
|
__name(isBooleanString, "isBooleanString");
|
|
879
879
|
const PREFIX = "__INTERNAL_EDITOR__", DOCS_NORMAL_EDITOR_UNIT_ID_KEY = `${PREFIX}DOCS_NORMAL`, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY = `${PREFIX}DOCS_FORMULA_BAR`, DOCS_ZEN_EDITOR_UNIT_ID_KEY = `${PREFIX}ZEN_EDITOR`, DEFAULT_EMPTY_DOCUMENT_VALUE = `\r
|
|
880
|
-
|
|
880
|
+
`, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE = "isRowStylePrecedeColumnStyle";
|
|
881
881
|
function createInternalEditorID(id) {
|
|
882
882
|
return `${PREFIX}${id}`;
|
|
883
883
|
}
|
|
@@ -3086,7 +3086,38 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
|
|
|
3086
3086
|
"X",
|
|
3087
3087
|
"Y",
|
|
3088
3088
|
"Z"
|
|
3089
|
-
]
|
|
3089
|
+
];
|
|
3090
|
+
function isValueEqual(oneValue, twoValue) {
|
|
3091
|
+
const oneType = Tools.getValueType(oneValue), twoType = Tools.getValueType(twoValue);
|
|
3092
|
+
return oneType !== twoType ? !1 : Tools.isArray(oneValue) ? diffArrays(oneValue, twoValue) : Tools.isObject(oneValue) ? diffObject(oneValue, twoValue) : Tools.isDate(oneValue) ? oneValue.getTime() === twoValue.getTime() : Tools.isRegExp(oneValue) ? oneValue.toString() === twoValue.toString() : oneValue === twoValue;
|
|
3093
|
+
}
|
|
3094
|
+
__name(isValueEqual, "isValueEqual");
|
|
3095
|
+
function diffArrays(oneArray, twoArray) {
|
|
3096
|
+
if (oneArray.length !== twoArray.length)
|
|
3097
|
+
return !1;
|
|
3098
|
+
for (let i = 0, len = oneArray.length; i < len; i++) {
|
|
3099
|
+
const oneValue = oneArray[i], twoValue = twoArray[i];
|
|
3100
|
+
if (!isValueEqual(oneValue, twoValue))
|
|
3101
|
+
return !1;
|
|
3102
|
+
}
|
|
3103
|
+
return !0;
|
|
3104
|
+
}
|
|
3105
|
+
__name(diffArrays, "diffArrays");
|
|
3106
|
+
function diffObject(oneObject, twoObject) {
|
|
3107
|
+
const oneKeys = Object.keys(oneObject), twoKeys = Object.keys(twoObject);
|
|
3108
|
+
if (oneKeys.length !== twoKeys.length)
|
|
3109
|
+
return !1;
|
|
3110
|
+
for (const key of oneKeys) {
|
|
3111
|
+
if (!twoKeys.includes(key))
|
|
3112
|
+
return !1;
|
|
3113
|
+
const oneValue = oneObject[key], twoValue = twoObject[key];
|
|
3114
|
+
if (!isValueEqual(oneValue, twoValue))
|
|
3115
|
+
return !1;
|
|
3116
|
+
}
|
|
3117
|
+
return !0;
|
|
3118
|
+
}
|
|
3119
|
+
__name(diffObject, "diffObject");
|
|
3120
|
+
const _Tools = class _Tools {
|
|
3090
3121
|
static stringAt(index2) {
|
|
3091
3122
|
let str = "", idx = index2;
|
|
3092
3123
|
for (; idx >= alphabets.length; )
|
|
@@ -3201,37 +3232,8 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
|
|
|
3201
3232
|
static numberFixed(value, digit) {
|
|
3202
3233
|
return Number(Number(value).toFixed(digit));
|
|
3203
3234
|
}
|
|
3204
|
-
static diffValue(one,
|
|
3205
|
-
|
|
3206
|
-
const oneType = _Tools.getValueType(oneValue), towType = _Tools.getValueType(towValue);
|
|
3207
|
-
return oneType !== towType ? !1 : _Tools.isArray(oneValue) ? diffArrays(oneValue, towValue) : _Tools.isObject(oneValue) ? diffObject(oneValue, towValue) : _Tools.isDate(oneValue) ? oneValue.getTime() === towValue.getTime() : _Tools.isRegExp(oneValue) ? oneValue.toString() === towValue.toString() : oneValue === towValue;
|
|
3208
|
-
}
|
|
3209
|
-
__name(diffValue, "diffValue");
|
|
3210
|
-
function diffArrays(oneArray, towArray) {
|
|
3211
|
-
if (oneArray.length !== towArray.length)
|
|
3212
|
-
return !1;
|
|
3213
|
-
for (let i = 0, len = oneArray.length; i < len; i++) {
|
|
3214
|
-
const oneValue = oneArray[i], towValue = towArray[i];
|
|
3215
|
-
if (!diffValue(oneValue, towValue))
|
|
3216
|
-
return !1;
|
|
3217
|
-
}
|
|
3218
|
-
return !0;
|
|
3219
|
-
}
|
|
3220
|
-
__name(diffArrays, "diffArrays");
|
|
3221
|
-
function diffObject(oneObject, towObject) {
|
|
3222
|
-
const oneKeys = Object.keys(oneObject), towKeys = Object.keys(towObject);
|
|
3223
|
-
if (oneKeys.length !== towKeys.length)
|
|
3224
|
-
return !1;
|
|
3225
|
-
for (const key of oneKeys) {
|
|
3226
|
-
if (!towKeys.includes(key))
|
|
3227
|
-
return !1;
|
|
3228
|
-
const oneValue = oneObject[key], towValue = towObject[key];
|
|
3229
|
-
if (!diffValue(oneValue, towValue))
|
|
3230
|
-
return !1;
|
|
3231
|
-
}
|
|
3232
|
-
return !0;
|
|
3233
|
-
}
|
|
3234
|
-
return __name(diffObject, "diffObject"), diffValue(one, tow);
|
|
3235
|
+
static diffValue(one, two) {
|
|
3236
|
+
return isValueEqual(one, two);
|
|
3235
3237
|
}
|
|
3236
3238
|
static deepClone(value) {
|
|
3237
3239
|
if (!this.isDefine(value))
|
|
@@ -3485,6 +3487,19 @@ function generateRandomId(n = 21, alphabet) {
|
|
|
3485
3487
|
return alphabet ? customAlphabet(alphabet, n)() : nanoid(n);
|
|
3486
3488
|
}
|
|
3487
3489
|
__name(generateRandomId, "generateRandomId");
|
|
3490
|
+
function composeStyles(...styles) {
|
|
3491
|
+
const result = {}, length = styles.length;
|
|
3492
|
+
for (let i = length - 1; i >= 0; i--) {
|
|
3493
|
+
const style = styles[i];
|
|
3494
|
+
if (style) {
|
|
3495
|
+
const keys = Object.keys(style);
|
|
3496
|
+
for (const key of keys)
|
|
3497
|
+
result[key] === void 0 && (result[key] = style[key]);
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
return result;
|
|
3501
|
+
}
|
|
3502
|
+
__name(composeStyles, "composeStyles");
|
|
3488
3503
|
function getBodySliceHtml(body, startIndex, endIndex) {
|
|
3489
3504
|
const { dataStream, textRuns = [] } = body;
|
|
3490
3505
|
let cursorIndex = startIndex;
|
|
@@ -4418,21 +4433,21 @@ function handleStyleToString(style, isCell = !1) {
|
|
|
4418
4433
|
"ul",
|
|
4419
4434
|
() => {
|
|
4420
4435
|
var _a12;
|
|
4421
|
-
(_a12 = style.ul) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (
|
|
4436
|
+
(_a12 = style.ul) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_2, p1) => `${p1} underline`) : str += "text-decoration: underline; ", style.ul.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ul.cl)}; `), style.ul.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ul.t} `));
|
|
4422
4437
|
}
|
|
4423
4438
|
],
|
|
4424
4439
|
[
|
|
4425
4440
|
"st",
|
|
4426
4441
|
() => {
|
|
4427
4442
|
var _a12;
|
|
4428
|
-
(_a12 = style.st) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (
|
|
4443
|
+
(_a12 = style.st) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_2, p1) => `${p1} line-through`) : str += "text-decoration-line: line-through; ", style.st.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.st.cl)}; `), style.st.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.st.t} `));
|
|
4429
4444
|
}
|
|
4430
4445
|
],
|
|
4431
4446
|
[
|
|
4432
4447
|
"ol",
|
|
4433
4448
|
() => {
|
|
4434
4449
|
var _a12;
|
|
4435
|
-
(_a12 = style.ol) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (
|
|
4450
|
+
(_a12 = style.ol) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_2, p1) => `${p1} overline`) : str += "text-decoration-line: overline; ", style.ol.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ol.cl)}; `), style.ol.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ol.t} `));
|
|
4436
4451
|
}
|
|
4437
4452
|
],
|
|
4438
4453
|
[
|
|
@@ -4906,7 +4921,7 @@ var numfmt$2 = { exports: {} };
|
|
|
4906
4921
|
return { ...g };
|
|
4907
4922
|
}
|
|
4908
4923
|
__name(h, "h");
|
|
4909
|
-
const y = { "#": "", 0: "0", "?": " " },
|
|
4924
|
+
const y = { "#": "", 0: "0", "?": " " }, _2 = { "@": "text", "-": "minus", "+": "plus" }, b = ["#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#800", "#080", "#008", "#880", "#808", "#088", "#CCC", "#888", "#99F", "#936", "#FFC", "#CFF", "#606", "#F88", "#06C", "#CCF", "#008", "#F0F", "#FF0", "#0FF", "#808", "#800", "#088", "#00F", "#0CF", "#CFF", "#CFC", "#FF9", "#9CF", "#F9C", "#C9F", "#FC9", "#36F", "#3CC", "#9C0", "#FC0"], j = ["¤", "$", "£", "¥", "֏", "؋", "৳", "฿", "៛", "₡", "₦", "₩", "₪", "₫", "€", "₭", "₮", "₱", "₲", "₴", "₸", "₹", "₺", "₼", "₽", "₾", "₿"], v = new RegExp("[" + j.join("") + "]");
|
|
4910
4925
|
function M(e2, t2, n2) {
|
|
4911
4926
|
return t2[n2 + "_max"] = e2.length, t2[n2 + "_min"] = e2.replace(/#/g, "").length, t2;
|
|
4912
4927
|
}
|
|
@@ -4947,7 +4962,7 @@ var numfmt$2 = { exports: {} };
|
|
|
4947
4962
|
i2 = !0;
|
|
4948
4963
|
break;
|
|
4949
4964
|
}
|
|
4950
|
-
if (d2 = /^[@+-]/.exec(a2)) d2[0] === "@" && (n2.text = !0), F({ type:
|
|
4965
|
+
if (d2 = /^[@+-]/.exec(a2)) d2[0] === "@" && (n2.text = !0), F({ type: _2[d2[0]] }, t2);
|
|
4951
4966
|
else if (d2 = /^(?:\[(h+|m+|s+)\])/i.exec(a2)) {
|
|
4952
4967
|
const e3 = d2[1].toLowerCase(), a3 = e3[0], r3 = { type: "", size: 0, date: 1, raw: d2[0], pad: e3.length };
|
|
4953
4968
|
a3 === "h" ? (r3.size = 16, r3.type = "hour-elap") : a3 === "m" ? (r3.size = 32, r3.type = "min-elap") : (r3.size = 64, r3.type = "sec-elap"), n2.date = n2.date | r3.size, l2.push(r3), F(r3, t2);
|
|
@@ -5106,7 +5121,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5106
5121
|
return t2 === 6 ? A(a2) : t2 === -1 ? E(a2) : C(a2, n2);
|
|
5107
5122
|
}
|
|
5108
5123
|
__name(Y, "Y");
|
|
5109
|
-
const
|
|
5124
|
+
const T = Math.floor, N = 86400;
|
|
5110
5125
|
function P(e2, t2) {
|
|
5111
5126
|
let n2 = null;
|
|
5112
5127
|
if (Array.isArray(e2)) {
|
|
@@ -5126,9 +5141,9 @@ var numfmt$2 = { exports: {} };
|
|
|
5126
5141
|
function I(e2, t2) {
|
|
5127
5142
|
let n2 = 0 | e2;
|
|
5128
5143
|
const a2 = N * (e2 - n2);
|
|
5129
|
-
let r2 =
|
|
5144
|
+
let r2 = T(a2);
|
|
5130
5145
|
a2 - r2 > 0.9999 && (r2 += 1, r2 === N && (r2 = 0, n2 += 1));
|
|
5131
|
-
const i2 = r2 < 0 ? N + r2 : r2, [s2, o2, l2] = Y(e2, 0, t2 && t2.leap1900), d2 =
|
|
5146
|
+
const i2 = r2 < 0 ? N + r2 : r2, [s2, o2, l2] = Y(e2, 0, t2 && t2.leap1900), d2 = T(i2 / 60 / 60) % 60, m2 = T(i2 / 60) % 60, u2 = T(i2) % 60;
|
|
5132
5147
|
if (t2 && t2.nativeDate) {
|
|
5133
5148
|
const e3 = /* @__PURE__ */ new Date(0);
|
|
5134
5149
|
return e3.setUTCFullYear(s2, o2 - 1, l2), e3.setUTCHours(d2, m2, u2), e3;
|
|
@@ -5149,7 +5164,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5149
5164
|
return !(t2 && !t2.generated || n2 && !n2.generated || a2 && !a2.generated || !r2 || !r2.text || r2.generated);
|
|
5150
5165
|
}
|
|
5151
5166
|
__name(L, "L");
|
|
5152
|
-
const U = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 },
|
|
5167
|
+
const U = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 }, R = [["DMY", 1], ["DM", 2], ["MY", 3], ["MDY", 4], ["MD", 5], ["hmsa", 6], ["hma", 7], ["hms", 8], ["hm", 9]], G2 = { total: 1, sign: 0, period: 0, int: 1, frac: 0 }, H = /* @__PURE__ */ __name((e2, t2) => e2.replace(/\./, t2.decimal), "H");
|
|
5153
5168
|
function B(e2, t2, n2, a2) {
|
|
5154
5169
|
const r2 = 0 | n2;
|
|
5155
5170
|
if (typeof n2 == "string") e2.push(n2);
|
|
@@ -5161,7 +5176,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5161
5176
|
const s2 = function(e3) {
|
|
5162
5177
|
let t4 = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
|
|
5163
5178
|
const n3 = Math.abs(e3);
|
|
5164
|
-
if (!n3) return
|
|
5179
|
+
if (!n3) return G2;
|
|
5165
5180
|
const a3 = t4 && e3 < 0 ? 1 : 0, r4 = Math.floor(n3), i3 = Math.floor(Math.log10(n3) + 1);
|
|
5166
5181
|
let s3 = 0, o3 = 0;
|
|
5167
5182
|
if (r4 !== n3) {
|
|
@@ -5204,7 +5219,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5204
5219
|
return t2 > 1 ? Math.floor(n2 / t2) * t2 : n2;
|
|
5205
5220
|
}, "Z");
|
|
5206
5221
|
function K(e2, t2, n2, a2) {
|
|
5207
|
-
let r2 = "", i2 = "", s2 = "", o2 = "", l2 = "", d2 = 0, m2 = 0 | e2, f2 = 0, g2 = 0, h2 = 1,
|
|
5222
|
+
let r2 = "", i2 = "", s2 = "", o2 = "", l2 = "", d2 = 0, m2 = 0 | e2, f2 = 0, g2 = 0, h2 = 1, _3 = 0, b2 = 0, j2 = 0, v2 = 0, M2 = 0, k2 = 0;
|
|
5208
5223
|
const x2 = a2 || u;
|
|
5209
5224
|
if (!t2.text && isFinite(t2.scale) && t2.scale !== 1 && (e2 = function(e3) {
|
|
5210
5225
|
if (e3 === 0) return e3;
|
|
@@ -5246,7 +5261,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5246
5261
|
}
|
|
5247
5262
|
if (m2 || t2.date_system) {
|
|
5248
5263
|
const a4 = Y(e2, t2.date_system, n2.leap1900);
|
|
5249
|
-
g2 = a4[0], h2 = a4[1],
|
|
5264
|
+
g2 = a4[0], h2 = a4[1], _3 = a4[2];
|
|
5250
5265
|
}
|
|
5251
5266
|
if (f2) {
|
|
5252
5267
|
const e3 = f2 < 0 ? $ + f2 : f2;
|
|
@@ -5296,7 +5311,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5296
5311
|
else if (u3.type === "monthname") t2.date_system === 6 ? D2.push(x2.mmmm6[h2 - 1]) : D2.push(x2.mmmm[h2 - 1]);
|
|
5297
5312
|
else if (u3.type === "weekday-short") D2.push(x2.ddd[b2]);
|
|
5298
5313
|
else if (u3.type === "weekday") D2.push(x2.dddd[b2]);
|
|
5299
|
-
else if (u3.type === "day") D2.push(u3.pad &&
|
|
5314
|
+
else if (u3.type === "day") D2.push(u3.pad && _3 < 10 ? "0" : "", _3);
|
|
5300
5315
|
else if (u3.type === "hour") {
|
|
5301
5316
|
const e3 = j2 % t2.clock || (t2.clock < 24 ? t2.clock : 0);
|
|
5302
5317
|
D2.push(u3.pad && e3 < 10 ? "0" : "", e3);
|
|
@@ -5540,7 +5555,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5540
5555
|
const r5 = a4.type;
|
|
5541
5556
|
/^(b-)?year/.test(r5) ? (n4 += "Y", t4++) : r5.startsWith("month") ? (n4 += "M", t4++) : /^(week)?day/.test(r5) ? (n4 += "D", t4++) : r5 !== "hour" && r5 !== "min" && r5 !== "sec" && r5 !== "am" || (n4 += r5[0], e4++);
|
|
5542
5557
|
}), s3.type = "date", t4 && e4 ? s3.type = "datetime" : !t4 && e4 && (s3.type = "time");
|
|
5543
|
-
const r4 =
|
|
5558
|
+
const r4 = R.find((e5) => n4.startsWith(e5[0]));
|
|
5544
5559
|
l2 = r4 ? "D" : "G", d2 = r4 ? r4[1] : "";
|
|
5545
5560
|
} else s3.isText ? (l2 = "G", s3.type = "text", d2 = "", s3.maxDecimals = 0) : a3.general ? (l2 = "G", s3.type = "general", d2 = "") : a3.fractions ? (l2 = "G", s3.type = "fraction", d2 = "") : a3.exponential ? (l2 = "S", s3.type = "scientific") : s3.isPercent ? (l2 = "P", s3.type = "percent") : a3.grouping ? (l2 = ",", s3.type = "grouped") : (a3.int_max || i3) && (l2 = "F", s3.type = "number");
|
|
5546
5561
|
return s3.code = l2 + d2 + u2 + m2, s3.level = U[s3.type], Object.freeze(s3);
|
|
@@ -6630,10 +6645,23 @@ function moveRangeByOffset(range, refOffsetX, refOffsetY, ignoreAbsolute = !1) {
|
|
|
6630
6645
|
if (refOffsetX === 0 && refOffsetY === 0)
|
|
6631
6646
|
return range;
|
|
6632
6647
|
let newRange = { ...range };
|
|
6633
|
-
const startAbsoluteRefType = newRange.startAbsoluteRefType || AbsoluteRefType.NONE, endAbsoluteRefType = newRange.endAbsoluteRefType || AbsoluteRefType.NONE;
|
|
6634
|
-
|
|
6648
|
+
const startAbsoluteRefType = newRange.startAbsoluteRefType || AbsoluteRefType.NONE, endAbsoluteRefType = newRange.endAbsoluteRefType || AbsoluteRefType.NONE, rangeType = newRange.rangeType || RANGE_TYPE.NORMAL;
|
|
6649
|
+
if (!ignoreAbsolute && startAbsoluteRefType === AbsoluteRefType.ALL && endAbsoluteRefType === AbsoluteRefType.ALL)
|
|
6650
|
+
return newRange;
|
|
6651
|
+
const start = moveRangeByRangeType(newRange.startRow, refOffsetY, newRange.startColumn, refOffsetX, rangeType), end = moveRangeByRangeType(newRange.endRow, refOffsetY, newRange.endColumn, refOffsetX, rangeType);
|
|
6652
|
+
return ignoreAbsolute || startAbsoluteRefType === AbsoluteRefType.NONE && endAbsoluteRefType === AbsoluteRefType.NONE ? newRange = {
|
|
6653
|
+
...newRange,
|
|
6654
|
+
startRow: start.row,
|
|
6655
|
+
startColumn: start.column,
|
|
6656
|
+
endRow: end.row,
|
|
6657
|
+
endColumn: end.column
|
|
6658
|
+
} : (startAbsoluteRefType === AbsoluteRefType.NONE ? newRange = { ...newRange, startRow: start.row, startColumn: start.column } : startAbsoluteRefType === AbsoluteRefType.COLUMN ? newRange = { ...newRange, startRow: start.row } : startAbsoluteRefType === AbsoluteRefType.ROW && (newRange = { ...newRange, startColumn: start.column }), endAbsoluteRefType === AbsoluteRefType.NONE ? newRange = { ...newRange, endRow: end.row, endColumn: end.column } : endAbsoluteRefType === AbsoluteRefType.COLUMN ? newRange = { ...newRange, endRow: end.row } : endAbsoluteRefType === AbsoluteRefType.ROW && (newRange = { ...newRange, endColumn: end.column }), newRange);
|
|
6635
6659
|
}
|
|
6636
6660
|
__name(moveRangeByOffset, "moveRangeByOffset");
|
|
6661
|
+
function moveRangeByRangeType(row, rowOffset, column, columnOffset, rangeType) {
|
|
6662
|
+
return rangeType === RANGE_TYPE.NORMAL ? { row: row + rowOffset, column: column + columnOffset } : rangeType === RANGE_TYPE.ROW ? { row: row + rowOffset, column } : rangeType === RANGE_TYPE.COLUMN ? { row, column: column + columnOffset } : { row, column };
|
|
6663
|
+
}
|
|
6664
|
+
__name(moveRangeByRangeType, "moveRangeByRangeType");
|
|
6637
6665
|
function splitIntoGrid(ranges) {
|
|
6638
6666
|
const columns = /* @__PURE__ */ new Set(), rows = /* @__PURE__ */ new Set();
|
|
6639
6667
|
for (const range of ranges)
|
|
@@ -6937,6 +6965,9 @@ const _Rectangle = class _Rectangle {
|
|
|
6937
6965
|
height: bottom - top
|
|
6938
6966
|
};
|
|
6939
6967
|
}
|
|
6968
|
+
static sort(ranges) {
|
|
6969
|
+
return ranges.sort((a, b) => a.startRow - b.startRow || a.startColumn - b.startColumn);
|
|
6970
|
+
}
|
|
6940
6971
|
};
|
|
6941
6972
|
__name(_Rectangle, "Rectangle"), __publicField(_Rectangle, "getRelativeRange", /* @__PURE__ */ __name((range, originRange) => ({
|
|
6942
6973
|
startRow: range.startRow - originRange.startRow,
|
|
@@ -7143,7 +7174,7 @@ function sortRulesFactory(key = "index", ruler = 1) {
|
|
|
7143
7174
|
return (oa, ob) => oa[key] > ob[key] ? ruler : oa[key] === ob[key] ? 0 : -ruler;
|
|
7144
7175
|
}
|
|
7145
7176
|
__name(sortRulesFactory, "sortRulesFactory");
|
|
7146
|
-
var
|
|
7177
|
+
var _ = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(_ || {}), S = /* @__PURE__ */ ((E) => (E[E.Reader = 0] = "Reader", E[E.Editor = 1] = "Editor", E[E.Owner = 2] = "Owner", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(S || {}), G = /* @__PURE__ */ ((E) => (E[E.SomeCollaborator = 0] = "SomeCollaborator", E[E.AllCollaborator = 1] = "AllCollaborator", E[E.OneSelf = 2] = "OneSelf", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(G || {});
|
|
7147
7178
|
const _UnitModel = class _UnitModel extends Disposable {
|
|
7148
7179
|
};
|
|
7149
7180
|
__name(_UnitModel, "UnitModel");
|
|
@@ -8697,7 +8728,7 @@ function makeCustomRangeStream(stream) {
|
|
|
8697
8728
|
return `${stream}`;
|
|
8698
8729
|
}
|
|
8699
8730
|
__name(makeCustomRangeStream, "makeCustomRangeStream");
|
|
8700
|
-
var DocStyleType = /* @__PURE__ */ ((DocStyleType2) => (DocStyleType2[DocStyleType2.character = 0] = "character", DocStyleType2[DocStyleType2.paragraph = 1] = "paragraph", DocStyleType2[DocStyleType2.table = 2] = "table", DocStyleType2[DocStyleType2.numbering = 3] = "numbering", DocStyleType2))(DocStyleType || {}), FollowNumberWithType = /* @__PURE__ */ ((FollowNumberWithType2) => (FollowNumberWithType2[FollowNumberWithType2.TAB = 0] = "TAB", FollowNumberWithType2[FollowNumberWithType2.SPACE = 1] = "SPACE", FollowNumberWithType2[FollowNumberWithType2.NOTHING = 2] = "NOTHING", FollowNumberWithType2))(FollowNumberWithType || {}), GlyphType = /* @__PURE__ */ ((GlyphType2) => (GlyphType2[GlyphType2.BULLET = 0] = "BULLET", GlyphType2[GlyphType2.NONE = 1] = "NONE", GlyphType2[GlyphType2.DECIMAL = 2] = "DECIMAL", GlyphType2[GlyphType2.DECIMAL_ZERO = 3] = "DECIMAL_ZERO", GlyphType2[GlyphType2.UPPER_LETTER = 4] = "UPPER_LETTER", GlyphType2[GlyphType2.LOWER_LETTER = 5] = "LOWER_LETTER", GlyphType2[GlyphType2.UPPER_ROMAN = 6] = "UPPER_ROMAN", GlyphType2[GlyphType2.LOWER_ROMAN = 7] = "LOWER_ROMAN", GlyphType2[GlyphType2.ORDINAL = 8] = "ORDINAL", GlyphType2[GlyphType2.CARDINAL_TEXT = 9] = "CARDINAL_TEXT", GlyphType2[GlyphType2.ORDINAL_TEXT = 10] = "ORDINAL_TEXT", GlyphType2[GlyphType2.HEX = 11] = "HEX", GlyphType2[GlyphType2.CHICAGO = 12] = "CHICAGO", GlyphType2[GlyphType2.IDEOGRAPH_DIGITAL = 13] = "IDEOGRAPH_DIGITAL", GlyphType2[GlyphType2.JAPANESE_COUNTING = 14] = "JAPANESE_COUNTING", GlyphType2[GlyphType2.AIUEO = 15] = "AIUEO", GlyphType2[GlyphType2.IROHA = 16] = "IROHA", GlyphType2[GlyphType2.DECIMAL_FULL_WIDTH = 17] = "DECIMAL_FULL_WIDTH", GlyphType2[GlyphType2.DECIMAL_HALF_WIDTH = 18] = "DECIMAL_HALF_WIDTH", GlyphType2[GlyphType2.JAPANESE_LEGAL = 19] = "JAPANESE_LEGAL", GlyphType2[GlyphType2.JAPANESE_DIGITAL_TEN_THOUSAND = 20] = "JAPANESE_DIGITAL_TEN_THOUSAND", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_CIRCLE = 21] = "DECIMAL_ENCLOSED_CIRCLE", GlyphType2[GlyphType2.DECIMAL_FULL_WIDTH2 = 22] = "DECIMAL_FULL_WIDTH2", GlyphType2[GlyphType2.AIUEO_FULL_WIDTH = 23] = "AIUEO_FULL_WIDTH", GlyphType2[GlyphType2.IROHA_FULL_WIDTH = 24] = "IROHA_FULL_WIDTH", GlyphType2[GlyphType2.GANADA = 25] = "GANADA", GlyphType2[GlyphType2.CHOSUNG = 26] = "CHOSUNG", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_FULLSTOP = 27] = "DECIMAL_ENCLOSED_FULLSTOP", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_PAREN = 28] = "DECIMAL_ENCLOSED_PAREN", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_CIRCLE_CHINESE = 29] = "DECIMAL_ENCLOSED_CIRCLE_CHINESE", GlyphType2[GlyphType2.IDEOGRAPH_ENCLOSED_CIRCLE = 30] = "IDEOGRAPH_ENCLOSED_CIRCLE", GlyphType2[GlyphType2.IDEOGRAPH_TRADITIONAL = 31] = "IDEOGRAPH_TRADITIONAL", GlyphType2[GlyphType2.IDEOGRAPH_ZODIAC = 32] = "IDEOGRAPH_ZODIAC", GlyphType2[GlyphType2.IDEOGRAPH_ZODIAC_TRADITIONAL = 33] = "IDEOGRAPH_ZODIAC_TRADITIONAL", GlyphType2[GlyphType2.TAIWANESE_COUNTING = 34] = "TAIWANESE_COUNTING", GlyphType2[GlyphType2.IDEOGRAPH_LEGAL_TRADITIONAL = 35] = "IDEOGRAPH_LEGAL_TRADITIONAL", GlyphType2[GlyphType2.TAIWANESE_COUNTING_THOUSAND = 36] = "TAIWANESE_COUNTING_THOUSAND", GlyphType2[GlyphType2.TAIWANESE_DIGITAL = 37] = "TAIWANESE_DIGITAL", GlyphType2[GlyphType2.CHINESE_COUNTING = 38] = "CHINESE_COUNTING", GlyphType2[GlyphType2.CHINESE_LEGAL_SIMPLIFIED = 39] = "CHINESE_LEGAL_SIMPLIFIED", GlyphType2[GlyphType2.CHINESE_COUNTING_THOUSAND = 40] = "CHINESE_COUNTING_THOUSAND", GlyphType2[GlyphType2.KOREAN_DIGITAL = 41] = "KOREAN_DIGITAL", GlyphType2[GlyphType2.KOREAN_COUNTING = 42] = "KOREAN_COUNTING", GlyphType2[GlyphType2.KOREAN_LEGAL = 43] = "KOREAN_LEGAL", GlyphType2[GlyphType2.KOREAN_DIGITAL2 = 44] = "KOREAN_DIGITAL2", GlyphType2[GlyphType2.VIETNAMESE_COUNTING = 45] = "VIETNAMESE_COUNTING", GlyphType2[GlyphType2.RUSSIAN_LOWER = 46] = "RUSSIAN_LOWER", GlyphType2[GlyphType2.RUSSIAN_UPPER = 47] = "RUSSIAN_UPPER", GlyphType2[GlyphType2.NUMBER_IN_DASH = 48] = "NUMBER_IN_DASH", GlyphType2[GlyphType2.HEBREW1 = 49] = "HEBREW1", GlyphType2[GlyphType2.HEBREW2 = 50] = "HEBREW2", GlyphType2[GlyphType2.ARABIC_ALPHA = 51] = "ARABIC_ALPHA", GlyphType2[GlyphType2.ARABIC_ABJAD = 52] = "ARABIC_ABJAD", GlyphType2[GlyphType2.HINDI_VOWELS = 53] = "HINDI_VOWELS", GlyphType2[GlyphType2.HINDI_CONSONANTS = 54] = "HINDI_CONSONANTS", GlyphType2[GlyphType2.HINDI_NUMBERS = 55] = "HINDI_NUMBERS", GlyphType2[GlyphType2.HINDI_COUNTING = 56] = "HINDI_COUNTING", GlyphType2[GlyphType2.THAI_LETTERS = 57] = "THAI_LETTERS", GlyphType2[GlyphType2.THAI_NUMBERS = 58] = "THAI_NUMBERS", GlyphType2[GlyphType2.THAI_COUNTING = 59] = "THAI_COUNTING", GlyphType2[GlyphType2.CUSTOM = 60] = "CUSTOM", GlyphType2))(GlyphType || {}), BulletAlignment = /* @__PURE__ */ ((BulletAlignment2) => (BulletAlignment2[BulletAlignment2.BULLET_ALIGNMENT_UNSPECIFIED = 0] = "BULLET_ALIGNMENT_UNSPECIFIED", BulletAlignment2[BulletAlignment2.START = 1] = "START", BulletAlignment2[BulletAlignment2.CENTER = 2] = "CENTER", BulletAlignment2[BulletAlignment2.END = 3] = "END", BulletAlignment2[BulletAlignment2.BOTH = 4] = "BOTH", BulletAlignment2))(BulletAlignment || {}), CustomRangeType = /* @__PURE__ */ ((CustomRangeType2) => (CustomRangeType2[CustomRangeType2.HYPERLINK = 0] = "HYPERLINK", CustomRangeType2[CustomRangeType2.FIELD = 1] = "FIELD", CustomRangeType2[CustomRangeType2.SDT = 2] = "SDT", CustomRangeType2[CustomRangeType2.BOOKMARK = 3] = "BOOKMARK", CustomRangeType2[CustomRangeType2.COMMENT = 4] = "COMMENT", CustomRangeType2[CustomRangeType2.CUSTOM = 5] = "CUSTOM", CustomRangeType2[CustomRangeType2.MENTION = 6] = "MENTION", CustomRangeType2[CustomRangeType2.UNI_FORMULA = 7] = "UNI_FORMULA", CustomRangeType2))(CustomRangeType || {}), CustomDecorationType = /* @__PURE__ */ ((CustomDecorationType2) => (CustomDecorationType2[CustomDecorationType2.COMMENT = 0] = "COMMENT", CustomDecorationType2))(CustomDecorationType || {}), BlockType = /* @__PURE__ */ ((BlockType2) => (BlockType2[BlockType2.DRAWING = 0] = "DRAWING", BlockType2[BlockType2.CUSTOM = 1] = "CUSTOM", BlockType2))(BlockType || {}), DocumentFlavor = /* @__PURE__ */ ((DocumentFlavor2) => (DocumentFlavor2[DocumentFlavor2.TRADITIONAL = 0] = "TRADITIONAL", DocumentFlavor2[DocumentFlavor2.MODERN = 1] = "MODERN", DocumentFlavor2))(DocumentFlavor || {}), GridType = /* @__PURE__ */ ((GridType2) => (GridType2[GridType2.DEFAULT = 0] = "DEFAULT", GridType2[GridType2.LINES = 1] = "LINES", GridType2[GridType2.LINES_AND_CHARS = 2] = "LINES_AND_CHARS", GridType2[GridType2.SNAP_TO_CHARS = 3] = "SNAP_TO_CHARS", GridType2))(GridType || {}), SectionType = /* @__PURE__ */ ((SectionType2) => (SectionType2[SectionType2.SECTION_TYPE_UNSPECIFIED = 0] = "SECTION_TYPE_UNSPECIFIED", SectionType2[SectionType2.CONTINUOUS = 1] = "CONTINUOUS", SectionType2[SectionType2.NEXT_PAGE = 2] = "NEXT_PAGE", SectionType2[SectionType2.EVEN_PAGE = 3] = "EVEN_PAGE", SectionType2[SectionType2.ODD_PAGE = 4] = "ODD_PAGE", SectionType2))(SectionType || {}), ColumnSeparatorType = /* @__PURE__ */ ((ColumnSeparatorType2) => (ColumnSeparatorType2[ColumnSeparatorType2.COLUMN_SEPARATOR_STYLE_UNSPECIFIED = 0] = "COLUMN_SEPARATOR_STYLE_UNSPECIFIED", ColumnSeparatorType2[ColumnSeparatorType2.NONE = 1] = "NONE", ColumnSeparatorType2[ColumnSeparatorType2.BETWEEN_EACH_COLUMN = 2] = "BETWEEN_EACH_COLUMN", ColumnSeparatorType2))(ColumnSeparatorType || {}), TextDirectionType = /* @__PURE__ */ ((TextDirectionType2) => (TextDirectionType2[TextDirectionType2.NORMAL = 0] = "NORMAL", TextDirectionType2[TextDirectionType2.TBRL = 1] = "TBRL", TextDirectionType2[TextDirectionType2.LRTBV = 2] = "LRTBV", TextDirectionType2))(TextDirectionType || {}), ParagraphElementType = /* @__PURE__ */ ((ParagraphElementType2) => (ParagraphElementType2[ParagraphElementType2.TEXT_RUN = 0] = "TEXT_RUN", ParagraphElementType2[ParagraphElementType2.AUTO_TEXT = 1] = "AUTO_TEXT", ParagraphElementType2[ParagraphElementType2.PAGE_BREAK = 2] = "PAGE_BREAK", ParagraphElementType2[ParagraphElementType2.COLUMN_BREAK = 3] = "COLUMN_BREAK", ParagraphElementType2[ParagraphElementType2.FOOT_NOTE_REFERENCE = 4] = "FOOT_NOTE_REFERENCE", ParagraphElementType2[ParagraphElementType2.HORIZONTAL_RULE = 5] = "HORIZONTAL_RULE", ParagraphElementType2[ParagraphElementType2.EQUATION = 6] = "EQUATION", ParagraphElementType2[ParagraphElementType2.DRAWING = 7] = "DRAWING", ParagraphElementType2[ParagraphElementType2.PERSON = 8] = "PERSON", ParagraphElementType2[ParagraphElementType2.RICH_LINK = 9] = "RICH_LINK", ParagraphElementType2))(ParagraphElementType || {}), WrapTextType = /* @__PURE__ */ ((WrapTextType2) => (WrapTextType2[WrapTextType2.BOTH_SIDES = 0] = "BOTH_SIDES", WrapTextType2[WrapTextType2.LEFT = 1] = "LEFT", WrapTextType2[WrapTextType2.RIGHT = 2] = "RIGHT", WrapTextType2[WrapTextType2.LARGEST = 3] = "LARGEST", WrapTextType2))(WrapTextType || {}), PositionedObjectLayoutType = /* @__PURE__ */ ((PositionedObjectLayoutType2) => (PositionedObjectLayoutType2[PositionedObjectLayoutType2.INLINE = 0] = "INLINE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_NONE = 1] = "WRAP_NONE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_POLYGON = 2] = "WRAP_POLYGON", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_SQUARE = 3] = "WRAP_SQUARE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_THROUGH = 4] = "WRAP_THROUGH", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TIGHT = 5] = "WRAP_TIGHT", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TOP_AND_BOTTOM = 6] = "WRAP_TOP_AND_BOTTOM", PositionedObjectLayoutType2))(PositionedObjectLayoutType || {}), NamedStyleType = /* @__PURE__ */ ((NamedStyleType2) => (NamedStyleType2[NamedStyleType2.NAMED_STYLE_TYPE_UNSPECIFIED = 0] = "NAMED_STYLE_TYPE_UNSPECIFIED", NamedStyleType2[NamedStyleType2.NORMAL_TEXT = 1] = "NORMAL_TEXT", NamedStyleType2[NamedStyleType2.TITLE = 2] = "TITLE", NamedStyleType2[NamedStyleType2.SUBTITLE = 3] = "SUBTITLE", NamedStyleType2[NamedStyleType2.HEADING_1 = 4] = "HEADING_1", NamedStyleType2[NamedStyleType2.HEADING_2 = 5] = "HEADING_2", NamedStyleType2[NamedStyleType2.HEADING_3 = 6] = "HEADING_3", NamedStyleType2[NamedStyleType2.HEADING_4 = 7] = "HEADING_4", NamedStyleType2[NamedStyleType2.HEADING_5 = 8] = "HEADING_5", NamedStyleType2[NamedStyleType2.HEADING_6 = 9] = "HEADING_6", NamedStyleType2))(NamedStyleType || {}), SpacingRule = /* @__PURE__ */ ((SpacingRule2) => (SpacingRule2[SpacingRule2.AUTO = 0] = "AUTO", SpacingRule2[SpacingRule2.AT_LEAST = 1] = "AT_LEAST", SpacingRule2[SpacingRule2.EXACT = 2] = "EXACT", SpacingRule2))(SpacingRule || {}), DashStyleType = /* @__PURE__ */ ((DashStyleType2) => (DashStyleType2[DashStyleType2.DASH_STYLE_UNSPECIFIED = 0] = "DASH_STYLE_UNSPECIFIED", DashStyleType2[DashStyleType2.SOLID = 1] = "SOLID", DashStyleType2[DashStyleType2.DOT = 2] = "DOT", DashStyleType2[DashStyleType2.DASH = 3] = "DASH", DashStyleType2))(DashStyleType || {}), TabStopAlignment = /* @__PURE__ */ ((TabStopAlignment2) => (TabStopAlignment2[TabStopAlignment2.TAB_STOP_ALIGNMENT_UNSPECIFIED = 0] = "TAB_STOP_ALIGNMENT_UNSPECIFIED", TabStopAlignment2[TabStopAlignment2.START = 1] = "START", TabStopAlignment2[TabStopAlignment2.CENTER = 2] = "CENTER", TabStopAlignment2[TabStopAlignment2.END = 3] = "END", TabStopAlignment2))(TabStopAlignment || {}), TableSizeType = /* @__PURE__ */ ((TableSizeType2) => (TableSizeType2[TableSizeType2.UNSPECIFIED = 0] = "UNSPECIFIED", TableSizeType2[TableSizeType2.SPECIFIED = 1] = "SPECIFIED", TableSizeType2))(TableSizeType || {}), TableAlignmentType = /* @__PURE__ */ ((TableAlignmentType2) => (TableAlignmentType2[TableAlignmentType2.START = 0] = "START", TableAlignmentType2[TableAlignmentType2.CENTER = 1] = "CENTER", TableAlignmentType2[TableAlignmentType2.END = 2] = "END", TableAlignmentType2))(TableAlignmentType || {}), TableLayoutType = /* @__PURE__ */ ((TableLayoutType2) => (TableLayoutType2[TableLayoutType2.AUTO_FIT = 0] = "AUTO_FIT", TableLayoutType2[TableLayoutType2.FIXED = 1] = "FIXED", TableLayoutType2))(TableLayoutType || {}), TableTextWrapType = /* @__PURE__ */ ((TableTextWrapType2) => (TableTextWrapType2[TableTextWrapType2.NONE = 0] = "NONE", TableTextWrapType2[TableTextWrapType2.WRAP = 1] = "WRAP", TableTextWrapType2))(TableTextWrapType || {}), TableCellHeightRule = /* @__PURE__ */ ((TableCellHeightRule2) => (TableCellHeightRule2[TableCellHeightRule2.AUTO = 0] = "AUTO", TableCellHeightRule2[TableCellHeightRule2.AT_LEAST = 1] = "AT_LEAST", TableCellHeightRule2[TableCellHeightRule2.EXACT = 2] = "EXACT", TableCellHeightRule2))(TableCellHeightRule || {}), VerticalAlignmentType = /* @__PURE__ */ ((VerticalAlignmentType2) => (VerticalAlignmentType2[VerticalAlignmentType2.CONTENT_ALIGNMENT_UNSPECIFIED = 0] = "CONTENT_ALIGNMENT_UNSPECIFIED", VerticalAlignmentType2[VerticalAlignmentType2.BOTH = 1] = "BOTH", VerticalAlignmentType2[VerticalAlignmentType2.TOP = 2] = "TOP", VerticalAlignmentType2[VerticalAlignmentType2.CENTER = 3] = "CENTER", VerticalAlignmentType2[VerticalAlignmentType2.BOTTOM = 4] = "BOTTOM", VerticalAlignmentType2))(VerticalAlignmentType || {}), FontStyleType = /* @__PURE__ */ ((FontStyleType2) => (FontStyleType2.NORMAL = "normal", FontStyleType2.BOLD = "bold", FontStyleType2.ITALIC = "italic", FontStyleType2))(FontStyleType || {}), ObjectRelativeFromH = /* @__PURE__ */ ((ObjectRelativeFromH2) => (ObjectRelativeFromH2[ObjectRelativeFromH2.PAGE = 0] = "PAGE", ObjectRelativeFromH2[ObjectRelativeFromH2.COLUMN = 1] = "COLUMN", ObjectRelativeFromH2[ObjectRelativeFromH2.CHARACTER = 2] = "CHARACTER", ObjectRelativeFromH2[ObjectRelativeFromH2.MARGIN = 3] = "MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.INSIDE_MARGIN = 4] = "INSIDE_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.OUTSIDE_MARGIN = 5] = "OUTSIDE_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.LEFT_MARGIN = 6] = "LEFT_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.RIGHT_MARGIN = 7] = "RIGHT_MARGIN", ObjectRelativeFromH2))(ObjectRelativeFromH || {}), ObjectRelativeFromV = /* @__PURE__ */ ((ObjectRelativeFromV2) => (ObjectRelativeFromV2[ObjectRelativeFromV2.PAGE = 0] = "PAGE", ObjectRelativeFromV2[ObjectRelativeFromV2.PARAGRAPH = 1] = "PARAGRAPH", ObjectRelativeFromV2[ObjectRelativeFromV2.LINE = 2] = "LINE", ObjectRelativeFromV2[ObjectRelativeFromV2.MARGIN = 3] = "MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.TOP_MARGIN = 4] = "TOP_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.BOTTOM_MARGIN = 5] = "BOTTOM_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.INSIDE_MARGIN = 6] = "INSIDE_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.OUTSIDE_MARGIN = 7] = "OUTSIDE_MARGIN", ObjectRelativeFromV2))(ObjectRelativeFromV || {}), NumberUnitType = /* @__PURE__ */ ((NumberUnitType2) => (NumberUnitType2[NumberUnitType2.POINT = 0] = "POINT", NumberUnitType2[NumberUnitType2.LINE = 1] = "LINE", NumberUnitType2[NumberUnitType2.CHARACTER = 2] = "CHARACTER", NumberUnitType2[NumberUnitType2.PIXEL = 3] = "PIXEL", NumberUnitType2[NumberUnitType2.PERCENT = 4] = "PERCENT", NumberUnitType2))(NumberUnitType || {}), AlignTypeH = /* @__PURE__ */ ((AlignTypeH2) => (AlignTypeH2[AlignTypeH2.CENTER = 0] = "CENTER", AlignTypeH2[AlignTypeH2.INSIDE = 1] = "INSIDE", AlignTypeH2[AlignTypeH2.LEFT = 2] = "LEFT", AlignTypeH2[AlignTypeH2.OUTSIDE = 3] = "OUTSIDE", AlignTypeH2[AlignTypeH2.RIGHT = 4] = "RIGHT", AlignTypeH2[AlignTypeH2.BOTH = 5] = "BOTH", AlignTypeH2[AlignTypeH2.DISTRIBUTE = 6] = "DISTRIBUTE", AlignTypeH2))(AlignTypeH || {}), AlignTypeV = /* @__PURE__ */ ((AlignTypeV2) => (AlignTypeV2[AlignTypeV2.BOTTOM = 0] = "BOTTOM", AlignTypeV2[AlignTypeV2.CENTER = 1] = "CENTER", AlignTypeV2[AlignTypeV2.INSIDE = 2] = "INSIDE", AlignTypeV2[AlignTypeV2.OUTSIDE = 3] = "OUTSIDE", AlignTypeV2[AlignTypeV2.TOP = 4] = "TOP", AlignTypeV2))(AlignTypeV || {}), characterSpacingControlType = /* @__PURE__ */ ((characterSpacingControlType2) => (characterSpacingControlType2[characterSpacingControlType2.compressPunctuation = 0] = "compressPunctuation", characterSpacingControlType2[characterSpacingControlType2.compressPunctuationAndJapaneseKana = 1] = "compressPunctuationAndJapaneseKana", characterSpacingControlType2[characterSpacingControlType2.doNotCompress = 2] = "doNotCompress", characterSpacingControlType2))(characterSpacingControlType || {}), PageOrientType = /* @__PURE__ */ ((PageOrientType2) => (PageOrientType2[PageOrientType2.PORTRAIT = 0] = "PORTRAIT", PageOrientType2[PageOrientType2.LANDSCAPE = 1] = "LANDSCAPE", PageOrientType2))(PageOrientType || {}), ArrangeTypeEnum = /* @__PURE__ */ ((ArrangeTypeEnum2) => (ArrangeTypeEnum2[ArrangeTypeEnum2.forward = 0] = "forward", ArrangeTypeEnum2[ArrangeTypeEnum2.backward = 1] = "backward", ArrangeTypeEnum2[ArrangeTypeEnum2.front = 2] = "front", ArrangeTypeEnum2[ArrangeTypeEnum2.back = 3] = "back", ArrangeTypeEnum2))(ArrangeTypeEnum || {}), DrawingTypeEnum = /* @__PURE__ */ ((DrawingTypeEnum2) => (DrawingTypeEnum2[DrawingTypeEnum2.UNRECOGNIZED = -1] = "UNRECOGNIZED", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_CHART = 2] = "DRAWING_CHART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_TABLE = 3] = "DRAWING_TABLE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_GROUP = 6] = "DRAWING_GROUP", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_UNIT = 7] = "DRAWING_UNIT", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_DOM = 8] = "DRAWING_DOM", DrawingTypeEnum2))(DrawingTypeEnum || {}), QuickListType = /* @__PURE__ */ ((QuickListType2) => (QuickListType2.ORDER_LIST_QUICK_1 = "1.", QuickListType2.ORDER_LIST_QUICK_2 = "a)", QuickListType2.ORDER_LIST_QUICK_3 = "a.", QuickListType2.ORDER_LIST_QUICK_4 = "i.", QuickListType2.ORDER_LIST_QUICK_5 = "A.", QuickListType2.ORDER_LIST_QUICK_6 = "I.", QuickListType2.ORDER_LIST_QUICK_7 = "01.", QuickListType2))(QuickListType || {}), PresetListType = /* @__PURE__ */ ((PresetListType2) => (PresetListType2.BULLET_LIST = "BULLET_LIST", PresetListType2.BULLET_LIST_1 = "BULLET_LIST_1", PresetListType2.BULLET_LIST_2 = "BULLET_LIST_2", PresetListType2.BULLET_LIST_3 = "BULLET_LIST_3", PresetListType2.BULLET_LIST_4 = "BULLET_LIST_4", PresetListType2.BULLET_LIST_5 = "BULLET_LIST_5", PresetListType2.ORDER_LIST = "ORDER_LIST", PresetListType2.ORDER_LIST_1 = "ORDER_LIST_1", PresetListType2.ORDER_LIST_2 = "ORDER_LIST_2", PresetListType2.ORDER_LIST_3 = "ORDER_LIST_3", PresetListType2.ORDER_LIST_4 = "ORDER_LIST_4", PresetListType2.ORDER_LIST_5 = "ORDER_LIST_5", PresetListType2.ORDER_LIST_QUICK_2 = "ORDER_LIST_QUICK_2", PresetListType2.ORDER_LIST_QUICK_3 = "ORDER_LIST_QUICK_3", PresetListType2.ORDER_LIST_QUICK_4 = "ORDER_LIST_QUICK_4", PresetListType2.ORDER_LIST_QUICK_5 = "ORDER_LIST_QUICK_5", PresetListType2.ORDER_LIST_QUICK_6 = "ORDER_LIST_QUICK_6", PresetListType2.CHECK_LIST = "CHECK_LIST", PresetListType2.CHECK_LIST_CHECKED = "CHECK_LIST_CHECKED", PresetListType2))(PresetListType || {});
|
|
8731
|
+
var DocStyleType = /* @__PURE__ */ ((DocStyleType2) => (DocStyleType2[DocStyleType2.character = 0] = "character", DocStyleType2[DocStyleType2.paragraph = 1] = "paragraph", DocStyleType2[DocStyleType2.table = 2] = "table", DocStyleType2[DocStyleType2.numbering = 3] = "numbering", DocStyleType2))(DocStyleType || {}), FollowNumberWithType = /* @__PURE__ */ ((FollowNumberWithType2) => (FollowNumberWithType2[FollowNumberWithType2.TAB = 0] = "TAB", FollowNumberWithType2[FollowNumberWithType2.SPACE = 1] = "SPACE", FollowNumberWithType2[FollowNumberWithType2.NOTHING = 2] = "NOTHING", FollowNumberWithType2))(FollowNumberWithType || {}), GlyphType = /* @__PURE__ */ ((GlyphType2) => (GlyphType2[GlyphType2.BULLET = 0] = "BULLET", GlyphType2[GlyphType2.NONE = 1] = "NONE", GlyphType2[GlyphType2.DECIMAL = 2] = "DECIMAL", GlyphType2[GlyphType2.DECIMAL_ZERO = 3] = "DECIMAL_ZERO", GlyphType2[GlyphType2.UPPER_LETTER = 4] = "UPPER_LETTER", GlyphType2[GlyphType2.LOWER_LETTER = 5] = "LOWER_LETTER", GlyphType2[GlyphType2.UPPER_ROMAN = 6] = "UPPER_ROMAN", GlyphType2[GlyphType2.LOWER_ROMAN = 7] = "LOWER_ROMAN", GlyphType2[GlyphType2.ORDINAL = 8] = "ORDINAL", GlyphType2[GlyphType2.CARDINAL_TEXT = 9] = "CARDINAL_TEXT", GlyphType2[GlyphType2.ORDINAL_TEXT = 10] = "ORDINAL_TEXT", GlyphType2[GlyphType2.HEX = 11] = "HEX", GlyphType2[GlyphType2.CHICAGO = 12] = "CHICAGO", GlyphType2[GlyphType2.IDEOGRAPH_DIGITAL = 13] = "IDEOGRAPH_DIGITAL", GlyphType2[GlyphType2.JAPANESE_COUNTING = 14] = "JAPANESE_COUNTING", GlyphType2[GlyphType2.AIUEO = 15] = "AIUEO", GlyphType2[GlyphType2.IROHA = 16] = "IROHA", GlyphType2[GlyphType2.DECIMAL_FULL_WIDTH = 17] = "DECIMAL_FULL_WIDTH", GlyphType2[GlyphType2.DECIMAL_HALF_WIDTH = 18] = "DECIMAL_HALF_WIDTH", GlyphType2[GlyphType2.JAPANESE_LEGAL = 19] = "JAPANESE_LEGAL", GlyphType2[GlyphType2.JAPANESE_DIGITAL_TEN_THOUSAND = 20] = "JAPANESE_DIGITAL_TEN_THOUSAND", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_CIRCLE = 21] = "DECIMAL_ENCLOSED_CIRCLE", GlyphType2[GlyphType2.DECIMAL_FULL_WIDTH2 = 22] = "DECIMAL_FULL_WIDTH2", GlyphType2[GlyphType2.AIUEO_FULL_WIDTH = 23] = "AIUEO_FULL_WIDTH", GlyphType2[GlyphType2.IROHA_FULL_WIDTH = 24] = "IROHA_FULL_WIDTH", GlyphType2[GlyphType2.GANADA = 25] = "GANADA", GlyphType2[GlyphType2.CHOSUNG = 26] = "CHOSUNG", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_FULLSTOP = 27] = "DECIMAL_ENCLOSED_FULLSTOP", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_PAREN = 28] = "DECIMAL_ENCLOSED_PAREN", GlyphType2[GlyphType2.DECIMAL_ENCLOSED_CIRCLE_CHINESE = 29] = "DECIMAL_ENCLOSED_CIRCLE_CHINESE", GlyphType2[GlyphType2.IDEOGRAPH_ENCLOSED_CIRCLE = 30] = "IDEOGRAPH_ENCLOSED_CIRCLE", GlyphType2[GlyphType2.IDEOGRAPH_TRADITIONAL = 31] = "IDEOGRAPH_TRADITIONAL", GlyphType2[GlyphType2.IDEOGRAPH_ZODIAC = 32] = "IDEOGRAPH_ZODIAC", GlyphType2[GlyphType2.IDEOGRAPH_ZODIAC_TRADITIONAL = 33] = "IDEOGRAPH_ZODIAC_TRADITIONAL", GlyphType2[GlyphType2.TAIWANESE_COUNTING = 34] = "TAIWANESE_COUNTING", GlyphType2[GlyphType2.IDEOGRAPH_LEGAL_TRADITIONAL = 35] = "IDEOGRAPH_LEGAL_TRADITIONAL", GlyphType2[GlyphType2.TAIWANESE_COUNTING_THOUSAND = 36] = "TAIWANESE_COUNTING_THOUSAND", GlyphType2[GlyphType2.TAIWANESE_DIGITAL = 37] = "TAIWANESE_DIGITAL", GlyphType2[GlyphType2.CHINESE_COUNTING = 38] = "CHINESE_COUNTING", GlyphType2[GlyphType2.CHINESE_LEGAL_SIMPLIFIED = 39] = "CHINESE_LEGAL_SIMPLIFIED", GlyphType2[GlyphType2.CHINESE_COUNTING_THOUSAND = 40] = "CHINESE_COUNTING_THOUSAND", GlyphType2[GlyphType2.KOREAN_DIGITAL = 41] = "KOREAN_DIGITAL", GlyphType2[GlyphType2.KOREAN_COUNTING = 42] = "KOREAN_COUNTING", GlyphType2[GlyphType2.KOREAN_LEGAL = 43] = "KOREAN_LEGAL", GlyphType2[GlyphType2.KOREAN_DIGITAL2 = 44] = "KOREAN_DIGITAL2", GlyphType2[GlyphType2.VIETNAMESE_COUNTING = 45] = "VIETNAMESE_COUNTING", GlyphType2[GlyphType2.RUSSIAN_LOWER = 46] = "RUSSIAN_LOWER", GlyphType2[GlyphType2.RUSSIAN_UPPER = 47] = "RUSSIAN_UPPER", GlyphType2[GlyphType2.NUMBER_IN_DASH = 48] = "NUMBER_IN_DASH", GlyphType2[GlyphType2.HEBREW1 = 49] = "HEBREW1", GlyphType2[GlyphType2.HEBREW2 = 50] = "HEBREW2", GlyphType2[GlyphType2.ARABIC_ALPHA = 51] = "ARABIC_ALPHA", GlyphType2[GlyphType2.ARABIC_ABJAD = 52] = "ARABIC_ABJAD", GlyphType2[GlyphType2.HINDI_VOWELS = 53] = "HINDI_VOWELS", GlyphType2[GlyphType2.HINDI_CONSONANTS = 54] = "HINDI_CONSONANTS", GlyphType2[GlyphType2.HINDI_NUMBERS = 55] = "HINDI_NUMBERS", GlyphType2[GlyphType2.HINDI_COUNTING = 56] = "HINDI_COUNTING", GlyphType2[GlyphType2.THAI_LETTERS = 57] = "THAI_LETTERS", GlyphType2[GlyphType2.THAI_NUMBERS = 58] = "THAI_NUMBERS", GlyphType2[GlyphType2.THAI_COUNTING = 59] = "THAI_COUNTING", GlyphType2[GlyphType2.CUSTOM = 60] = "CUSTOM", GlyphType2))(GlyphType || {}), BulletAlignment = /* @__PURE__ */ ((BulletAlignment2) => (BulletAlignment2[BulletAlignment2.BULLET_ALIGNMENT_UNSPECIFIED = 0] = "BULLET_ALIGNMENT_UNSPECIFIED", BulletAlignment2[BulletAlignment2.START = 1] = "START", BulletAlignment2[BulletAlignment2.CENTER = 2] = "CENTER", BulletAlignment2[BulletAlignment2.END = 3] = "END", BulletAlignment2[BulletAlignment2.BOTH = 4] = "BOTH", BulletAlignment2))(BulletAlignment || {}), CustomRangeType = /* @__PURE__ */ ((CustomRangeType2) => (CustomRangeType2[CustomRangeType2.HYPERLINK = 0] = "HYPERLINK", CustomRangeType2[CustomRangeType2.FIELD = 1] = "FIELD", CustomRangeType2[CustomRangeType2.SDT = 2] = "SDT", CustomRangeType2[CustomRangeType2.BOOKMARK = 3] = "BOOKMARK", CustomRangeType2[CustomRangeType2.COMMENT = 4] = "COMMENT", CustomRangeType2[CustomRangeType2.CUSTOM = 5] = "CUSTOM", CustomRangeType2[CustomRangeType2.MENTION = 6] = "MENTION", CustomRangeType2[CustomRangeType2.UNI_FORMULA = 7] = "UNI_FORMULA", CustomRangeType2))(CustomRangeType || {}), CustomDecorationType = /* @__PURE__ */ ((CustomDecorationType2) => (CustomDecorationType2[CustomDecorationType2.COMMENT = 0] = "COMMENT", CustomDecorationType2))(CustomDecorationType || {}), BlockType = /* @__PURE__ */ ((BlockType2) => (BlockType2[BlockType2.DRAWING = 0] = "DRAWING", BlockType2[BlockType2.CUSTOM = 1] = "CUSTOM", BlockType2))(BlockType || {}), DocumentFlavor = /* @__PURE__ */ ((DocumentFlavor2) => (DocumentFlavor2[DocumentFlavor2.UNSPECIFIED = 0] = "UNSPECIFIED", DocumentFlavor2[DocumentFlavor2.TRADITIONAL = 1] = "TRADITIONAL", DocumentFlavor2[DocumentFlavor2.MODERN = 2] = "MODERN", DocumentFlavor2))(DocumentFlavor || {}), GridType = /* @__PURE__ */ ((GridType2) => (GridType2[GridType2.DEFAULT = 0] = "DEFAULT", GridType2[GridType2.LINES = 1] = "LINES", GridType2[GridType2.LINES_AND_CHARS = 2] = "LINES_AND_CHARS", GridType2[GridType2.SNAP_TO_CHARS = 3] = "SNAP_TO_CHARS", GridType2))(GridType || {}), SectionType = /* @__PURE__ */ ((SectionType2) => (SectionType2[SectionType2.SECTION_TYPE_UNSPECIFIED = 0] = "SECTION_TYPE_UNSPECIFIED", SectionType2[SectionType2.CONTINUOUS = 1] = "CONTINUOUS", SectionType2[SectionType2.NEXT_PAGE = 2] = "NEXT_PAGE", SectionType2[SectionType2.EVEN_PAGE = 3] = "EVEN_PAGE", SectionType2[SectionType2.ODD_PAGE = 4] = "ODD_PAGE", SectionType2))(SectionType || {}), ColumnSeparatorType = /* @__PURE__ */ ((ColumnSeparatorType2) => (ColumnSeparatorType2[ColumnSeparatorType2.COLUMN_SEPARATOR_STYLE_UNSPECIFIED = 0] = "COLUMN_SEPARATOR_STYLE_UNSPECIFIED", ColumnSeparatorType2[ColumnSeparatorType2.NONE = 1] = "NONE", ColumnSeparatorType2[ColumnSeparatorType2.BETWEEN_EACH_COLUMN = 2] = "BETWEEN_EACH_COLUMN", ColumnSeparatorType2))(ColumnSeparatorType || {}), TextDirectionType = /* @__PURE__ */ ((TextDirectionType2) => (TextDirectionType2[TextDirectionType2.NORMAL = 0] = "NORMAL", TextDirectionType2[TextDirectionType2.TBRL = 1] = "TBRL", TextDirectionType2[TextDirectionType2.LRTBV = 2] = "LRTBV", TextDirectionType2))(TextDirectionType || {}), ParagraphElementType = /* @__PURE__ */ ((ParagraphElementType2) => (ParagraphElementType2[ParagraphElementType2.TEXT_RUN = 0] = "TEXT_RUN", ParagraphElementType2[ParagraphElementType2.AUTO_TEXT = 1] = "AUTO_TEXT", ParagraphElementType2[ParagraphElementType2.PAGE_BREAK = 2] = "PAGE_BREAK", ParagraphElementType2[ParagraphElementType2.COLUMN_BREAK = 3] = "COLUMN_BREAK", ParagraphElementType2[ParagraphElementType2.FOOT_NOTE_REFERENCE = 4] = "FOOT_NOTE_REFERENCE", ParagraphElementType2[ParagraphElementType2.HORIZONTAL_RULE = 5] = "HORIZONTAL_RULE", ParagraphElementType2[ParagraphElementType2.EQUATION = 6] = "EQUATION", ParagraphElementType2[ParagraphElementType2.DRAWING = 7] = "DRAWING", ParagraphElementType2[ParagraphElementType2.PERSON = 8] = "PERSON", ParagraphElementType2[ParagraphElementType2.RICH_LINK = 9] = "RICH_LINK", ParagraphElementType2))(ParagraphElementType || {}), WrapTextType = /* @__PURE__ */ ((WrapTextType2) => (WrapTextType2[WrapTextType2.BOTH_SIDES = 0] = "BOTH_SIDES", WrapTextType2[WrapTextType2.LEFT = 1] = "LEFT", WrapTextType2[WrapTextType2.RIGHT = 2] = "RIGHT", WrapTextType2[WrapTextType2.LARGEST = 3] = "LARGEST", WrapTextType2))(WrapTextType || {}), PositionedObjectLayoutType = /* @__PURE__ */ ((PositionedObjectLayoutType2) => (PositionedObjectLayoutType2[PositionedObjectLayoutType2.INLINE = 0] = "INLINE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_NONE = 1] = "WRAP_NONE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_POLYGON = 2] = "WRAP_POLYGON", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_SQUARE = 3] = "WRAP_SQUARE", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_THROUGH = 4] = "WRAP_THROUGH", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TIGHT = 5] = "WRAP_TIGHT", PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TOP_AND_BOTTOM = 6] = "WRAP_TOP_AND_BOTTOM", PositionedObjectLayoutType2))(PositionedObjectLayoutType || {}), NamedStyleType = /* @__PURE__ */ ((NamedStyleType2) => (NamedStyleType2[NamedStyleType2.NAMED_STYLE_TYPE_UNSPECIFIED = 0] = "NAMED_STYLE_TYPE_UNSPECIFIED", NamedStyleType2[NamedStyleType2.NORMAL_TEXT = 1] = "NORMAL_TEXT", NamedStyleType2[NamedStyleType2.TITLE = 2] = "TITLE", NamedStyleType2[NamedStyleType2.SUBTITLE = 3] = "SUBTITLE", NamedStyleType2[NamedStyleType2.HEADING_1 = 4] = "HEADING_1", NamedStyleType2[NamedStyleType2.HEADING_2 = 5] = "HEADING_2", NamedStyleType2[NamedStyleType2.HEADING_3 = 6] = "HEADING_3", NamedStyleType2[NamedStyleType2.HEADING_4 = 7] = "HEADING_4", NamedStyleType2[NamedStyleType2.HEADING_5 = 8] = "HEADING_5", NamedStyleType2[NamedStyleType2.HEADING_6 = 9] = "HEADING_6", NamedStyleType2))(NamedStyleType || {}), SpacingRule = /* @__PURE__ */ ((SpacingRule2) => (SpacingRule2[SpacingRule2.AUTO = 0] = "AUTO", SpacingRule2[SpacingRule2.AT_LEAST = 1] = "AT_LEAST", SpacingRule2[SpacingRule2.EXACT = 2] = "EXACT", SpacingRule2))(SpacingRule || {}), DashStyleType = /* @__PURE__ */ ((DashStyleType2) => (DashStyleType2[DashStyleType2.DASH_STYLE_UNSPECIFIED = 0] = "DASH_STYLE_UNSPECIFIED", DashStyleType2[DashStyleType2.SOLID = 1] = "SOLID", DashStyleType2[DashStyleType2.DOT = 2] = "DOT", DashStyleType2[DashStyleType2.DASH = 3] = "DASH", DashStyleType2))(DashStyleType || {}), TabStopAlignment = /* @__PURE__ */ ((TabStopAlignment2) => (TabStopAlignment2[TabStopAlignment2.TAB_STOP_ALIGNMENT_UNSPECIFIED = 0] = "TAB_STOP_ALIGNMENT_UNSPECIFIED", TabStopAlignment2[TabStopAlignment2.START = 1] = "START", TabStopAlignment2[TabStopAlignment2.CENTER = 2] = "CENTER", TabStopAlignment2[TabStopAlignment2.END = 3] = "END", TabStopAlignment2))(TabStopAlignment || {}), TableSizeType = /* @__PURE__ */ ((TableSizeType2) => (TableSizeType2[TableSizeType2.UNSPECIFIED = 0] = "UNSPECIFIED", TableSizeType2[TableSizeType2.SPECIFIED = 1] = "SPECIFIED", TableSizeType2))(TableSizeType || {}), TableAlignmentType = /* @__PURE__ */ ((TableAlignmentType2) => (TableAlignmentType2[TableAlignmentType2.START = 0] = "START", TableAlignmentType2[TableAlignmentType2.CENTER = 1] = "CENTER", TableAlignmentType2[TableAlignmentType2.END = 2] = "END", TableAlignmentType2))(TableAlignmentType || {}), TableLayoutType = /* @__PURE__ */ ((TableLayoutType2) => (TableLayoutType2[TableLayoutType2.AUTO_FIT = 0] = "AUTO_FIT", TableLayoutType2[TableLayoutType2.FIXED = 1] = "FIXED", TableLayoutType2))(TableLayoutType || {}), TableTextWrapType = /* @__PURE__ */ ((TableTextWrapType2) => (TableTextWrapType2[TableTextWrapType2.NONE = 0] = "NONE", TableTextWrapType2[TableTextWrapType2.WRAP = 1] = "WRAP", TableTextWrapType2))(TableTextWrapType || {}), TableCellHeightRule = /* @__PURE__ */ ((TableCellHeightRule2) => (TableCellHeightRule2[TableCellHeightRule2.AUTO = 0] = "AUTO", TableCellHeightRule2[TableCellHeightRule2.AT_LEAST = 1] = "AT_LEAST", TableCellHeightRule2[TableCellHeightRule2.EXACT = 2] = "EXACT", TableCellHeightRule2))(TableCellHeightRule || {}), VerticalAlignmentType = /* @__PURE__ */ ((VerticalAlignmentType2) => (VerticalAlignmentType2[VerticalAlignmentType2.CONTENT_ALIGNMENT_UNSPECIFIED = 0] = "CONTENT_ALIGNMENT_UNSPECIFIED", VerticalAlignmentType2[VerticalAlignmentType2.BOTH = 1] = "BOTH", VerticalAlignmentType2[VerticalAlignmentType2.TOP = 2] = "TOP", VerticalAlignmentType2[VerticalAlignmentType2.CENTER = 3] = "CENTER", VerticalAlignmentType2[VerticalAlignmentType2.BOTTOM = 4] = "BOTTOM", VerticalAlignmentType2))(VerticalAlignmentType || {}), FontStyleType = /* @__PURE__ */ ((FontStyleType2) => (FontStyleType2.NORMAL = "normal", FontStyleType2.BOLD = "bold", FontStyleType2.ITALIC = "italic", FontStyleType2))(FontStyleType || {}), ObjectRelativeFromH = /* @__PURE__ */ ((ObjectRelativeFromH2) => (ObjectRelativeFromH2[ObjectRelativeFromH2.PAGE = 0] = "PAGE", ObjectRelativeFromH2[ObjectRelativeFromH2.COLUMN = 1] = "COLUMN", ObjectRelativeFromH2[ObjectRelativeFromH2.CHARACTER = 2] = "CHARACTER", ObjectRelativeFromH2[ObjectRelativeFromH2.MARGIN = 3] = "MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.INSIDE_MARGIN = 4] = "INSIDE_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.OUTSIDE_MARGIN = 5] = "OUTSIDE_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.LEFT_MARGIN = 6] = "LEFT_MARGIN", ObjectRelativeFromH2[ObjectRelativeFromH2.RIGHT_MARGIN = 7] = "RIGHT_MARGIN", ObjectRelativeFromH2))(ObjectRelativeFromH || {}), ObjectRelativeFromV = /* @__PURE__ */ ((ObjectRelativeFromV2) => (ObjectRelativeFromV2[ObjectRelativeFromV2.PAGE = 0] = "PAGE", ObjectRelativeFromV2[ObjectRelativeFromV2.PARAGRAPH = 1] = "PARAGRAPH", ObjectRelativeFromV2[ObjectRelativeFromV2.LINE = 2] = "LINE", ObjectRelativeFromV2[ObjectRelativeFromV2.MARGIN = 3] = "MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.TOP_MARGIN = 4] = "TOP_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.BOTTOM_MARGIN = 5] = "BOTTOM_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.INSIDE_MARGIN = 6] = "INSIDE_MARGIN", ObjectRelativeFromV2[ObjectRelativeFromV2.OUTSIDE_MARGIN = 7] = "OUTSIDE_MARGIN", ObjectRelativeFromV2))(ObjectRelativeFromV || {}), NumberUnitType = /* @__PURE__ */ ((NumberUnitType2) => (NumberUnitType2[NumberUnitType2.POINT = 0] = "POINT", NumberUnitType2[NumberUnitType2.LINE = 1] = "LINE", NumberUnitType2[NumberUnitType2.CHARACTER = 2] = "CHARACTER", NumberUnitType2[NumberUnitType2.PIXEL = 3] = "PIXEL", NumberUnitType2[NumberUnitType2.PERCENT = 4] = "PERCENT", NumberUnitType2))(NumberUnitType || {}), AlignTypeH = /* @__PURE__ */ ((AlignTypeH2) => (AlignTypeH2[AlignTypeH2.CENTER = 0] = "CENTER", AlignTypeH2[AlignTypeH2.INSIDE = 1] = "INSIDE", AlignTypeH2[AlignTypeH2.LEFT = 2] = "LEFT", AlignTypeH2[AlignTypeH2.OUTSIDE = 3] = "OUTSIDE", AlignTypeH2[AlignTypeH2.RIGHT = 4] = "RIGHT", AlignTypeH2[AlignTypeH2.BOTH = 5] = "BOTH", AlignTypeH2[AlignTypeH2.DISTRIBUTE = 6] = "DISTRIBUTE", AlignTypeH2))(AlignTypeH || {}), AlignTypeV = /* @__PURE__ */ ((AlignTypeV2) => (AlignTypeV2[AlignTypeV2.BOTTOM = 0] = "BOTTOM", AlignTypeV2[AlignTypeV2.CENTER = 1] = "CENTER", AlignTypeV2[AlignTypeV2.INSIDE = 2] = "INSIDE", AlignTypeV2[AlignTypeV2.OUTSIDE = 3] = "OUTSIDE", AlignTypeV2[AlignTypeV2.TOP = 4] = "TOP", AlignTypeV2))(AlignTypeV || {}), characterSpacingControlType = /* @__PURE__ */ ((characterSpacingControlType2) => (characterSpacingControlType2[characterSpacingControlType2.compressPunctuation = 0] = "compressPunctuation", characterSpacingControlType2[characterSpacingControlType2.compressPunctuationAndJapaneseKana = 1] = "compressPunctuationAndJapaneseKana", characterSpacingControlType2[characterSpacingControlType2.doNotCompress = 2] = "doNotCompress", characterSpacingControlType2))(characterSpacingControlType || {}), PageOrientType = /* @__PURE__ */ ((PageOrientType2) => (PageOrientType2[PageOrientType2.PORTRAIT = 0] = "PORTRAIT", PageOrientType2[PageOrientType2.LANDSCAPE = 1] = "LANDSCAPE", PageOrientType2))(PageOrientType || {}), ArrangeTypeEnum = /* @__PURE__ */ ((ArrangeTypeEnum2) => (ArrangeTypeEnum2[ArrangeTypeEnum2.forward = 0] = "forward", ArrangeTypeEnum2[ArrangeTypeEnum2.backward = 1] = "backward", ArrangeTypeEnum2[ArrangeTypeEnum2.front = 2] = "front", ArrangeTypeEnum2[ArrangeTypeEnum2.back = 3] = "back", ArrangeTypeEnum2))(ArrangeTypeEnum || {}), DrawingTypeEnum = /* @__PURE__ */ ((DrawingTypeEnum2) => (DrawingTypeEnum2[DrawingTypeEnum2.UNRECOGNIZED = -1] = "UNRECOGNIZED", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_CHART = 2] = "DRAWING_CHART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_TABLE = 3] = "DRAWING_TABLE", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_GROUP = 6] = "DRAWING_GROUP", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_UNIT = 7] = "DRAWING_UNIT", DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_DOM = 8] = "DRAWING_DOM", DrawingTypeEnum2))(DrawingTypeEnum || {}), QuickListType = /* @__PURE__ */ ((QuickListType2) => (QuickListType2.ORDER_LIST_QUICK_1 = "1.", QuickListType2.ORDER_LIST_QUICK_2 = "a)", QuickListType2.ORDER_LIST_QUICK_3 = "a.", QuickListType2.ORDER_LIST_QUICK_4 = "i.", QuickListType2.ORDER_LIST_QUICK_5 = "A.", QuickListType2.ORDER_LIST_QUICK_6 = "I.", QuickListType2.ORDER_LIST_QUICK_7 = "01.", QuickListType2))(QuickListType || {}), PresetListType = /* @__PURE__ */ ((PresetListType2) => (PresetListType2.BULLET_LIST = "BULLET_LIST", PresetListType2.BULLET_LIST_1 = "BULLET_LIST_1", PresetListType2.BULLET_LIST_2 = "BULLET_LIST_2", PresetListType2.BULLET_LIST_3 = "BULLET_LIST_3", PresetListType2.BULLET_LIST_4 = "BULLET_LIST_4", PresetListType2.BULLET_LIST_5 = "BULLET_LIST_5", PresetListType2.ORDER_LIST = "ORDER_LIST", PresetListType2.ORDER_LIST_1 = "ORDER_LIST_1", PresetListType2.ORDER_LIST_2 = "ORDER_LIST_2", PresetListType2.ORDER_LIST_3 = "ORDER_LIST_3", PresetListType2.ORDER_LIST_4 = "ORDER_LIST_4", PresetListType2.ORDER_LIST_5 = "ORDER_LIST_5", PresetListType2.ORDER_LIST_QUICK_2 = "ORDER_LIST_QUICK_2", PresetListType2.ORDER_LIST_QUICK_3 = "ORDER_LIST_QUICK_3", PresetListType2.ORDER_LIST_QUICK_4 = "ORDER_LIST_QUICK_4", PresetListType2.ORDER_LIST_QUICK_5 = "ORDER_LIST_QUICK_5", PresetListType2.ORDER_LIST_QUICK_6 = "ORDER_LIST_QUICK_6", PresetListType2.CHECK_LIST = "CHECK_LIST", PresetListType2.CHECK_LIST_CHECKED = "CHECK_LIST_CHECKED", PresetListType2))(PresetListType || {});
|
|
8701
8732
|
const orderListSymbolMap = {
|
|
8702
8733
|
"a)": { glyphFormat: "%1)", glyphType: GlyphType.DECIMAL },
|
|
8703
8734
|
"1.": { glyphFormat: "%1.", glyphType: GlyphType.DECIMAL },
|
|
@@ -8732,7 +8763,7 @@ const orderListSymbolMap = {
|
|
|
8732
8763
|
hanging: { v: 21 },
|
|
8733
8764
|
indentStart: { v: 21 * i }
|
|
8734
8765
|
}
|
|
8735
|
-
})), "orderListFactory"), checkListFactory = /* @__PURE__ */ __name((symbol, textStyle) => new Array(9).fill(0).map((
|
|
8766
|
+
})), "orderListFactory"), checkListFactory = /* @__PURE__ */ __name((symbol, textStyle) => new Array(9).fill(0).map((_2, i) => ({
|
|
8736
8767
|
glyphFormat: ` %${i + 1}`,
|
|
8737
8768
|
glyphSymbol: symbol,
|
|
8738
8769
|
bulletAlignment: BulletAlignment.START,
|
|
@@ -8902,8 +8933,8 @@ const QuickListTypeMap = {
|
|
|
8902
8933
|
function normalizeTextRuns(textRuns) {
|
|
8903
8934
|
const results = [];
|
|
8904
8935
|
for (const textRun of textRuns) {
|
|
8905
|
-
const { ed, ts } = textRun;
|
|
8906
|
-
if (textRun.sId === void 0 && delete textRun.sId, Tools.isEmptyObject(ts) && textRun.sId == null)
|
|
8936
|
+
const { st, ed, ts } = textRun;
|
|
8937
|
+
if (textRun.sId === void 0 && delete textRun.sId, st === ed || Tools.isEmptyObject(ts) && textRun.sId == null)
|
|
8907
8938
|
continue;
|
|
8908
8939
|
if (results.length === 0) {
|
|
8909
8940
|
results.push(textRun);
|
|
@@ -8931,36 +8962,22 @@ function insertTextRuns(body, insertBody, textLength, currentIndex) {
|
|
|
8931
8962
|
for (const insertTextRun of insertTextRuns2)
|
|
8932
8963
|
insertTextRun.st += currentIndex, insertTextRun.ed += currentIndex;
|
|
8933
8964
|
for (let i = 0; i < len; i++) {
|
|
8934
|
-
const textRun = textRuns[i],
|
|
8935
|
-
if (ed
|
|
8965
|
+
const textRun = textRuns[i], { st, ed } = textRun;
|
|
8966
|
+
if (ed <= currentIndex)
|
|
8936
8967
|
newTextRuns.push(textRun);
|
|
8937
|
-
else if (currentIndex
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
st,
|
|
8951
|
-
ed: insertTextRuns2[0].st
|
|
8952
|
-
};
|
|
8953
|
-
startSplitTextRun.ed > startSplitTextRun.st && pendingTextRuns.push(startSplitTextRun), pendingTextRuns.push(...insertTextRuns2);
|
|
8954
|
-
const lastInsertTextRuns = insertTextRuns2[insertTextRuns2.length - 1], endSplitTextRun = {
|
|
8955
|
-
...textRun,
|
|
8956
|
-
st: lastInsertTextRuns.ed,
|
|
8957
|
-
ed: ed + textLength
|
|
8958
|
-
};
|
|
8959
|
-
endSplitTextRun.ed > endSplitTextRun.st && pendingTextRuns.push(endSplitTextRun);
|
|
8960
|
-
} else
|
|
8961
|
-
pendingTextRuns.push(textRun);
|
|
8962
|
-
newTextRuns.push(...pendingTextRuns);
|
|
8963
|
-
}
|
|
8968
|
+
else if (currentIndex > st && currentIndex < ed) {
|
|
8969
|
+
hasInserted = !0;
|
|
8970
|
+
const firstSplitTextRun = {
|
|
8971
|
+
...textRun,
|
|
8972
|
+
ed: currentIndex
|
|
8973
|
+
};
|
|
8974
|
+
newTextRuns.push(firstSplitTextRun), insertTextRuns2.length && newTextRuns.push(...insertTextRuns2);
|
|
8975
|
+
const lastSplitTextRun = {
|
|
8976
|
+
...textRun,
|
|
8977
|
+
st: currentIndex + textLength,
|
|
8978
|
+
ed: ed + textLength
|
|
8979
|
+
};
|
|
8980
|
+
newTextRuns.push(lastSplitTextRun);
|
|
8964
8981
|
} else
|
|
8965
8982
|
textRun.st += textLength, textRun.ed += textLength, hasInserted || (hasInserted = !0, newTextRuns.push(...insertTextRuns2)), newTextRuns.push(textRun);
|
|
8966
8983
|
}
|
|
@@ -9119,30 +9136,19 @@ function insertCustomDecorations(body, insertBody, textLength, currentIndex) {
|
|
|
9119
9136
|
}
|
|
9120
9137
|
__name(insertCustomDecorations, "insertCustomDecorations");
|
|
9121
9138
|
function deleteTextRuns(body, textLength, currentIndex) {
|
|
9122
|
-
var _a11;
|
|
9123
9139
|
const { textRuns } = body, startIndex = currentIndex, endIndex = currentIndex + textLength, removeTextRuns = [];
|
|
9124
|
-
if (startIndex === endIndex && (textRuns != null && textRuns.find((t) => t.st === currentIndex && t.ed === currentIndex))) {
|
|
9125
|
-
const textRun = textRuns.find((t) => t.st === currentIndex && t.ed === currentIndex);
|
|
9126
|
-
return removeTextRuns.push({
|
|
9127
|
-
...textRun,
|
|
9128
|
-
st: textRun.st - currentIndex,
|
|
9129
|
-
ed: textRun.ed - currentIndex
|
|
9130
|
-
}), body.textRuns = (_a11 = body.textRuns) == null ? void 0 : _a11.filter((t) => t !== textRun), removeTextRuns;
|
|
9131
|
-
}
|
|
9132
9140
|
if (textRuns) {
|
|
9133
9141
|
const newTextRuns = [];
|
|
9134
9142
|
for (let i = 0, len = textRuns.length; i < len; i++) {
|
|
9135
9143
|
const textRun = textRuns[i], { st, ed } = textRun;
|
|
9136
|
-
if (startIndex <= st && endIndex >= ed)
|
|
9137
|
-
|
|
9144
|
+
if (startIndex <= st && endIndex >= ed) {
|
|
9145
|
+
removeTextRuns.push({
|
|
9138
9146
|
...textRun,
|
|
9139
9147
|
st: st - startIndex,
|
|
9140
9148
|
ed: ed - startIndex
|
|
9141
|
-
})
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
continue;
|
|
9145
|
-
else st <= startIndex && ed >= endIndex ? (removeTextRuns.push({
|
|
9149
|
+
});
|
|
9150
|
+
continue;
|
|
9151
|
+
} else st <= startIndex && ed >= endIndex ? (removeTextRuns.push({
|
|
9146
9152
|
...textRun,
|
|
9147
9153
|
st: startIndex - startIndex,
|
|
9148
9154
|
ed: endIndex - startIndex
|
|
@@ -9687,8 +9693,8 @@ function isUselessRetainAction(action) {
|
|
|
9687
9693
|
const { body } = action;
|
|
9688
9694
|
if (body == null)
|
|
9689
9695
|
return !0;
|
|
9690
|
-
const { textRuns = [], paragraphs = [] } = body;
|
|
9691
|
-
return textRuns.length === 0 && paragraphs.length === 0;
|
|
9696
|
+
const { textRuns = [], paragraphs = [], customRanges = [], customBlocks = [], customDecorations = [] } = body;
|
|
9697
|
+
return textRuns.length === 0 && paragraphs.length === 0 && customRanges.length === 0 && customBlocks.length === 0 && customDecorations.length === 0;
|
|
9692
9698
|
}
|
|
9693
9699
|
__name(isUselessRetainAction, "isUselessRetainAction");
|
|
9694
9700
|
const _ActionIterator = class _ActionIterator {
|
|
@@ -9849,7 +9855,15 @@ function transformTextRuns(originTextRuns, targetTextRuns, transformType) {
|
|
|
9849
9855
|
return tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed) && (updateLastTextRun.ed > removeLastTextRun.ed ? newUpdateTextRuns.push(updateLastTextRun) : newUpdateTextRuns.push(removeLastTextRun)), normalizeTextRuns(newUpdateTextRuns);
|
|
9850
9856
|
}
|
|
9851
9857
|
__name(transformTextRuns, "transformTextRuns");
|
|
9852
|
-
function
|
|
9858
|
+
function transformCustomRanges(originCustomRanges, targetCustomRanges, transformType, coverType = UpdateDocsAttributeType.COVER) {
|
|
9859
|
+
if (originCustomRanges.length === 0)
|
|
9860
|
+
return Tools.deepClone(targetCustomRanges);
|
|
9861
|
+
if (coverType === UpdateDocsAttributeType.REPLACE)
|
|
9862
|
+
return transformType === 1 ? Tools.deepClone(originCustomRanges) : Tools.deepClone(targetCustomRanges);
|
|
9863
|
+
throw new Error("CustomRanges is only supported in replace mode.");
|
|
9864
|
+
}
|
|
9865
|
+
__name(transformCustomRanges, "transformCustomRanges");
|
|
9866
|
+
function transformParagraph(originParagraph, targetParagraph, transformType, coverType = UpdateDocsAttributeType.COVER) {
|
|
9853
9867
|
const paragraph = {
|
|
9854
9868
|
startIndex: targetParagraph.startIndex
|
|
9855
9869
|
};
|
|
@@ -9858,6 +9872,8 @@ function transformParagraph(originParagraph, targetParagraph, transformType) {
|
|
|
9858
9872
|
paragraph.paragraphStyle = {
|
|
9859
9873
|
...targetParagraph.paragraphStyle
|
|
9860
9874
|
};
|
|
9875
|
+
else if (coverType === UpdateDocsAttributeType.REPLACE)
|
|
9876
|
+
paragraph.paragraphStyle = transformType === 1 ? { ...originParagraph.paragraphStyle } : { ...targetParagraph.paragraphStyle };
|
|
9861
9877
|
else if (paragraph.paragraphStyle = {
|
|
9862
9878
|
...targetParagraph.paragraphStyle
|
|
9863
9879
|
}, transformType === 1) {
|
|
@@ -9866,18 +9882,27 @@ function transformParagraph(originParagraph, targetParagraph, transformType) {
|
|
|
9866
9882
|
paragraph.paragraphStyle[key] && delete paragraph.paragraphStyle[key];
|
|
9867
9883
|
}
|
|
9868
9884
|
}
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9885
|
+
if (targetParagraph.bullet)
|
|
9886
|
+
if (originParagraph.bullet == null)
|
|
9887
|
+
paragraph.bullet = {
|
|
9888
|
+
...targetParagraph.bullet
|
|
9889
|
+
};
|
|
9890
|
+
else if (coverType === UpdateDocsAttributeType.REPLACE)
|
|
9891
|
+
paragraph.bullet = transformType === 1 ? { ...originParagraph.bullet } : { ...targetParagraph.bullet };
|
|
9892
|
+
else
|
|
9893
|
+
throw new Error("Bullet is only supported in replace mode.");
|
|
9894
|
+
return paragraph;
|
|
9872
9895
|
}
|
|
9873
9896
|
__name(transformParagraph, "transformParagraph");
|
|
9874
9897
|
function transformBody(thisAction, otherAction, priority = !1) {
|
|
9875
|
-
const { body: thisBody } = thisAction, { body: otherBody } = otherAction;
|
|
9898
|
+
const { body: thisBody, coverType: thisCoverType } = thisAction, { body: otherBody, coverType: otherCoverType } = otherAction;
|
|
9876
9899
|
if (thisBody == null || thisBody.dataStream !== "" || otherBody == null || otherBody.dataStream !== "")
|
|
9877
|
-
throw new Error("Data stream is not supported in transform.");
|
|
9900
|
+
throw new Error("Data stream is not supported in retain transform.");
|
|
9901
|
+
if (thisCoverType !== otherCoverType)
|
|
9902
|
+
throw new Error("Cover type is not consistent.");
|
|
9878
9903
|
const retBody = {
|
|
9879
9904
|
dataStream: ""
|
|
9880
|
-
}, { textRuns: thisTextRuns = [], paragraphs: thisParagraphs = [] } = thisBody, { textRuns: otherTextRuns = [], paragraphs: otherParagraphs = [] } = otherBody;
|
|
9905
|
+
}, { textRuns: thisTextRuns = [], paragraphs: thisParagraphs = [], customRanges: thisCustomRanges = [] } = thisBody, { textRuns: otherTextRuns = [], paragraphs: otherParagraphs = [], customRanges: otherCustomRanges = [] } = otherBody;
|
|
9881
9906
|
let textRuns = [];
|
|
9882
9907
|
priority ? textRuns = transformTextRuns(
|
|
9883
9908
|
thisTextRuns,
|
|
@@ -9890,6 +9915,8 @@ function transformBody(thisAction, otherAction, priority = !1) {
|
|
|
9890
9915
|
0
|
|
9891
9916
|
/* COVER */
|
|
9892
9917
|
), textRuns.length && (retBody.textRuns = textRuns);
|
|
9918
|
+
let customRanges = [];
|
|
9919
|
+
priority ? customRanges = transformCustomRanges(thisCustomRanges, otherCustomRanges, 1, thisCoverType) : customRanges = transformCustomRanges(thisCustomRanges, otherCustomRanges, 0, thisCoverType), customRanges.length && (retBody.customRanges = customRanges);
|
|
9893
9920
|
const paragraphs = [];
|
|
9894
9921
|
let thisIndex = 0, otherIndex = 0;
|
|
9895
9922
|
for (; thisIndex < thisParagraphs.length && otherIndex < otherParagraphs.length; ) {
|
|
@@ -9901,14 +9928,9 @@ function transformBody(thisAction, otherAction, priority = !1) {
|
|
|
9901
9928
|
priority ? paragraph = transformParagraph(
|
|
9902
9929
|
thisParagraph,
|
|
9903
9930
|
otherParagraph,
|
|
9904
|
-
1
|
|
9905
|
-
|
|
9906
|
-
) : paragraph = transformParagraph(
|
|
9907
|
-
thisParagraph,
|
|
9908
|
-
otherParagraph,
|
|
9909
|
-
0
|
|
9910
|
-
/* COVER */
|
|
9911
|
-
), paragraphs.push(paragraph), thisIndex++, otherIndex++;
|
|
9931
|
+
1,
|
|
9932
|
+
thisCoverType
|
|
9933
|
+
) : paragraph = transformParagraph(thisParagraph, otherParagraph, 0, thisCoverType), paragraphs.push(paragraph), thisIndex++, otherIndex++;
|
|
9912
9934
|
} else thisStart < otherStart ? thisIndex++ : (paragraphs.push(Tools.deepClone(otherParagraph)), otherIndex++);
|
|
9913
9935
|
}
|
|
9914
9936
|
return otherIndex < otherParagraphs.length && paragraphs.push(...otherParagraphs.slice(otherIndex)), paragraphs.length && (retBody.paragraphs = paragraphs), retBody;
|
|
@@ -9969,16 +9991,16 @@ const _TextX = class _TextX {
|
|
|
9969
9991
|
* 2) If the other body property exists, then execute the TransformBody logic to override it
|
|
9970
9992
|
*/
|
|
9971
9993
|
// priority - if true, this actions takes priority over other, that is, this actions are considered to happen "first".
|
|
9994
|
+
// thisActions is the target action.
|
|
9972
9995
|
static transform(thisActions, otherActions, priority = "right") {
|
|
9973
9996
|
return this._transform(otherActions, thisActions, priority === "left" ? "right" : "left");
|
|
9974
9997
|
}
|
|
9975
9998
|
static _transform(thisActions, otherActions, priority = "right") {
|
|
9976
|
-
var _a11;
|
|
9977
9999
|
const thisIter = new ActionIterator(thisActions), otherIter = new ActionIterator(otherActions), textX = new _TextX();
|
|
9978
10000
|
for (; thisIter.hasNext() || otherIter.hasNext(); )
|
|
9979
10001
|
if (thisIter.peekType() === TextXActionType.INSERT && (priority === "left" || otherIter.peekType() !== TextXActionType.INSERT)) {
|
|
9980
10002
|
const thisAction = thisIter.next();
|
|
9981
|
-
textX.retain(thisAction.len
|
|
10003
|
+
textX.retain(thisAction.len);
|
|
9982
10004
|
} else if (otherIter.peekType() === TextXActionType.INSERT)
|
|
9983
10005
|
textX.push(otherIter.next());
|
|
9984
10006
|
else {
|
|
@@ -10023,10 +10045,7 @@ const _TextX = class _TextX {
|
|
|
10023
10045
|
invertedActions.push({
|
|
10024
10046
|
t: TextXActionType.DELETE,
|
|
10025
10047
|
len: action.len,
|
|
10026
|
-
|
|
10027
|
-
// hardcode
|
|
10028
|
-
body: action.body,
|
|
10029
|
-
segmentId: action.segmentId
|
|
10048
|
+
body: action.body
|
|
10030
10049
|
});
|
|
10031
10050
|
else if (action.t === TextXActionType.DELETE) {
|
|
10032
10051
|
if (action.body == null)
|
|
@@ -10034,10 +10053,7 @@ const _TextX = class _TextX {
|
|
|
10034
10053
|
invertedActions.push({
|
|
10035
10054
|
t: TextXActionType.INSERT,
|
|
10036
10055
|
body: action.body,
|
|
10037
|
-
len: action.len
|
|
10038
|
-
line: 0,
|
|
10039
|
-
// hardcode
|
|
10040
|
-
segmentId: action.segmentId
|
|
10056
|
+
len: action.len
|
|
10041
10057
|
});
|
|
10042
10058
|
} else if (action.body != null) {
|
|
10043
10059
|
if (action.oldBody == null)
|
|
@@ -10047,8 +10063,7 @@ const _TextX = class _TextX {
|
|
|
10047
10063
|
body: action.oldBody,
|
|
10048
10064
|
oldBody: action.body,
|
|
10049
10065
|
len: action.len,
|
|
10050
|
-
coverType: UpdateDocsAttributeType.REPLACE
|
|
10051
|
-
segmentId: action.segmentId
|
|
10066
|
+
coverType: UpdateDocsAttributeType.REPLACE
|
|
10052
10067
|
});
|
|
10053
10068
|
} else
|
|
10054
10069
|
invertedActions.push(action);
|
|
@@ -10073,32 +10088,25 @@ const _TextX = class _TextX {
|
|
|
10073
10088
|
}
|
|
10074
10089
|
return invertibleActions;
|
|
10075
10090
|
}
|
|
10076
|
-
insert(len, body
|
|
10091
|
+
insert(len, body) {
|
|
10077
10092
|
const insertAction = {
|
|
10078
10093
|
t: TextXActionType.INSERT,
|
|
10079
10094
|
body,
|
|
10080
|
-
len
|
|
10081
|
-
line: 0,
|
|
10082
|
-
// hardcode
|
|
10083
|
-
segmentId
|
|
10095
|
+
len
|
|
10084
10096
|
};
|
|
10085
10097
|
return this.push(insertAction), this;
|
|
10086
10098
|
}
|
|
10087
|
-
retain(len,
|
|
10099
|
+
retain(len, body, coverType) {
|
|
10088
10100
|
const retainAction = {
|
|
10089
10101
|
t: TextXActionType.RETAIN,
|
|
10090
|
-
len
|
|
10091
|
-
segmentId
|
|
10102
|
+
len
|
|
10092
10103
|
};
|
|
10093
10104
|
return body != null && (retainAction.body = body), coverType != null && (retainAction.coverType = coverType), this.push(retainAction), this;
|
|
10094
10105
|
}
|
|
10095
|
-
delete(len
|
|
10106
|
+
delete(len) {
|
|
10096
10107
|
const deleteAction = {
|
|
10097
10108
|
t: TextXActionType.DELETE,
|
|
10098
|
-
len
|
|
10099
|
-
line: 0,
|
|
10100
|
-
// hardcode
|
|
10101
|
-
segmentId
|
|
10109
|
+
len
|
|
10102
10110
|
};
|
|
10103
10111
|
return this.push(deleteAction), this;
|
|
10104
10112
|
}
|
|
@@ -10202,7 +10210,7 @@ const DEFAULT_DOC = {
|
|
|
10202
10210
|
constructor(snapshot) {
|
|
10203
10211
|
var _a11;
|
|
10204
10212
|
super();
|
|
10205
|
-
__publicField(this, "type",
|
|
10213
|
+
__publicField(this, "type", _.UNIVER_DOC);
|
|
10206
10214
|
__publicField(this, "_name$", new BehaviorSubject(""));
|
|
10207
10215
|
__publicField(this, "name$", this._name$.asObservable());
|
|
10208
10216
|
__publicField(this, "snapshot");
|
|
@@ -10403,15 +10411,15 @@ function shouldDeleteCustomRange(deleteStart, deleteLen, customRange, dataStream
|
|
|
10403
10411
|
return !0;
|
|
10404
10412
|
}
|
|
10405
10413
|
__name(shouldDeleteCustomRange, "shouldDeleteCustomRange");
|
|
10406
|
-
function
|
|
10414
|
+
function getCustomRangesInterestsWithSelection(range, customRanges) {
|
|
10407
10415
|
const result = [];
|
|
10408
10416
|
for (let i = 0, len = customRanges.length; i < len; i++) {
|
|
10409
10417
|
const customRange = customRanges[i];
|
|
10410
|
-
range.collapsed ? customRange.startIndex < range.startOffset && range.startOffset <= customRange.endIndex && result.push(customRange) : isIntersecting(range.startOffset, range.endOffset, customRange.startIndex, customRange.endIndex) && result.push(customRange);
|
|
10418
|
+
range.collapsed ? customRange.startIndex < range.startOffset && range.startOffset <= customRange.endIndex && result.push(customRange) : isIntersecting(range.startOffset, range.endOffset - 1, customRange.startIndex, customRange.endIndex) && result.push(customRange);
|
|
10411
10419
|
}
|
|
10412
10420
|
return result;
|
|
10413
10421
|
}
|
|
10414
|
-
__name(
|
|
10422
|
+
__name(getCustomRangesInterestsWithSelection, "getCustomRangesInterestsWithSelection");
|
|
10415
10423
|
function copyCustomRange(range) {
|
|
10416
10424
|
return {
|
|
10417
10425
|
...Tools.deepClone(range),
|
|
@@ -10447,8 +10455,7 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
|
|
|
10447
10455
|
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
10448
10456
|
textX.push({
|
|
10449
10457
|
t: TextXActionType.RETAIN,
|
|
10450
|
-
len: startIndex - memoryCursor.cursor
|
|
10451
|
-
segmentId
|
|
10458
|
+
len: startIndex - memoryCursor.cursor
|
|
10452
10459
|
}), textX.push({
|
|
10453
10460
|
t: TextXActionType.RETAIN,
|
|
10454
10461
|
len: 1,
|
|
@@ -10474,7 +10481,6 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
|
|
|
10474
10481
|
}
|
|
10475
10482
|
]
|
|
10476
10483
|
},
|
|
10477
|
-
segmentId,
|
|
10478
10484
|
coverType: UpdateDocsAttributeType.REPLACE
|
|
10479
10485
|
}), memoryCursor.moveCursorTo(startIndex + 1);
|
|
10480
10486
|
}
|
|
@@ -10492,8 +10498,7 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
|
|
|
10492
10498
|
const textX = new TextX(), { startIndex, paragraphStyle = {} } = currentParagraph, listType = currentParagraph.bullet.listType === PresetListType.CHECK_LIST ? PresetListType.CHECK_LIST_CHECKED : PresetListType.CHECK_LIST;
|
|
10493
10499
|
return textX.push({
|
|
10494
10500
|
t: TextXActionType.RETAIN,
|
|
10495
|
-
len: startIndex - memoryCursor.cursor
|
|
10496
|
-
segmentId
|
|
10501
|
+
len: startIndex - memoryCursor.cursor
|
|
10497
10502
|
}), textX.push({
|
|
10498
10503
|
t: TextXActionType.RETAIN,
|
|
10499
10504
|
len: 1,
|
|
@@ -10511,8 +10516,7 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
|
|
|
10511
10516
|
}
|
|
10512
10517
|
]
|
|
10513
10518
|
},
|
|
10514
|
-
coverType: UpdateDocsAttributeType.REPLACE
|
|
10515
|
-
segmentId
|
|
10519
|
+
coverType: UpdateDocsAttributeType.REPLACE
|
|
10516
10520
|
}), memoryCursor.moveCursorTo(startIndex + 1), textX;
|
|
10517
10521
|
}, "toggleChecklistParagraph"), setParagraphBullet = /* @__PURE__ */ __name((params) => {
|
|
10518
10522
|
var _a11, _b2;
|
|
@@ -10526,8 +10530,7 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
|
|
|
10526
10530
|
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
10527
10531
|
textX.push({
|
|
10528
10532
|
t: TextXActionType.RETAIN,
|
|
10529
|
-
len: startIndex - memoryCursor.cursor
|
|
10530
|
-
segmentId
|
|
10533
|
+
len: startIndex - memoryCursor.cursor
|
|
10531
10534
|
}), textX.push({
|
|
10532
10535
|
t: TextXActionType.RETAIN,
|
|
10533
10536
|
len: 1,
|
|
@@ -10548,7 +10551,6 @@ const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
|
|
|
10548
10551
|
}
|
|
10549
10552
|
]
|
|
10550
10553
|
},
|
|
10551
|
-
segmentId,
|
|
10552
10554
|
coverType: UpdateDocsAttributeType.REPLACE
|
|
10553
10555
|
}), memoryCursor.moveCursorTo(startIndex + 1);
|
|
10554
10556
|
}
|
|
@@ -10570,8 +10572,7 @@ const changeParagraphBulletNestLevel = /* @__PURE__ */ __name((params) => {
|
|
|
10570
10572
|
const { startIndex, paragraphStyle = {}, bullet } = paragraph, isInTable = hasParagraphInTable(paragraph, tables);
|
|
10571
10573
|
if (textX.push({
|
|
10572
10574
|
t: TextXActionType.RETAIN,
|
|
10573
|
-
len: startIndex - memoryCursor.cursor
|
|
10574
|
-
segmentId
|
|
10575
|
+
len: startIndex - memoryCursor.cursor
|
|
10575
10576
|
}), bullet) {
|
|
10576
10577
|
const listType = bullet.listType;
|
|
10577
10578
|
let maxLevel = lists[listType].nestingLevel.length - 1;
|
|
@@ -10593,7 +10594,6 @@ const changeParagraphBulletNestLevel = /* @__PURE__ */ __name((params) => {
|
|
|
10593
10594
|
}
|
|
10594
10595
|
]
|
|
10595
10596
|
},
|
|
10596
|
-
segmentId,
|
|
10597
10597
|
coverType: UpdateDocsAttributeType.REPLACE
|
|
10598
10598
|
});
|
|
10599
10599
|
} else
|
|
@@ -10684,8 +10684,12 @@ function getSelectionWithSymbolMax(selection, body) {
|
|
|
10684
10684
|
let { startOffset, endOffset } = normalizeSelection(selection);
|
|
10685
10685
|
for (; body.dataStream[startOffset - 1] === DataStreamTreeTokenType.CUSTOM_RANGE_START; )
|
|
10686
10686
|
startOffset -= 1;
|
|
10687
|
+
for (; body.dataStream[startOffset] === DataStreamTreeTokenType.CUSTOM_RANGE_END; )
|
|
10688
|
+
startOffset += 1;
|
|
10687
10689
|
for (; body.dataStream[endOffset] === DataStreamTreeTokenType.CUSTOM_RANGE_END; )
|
|
10688
10690
|
endOffset += 1;
|
|
10691
|
+
for (; body.dataStream[endOffset - 1] === DataStreamTreeTokenType.CUSTOM_RANGE_START; )
|
|
10692
|
+
endOffset -= 1;
|
|
10689
10693
|
return {
|
|
10690
10694
|
startOffset,
|
|
10691
10695
|
endOffset
|
|
@@ -10791,13 +10795,12 @@ function isSegmentIntersects(start, end, start2, end2) {
|
|
|
10791
10795
|
__name(isSegmentIntersects, "isSegmentIntersects");
|
|
10792
10796
|
function getRetainAndDeleteFromReplace(range, segmentId = "", memoryCursor, body) {
|
|
10793
10797
|
var _a11;
|
|
10794
|
-
const { startOffset, endOffset } = range, dos = [], textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, dataStream = body.dataStream, relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
|
|
10798
|
+
const { startOffset, endOffset } = range, dos = [], textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, dataStream = body.dataStream, relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset - 1)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
|
|
10795
10799
|
relativeCustomRanges == null || relativeCustomRanges.forEach((range2) => {
|
|
10796
10800
|
toDeleteRanges.has(range2) || (range2.startIndex - memoryCursor >= textStart && range2.startIndex - memoryCursor < textEnd && range2.endIndex - memoryCursor >= textEnd && retainPoints.add(range2.startIndex), range2.endIndex - memoryCursor >= textStart && range2.endIndex - memoryCursor < textEnd && range2.startIndex - memoryCursor < textStart && retainPoints.add(range2.endIndex));
|
|
10797
10801
|
}), textStart > 0 && dos.push({
|
|
10798
10802
|
t: TextXActionType.RETAIN,
|
|
10799
|
-
len: textStart
|
|
10800
|
-
segmentId
|
|
10803
|
+
len: textStart
|
|
10801
10804
|
});
|
|
10802
10805
|
const sortedRetains = [...retainPoints].sort((pre, aft) => pre - aft);
|
|
10803
10806
|
let cursor2 = textStart;
|
|
@@ -10805,19 +10808,14 @@ function getRetainAndDeleteFromReplace(range, segmentId = "", memoryCursor, body
|
|
|
10805
10808
|
const len = pos - cursor2;
|
|
10806
10809
|
len > 0 && dos.push({
|
|
10807
10810
|
t: TextXActionType.DELETE,
|
|
10808
|
-
len
|
|
10809
|
-
line: 0,
|
|
10810
|
-
segmentId
|
|
10811
|
+
len
|
|
10811
10812
|
}), dos.push({
|
|
10812
10813
|
t: TextXActionType.RETAIN,
|
|
10813
|
-
len: 1
|
|
10814
|
-
segmentId
|
|
10814
|
+
len: 1
|
|
10815
10815
|
}), cursor2 = pos + 1;
|
|
10816
10816
|
}), cursor2 < textEnd && (dos.push({
|
|
10817
10817
|
t: TextXActionType.DELETE,
|
|
10818
|
-
len: textEnd - cursor2
|
|
10819
|
-
line: 0,
|
|
10820
|
-
segmentId
|
|
10818
|
+
len: textEnd - cursor2
|
|
10821
10819
|
}), cursor2 = textEnd + 1), {
|
|
10822
10820
|
dos,
|
|
10823
10821
|
cursor: cursor2,
|
|
@@ -10833,28 +10831,20 @@ function deleteCustomRangeTextX(accessor, params) {
|
|
|
10833
10831
|
const { startIndex, endIndex } = range, textX = new TextX(), len = endIndex - startIndex + 1;
|
|
10834
10832
|
return startIndex > 0 && textX.push({
|
|
10835
10833
|
t: TextXActionType.RETAIN,
|
|
10836
|
-
len: startIndex
|
|
10837
|
-
segmentId
|
|
10834
|
+
len: startIndex
|
|
10838
10835
|
}), textX.push({
|
|
10839
10836
|
t: TextXActionType.DELETE,
|
|
10840
|
-
len: 1
|
|
10841
|
-
segmentId,
|
|
10842
|
-
line: 0
|
|
10837
|
+
len: 1
|
|
10843
10838
|
}), textRange && textRange.index > startIndex && textRange.index--, len - 2 > 0 && textX.push({
|
|
10844
10839
|
t: TextXActionType.RETAIN,
|
|
10845
|
-
len: len - 2
|
|
10846
|
-
segmentId
|
|
10840
|
+
len: len - 2
|
|
10847
10841
|
}), textX.push({
|
|
10848
10842
|
t: TextXActionType.DELETE,
|
|
10849
|
-
len: 1
|
|
10850
|
-
segmentId,
|
|
10851
|
-
line: 0
|
|
10843
|
+
len: 1
|
|
10852
10844
|
}), textRange && textRange.index > endIndex && textRange.index--, insert && (textX.push({
|
|
10853
10845
|
body: insert,
|
|
10854
10846
|
t: TextXActionType.INSERT,
|
|
10855
|
-
len: insert.dataStream.length
|
|
10856
|
-
segmentId,
|
|
10857
|
-
line: 1
|
|
10847
|
+
len: insert.dataStream.length
|
|
10858
10848
|
}), textRange && textRange.index > endIndex && (textRange.index += insert.dataStream.length)), textX;
|
|
10859
10849
|
}
|
|
10860
10850
|
__name(deleteCustomRangeTextX, "deleteCustomRangeTextX");
|
|
@@ -10881,31 +10871,24 @@ function addCustomRangeTextX(param) {
|
|
|
10881
10871
|
};
|
|
10882
10872
|
range2.startOffset !== cursor2 && (textX.push({
|
|
10883
10873
|
t: TextXActionType.RETAIN,
|
|
10884
|
-
len: range2.startOffset - cursor2
|
|
10885
|
-
segmentId
|
|
10874
|
+
len: range2.startOffset - cursor2
|
|
10886
10875
|
}), cursor2 = range2.startOffset), textX.push({
|
|
10887
10876
|
t: TextXActionType.INSERT,
|
|
10888
10877
|
body: {
|
|
10889
10878
|
dataStream: DataStreamTreeTokenType.CUSTOM_RANGE_START
|
|
10890
10879
|
},
|
|
10891
|
-
len: 1
|
|
10892
|
-
line: 0,
|
|
10893
|
-
segmentId
|
|
10880
|
+
len: 1
|
|
10894
10881
|
}), deletes.forEach((index22) => {
|
|
10895
10882
|
index22 !== cursor2 && (textX.push({
|
|
10896
10883
|
t: TextXActionType.RETAIN,
|
|
10897
|
-
len: index22 - cursor2
|
|
10898
|
-
segmentId
|
|
10884
|
+
len: index22 - cursor2
|
|
10899
10885
|
}), cursor2 = index22), textX.push({
|
|
10900
10886
|
t: TextXActionType.DELETE,
|
|
10901
|
-
len: 1
|
|
10902
|
-
line: 0,
|
|
10903
|
-
segmentId
|
|
10887
|
+
len: 1
|
|
10904
10888
|
}), cursor2++;
|
|
10905
10889
|
}), cursor2 !== range2.endOffset && (textX.push({
|
|
10906
10890
|
t: TextXActionType.RETAIN,
|
|
10907
|
-
len: range2.endOffset - cursor2
|
|
10908
|
-
segmentId
|
|
10891
|
+
len: range2.endOffset - cursor2
|
|
10909
10892
|
}), cursor2 = range2.endOffset), textX.push({
|
|
10910
10893
|
t: TextXActionType.INSERT,
|
|
10911
10894
|
body: {
|
|
@@ -10923,9 +10906,7 @@ function addCustomRangeTextX(param) {
|
|
|
10923
10906
|
}
|
|
10924
10907
|
]
|
|
10925
10908
|
},
|
|
10926
|
-
len: 1
|
|
10927
|
-
line: 0,
|
|
10928
|
-
segmentId
|
|
10909
|
+
len: 1
|
|
10929
10910
|
});
|
|
10930
10911
|
}, "addCustomRange"), relativeParagraphs = ((_b2 = body.paragraphs) != null ? _b2 : []).filter((p) => p.startIndex < endOffset && p.startIndex > startOffset);
|
|
10931
10912
|
return excludePointsFromRange([startOffset, endOffset - 1], relativeParagraphs.map((p) => p.startIndex)).forEach(([start, end], i) => addCustomRange(start, end, i)), textX;
|
|
@@ -10935,13 +10916,12 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
|
|
|
10935
10916
|
var _a11;
|
|
10936
10917
|
const { startOffset, endOffset } = getDeleteSelection(selection, body), dos = [], { paragraphs = [], dataStream } = body, textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, paragraphInRange = paragraphs == null ? void 0 : paragraphs.find(
|
|
10937
10918
|
(p) => p.startIndex - memoryCursor >= textStart && p.startIndex - memoryCursor < textEnd
|
|
10938
|
-
), relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
|
|
10919
|
+
), relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset - 1)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
|
|
10939
10920
|
if (relativeCustomRanges == null || relativeCustomRanges.forEach((range) => {
|
|
10940
10921
|
toDeleteRanges.has(range) || (range.startIndex - memoryCursor >= textStart && range.startIndex - memoryCursor <= textEnd && range.endIndex - memoryCursor > textEnd && retainPoints.add(range.startIndex), range.endIndex - memoryCursor >= textStart && range.endIndex - memoryCursor <= textEnd && range.startIndex < textStart && retainPoints.add(range.endIndex));
|
|
10941
10922
|
}), textStart > 0 && dos.push({
|
|
10942
10923
|
t: TextXActionType.RETAIN,
|
|
10943
|
-
len: textStart
|
|
10944
|
-
segmentId
|
|
10924
|
+
len: textStart
|
|
10945
10925
|
}), preserveLineBreak && paragraphInRange && paragraphInRange.startIndex - memoryCursor > textStart) {
|
|
10946
10926
|
const paragraphIndex = paragraphInRange.startIndex - memoryCursor;
|
|
10947
10927
|
retainPoints.add(paragraphIndex);
|
|
@@ -10952,29 +10932,22 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
|
|
|
10952
10932
|
const len = pos - cursor2;
|
|
10953
10933
|
len > 0 && dos.push({
|
|
10954
10934
|
t: TextXActionType.DELETE,
|
|
10955
|
-
len
|
|
10956
|
-
line: 0,
|
|
10957
|
-
segmentId
|
|
10935
|
+
len
|
|
10958
10936
|
}), dos.push({
|
|
10959
10937
|
t: TextXActionType.RETAIN,
|
|
10960
|
-
len: 1
|
|
10961
|
-
segmentId
|
|
10938
|
+
len: 1
|
|
10962
10939
|
}), cursor2 = pos + 1;
|
|
10963
10940
|
}), cursor2 < textEnd && (dos.push({
|
|
10964
10941
|
t: TextXActionType.DELETE,
|
|
10965
|
-
len: textEnd - cursor2
|
|
10966
|
-
line: 0,
|
|
10967
|
-
segmentId
|
|
10942
|
+
len: textEnd - cursor2
|
|
10968
10943
|
}), cursor2 = textEnd), !preserveLineBreak) {
|
|
10969
10944
|
const nextParagraph = paragraphs.find((p) => p.startIndex - memoryCursor >= textEnd);
|
|
10970
10945
|
nextParagraph && (nextParagraph.startIndex > cursor2 && (dos.push({
|
|
10971
10946
|
t: TextXActionType.RETAIN,
|
|
10972
|
-
len: nextParagraph.startIndex - cursor2
|
|
10973
|
-
segmentId
|
|
10947
|
+
len: nextParagraph.startIndex - cursor2
|
|
10974
10948
|
}), cursor2 = nextParagraph.startIndex), dos.push({
|
|
10975
10949
|
t: TextXActionType.RETAIN,
|
|
10976
10950
|
len: 1,
|
|
10977
|
-
segmentId,
|
|
10978
10951
|
body: {
|
|
10979
10952
|
dataStream: "",
|
|
10980
10953
|
paragraphs: [
|
|
@@ -10999,9 +10972,7 @@ const replaceSelectionTextX = /* @__PURE__ */ __name((params) => {
|
|
|
10999
10972
|
return deleteActions.length && textX.push(...deleteActions), textX.push({
|
|
11000
10973
|
t: TextXActionType.INSERT,
|
|
11001
10974
|
body: insertBody,
|
|
11002
|
-
len: insertBody.dataStream.length
|
|
11003
|
-
line: 0,
|
|
11004
|
-
segmentId
|
|
10975
|
+
len: insertBody.dataStream.length
|
|
11005
10976
|
}), textX;
|
|
11006
10977
|
}, "replaceSelectionTextX"), _BuildTextUtils = class _BuildTextUtils {
|
|
11007
10978
|
};
|
|
@@ -11009,7 +10980,7 @@ __name(_BuildTextUtils, "BuildTextUtils"), __publicField(_BuildTextUtils, "custo
|
|
|
11009
10980
|
add: addCustomRangeTextX,
|
|
11010
10981
|
delete: deleteCustomRangeTextX,
|
|
11011
10982
|
copyCustomRange,
|
|
11012
|
-
|
|
10983
|
+
getCustomRangesInterestsWithSelection,
|
|
11013
10984
|
shouldDeleteCustomRange,
|
|
11014
10985
|
isIntersecting
|
|
11015
10986
|
}), __publicField(_BuildTextUtils, "selection", {
|
|
@@ -11019,7 +10990,7 @@ __name(_BuildTextUtils, "BuildTextUtils"), __publicField(_BuildTextUtils, "custo
|
|
|
11019
10990
|
getDeleteSelection,
|
|
11020
10991
|
getInsertSelection,
|
|
11021
10992
|
getDeleteActions: getRetainAndDeleteFromReplace,
|
|
11022
|
-
|
|
10993
|
+
getDeleteExcludeLastLineBreakActions: getRetainAndDeleteAndExcludeLineBreak
|
|
11023
10994
|
}), __publicField(_BuildTextUtils, "range", {
|
|
11024
10995
|
isIntersects: isSegmentIntersects
|
|
11025
10996
|
}), __publicField(_BuildTextUtils, "transform", {
|
|
@@ -11234,7 +11205,7 @@ let AuthzIoLocalService = (_a3 = class {
|
|
|
11234
11205
|
}, "toJson"),
|
|
11235
11206
|
parseJson: /* @__PURE__ */ __name((json) => JSON.parse(json), "parseJson"),
|
|
11236
11207
|
pluginName: "SHEET_AuthzIoMockService_PLUGIN",
|
|
11237
|
-
businesses: [
|
|
11208
|
+
businesses: [_.UNIVER_SHEET, _.UNIVER_DOC, _.UNIVER_SLIDE],
|
|
11238
11209
|
onLoad: /* @__PURE__ */ __name((_unitId, resource) => {
|
|
11239
11210
|
for (const key in resource)
|
|
11240
11211
|
this._permissionMap.set(key, resource[key]);
|
|
@@ -11268,8 +11239,8 @@ let AuthzIoLocalService = (_a3 = class {
|
|
|
11268
11239
|
shareRole: S.Owner,
|
|
11269
11240
|
shareScope: -1,
|
|
11270
11241
|
scope: {
|
|
11271
|
-
read:
|
|
11272
|
-
edit:
|
|
11242
|
+
read: G.AllCollaborator,
|
|
11243
|
+
edit: G.AllCollaborator
|
|
11273
11244
|
},
|
|
11274
11245
|
creator: createDefaultUser(S.Owner),
|
|
11275
11246
|
strategies: [
|
|
@@ -11358,23 +11329,32 @@ AuthzIoLocalService = __decorateClass$6([
|
|
|
11358
11329
|
], AuthzIoLocalService);
|
|
11359
11330
|
const IAuthzIoService = createIdentifier("IAuthzIoIoService"), IConfigService = createIdentifier("univer.config-service"), _ConfigService = class _ConfigService {
|
|
11360
11331
|
constructor() {
|
|
11332
|
+
__publicField(this, "_configChanged$", new Subject());
|
|
11333
|
+
__publicField(this, "configChanged$", this._configChanged$.asObservable());
|
|
11361
11334
|
__publicField(this, "_config", /* @__PURE__ */ new Map());
|
|
11362
11335
|
}
|
|
11336
|
+
dispose() {
|
|
11337
|
+
this._configChanged$.complete();
|
|
11338
|
+
}
|
|
11363
11339
|
getConfig(id) {
|
|
11364
11340
|
return this._config.get(id);
|
|
11365
11341
|
}
|
|
11366
11342
|
setConfig(id, value, options) {
|
|
11367
11343
|
var _a11;
|
|
11368
|
-
const { merge: merge2 = !1 } = options || {}
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
return;
|
|
11372
|
-
}
|
|
11373
|
-
this._config.set(id, value);
|
|
11344
|
+
const { merge: merge2 = !1 } = options || {};
|
|
11345
|
+
let nextValue = (_a11 = this._config.get(id)) != null ? _a11 : {};
|
|
11346
|
+
merge2 ? nextValue = Tools.deepMerge(nextValue, value) : nextValue = value, this._config.set(id, nextValue), this._configChanged$.next({ [id]: nextValue });
|
|
11374
11347
|
}
|
|
11375
11348
|
deleteConfig(id) {
|
|
11376
11349
|
return this._config.delete(id);
|
|
11377
11350
|
}
|
|
11351
|
+
subscribeConfigValue$(key) {
|
|
11352
|
+
return new Observable((observer) => {
|
|
11353
|
+
Object.prototype.hasOwnProperty.call(this._config, key) && observer.next(this._config.get(key));
|
|
11354
|
+
const sub = this.configChanged$.pipe(filter((c) => Object.prototype.hasOwnProperty.call(c, key))).subscribe((c) => observer.next(c[key]));
|
|
11355
|
+
return () => sub.unsubscribe();
|
|
11356
|
+
});
|
|
11357
|
+
}
|
|
11378
11358
|
};
|
|
11379
11359
|
__name(_ConfigService, "ConfigService");
|
|
11380
11360
|
let ConfigService = _ConfigService;
|
|
@@ -11393,7 +11373,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
|
|
|
11393
11373
|
};
|
|
11394
11374
|
__name(_ErrorService, "ErrorService");
|
|
11395
11375
|
let ErrorService = _ErrorService;
|
|
11396
|
-
const version = "0.4.
|
|
11376
|
+
const version = "0.4.2";
|
|
11397
11377
|
function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
|
|
11398
11378
|
return {
|
|
11399
11379
|
id: unitID,
|
|
@@ -11479,6 +11459,24 @@ const _ColumnManager = class _ColumnManager {
|
|
|
11479
11459
|
const { _columnData } = this, col = _columnData[colPos];
|
|
11480
11460
|
return col ? col.hd !== BooleanNumber.TRUE : !0;
|
|
11481
11461
|
}
|
|
11462
|
+
/**
|
|
11463
|
+
* Get the column style
|
|
11464
|
+
* @param {number} col Column index
|
|
11465
|
+
* @returns {string | Nullable<IStyleData>} Style data, may be undefined
|
|
11466
|
+
*/
|
|
11467
|
+
getColumnStyle(col) {
|
|
11468
|
+
var _a11;
|
|
11469
|
+
return (_a11 = this._columnData[col]) == null ? void 0 : _a11.s;
|
|
11470
|
+
}
|
|
11471
|
+
/**
|
|
11472
|
+
* Set the set column default style
|
|
11473
|
+
* @param {number} col Column index
|
|
11474
|
+
* @param {string | Nullable<IStyleData>} style Style data
|
|
11475
|
+
*/
|
|
11476
|
+
setColumnStyle(col, style) {
|
|
11477
|
+
const coldData = this.getColumnOrCreate(col);
|
|
11478
|
+
coldData.s = style;
|
|
11479
|
+
}
|
|
11482
11480
|
/**
|
|
11483
11481
|
* Get all hidden columns
|
|
11484
11482
|
* @param start Start index
|
|
@@ -11565,26 +11563,29 @@ const _ColumnManager = class _ColumnManager {
|
|
|
11565
11563
|
/**
|
|
11566
11564
|
* get given column data
|
|
11567
11565
|
* @param columnPos column index
|
|
11568
|
-
* @returns
|
|
11569
11566
|
*/
|
|
11570
11567
|
getColumn(columnPos) {
|
|
11571
11568
|
const column = this._columnData[columnPos];
|
|
11572
11569
|
if (column)
|
|
11573
11570
|
return column;
|
|
11574
11571
|
}
|
|
11572
|
+
/**
|
|
11573
|
+
* Remove column data of given column
|
|
11574
|
+
* @param columnPos
|
|
11575
|
+
*/
|
|
11576
|
+
removeColumn(columnPos) {
|
|
11577
|
+
delete this._columnData[columnPos];
|
|
11578
|
+
}
|
|
11575
11579
|
/**
|
|
11576
11580
|
* get given column data or create a column data when it's null
|
|
11577
11581
|
* @param columnPos column index
|
|
11578
|
-
* @returns
|
|
11582
|
+
* @returns {Partial<IColumnData>} columnData
|
|
11579
11583
|
*/
|
|
11580
11584
|
getColumnOrCreate(columnPos) {
|
|
11581
|
-
const { _columnData } = this,
|
|
11585
|
+
const { _columnData } = this, column = _columnData[columnPos];
|
|
11582
11586
|
if (column)
|
|
11583
11587
|
return column;
|
|
11584
|
-
const create = {
|
|
11585
|
-
w: config.defaultColumnWidth,
|
|
11586
|
-
hd: BooleanNumber.FALSE
|
|
11587
|
-
};
|
|
11588
|
+
const create = {};
|
|
11588
11589
|
return this._columnData[columnPos] = create, create;
|
|
11589
11590
|
}
|
|
11590
11591
|
};
|
|
@@ -11602,6 +11603,24 @@ const _RowManager = class _RowManager {
|
|
|
11602
11603
|
getRowData() {
|
|
11603
11604
|
return this._rowData;
|
|
11604
11605
|
}
|
|
11606
|
+
/**
|
|
11607
|
+
* Get the row style
|
|
11608
|
+
* @param {number} row Row index
|
|
11609
|
+
* @returns {string | Nullable<IStyleData>} Style data, may be undefined
|
|
11610
|
+
*/
|
|
11611
|
+
getRowStyle(row) {
|
|
11612
|
+
var _a11;
|
|
11613
|
+
return (_a11 = this._rowData[row]) == null ? void 0 : _a11.s;
|
|
11614
|
+
}
|
|
11615
|
+
/**
|
|
11616
|
+
* Set row default style
|
|
11617
|
+
* @param {number} row The row index
|
|
11618
|
+
* @param {string | Nullable<IStyleData>} style The style data
|
|
11619
|
+
*/
|
|
11620
|
+
setRowStyle(row, style) {
|
|
11621
|
+
const rowData = this.getRowOrCreate(row);
|
|
11622
|
+
rowData.s = style;
|
|
11623
|
+
}
|
|
11605
11624
|
getRowDatas(rowPos, numRows) {
|
|
11606
11625
|
const rowData = {};
|
|
11607
11626
|
let index2 = 0;
|
|
@@ -11631,16 +11650,23 @@ const _RowManager = class _RowManager {
|
|
|
11631
11650
|
getRow(rowPos) {
|
|
11632
11651
|
return this._rowData[rowPos];
|
|
11633
11652
|
}
|
|
11653
|
+
/**
|
|
11654
|
+
* Remove row data of given row
|
|
11655
|
+
* @param rowPos
|
|
11656
|
+
*/
|
|
11657
|
+
removeRow(rowPos) {
|
|
11658
|
+
delete this._rowData[rowPos];
|
|
11659
|
+
}
|
|
11634
11660
|
/**
|
|
11635
11661
|
* Get given row data or create a row data when it's null
|
|
11636
11662
|
* @param rowPos row index
|
|
11637
|
-
* @returns
|
|
11663
|
+
* @returns {Partial<IRowData>} rowData
|
|
11638
11664
|
*/
|
|
11639
11665
|
getRowOrCreate(rowPos) {
|
|
11640
11666
|
const { _rowData } = this, row = _rowData[rowPos];
|
|
11641
11667
|
if (row)
|
|
11642
11668
|
return row;
|
|
11643
|
-
const
|
|
11669
|
+
const create = {};
|
|
11644
11670
|
return _rowData[rowPos] = create, create;
|
|
11645
11671
|
}
|
|
11646
11672
|
/**
|
|
@@ -11691,7 +11717,7 @@ const _RowManager = class _RowManager {
|
|
|
11691
11717
|
}
|
|
11692
11718
|
/**
|
|
11693
11719
|
* Get count of row in the sheet
|
|
11694
|
-
* @returns
|
|
11720
|
+
* @returns {number} row count
|
|
11695
11721
|
*/
|
|
11696
11722
|
getSize() {
|
|
11697
11723
|
return getArrayLength(this._rowData);
|
|
@@ -12013,9 +12039,77 @@ const _Worksheet = class _Worksheet {
|
|
|
12013
12039
|
getSpanModel() {
|
|
12014
12040
|
return this._spanModel;
|
|
12015
12041
|
}
|
|
12042
|
+
/**
|
|
12043
|
+
* Get the style of the column.
|
|
12044
|
+
* @param {number} column The column index
|
|
12045
|
+
* @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
|
|
12046
|
+
* @returns {Nullable<IStyleData>|string} The style of the column
|
|
12047
|
+
*/
|
|
12048
|
+
getColumnStyle(column, keepRaw = !1) {
|
|
12049
|
+
return keepRaw ? this._columnManager.getColumnStyle(column) : this._styles.get(this._columnManager.getColumnStyle(column));
|
|
12050
|
+
}
|
|
12051
|
+
/**
|
|
12052
|
+
* Set the style of the column.
|
|
12053
|
+
* @param {number} column The column index
|
|
12054
|
+
* @param {string|Nullable<IStyleData>} style The style to be set
|
|
12055
|
+
*/
|
|
12056
|
+
setColumnStyle(column, style) {
|
|
12057
|
+
this._columnManager.setColumnStyle(column, style);
|
|
12058
|
+
}
|
|
12059
|
+
/**
|
|
12060
|
+
* Get the style of the row.
|
|
12061
|
+
* @param {number} row The row index
|
|
12062
|
+
* @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
|
|
12063
|
+
* @returns {Nullable<IStyleData>} The style of the row
|
|
12064
|
+
*/
|
|
12065
|
+
getRowStyle(row, keepRaw = !1) {
|
|
12066
|
+
return keepRaw ? this._rowManager.getRowStyle(row) : this._styles.get(this._rowManager.getRowStyle(row));
|
|
12067
|
+
}
|
|
12068
|
+
/**
|
|
12069
|
+
* Set the style of the row.
|
|
12070
|
+
* @param {number} row
|
|
12071
|
+
* @param {string|Nullable<IStyleData>} style The style to be set
|
|
12072
|
+
*/
|
|
12073
|
+
setRowStyle(row, style) {
|
|
12074
|
+
this._rowManager.setRowStyle(row, style);
|
|
12075
|
+
}
|
|
12076
|
+
/**
|
|
12077
|
+
* this function is used to mixin default style to cell raw{number}
|
|
12078
|
+
* @param {number} row The row index
|
|
12079
|
+
* @param {number} col The column index
|
|
12080
|
+
* @param cellRaw The cell raw data
|
|
12081
|
+
* @param {boolean} isRowStylePrecedeColumnStyle The priority of row style and column style
|
|
12082
|
+
*/
|
|
12083
|
+
mixinDefaultStyleToCellRaw(row, col, cellRaw, isRowStylePrecedeColumnStyle) {
|
|
12084
|
+
const columnStyle = this.getColumnStyle(col), rowStyle = this.getRowStyle(row), defaultStyle = this.getDefaultCellStyleInternal();
|
|
12085
|
+
if (defaultStyle || columnStyle || rowStyle) {
|
|
12086
|
+
let cellStyle = cellRaw == null ? void 0 : cellRaw.s;
|
|
12087
|
+
typeof cellStyle == "string" && (cellStyle = this._styles.get(cellStyle));
|
|
12088
|
+
const s = isRowStylePrecedeColumnStyle ? composeStyles(defaultStyle, columnStyle, rowStyle, cellStyle) : composeStyles(defaultStyle, rowStyle, columnStyle, cellStyle);
|
|
12089
|
+
cellRaw || (cellRaw = {}), cellRaw.s = s;
|
|
12090
|
+
}
|
|
12091
|
+
}
|
|
12092
|
+
/**
|
|
12093
|
+
* Get the default style of the worksheet.
|
|
12094
|
+
* @returns {Nullable<IStyleData>} Default Style
|
|
12095
|
+
*/
|
|
12096
|
+
getDefaultCellStyle() {
|
|
12097
|
+
return this._snapshot.defaultStyle;
|
|
12098
|
+
}
|
|
12099
|
+
getDefaultCellStyleInternal() {
|
|
12100
|
+
const style = this._snapshot.defaultStyle;
|
|
12101
|
+
return this._styles.get(style);
|
|
12102
|
+
}
|
|
12103
|
+
/**
|
|
12104
|
+
* Set Default Style, if the style has been set, all cells style will be base on this style.
|
|
12105
|
+
* @param {Nullable<IStyleData>} style The style to be set as default style
|
|
12106
|
+
*/
|
|
12107
|
+
setDefaultCellStyle(style) {
|
|
12108
|
+
this._snapshot.defaultStyle = style;
|
|
12109
|
+
}
|
|
12016
12110
|
/**
|
|
12017
12111
|
* Returns WorkSheet Cell Data Matrix
|
|
12018
|
-
* @returns
|
|
12112
|
+
* @returns WorkSheet Cell Data Matrix
|
|
12019
12113
|
*/
|
|
12020
12114
|
getCellMatrix() {
|
|
12021
12115
|
return this._cellData;
|
|
@@ -12543,7 +12637,7 @@ var _a4;
|
|
|
12543
12637
|
let Workbook = (_a4 = class extends UnitModel {
|
|
12544
12638
|
constructor(workbookData = {}, _logService) {
|
|
12545
12639
|
super();
|
|
12546
|
-
__publicField(this, "type",
|
|
12640
|
+
__publicField(this, "type", _.UNIVER_SHEET);
|
|
12547
12641
|
__publicField(this, "_sheetCreated$", new Subject());
|
|
12548
12642
|
__publicField(this, "sheetCreated$", this._sheetCreated$.asObservable());
|
|
12549
12643
|
__publicField(this, "_sheetDisposed$", new Subject());
|
|
@@ -12788,7 +12882,7 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
|
|
|
12788
12882
|
constructor(snapshot) {
|
|
12789
12883
|
var _a11;
|
|
12790
12884
|
super();
|
|
12791
|
-
__publicField(this, "type",
|
|
12885
|
+
__publicField(this, "type", _.UNIVER_SLIDE);
|
|
12792
12886
|
__publicField(this, "_activePage$", new BehaviorSubject(null));
|
|
12793
12887
|
__publicField(this, "activePage$", this._activePage$.asObservable());
|
|
12794
12888
|
__publicField(this, "_name$");
|
|
@@ -12961,20 +13055,20 @@ let UniverInstanceService = (_a5 = class extends Disposable {
|
|
|
12961
13055
|
return type2 && (unit == null ? void 0 : unit.type) !== type2 ? null : unit;
|
|
12962
13056
|
}
|
|
12963
13057
|
getCurrentUniverDocInstance() {
|
|
12964
|
-
return this.getCurrentUnitForType(
|
|
13058
|
+
return this.getCurrentUnitForType(_.UNIVER_DOC);
|
|
12965
13059
|
}
|
|
12966
13060
|
getUniverDocInstance(unitId) {
|
|
12967
|
-
return this.getUnit(unitId,
|
|
13061
|
+
return this.getUnit(unitId, _.UNIVER_DOC);
|
|
12968
13062
|
}
|
|
12969
13063
|
getUniverSheetInstance(unitId) {
|
|
12970
|
-
return this.getUnit(unitId,
|
|
13064
|
+
return this.getUnit(unitId, _.UNIVER_SHEET);
|
|
12971
13065
|
}
|
|
12972
13066
|
getAllUnitsForType(type2) {
|
|
12973
13067
|
var _a11;
|
|
12974
13068
|
return (_a11 = this._unitsByType.get(type2)) != null ? _a11 : [];
|
|
12975
13069
|
}
|
|
12976
13070
|
changeDoc(unitId, doc) {
|
|
12977
|
-
const allDocs = this.getAllUnitsForType(
|
|
13071
|
+
const allDocs = this.getAllUnitsForType(_.UNIVER_DOC), oldDoc = allDocs.find((doc2) => doc2.getUnitId() === unitId);
|
|
12978
13072
|
if (oldDoc != null) {
|
|
12979
13073
|
const index2 = allDocs.indexOf(oldDoc);
|
|
12980
13074
|
allDocs.splice(index2, 1);
|
|
@@ -12994,7 +13088,7 @@ let UniverInstanceService = (_a5 = class extends Disposable {
|
|
|
12994
13088
|
}
|
|
12995
13089
|
getUnitType(unitId) {
|
|
12996
13090
|
const result = this._getUnitById(unitId);
|
|
12997
|
-
return result ? result[1] :
|
|
13091
|
+
return result ? result[1] : _.UNRECOGNIZED;
|
|
12998
13092
|
}
|
|
12999
13093
|
disposeUnit(unitId) {
|
|
13000
13094
|
const result = this._getUnitById(unitId);
|
|
@@ -13171,6 +13265,13 @@ const IPermissionService = createIdentifier("univer.permission-service"), _Permi
|
|
|
13171
13265
|
__publicField(this, "_permissionPointMap", /* @__PURE__ */ new Map());
|
|
13172
13266
|
__publicField(this, "_permissionPointUpdate$", new Subject());
|
|
13173
13267
|
__publicField(this, "permissionPointUpdate$", this._permissionPointUpdate$.asObservable());
|
|
13268
|
+
__publicField(this, "_showComponents", !0);
|
|
13269
|
+
}
|
|
13270
|
+
setShowComponents(showComponents) {
|
|
13271
|
+
this._showComponents = showComponents;
|
|
13272
|
+
}
|
|
13273
|
+
getShowComponents() {
|
|
13274
|
+
return this._showComponents;
|
|
13174
13275
|
}
|
|
13175
13276
|
deletePermissionPoint(permissionId) {
|
|
13176
13277
|
const permissionPoint = this._permissionPointMap.get(permissionId);
|
|
@@ -13251,7 +13352,7 @@ const DependentOnSymbol = Symbol("DependentOn"), _Plugin = class _Plugin extends
|
|
|
13251
13352
|
return this.constructor.pluginName;
|
|
13252
13353
|
}
|
|
13253
13354
|
};
|
|
13254
|
-
__name(_Plugin, "Plugin"), __publicField(_Plugin, "pluginName"), __publicField(_Plugin, "type",
|
|
13355
|
+
__name(_Plugin, "Plugin"), __publicField(_Plugin, "pluginName"), __publicField(_Plugin, "type", _.UNIVER_UNKNOWN);
|
|
13255
13356
|
let Plugin = _Plugin;
|
|
13256
13357
|
const _PluginStore = class _PluginStore {
|
|
13257
13358
|
constructor() {
|
|
@@ -13310,7 +13411,7 @@ let PluginService = (_a7 = class {
|
|
|
13310
13411
|
PluginHolder,
|
|
13311
13412
|
this._checkPluginSeen.bind(this),
|
|
13312
13413
|
this._immediateInitPlugin.bind(this)
|
|
13313
|
-
), this._pluginHoldersForTypes.set(
|
|
13414
|
+
), this._pluginHoldersForTypes.set(_.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
|
|
13314
13415
|
}
|
|
13315
13416
|
dispose() {
|
|
13316
13417
|
this._clearFlushTimer();
|
|
@@ -13322,7 +13423,7 @@ let PluginService = (_a7 = class {
|
|
|
13322
13423
|
registerPlugin(ctor, config) {
|
|
13323
13424
|
this._assertPluginValid(ctor), this._scheduleInitPlugin();
|
|
13324
13425
|
const { type: type2 } = ctor;
|
|
13325
|
-
type2 ===
|
|
13426
|
+
type2 === _.UNIVER_UNKNOWN ? (this._pluginHolderForUniver.register(ctor, config), this._pluginHolderForUniver.flush()) : this._ensurePluginHolderForType(type2).register(ctor, config);
|
|
13326
13427
|
}
|
|
13327
13428
|
startPluginForType(type2) {
|
|
13328
13429
|
this._ensurePluginHolderForType(type2).start();
|
|
@@ -13346,7 +13447,7 @@ let PluginService = (_a7 = class {
|
|
|
13346
13447
|
}
|
|
13347
13448
|
_assertPluginValid(ctor) {
|
|
13348
13449
|
const { type: type2, pluginName } = ctor;
|
|
13349
|
-
if (type2 ===
|
|
13450
|
+
if (type2 === _.UNRECOGNIZED)
|
|
13350
13451
|
throw new Error(`[PluginService]: invalid plugin type for ${ctor.name}. Please assign a "type" to your plugin.`);
|
|
13351
13452
|
if (!pluginName)
|
|
13352
13453
|
throw new Error(`[PluginService]: no plugin name for ${ctor.name}. Please assign a "pluginName" to your plugin.`);
|
|
@@ -13367,7 +13468,7 @@ let PluginService = (_a7 = class {
|
|
|
13367
13468
|
}
|
|
13368
13469
|
_flushPlugins() {
|
|
13369
13470
|
this._pluginHolderForUniver.flush();
|
|
13370
|
-
for (const [
|
|
13471
|
+
for (const [_2, holder] of this._pluginHoldersForTypes)
|
|
13371
13472
|
holder.started && holder.flush();
|
|
13372
13473
|
}
|
|
13373
13474
|
}, __name(_a7, "PluginService"), _a7);
|
|
@@ -13715,7 +13816,157 @@ const isRangesEqual = /* @__PURE__ */ __name((oldRanges, ranges) => ranges.lengt
|
|
|
13715
13816
|
const current = ranges[i];
|
|
13716
13817
|
return current.unitId === oldRange.unitId && current.sheetId === oldRange.sheetId && Rectangle.equals(oldRange.range, current.range);
|
|
13717
13818
|
}), "isUnitRangesEqual"), skipParseTagNames = ["script", "style", "meta", "comment", "link"];
|
|
13718
|
-
var DataValidationErrorStyle = /* @__PURE__ */ ((DataValidationErrorStyle2) => (DataValidationErrorStyle2[DataValidationErrorStyle2.INFO = 0] = "INFO", DataValidationErrorStyle2[DataValidationErrorStyle2.STOP = 1] = "STOP", DataValidationErrorStyle2[DataValidationErrorStyle2.WARNING = 2] = "WARNING", DataValidationErrorStyle2))(DataValidationErrorStyle || {}), DataValidationImeMode = /* @__PURE__ */ ((DataValidationImeMode2) => (DataValidationImeMode2[DataValidationImeMode2.DISABLED = 0] = "DISABLED", DataValidationImeMode2[DataValidationImeMode2.FULL_ALPHA = 1] = "FULL_ALPHA", DataValidationImeMode2[DataValidationImeMode2.FULL_HANGUL = 2] = "FULL_HANGUL", DataValidationImeMode2[DataValidationImeMode2.FULL_KATAKANA = 3] = "FULL_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HALF_ALPHA = 4] = "HALF_ALPHA", DataValidationImeMode2[DataValidationImeMode2.HALF_HANGUL = 5] = "HALF_HANGUL", DataValidationImeMode2[DataValidationImeMode2.HALF_KATAKANA = 6] = "HALF_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HIRAGANA = 7] = "HIRAGANA", DataValidationImeMode2[DataValidationImeMode2.NO_CONTROL = 8] = "NO_CONTROL", DataValidationImeMode2[DataValidationImeMode2.OFF = 9] = "OFF", DataValidationImeMode2[DataValidationImeMode2.ON = 10] = "ON", DataValidationImeMode2))(DataValidationImeMode || {}), DataValidationOperator = /* @__PURE__ */ ((DataValidationOperator2) => (DataValidationOperator2.BETWEEN = "between", DataValidationOperator2.EQUAL = "equal", DataValidationOperator2.GREATER_THAN = "greaterThan", DataValidationOperator2.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", DataValidationOperator2.LESS_THAN = "lessThan", DataValidationOperator2.LESS_THAN_OR_EQUAL = "lessThanOrEqual", DataValidationOperator2.NOT_BETWEEN = "notBetween", DataValidationOperator2.NOT_EQUAL = "notEqual", DataValidationOperator2))(DataValidationOperator || {}), DataValidationRenderMode = /* @__PURE__ */ ((DataValidationRenderMode2) => (DataValidationRenderMode2[DataValidationRenderMode2.TEXT = 0] = "TEXT", DataValidationRenderMode2[DataValidationRenderMode2.ARROW = 1] = "ARROW", DataValidationRenderMode2[DataValidationRenderMode2.CUSTOM = 2] = "CUSTOM", DataValidationRenderMode2))(DataValidationRenderMode || {}), DataValidationStatus = /* @__PURE__ */ ((DataValidationStatus2) => (DataValidationStatus2.VALID = "valid", DataValidationStatus2.INVALID = "invalid", DataValidationStatus2.VALIDATING = "validating", DataValidationStatus2))(DataValidationStatus || {}), DataValidationType = /* @__PURE__ */ ((DataValidationType2) => (DataValidationType2.CUSTOM = "custom", DataValidationType2.LIST = "list", DataValidationType2.LIST_MULTIPLE = "listMultiple", DataValidationType2.NONE = "none", DataValidationType2.TEXT_LENGTH = "textLength", DataValidationType2.DATE = "date", DataValidationType2.TIME = "time", DataValidationType2.WHOLE = "whole", DataValidationType2.DECIMAL = "decimal", DataValidationType2.CHECKBOX = "checkbox", DataValidationType2))(DataValidationType || {});
|
|
13819
|
+
var DataValidationErrorStyle = /* @__PURE__ */ ((DataValidationErrorStyle2) => (DataValidationErrorStyle2[DataValidationErrorStyle2.INFO = 0] = "INFO", DataValidationErrorStyle2[DataValidationErrorStyle2.STOP = 1] = "STOP", DataValidationErrorStyle2[DataValidationErrorStyle2.WARNING = 2] = "WARNING", DataValidationErrorStyle2))(DataValidationErrorStyle || {}), DataValidationImeMode = /* @__PURE__ */ ((DataValidationImeMode2) => (DataValidationImeMode2[DataValidationImeMode2.DISABLED = 0] = "DISABLED", DataValidationImeMode2[DataValidationImeMode2.FULL_ALPHA = 1] = "FULL_ALPHA", DataValidationImeMode2[DataValidationImeMode2.FULL_HANGUL = 2] = "FULL_HANGUL", DataValidationImeMode2[DataValidationImeMode2.FULL_KATAKANA = 3] = "FULL_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HALF_ALPHA = 4] = "HALF_ALPHA", DataValidationImeMode2[DataValidationImeMode2.HALF_HANGUL = 5] = "HALF_HANGUL", DataValidationImeMode2[DataValidationImeMode2.HALF_KATAKANA = 6] = "HALF_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HIRAGANA = 7] = "HIRAGANA", DataValidationImeMode2[DataValidationImeMode2.NO_CONTROL = 8] = "NO_CONTROL", DataValidationImeMode2[DataValidationImeMode2.OFF = 9] = "OFF", DataValidationImeMode2[DataValidationImeMode2.ON = 10] = "ON", DataValidationImeMode2))(DataValidationImeMode || {}), DataValidationOperator = /* @__PURE__ */ ((DataValidationOperator2) => (DataValidationOperator2.BETWEEN = "between", DataValidationOperator2.EQUAL = "equal", DataValidationOperator2.GREATER_THAN = "greaterThan", DataValidationOperator2.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", DataValidationOperator2.LESS_THAN = "lessThan", DataValidationOperator2.LESS_THAN_OR_EQUAL = "lessThanOrEqual", DataValidationOperator2.NOT_BETWEEN = "notBetween", DataValidationOperator2.NOT_EQUAL = "notEqual", DataValidationOperator2))(DataValidationOperator || {}), DataValidationRenderMode = /* @__PURE__ */ ((DataValidationRenderMode2) => (DataValidationRenderMode2[DataValidationRenderMode2.TEXT = 0] = "TEXT", DataValidationRenderMode2[DataValidationRenderMode2.ARROW = 1] = "ARROW", DataValidationRenderMode2[DataValidationRenderMode2.CUSTOM = 2] = "CUSTOM", DataValidationRenderMode2))(DataValidationRenderMode || {}), DataValidationStatus = /* @__PURE__ */ ((DataValidationStatus2) => (DataValidationStatus2.VALID = "valid", DataValidationStatus2.INVALID = "invalid", DataValidationStatus2.VALIDATING = "validating", DataValidationStatus2))(DataValidationStatus || {}), DataValidationType = /* @__PURE__ */ ((DataValidationType2) => (DataValidationType2.CUSTOM = "custom", DataValidationType2.LIST = "list", DataValidationType2.LIST_MULTIPLE = "listMultiple", DataValidationType2.NONE = "none", DataValidationType2.TEXT_LENGTH = "textLength", DataValidationType2.DATE = "date", DataValidationType2.TIME = "time", DataValidationType2.WHOLE = "whole", DataValidationType2.DECIMAL = "decimal", DataValidationType2.CHECKBOX = "checkbox", DataValidationType2.ANY = "any", DataValidationType2))(DataValidationType || {});
|
|
13820
|
+
const ARRAY_TYPES = [
|
|
13821
|
+
Int8Array,
|
|
13822
|
+
Uint8Array,
|
|
13823
|
+
Uint8ClampedArray,
|
|
13824
|
+
Int16Array,
|
|
13825
|
+
Uint16Array,
|
|
13826
|
+
Int32Array,
|
|
13827
|
+
Uint32Array,
|
|
13828
|
+
Float32Array,
|
|
13829
|
+
Float64Array
|
|
13830
|
+
], VERSION = 1, HEADER_SIZE = 8, _KDBush = class _KDBush {
|
|
13831
|
+
/**
|
|
13832
|
+
* Creates an index from raw `ArrayBuffer` data.
|
|
13833
|
+
* @param {ArrayBuffer} data
|
|
13834
|
+
*/
|
|
13835
|
+
static from(data) {
|
|
13836
|
+
if (!(data instanceof ArrayBuffer))
|
|
13837
|
+
throw new Error("Data must be an instance of ArrayBuffer.");
|
|
13838
|
+
const [magic, versionAndType] = new Uint8Array(data, 0, 2);
|
|
13839
|
+
if (magic !== 219)
|
|
13840
|
+
throw new Error("Data does not appear to be in a KDBush format.");
|
|
13841
|
+
const version2 = versionAndType >> 4;
|
|
13842
|
+
if (version2 !== VERSION)
|
|
13843
|
+
throw new Error(`Got v${version2} data when expected v${VERSION}.`);
|
|
13844
|
+
const ArrayType = ARRAY_TYPES[versionAndType & 15];
|
|
13845
|
+
if (!ArrayType)
|
|
13846
|
+
throw new Error("Unrecognized array type.");
|
|
13847
|
+
const [nodeSize] = new Uint16Array(data, 2, 1), [numItems] = new Uint32Array(data, 4, 1);
|
|
13848
|
+
return new _KDBush(numItems, nodeSize, ArrayType, data);
|
|
13849
|
+
}
|
|
13850
|
+
/**
|
|
13851
|
+
* Creates an index that will hold a given number of items.
|
|
13852
|
+
* @param {number} numItems
|
|
13853
|
+
* @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
|
|
13854
|
+
* @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
|
|
13855
|
+
* @param {ArrayBuffer} [data] (For internal use only)
|
|
13856
|
+
*/
|
|
13857
|
+
constructor(numItems, nodeSize = 64, ArrayType = Float64Array, data) {
|
|
13858
|
+
if (isNaN(numItems) || numItems < 0) throw new Error(`Unpexpected numItems value: ${numItems}.`);
|
|
13859
|
+
this.numItems = +numItems, this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535), this.ArrayType = ArrayType, this.IndexArrayType = numItems < 65536 ? Uint16Array : Uint32Array;
|
|
13860
|
+
const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType), coordsByteSize = numItems * 2 * this.ArrayType.BYTES_PER_ELEMENT, idsByteSize = numItems * this.IndexArrayType.BYTES_PER_ELEMENT, padCoords = (8 - idsByteSize % 8) % 8;
|
|
13861
|
+
if (arrayTypeIndex < 0)
|
|
13862
|
+
throw new Error(`Unexpected typed array class: ${ArrayType}.`);
|
|
13863
|
+
data && data instanceof ArrayBuffer ? (this.data = data, this.ids = new this.IndexArrayType(this.data, HEADER_SIZE, numItems), this.coords = new this.ArrayType(this.data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2), this._pos = numItems * 2, this._finished = !0) : (this.data = new ArrayBuffer(HEADER_SIZE + coordsByteSize + idsByteSize + padCoords), this.ids = new this.IndexArrayType(this.data, HEADER_SIZE, numItems), this.coords = new this.ArrayType(this.data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (VERSION << 4) + arrayTypeIndex]), new Uint16Array(this.data, 2, 1)[0] = nodeSize, new Uint32Array(this.data, 4, 1)[0] = numItems);
|
|
13864
|
+
}
|
|
13865
|
+
/**
|
|
13866
|
+
* Add a point to the index.
|
|
13867
|
+
* @param {number} x
|
|
13868
|
+
* @param {number} y
|
|
13869
|
+
* @returns {number} An incremental index associated with the added item (starting from `0`).
|
|
13870
|
+
*/
|
|
13871
|
+
add(x, y) {
|
|
13872
|
+
const index2 = this._pos >> 1;
|
|
13873
|
+
return this.ids[index2] = index2, this.coords[this._pos++] = x, this.coords[this._pos++] = y, index2;
|
|
13874
|
+
}
|
|
13875
|
+
/**
|
|
13876
|
+
* Perform indexing of the added points.
|
|
13877
|
+
*/
|
|
13878
|
+
finish() {
|
|
13879
|
+
const numAdded = this._pos >> 1;
|
|
13880
|
+
if (numAdded !== this.numItems)
|
|
13881
|
+
throw new Error(`Added ${numAdded} items when expected ${this.numItems}.`);
|
|
13882
|
+
return sort(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
|
|
13883
|
+
}
|
|
13884
|
+
/**
|
|
13885
|
+
* Search the index for items within a given bounding box.
|
|
13886
|
+
* @param {number} minX
|
|
13887
|
+
* @param {number} minY
|
|
13888
|
+
* @param {number} maxX
|
|
13889
|
+
* @param {number} maxY
|
|
13890
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
13891
|
+
*/
|
|
13892
|
+
range(minX, minY, maxX, maxY) {
|
|
13893
|
+
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
13894
|
+
const { ids, coords, nodeSize } = this, stack = [0, ids.length - 1, 0], result = [];
|
|
13895
|
+
for (; stack.length; ) {
|
|
13896
|
+
const axis = stack.pop() || 0, right = stack.pop() || 0, left = stack.pop() || 0;
|
|
13897
|
+
if (right - left <= nodeSize) {
|
|
13898
|
+
for (let i = left; i <= right; i++) {
|
|
13899
|
+
const x2 = coords[2 * i], y2 = coords[2 * i + 1];
|
|
13900
|
+
x2 >= minX && x2 <= maxX && y2 >= minY && y2 <= maxY && result.push(ids[i]);
|
|
13901
|
+
}
|
|
13902
|
+
continue;
|
|
13903
|
+
}
|
|
13904
|
+
const m = left + right >> 1, x = coords[2 * m], y = coords[2 * m + 1];
|
|
13905
|
+
x >= minX && x <= maxX && y >= minY && y <= maxY && result.push(ids[m]), (axis === 0 ? minX <= x : minY <= y) && (stack.push(left), stack.push(m - 1), stack.push(1 - axis)), (axis === 0 ? maxX >= x : maxY >= y) && (stack.push(m + 1), stack.push(right), stack.push(1 - axis));
|
|
13906
|
+
}
|
|
13907
|
+
return result;
|
|
13908
|
+
}
|
|
13909
|
+
/**
|
|
13910
|
+
* Search the index for items within a given radius.
|
|
13911
|
+
* @param {number} qx
|
|
13912
|
+
* @param {number} qy
|
|
13913
|
+
* @param {number} r Query radius.
|
|
13914
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
13915
|
+
*/
|
|
13916
|
+
within(qx, qy, r) {
|
|
13917
|
+
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
13918
|
+
const { ids, coords, nodeSize } = this, stack = [0, ids.length - 1, 0], result = [], r2 = r * r;
|
|
13919
|
+
for (; stack.length; ) {
|
|
13920
|
+
const axis = stack.pop() || 0, right = stack.pop() || 0, left = stack.pop() || 0;
|
|
13921
|
+
if (right - left <= nodeSize) {
|
|
13922
|
+
for (let i = left; i <= right; i++)
|
|
13923
|
+
sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2 && result.push(ids[i]);
|
|
13924
|
+
continue;
|
|
13925
|
+
}
|
|
13926
|
+
const m = left + right >> 1, x = coords[2 * m], y = coords[2 * m + 1];
|
|
13927
|
+
sqDist(x, y, qx, qy) <= r2 && result.push(ids[m]), (axis === 0 ? qx - r <= x : qy - r <= y) && (stack.push(left), stack.push(m - 1), stack.push(1 - axis)), (axis === 0 ? qx + r >= x : qy + r >= y) && (stack.push(m + 1), stack.push(right), stack.push(1 - axis));
|
|
13928
|
+
}
|
|
13929
|
+
return result;
|
|
13930
|
+
}
|
|
13931
|
+
};
|
|
13932
|
+
__name(_KDBush, "KDBush");
|
|
13933
|
+
let KDBush = _KDBush;
|
|
13934
|
+
function sort(ids, coords, nodeSize, left, right, axis) {
|
|
13935
|
+
if (right - left <= nodeSize) return;
|
|
13936
|
+
const m = left + right >> 1;
|
|
13937
|
+
select(ids, coords, m, left, right, axis), sort(ids, coords, nodeSize, left, m - 1, 1 - axis), sort(ids, coords, nodeSize, m + 1, right, 1 - axis);
|
|
13938
|
+
}
|
|
13939
|
+
__name(sort, "sort");
|
|
13940
|
+
function select(ids, coords, k, left, right, axis) {
|
|
13941
|
+
for (; right > left; ) {
|
|
13942
|
+
if (right - left > 600) {
|
|
13943
|
+
const n = right - left + 1, m = k - left + 1, z = Math.log(n), s = 0.5 * Math.exp(2 * z / 3), sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1), newLeft = Math.max(left, Math.floor(k - m * s / n + sd)), newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
|
13944
|
+
select(ids, coords, k, newLeft, newRight, axis);
|
|
13945
|
+
}
|
|
13946
|
+
const t = coords[2 * k + axis];
|
|
13947
|
+
let i = left, j = right;
|
|
13948
|
+
for (swapItem(ids, coords, left, k), coords[2 * right + axis] > t && swapItem(ids, coords, left, right); i < j; ) {
|
|
13949
|
+
for (swapItem(ids, coords, i, j), i++, j--; coords[2 * i + axis] < t; ) i++;
|
|
13950
|
+
for (; coords[2 * j + axis] > t; ) j--;
|
|
13951
|
+
}
|
|
13952
|
+
coords[2 * left + axis] === t ? swapItem(ids, coords, left, j) : (j++, swapItem(ids, coords, j, right)), j <= k && (left = j + 1), k <= j && (right = j - 1);
|
|
13953
|
+
}
|
|
13954
|
+
}
|
|
13955
|
+
__name(select, "select");
|
|
13956
|
+
function swapItem(ids, coords, i, j) {
|
|
13957
|
+
swap$1(ids, i, j), swap$1(coords, 2 * i, 2 * j), swap$1(coords, 2 * i + 1, 2 * j + 1);
|
|
13958
|
+
}
|
|
13959
|
+
__name(swapItem, "swapItem");
|
|
13960
|
+
function swap$1(arr, i, j) {
|
|
13961
|
+
const tmp = arr[i];
|
|
13962
|
+
arr[i] = arr[j], arr[j] = tmp;
|
|
13963
|
+
}
|
|
13964
|
+
__name(swap$1, "swap$1");
|
|
13965
|
+
function sqDist(ax, ay, bx, by) {
|
|
13966
|
+
const dx = ax - bx, dy = ay - by;
|
|
13967
|
+
return dx * dx + dy * dy;
|
|
13968
|
+
}
|
|
13969
|
+
__name(sqDist, "sqDist");
|
|
13719
13970
|
function quickselect(arr, k, left = 0, right = arr.length - 1, compare = defaultCompare) {
|
|
13720
13971
|
for (; right > left; ) {
|
|
13721
13972
|
if (right - left > 600) {
|
|
@@ -14004,8 +14255,13 @@ function multiSelect(arr, left, right, n, compare) {
|
|
|
14004
14255
|
}
|
|
14005
14256
|
__name(multiSelect, "multiSelect");
|
|
14006
14257
|
const _RTree = class _RTree {
|
|
14007
|
-
constructor() {
|
|
14258
|
+
constructor(_enableOneCellCache = !1) {
|
|
14008
14259
|
__publicField(this, "_tree", /* @__PURE__ */ new Map());
|
|
14260
|
+
// unitId -> subUnitId -> row -> column -> ids
|
|
14261
|
+
__publicField(this, "_oneCellCache", /* @__PURE__ */ new Map());
|
|
14262
|
+
__publicField(this, "_kdTree", /* @__PURE__ */ new Map());
|
|
14263
|
+
__publicField(this, "_kdTreeSearchState", !1);
|
|
14264
|
+
this._enableOneCellCache = _enableOneCellCache;
|
|
14009
14265
|
}
|
|
14010
14266
|
dispose() {
|
|
14011
14267
|
this.clear();
|
|
@@ -14013,12 +14269,83 @@ const _RTree = class _RTree {
|
|
|
14013
14269
|
getTree(unitId, subUnitId) {
|
|
14014
14270
|
return this._tree.has(unitId) || this._tree.set(unitId, /* @__PURE__ */ new Map()), this._tree.get(unitId).has(subUnitId) || this._tree.get(unitId).set(subUnitId, new RBush()), this._tree.get(unitId).get(subUnitId);
|
|
14015
14271
|
}
|
|
14272
|
+
_getOneCellCache(unitId, subUnitId, row, column) {
|
|
14273
|
+
return this._oneCellCache.has(unitId) || this._oneCellCache.set(unitId, /* @__PURE__ */ new Map()), this._oneCellCache.get(unitId).has(subUnitId) || this._oneCellCache.get(unitId).set(subUnitId, /* @__PURE__ */ new Map()), this._oneCellCache.get(unitId).get(subUnitId).has(row) || this._oneCellCache.get(unitId).get(subUnitId).set(row, /* @__PURE__ */ new Map()), this._oneCellCache.get(unitId).get(subUnitId).get(row).has(column) || this._oneCellCache.get(unitId).get(subUnitId).get(row).set(column, /* @__PURE__ */ new Set()), this._oneCellCache.get(unitId).get(subUnitId).get(row).get(column);
|
|
14274
|
+
}
|
|
14275
|
+
_removeOneCellCache(unitId, subUnitId, row, column, id) {
|
|
14276
|
+
const unitCache = this._oneCellCache.get(unitId);
|
|
14277
|
+
if (!unitCache) return;
|
|
14278
|
+
const subUnitCache = unitCache.get(subUnitId);
|
|
14279
|
+
if (!subUnitCache) return;
|
|
14280
|
+
const rowCache = subUnitCache.get(row);
|
|
14281
|
+
if (!rowCache) return;
|
|
14282
|
+
const cellCache = rowCache.get(column);
|
|
14283
|
+
cellCache && cellCache.delete(id);
|
|
14284
|
+
}
|
|
14285
|
+
_insertOneCellCache(unitId, subUnitId, row, column, id) {
|
|
14286
|
+
this._getOneCellCache(unitId, subUnitId, row, column).add(id);
|
|
14287
|
+
}
|
|
14288
|
+
_getRdTreeItems(map2) {
|
|
14289
|
+
const items = [];
|
|
14290
|
+
for (const [y, innerMap] of map2)
|
|
14291
|
+
for (const [x, ids] of innerMap)
|
|
14292
|
+
items.push({
|
|
14293
|
+
x,
|
|
14294
|
+
y,
|
|
14295
|
+
ids
|
|
14296
|
+
});
|
|
14297
|
+
return items;
|
|
14298
|
+
}
|
|
14299
|
+
_searchByOneCellCache(search) {
|
|
14300
|
+
var _a11;
|
|
14301
|
+
const { unitId, sheetId: subUnitId, range } = search, { startRow, startColumn, endRow, endColumn } = range, searchObject = (_a11 = this._kdTree.get(unitId)) == null ? void 0 : _a11.get(subUnitId);
|
|
14302
|
+
if (!searchObject)
|
|
14303
|
+
return [];
|
|
14304
|
+
const { tree, items } = searchObject, indexes = tree.range(startColumn, startRow, endColumn, endRow), result = [];
|
|
14305
|
+
for (const index2 of indexes) {
|
|
14306
|
+
const item = items[index2];
|
|
14307
|
+
result.push(...Array.from(item.ids));
|
|
14308
|
+
}
|
|
14309
|
+
return result;
|
|
14310
|
+
}
|
|
14311
|
+
/**
|
|
14312
|
+
* Open the kd-tree search state.
|
|
14313
|
+
* The kd-tree is used to search for data in a single cell.
|
|
14314
|
+
*/
|
|
14315
|
+
openKdTree() {
|
|
14316
|
+
var _a11;
|
|
14317
|
+
this._kdTreeSearchState = !0;
|
|
14318
|
+
for (const [unitId, map1] of this._oneCellCache) {
|
|
14319
|
+
this._kdTree.has(unitId) || this._kdTree.set(unitId, /* @__PURE__ */ new Map());
|
|
14320
|
+
for (const [subUnitId, map2] of map1) {
|
|
14321
|
+
const items = this._getRdTreeItems(map2), tree = new KDBush(items.length);
|
|
14322
|
+
(_a11 = this._kdTree.get(unitId)) == null || _a11.set(subUnitId, {
|
|
14323
|
+
tree,
|
|
14324
|
+
items
|
|
14325
|
+
});
|
|
14326
|
+
for (const item of items)
|
|
14327
|
+
tree.add(item.x, item.y);
|
|
14328
|
+
tree.finish();
|
|
14329
|
+
}
|
|
14330
|
+
}
|
|
14331
|
+
}
|
|
14332
|
+
closeKdTree() {
|
|
14333
|
+
var _a11;
|
|
14334
|
+
this._kdTreeSearchState = !1;
|
|
14335
|
+
for (const [unitId, map1] of this._oneCellCache)
|
|
14336
|
+
for (const [subUnitId, map2] of map1)
|
|
14337
|
+
(_a11 = this._kdTree.get(unitId)) == null || _a11.set(subUnitId, void 0);
|
|
14338
|
+
}
|
|
14016
14339
|
insert(item) {
|
|
14017
14340
|
const { unitId, sheetId: subUnitId, range, id } = item;
|
|
14018
14341
|
if (!unitId || unitId.length === 0)
|
|
14019
14342
|
return;
|
|
14020
|
-
const tree = this.getTree(unitId, subUnitId);
|
|
14021
14343
|
let { startRow: rangeStartRow, endRow: rangeEndRow, startColumn: rangeStartColumn, endColumn: rangeEndColumn } = range;
|
|
14344
|
+
if (this._enableOneCellCache && rangeStartRow === rangeEndRow && rangeStartColumn === rangeEndColumn) {
|
|
14345
|
+
this._insertOneCellCache(unitId, subUnitId, rangeStartRow, rangeStartColumn, id);
|
|
14346
|
+
return;
|
|
14347
|
+
}
|
|
14348
|
+
const tree = this.getTree(unitId, subUnitId);
|
|
14022
14349
|
Number.isNaN(rangeStartRow) && (rangeStartRow = 0), Number.isNaN(rangeStartColumn) && (rangeStartColumn = 0), Number.isNaN(rangeEndRow) && (rangeEndRow = Number.POSITIVE_INFINITY), Number.isNaN(rangeEndColumn) && (rangeEndColumn = Number.POSITIVE_INFINITY), tree.insert({
|
|
14023
14350
|
minX: rangeStartColumn,
|
|
14024
14351
|
minY: rangeStartRow,
|
|
@@ -14033,30 +14360,41 @@ const _RTree = class _RTree {
|
|
|
14033
14360
|
}
|
|
14034
14361
|
search(search) {
|
|
14035
14362
|
var _a11;
|
|
14036
|
-
const { unitId, sheetId: subUnitId, range } = search,
|
|
14037
|
-
|
|
14363
|
+
const { unitId, sheetId: subUnitId, range } = search, results = [];
|
|
14364
|
+
if (this._enableOneCellCache && this._enableOneCellCache) {
|
|
14365
|
+
const oneCellResults = this._searchByOneCellCache(search);
|
|
14366
|
+
for (const result of oneCellResults)
|
|
14367
|
+
results.push(result);
|
|
14368
|
+
}
|
|
14369
|
+
const tree = (_a11 = this._tree.get(unitId)) == null ? void 0 : _a11.get(subUnitId);
|
|
14370
|
+
if (!tree)
|
|
14371
|
+
return results;
|
|
14372
|
+
const searchData = tree.search({
|
|
14038
14373
|
minX: range.startColumn,
|
|
14039
14374
|
minY: range.startRow,
|
|
14040
14375
|
maxX: range.endColumn,
|
|
14041
14376
|
maxY: range.endRow
|
|
14042
|
-
})
|
|
14377
|
+
});
|
|
14378
|
+
for (const item of searchData)
|
|
14379
|
+
results.push(item.id);
|
|
14380
|
+
return results;
|
|
14043
14381
|
}
|
|
14044
14382
|
bulkSearch(searchList) {
|
|
14045
|
-
const result = /* @__PURE__ */ new
|
|
14383
|
+
const result = /* @__PURE__ */ new Set();
|
|
14046
14384
|
for (const search of searchList) {
|
|
14047
14385
|
const items = this.search(search);
|
|
14048
14386
|
for (const item of items)
|
|
14049
|
-
result.
|
|
14387
|
+
result.add(item);
|
|
14050
14388
|
}
|
|
14051
14389
|
return result;
|
|
14052
14390
|
}
|
|
14053
14391
|
removeById(unitId, subUnitId) {
|
|
14054
|
-
var _a11;
|
|
14055
|
-
subUnitId ? (_a11 = this._tree.get(unitId)) == null || _a11.delete(subUnitId) : this._tree.delete(unitId);
|
|
14392
|
+
var _a11, _b2;
|
|
14393
|
+
subUnitId ? ((_a11 = this._tree.get(unitId)) == null || _a11.delete(subUnitId), (_b2 = this._oneCellCache.get(unitId)) == null || _b2.delete(subUnitId)) : (this._tree.delete(unitId), this._oneCellCache.delete(unitId));
|
|
14056
14394
|
}
|
|
14057
14395
|
remove(search) {
|
|
14058
|
-
const { unitId, sheetId: subUnitId, range, id } = search;
|
|
14059
|
-
this.
|
|
14396
|
+
const { unitId, sheetId: subUnitId, range, id } = search, tree = this.getTree(unitId, subUnitId);
|
|
14397
|
+
this._removeOneCellCache(unitId, subUnitId, range.startRow, range.startColumn, id), tree.remove({
|
|
14060
14398
|
minX: range.startColumn,
|
|
14061
14399
|
minY: range.startRow,
|
|
14062
14400
|
maxX: range.endColumn,
|
|
@@ -14069,7 +14407,7 @@ const _RTree = class _RTree {
|
|
|
14069
14407
|
this.remove(search);
|
|
14070
14408
|
}
|
|
14071
14409
|
clear() {
|
|
14072
|
-
this._tree.clear();
|
|
14410
|
+
this._tree.clear(), this._oneCellCache.clear();
|
|
14073
14411
|
}
|
|
14074
14412
|
toJSON() {
|
|
14075
14413
|
const result = {};
|
|
@@ -14105,11 +14443,11 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
|
|
|
14105
14443
|
const handleHookAdd = /* @__PURE__ */ __name((hook) => {
|
|
14106
14444
|
hook.businesses.forEach((business) => {
|
|
14107
14445
|
switch (business) {
|
|
14108
|
-
case
|
|
14109
|
-
case
|
|
14110
|
-
case
|
|
14111
|
-
case
|
|
14112
|
-
this._univerInstanceService.getAllUnitsForType(
|
|
14446
|
+
case _.UNRECOGNIZED:
|
|
14447
|
+
case _.UNIVER_UNKNOWN:
|
|
14448
|
+
case _.UNIVER_SLIDE:
|
|
14449
|
+
case _.UNIVER_DOC: {
|
|
14450
|
+
this._univerInstanceService.getAllUnitsForType(_.UNIVER_DOC).forEach((doc) => {
|
|
14113
14451
|
const plugin = (doc.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
|
|
14114
14452
|
if (plugin)
|
|
14115
14453
|
try {
|
|
@@ -14121,8 +14459,8 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
|
|
|
14121
14459
|
});
|
|
14122
14460
|
break;
|
|
14123
14461
|
}
|
|
14124
|
-
case
|
|
14125
|
-
this._univerInstanceService.getAllUnitsForType(
|
|
14462
|
+
case _.UNIVER_SHEET:
|
|
14463
|
+
this._univerInstanceService.getAllUnitsForType(_.UNIVER_SHEET).forEach((workbook) => {
|
|
14126
14464
|
const plugin = (workbook.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
|
|
14127
14465
|
if (plugin)
|
|
14128
14466
|
try {
|
|
@@ -14136,20 +14474,20 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
|
|
|
14136
14474
|
});
|
|
14137
14475
|
}, "handleHookAdd");
|
|
14138
14476
|
this._resourceManagerService.getAllResourceHooks().forEach((hook) => handleHookAdd(hook)), this.disposeWithMe(this._resourceManagerService.register$.subscribe((hook) => handleHookAdd(hook))), this.disposeWithMe(
|
|
14139
|
-
this._univerInstanceService.getTypeOfUnitAdded$(
|
|
14477
|
+
this._univerInstanceService.getTypeOfUnitAdded$(_.UNIVER_SHEET).subscribe((workbook) => {
|
|
14140
14478
|
this._resourceManagerService.loadResources(workbook.getUnitId(), workbook.getSnapshot().resources);
|
|
14141
14479
|
})
|
|
14142
14480
|
), this.disposeWithMe(
|
|
14143
|
-
this._univerInstanceService.getTypeOfUnitAdded$(
|
|
14481
|
+
this._univerInstanceService.getTypeOfUnitAdded$(_.UNIVER_DOC).subscribe((doc) => {
|
|
14144
14482
|
const unitId = doc.getUnitId();
|
|
14145
14483
|
isInternalEditorID(unitId) || this._resourceManagerService.loadResources(doc.getUnitId(), doc.getSnapshot().resources);
|
|
14146
14484
|
})
|
|
14147
14485
|
), this.disposeWithMe(
|
|
14148
|
-
this._univerInstanceService.getTypeOfUnitDisposed$(
|
|
14486
|
+
this._univerInstanceService.getTypeOfUnitDisposed$(_.UNIVER_SHEET).subscribe((workbook) => {
|
|
14149
14487
|
this._resourceManagerService.unloadResources(workbook.getUnitId());
|
|
14150
14488
|
})
|
|
14151
14489
|
), this.disposeWithMe(
|
|
14152
|
-
this._univerInstanceService.getTypeOfUnitDisposed$(
|
|
14490
|
+
this._univerInstanceService.getTypeOfUnitDisposed$(_.UNIVER_DOC).subscribe((doc) => {
|
|
14153
14491
|
this._resourceManagerService.unloadResources(doc.getUnitId());
|
|
14154
14492
|
})
|
|
14155
14493
|
);
|
|
@@ -14202,22 +14540,22 @@ const _Univer = class _Univer {
|
|
|
14202
14540
|
* @deprecated use `createUnit` instead
|
|
14203
14541
|
*/
|
|
14204
14542
|
createUniverSheet(data) {
|
|
14205
|
-
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(
|
|
14543
|
+
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(_.UNIVER_SHEET, data);
|
|
14206
14544
|
}
|
|
14207
14545
|
/**
|
|
14208
14546
|
* @deprecated use `createUnit` instead
|
|
14209
14547
|
*/
|
|
14210
14548
|
createUniverDoc(data) {
|
|
14211
|
-
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(
|
|
14549
|
+
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(_.UNIVER_DOC, data);
|
|
14212
14550
|
}
|
|
14213
14551
|
/**
|
|
14214
14552
|
* @deprecated use `createUnit` instead
|
|
14215
14553
|
*/
|
|
14216
14554
|
createUniverSlide(data) {
|
|
14217
|
-
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(
|
|
14555
|
+
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(_.UNIVER_SLIDE, data);
|
|
14218
14556
|
}
|
|
14219
14557
|
_init(injector) {
|
|
14220
|
-
this._univerInstanceService.registerCtorForType(
|
|
14558
|
+
this._univerInstanceService.registerCtorForType(_.UNIVER_SHEET, Workbook), this._univerInstanceService.registerCtorForType(_.UNIVER_DOC, DocumentDataModel), this._univerInstanceService.registerCtorForType(_.UNIVER_SLIDE, SlideDataModel);
|
|
14221
14559
|
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
14222
14560
|
univerInstanceService.__setCreateHandler(
|
|
14223
14561
|
(type2, data, ctor, options) => {
|
|
@@ -14383,6 +14721,7 @@ export {
|
|
|
14383
14721
|
IPermissionService,
|
|
14384
14722
|
IResourceLoaderService,
|
|
14385
14723
|
IResourceManagerService,
|
|
14724
|
+
IS_ROW_STYLE_PRECEDE_COLUMN_STYLE,
|
|
14386
14725
|
IUndoRedoService,
|
|
14387
14726
|
IUniverInstanceService,
|
|
14388
14727
|
Inject,
|
|
@@ -14482,7 +14821,7 @@ export {
|
|
|
14482
14821
|
UnitModel,
|
|
14483
14822
|
Univer,
|
|
14484
14823
|
UniverInstanceService,
|
|
14485
|
-
|
|
14824
|
+
_ as UniverInstanceType,
|
|
14486
14825
|
UpdateDocsAttributeType,
|
|
14487
14826
|
UserManagerService,
|
|
14488
14827
|
VerticalAlign,
|
|
@@ -14507,6 +14846,7 @@ export {
|
|
|
14507
14846
|
codeToBlob,
|
|
14508
14847
|
composeBody,
|
|
14509
14848
|
composeInterceptors,
|
|
14849
|
+
composeStyles,
|
|
14510
14850
|
concatMatrixArray,
|
|
14511
14851
|
connectDependencies,
|
|
14512
14852
|
connectInjector,
|