@univerjs/core 1.0.0-rc.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +96 -40
- package/lib/cjs/index.js +985 -362
- package/lib/es/facade.js +97 -41
- package/lib/es/index.js +979 -362
- package/lib/facade.js +97 -41
- package/lib/index.js +979 -362
- package/lib/types/docs/data-model/text-x/action-types.d.ts +19 -1
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/apply-utils/delete-apply.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/apply-utils/insert-apply.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/apply.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +2 -1
- package/lib/types/docs/data-model/text-x/custom-range-update.d.ts +30 -0
- package/lib/types/docs/data-model/text-x/structure-validator.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/text-x.d.ts +7 -3
- package/lib/types/docs/data-model/text-x/utils.d.ts +7 -1
- package/lib/types/docs/sdt-binding.d.ts +19 -0
- package/lib/types/facade/f-blob.d.ts +11 -11
- package/lib/types/facade/f-enum.d.ts +9 -1
- package/lib/types/facade/f-event-registry.d.ts +18 -6
- package/lib/types/facade/f-event.d.ts +4 -0
- package/lib/types/facade/f-univer.d.ts +43 -19
- package/lib/types/index.d.ts +2 -0
- package/lib/types/sheets/typedef.d.ts +38 -7
- package/lib/types/sheets/workbook.d.ts +1 -1
- package/lib/types/sheets/worksheet.d.ts +8 -7
- package/lib/types/types/enum/record-filter.d.ts +30 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +256 -9
- package/lib/types/types/interfaces/i-drawing.d.ts +9 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +26 -26
- package/package.json +7 -7
package/lib/es/index.js
CHANGED
|
@@ -123,7 +123,7 @@ function installShims() {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
//#endregion
|
|
126
|
-
//#region \0@oxc-project+runtime@0.
|
|
126
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
127
127
|
function _typeof(o) {
|
|
128
128
|
"@babel/helpers - typeof";
|
|
129
129
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -134,7 +134,7 @@ function _typeof(o) {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
//#endregion
|
|
137
|
-
//#region \0@oxc-project+runtime@0.
|
|
137
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
138
138
|
function toPrimitive(t, r) {
|
|
139
139
|
if ("object" != _typeof(t) || !t) return t;
|
|
140
140
|
var e = t[Symbol.toPrimitive];
|
|
@@ -147,14 +147,14 @@ function toPrimitive(t, r) {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
//#endregion
|
|
150
|
-
//#region \0@oxc-project+runtime@0.
|
|
150
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
151
151
|
function toPropertyKey(t) {
|
|
152
152
|
var i = toPrimitive(t, "string");
|
|
153
153
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
//#endregion
|
|
157
|
-
//#region \0@oxc-project+runtime@0.
|
|
157
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
158
158
|
function _defineProperty(e, r, t) {
|
|
159
159
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
160
160
|
value: t,
|
|
@@ -545,12 +545,14 @@ const re_weburl = /* @__PURE__ */ new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?
|
|
|
545
545
|
function isLegalUrl(url) {
|
|
546
546
|
if (!Number.isNaN(+url)) return false;
|
|
547
547
|
if (url.startsWith("http://localhost:5173") || url.startsWith("localhost:5173")) return true;
|
|
548
|
-
if (re_weburl.test(url))
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
548
|
+
if (re_weburl.test(url)) {
|
|
549
|
+
if (hasProtocol(url)) return true;
|
|
550
|
+
else try {
|
|
551
|
+
const topLevelDomain = new URL(normalizeUrl(url)).hostname.split(".").pop();
|
|
552
|
+
if (topLevelDomain && topLevelDomainSet.has(topLevelDomain)) return true;
|
|
553
|
+
} catch {
|
|
554
|
+
return false;
|
|
555
|
+
}
|
|
554
556
|
}
|
|
555
557
|
return false;
|
|
556
558
|
}
|
|
@@ -1668,7 +1670,7 @@ let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
|
|
|
1668
1670
|
//#endregion
|
|
1669
1671
|
//#region package.json
|
|
1670
1672
|
var name = "@univerjs/core";
|
|
1671
|
-
var version = "1.0.0
|
|
1673
|
+
var version = "1.0.0";
|
|
1672
1674
|
|
|
1673
1675
|
//#endregion
|
|
1674
1676
|
//#region src/common/array.ts
|
|
@@ -2014,7 +2016,7 @@ function hashLogContent(...args) {
|
|
|
2014
2016
|
}
|
|
2015
2017
|
|
|
2016
2018
|
//#endregion
|
|
2017
|
-
//#region \0@oxc-project+runtime@0.
|
|
2019
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
|
|
2018
2020
|
function __decorateParam(paramIndex, decorator) {
|
|
2019
2021
|
return function(target, key) {
|
|
2020
2022
|
decorator(target, key, paramIndex);
|
|
@@ -2022,7 +2024,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
2022
2024
|
}
|
|
2023
2025
|
|
|
2024
2026
|
//#endregion
|
|
2025
|
-
//#region \0@oxc-project+runtime@0.
|
|
2027
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
2026
2028
|
function __decorate(decorators, target, key, desc) {
|
|
2027
2029
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2028
2030
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2366,10 +2368,12 @@ var MultiCommand = class {
|
|
|
2366
2368
|
}
|
|
2367
2369
|
};
|
|
2368
2370
|
function sequenceExecute(tasks, commandService, options) {
|
|
2369
|
-
|
|
2371
|
+
const taskFns = tasks.map((task) => () => commandService.syncExecuteCommand(task.id, task.params, options));
|
|
2372
|
+
return sequence(taskFns);
|
|
2370
2373
|
}
|
|
2371
2374
|
function sequenceExecuteAsync(tasks, commandService, options) {
|
|
2372
|
-
|
|
2375
|
+
const promises = tasks.map((task) => () => commandService.executeCommand(task.id, task.params, options));
|
|
2376
|
+
return sequenceAsync(promises);
|
|
2373
2377
|
}
|
|
2374
2378
|
|
|
2375
2379
|
//#endregion
|
|
@@ -3670,9 +3674,7 @@ const rgb2Hsl = (color) => {
|
|
|
3670
3674
|
case g:
|
|
3671
3675
|
h = (b - r) / d + 2;
|
|
3672
3676
|
break;
|
|
3673
|
-
default:
|
|
3674
|
-
h = (r - g) / d + 4;
|
|
3675
|
-
break;
|
|
3677
|
+
default: h = (r - g) / d + 4;
|
|
3676
3678
|
}
|
|
3677
3679
|
h /= 6;
|
|
3678
3680
|
}
|
|
@@ -3704,9 +3706,7 @@ const rgb2Hsv = (color) => {
|
|
|
3704
3706
|
case g:
|
|
3705
3707
|
h = (b - r) / d + 2;
|
|
3706
3708
|
break;
|
|
3707
|
-
default:
|
|
3708
|
-
h = (r - g) / d + 4;
|
|
3709
|
-
break;
|
|
3709
|
+
default: h = (r - g) / d + 4;
|
|
3710
3710
|
}
|
|
3711
3711
|
h /= 6;
|
|
3712
3712
|
}
|
|
@@ -3772,8 +3772,27 @@ let UpdateDocsAttributeType = /* @__PURE__ */ function(UpdateDocsAttributeType)
|
|
|
3772
3772
|
|
|
3773
3773
|
//#endregion
|
|
3774
3774
|
//#region src/sheets/typedef.ts
|
|
3775
|
+
/** Worksheet-only hiding states; row/column and cell flags still use BooleanNumber. */
|
|
3776
|
+
let WorksheetHiddenState = /* @__PURE__ */ function(WorksheetHiddenState) {
|
|
3777
|
+
/** Visible in the sheet bar. Preserves the existing hidden: 0 value. */
|
|
3778
|
+
WorksheetHiddenState[WorksheetHiddenState["VISIBLE"] = 0] = "VISIBLE";
|
|
3779
|
+
/** Hidden, and listed in the UI's Unhide dialog. Preserves hidden: 1. */
|
|
3780
|
+
WorksheetHiddenState[WorksheetHiddenState["HIDDEN"] = 1] = "HIDDEN";
|
|
3781
|
+
/** Omitted from Unhide UI; can be revealed through the API. Not an access permission. */
|
|
3782
|
+
WorksheetHiddenState[WorksheetHiddenState["VERY_HIDDEN"] = 2] = "VERY_HIDDEN";
|
|
3783
|
+
return WorksheetHiddenState;
|
|
3784
|
+
}({});
|
|
3785
|
+
/** Formula kinds from SpreadsheetML ST_CellFormulaType. */
|
|
3786
|
+
let FormulaType = /* @__PURE__ */ function(FormulaType) {
|
|
3787
|
+
FormulaType[FormulaType["NORMAL"] = 0] = "NORMAL";
|
|
3788
|
+
FormulaType[FormulaType["SHARED"] = 1] = "SHARED";
|
|
3789
|
+
FormulaType[FormulaType["ARRAY"] = 2] = "ARRAY";
|
|
3790
|
+
/** What-if analysis data table, not a structured table. */
|
|
3791
|
+
FormulaType[FormulaType["DATA_TABLE"] = 3] = "DATA_TABLE";
|
|
3792
|
+
return FormulaType;
|
|
3793
|
+
}({});
|
|
3775
3794
|
function isICellData(value) {
|
|
3776
|
-
return value && (value.s !== void 0 || value.p !== void 0 || value.v !== void 0 || value.t !== void 0 || value.f !== void 0 || value.si !== void 0 || value.custom !== void 0);
|
|
3795
|
+
return value && (value.s !== void 0 || value.p !== void 0 || value.v !== void 0 || value.t !== void 0 || value.f !== void 0 || value.ft !== void 0 || value.fd !== void 0 || value.si !== void 0 || value.custom !== void 0);
|
|
3777
3796
|
}
|
|
3778
3797
|
function getCellValueType(cell) {
|
|
3779
3798
|
if (cell.t !== void 0) return cell.t;
|
|
@@ -3988,22 +4007,6 @@ const reCurrencySymbols = new RegExp(`[${currencySymbols$1.join("")}]`);
|
|
|
3988
4007
|
|
|
3989
4008
|
//#endregion
|
|
3990
4009
|
//#region src/shared/numfmt/decimal.ts
|
|
3991
|
-
/**
|
|
3992
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3993
|
-
*
|
|
3994
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3995
|
-
* you may not use this file except in compliance with the License.
|
|
3996
|
-
* You may obtain a copy of the License at
|
|
3997
|
-
*
|
|
3998
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3999
|
-
*
|
|
4000
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4001
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4002
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4003
|
-
* See the License for the specific language governing permissions and
|
|
4004
|
-
* limitations under the License.
|
|
4005
|
-
*/
|
|
4006
|
-
const SPREADSHEET_SIGNIFICANT_DIGITS = 15;
|
|
4007
4010
|
function decimalFromNumber(value) {
|
|
4008
4011
|
if (!Number.isFinite(value)) throw new RangeError("decimalFromNumber requires a finite number");
|
|
4009
4012
|
const negative = value < 0 || Object.is(value, -0);
|
|
@@ -4012,7 +4015,7 @@ function decimalFromNumber(value) {
|
|
|
4012
4015
|
digits: "0",
|
|
4013
4016
|
exponent: 0
|
|
4014
4017
|
};
|
|
4015
|
-
const [mantissa, exponentText] = Math.abs(value).toExponential(
|
|
4018
|
+
const [mantissa, exponentText] = Math.abs(value).toExponential(14).split("e");
|
|
4016
4019
|
return {
|
|
4017
4020
|
negative,
|
|
4018
4021
|
digits: mantissa.replace(".", "").replace(/0+$/, "") || "0",
|
|
@@ -5012,7 +5015,6 @@ function minMaxPad(str, part, prefix) {
|
|
|
5012
5015
|
case "num":
|
|
5013
5016
|
part.num_max = max;
|
|
5014
5017
|
part.num_min = min;
|
|
5015
|
-
break;
|
|
5016
5018
|
}
|
|
5017
5019
|
return part;
|
|
5018
5020
|
}
|
|
@@ -5184,8 +5186,10 @@ function parseFormatSection(inputTokens) {
|
|
|
5184
5186
|
date: 1
|
|
5185
5187
|
}, outputTokens);
|
|
5186
5188
|
} else if (type === "calendar") {
|
|
5187
|
-
if (!haveLocale)
|
|
5188
|
-
|
|
5189
|
+
if (!haveLocale) {
|
|
5190
|
+
if (token.value === "B2" || token.value === "b2") part.date_system = 6;
|
|
5191
|
+
else part.date_system = 1;
|
|
5192
|
+
}
|
|
5189
5193
|
} else if (type === "datetime") {
|
|
5190
5194
|
const bit = {
|
|
5191
5195
|
type: "",
|
|
@@ -5602,13 +5606,14 @@ function general(output, part, value, locale, decimalValue = null) {
|
|
|
5602
5606
|
} else if (exponent === 10) {
|
|
5603
5607
|
const formatted = absoluteValue.toFixed(10).slice(0, 12).replace(/\.$/, "");
|
|
5604
5608
|
output.push(fixLocale(formatted, locale));
|
|
5605
|
-
} else if (Math.abs(exponent) <= 9)
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5609
|
+
} else if (Math.abs(exponent) <= 9) {
|
|
5610
|
+
if (digits.total <= 11) {
|
|
5611
|
+
const formatted = round(absoluteValue, 9).toFixed(digits.frac);
|
|
5612
|
+
output.push(fixLocale(formatted, locale));
|
|
5613
|
+
} else if (exponent === 9) output.push(Math.floor(absoluteValue));
|
|
5614
|
+
else if (exponent >= 0 && exponent < 9) output.push(fixLocale(String(round(absoluteValue, 9 - exponent)), locale));
|
|
5615
|
+
else output.push(...shortestSignificand === null ? getExp(absoluteDecimal, locale) : getShortestExp(shortestSignificand, exponent, locale));
|
|
5616
|
+
} else if (digits.total >= 12) output.push(...shortestSignificand === null ? getExp(absoluteDecimal, locale) : getShortestExp(shortestSignificand, exponent, locale));
|
|
5612
5617
|
else output.push(fixLocale(round(absoluteValue, 9).toFixed(digits.frac), locale));
|
|
5613
5618
|
}
|
|
5614
5619
|
return output;
|
|
@@ -5730,7 +5735,7 @@ const EXCEL_1904_OFFSET = 1462;
|
|
|
5730
5735
|
const EXCEL_1900_MAX_SERIAL = 2958465;
|
|
5731
5736
|
const MAX_YEAR = 9999;
|
|
5732
5737
|
function getDateSystemMaxSerial(dateSystem = "date1900") {
|
|
5733
|
-
return dateSystem === "date1904" ?
|
|
5738
|
+
return dateSystem === "date1904" ? 2957003 : EXCEL_1900_MAX_SERIAL;
|
|
5734
5739
|
}
|
|
5735
5740
|
function isLeapYear(year) {
|
|
5736
5741
|
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
@@ -5772,7 +5777,8 @@ function datePartsToExcel1900Serial(year, month, day) {
|
|
|
5772
5777
|
function excelSerialToDateTimeParts(serial, options) {
|
|
5773
5778
|
if (!Number.isFinite(serial) || serial < 0) return null;
|
|
5774
5779
|
const wholeDays = Math.floor(serial);
|
|
5775
|
-
const
|
|
5780
|
+
const excel1900Serial = options.dateSystem === "date1904" ? wholeDays + EXCEL_1904_OFFSET : wholeDays;
|
|
5781
|
+
const [year, month, day] = toYMD(excel1900Serial, 0, true);
|
|
5776
5782
|
if (year > MAX_YEAR) return null;
|
|
5777
5783
|
const totalSeconds = (serial - wholeDays) * DAYSIZE$1;
|
|
5778
5784
|
const wholeSeconds = Math.floor(totalSeconds);
|
|
@@ -5961,11 +5967,13 @@ function runPart(value, part, options, locale, decimalValue = null) {
|
|
|
5961
5967
|
}
|
|
5962
5968
|
const requiresDecimalRounding = !Number.isSafeInteger(numericValue) || Boolean(section.scaleExponent);
|
|
5963
5969
|
roundedNumber = roundedNumber || (decimal && requiresDecimalRounding && !section.date && !section.fractions && !section.exponential && (section.integer || section.dec_fractions) ? roundDecimal(decimal, section.frac_max) : null);
|
|
5964
|
-
if (section.integer)
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5970
|
+
if (section.integer) {
|
|
5971
|
+
if (roundedNumber) integer = roundedNumber.integer === "0" ? "" : roundedNumber.integer;
|
|
5972
|
+
else {
|
|
5973
|
+
const places = section.fractions ? 1 : section.frac_max;
|
|
5974
|
+
const roundedInteger = Math.abs(Number.isSafeInteger(numericValue) && places === 0 ? numericValue : legacyRound(numericValue, places));
|
|
5975
|
+
integer += roundedInteger < 1 ? "" : Math.floor(roundedInteger);
|
|
5976
|
+
}
|
|
5969
5977
|
}
|
|
5970
5978
|
const primaryGroup = options.grouping[0] ?? 3;
|
|
5971
5979
|
const secondaryGroup = options.grouping[1] ?? primaryGroup;
|
|
@@ -6039,7 +6047,10 @@ function runPart(value, part, options, locale, decimalValue = null) {
|
|
|
6039
6047
|
weekday = ((dateSystem === -1 ? 5 : 6) + date) % 7;
|
|
6040
6048
|
if (section.date_eval && dateOverflows(numericValue, date + time / DAYSIZE, options.dateSpanLarge, options.dateSystem)) {
|
|
6041
6049
|
if (options.dateErrorThrows) throw new Error("Date out of bounds");
|
|
6042
|
-
if (options.dateErrorNumber)
|
|
6050
|
+
if (options.dateErrorNumber) {
|
|
6051
|
+
const output = numericValue < 0 ? [l10n.negative] : [];
|
|
6052
|
+
return general(output, {}, numericValue, l10n, decimal).join("");
|
|
6053
|
+
}
|
|
6043
6054
|
return options.overflow;
|
|
6044
6055
|
}
|
|
6045
6056
|
}
|
|
@@ -6080,44 +6091,49 @@ function runPart(value, part, options, locale, decimalValue = null) {
|
|
|
6080
6091
|
else if (section.den_min > 0) output.push(tokenValue.replace(/./g, questionPadding));
|
|
6081
6092
|
}
|
|
6082
6093
|
} else output.push(tokenValue.replace(/ /g, questionPadding));
|
|
6083
|
-
} else if (tokenType === "space")
|
|
6084
|
-
if (
|
|
6085
|
-
|
|
6086
|
-
|
|
6094
|
+
} else if (tokenType === "space") {
|
|
6095
|
+
if (token.rule === "num+int") {
|
|
6096
|
+
if ((haveFraction || section.num_min || section.den_min) && (integer || section.num_min)) output.push(questionPadding);
|
|
6097
|
+
} else output.push(questionPadding);
|
|
6098
|
+
} else if (tokenType === "error") output.push(options.invalid);
|
|
6087
6099
|
else if (tokenType === "point") output.push(section.date ? token.value : l10n.decimal);
|
|
6088
6100
|
else if (tokenType === "general") general(output, section, renderValue, l10n, decimal);
|
|
6089
6101
|
else if (tokenType === "exp") output.push(l10n.exponent);
|
|
6090
|
-
else if (tokenType === "minus")
|
|
6091
|
-
if (
|
|
6092
|
-
|
|
6093
|
-
if (numericValue
|
|
6094
|
-
|
|
6095
|
-
|
|
6102
|
+
else if (tokenType === "minus") {
|
|
6103
|
+
if (token.volatile && section.date) {} else if (token.volatile && roundedNumber) {
|
|
6104
|
+
if (roundedNumber.negative && !roundedNumber.zero) output.push(l10n.negative);
|
|
6105
|
+
} else if (token.volatile && (numericValue >= 0 || typeof renderValue !== "number")) {} else if (token.volatile && !section.fractions && (section.integer || section.dec_fractions)) {
|
|
6106
|
+
if (numericValue < 0 && !!integer && integer !== "0" || fraction) output.push(l10n.negative);
|
|
6107
|
+
} else output.push(l10n.negative);
|
|
6108
|
+
} else if (tokenType === "plus") output.push(l10n.positive);
|
|
6096
6109
|
else if (tokenType === "text") output.push(renderValue);
|
|
6097
6110
|
else if (tokenType === "fill") {
|
|
6098
6111
|
if (options.fillChar) output.push(options.fillChar, token.value);
|
|
6099
|
-
} else if (tokenType === "skip")
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
else if (
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
const
|
|
6110
|
-
|
|
6111
|
-
let
|
|
6112
|
-
|
|
6113
|
-
const
|
|
6114
|
-
|
|
6112
|
+
} else if (tokenType === "skip") {
|
|
6113
|
+
if (options.skipChar) output.push(options.skipChar, token.value);
|
|
6114
|
+
else output.push(options.nbsp ? "\xA0" : " ");
|
|
6115
|
+
} else if (tokenType === "div") {
|
|
6116
|
+
if (haveFraction) output.push("/");
|
|
6117
|
+
else if (section.num_min > 0 || section.den_min > 0) output.push(questionPadding);
|
|
6118
|
+
else output.push(pad$1("#", options.nbsp));
|
|
6119
|
+
} else if (tokenType === "int") {
|
|
6120
|
+
if (section.int_pattern.length === 1) {
|
|
6121
|
+
const pattern = section.int_p;
|
|
6122
|
+
const length = Math.max(section.int_min, integer.length);
|
|
6123
|
+
let digits = "";
|
|
6124
|
+
for (let index = length; index > 0; index--) {
|
|
6125
|
+
const digit = integer.charAt(integer.length - index);
|
|
6126
|
+
const patternDigit = digit ? "" : pattern.charAt(pattern.length - index) || pattern[0];
|
|
6127
|
+
let separator = "";
|
|
6128
|
+
if (section.grouping) {
|
|
6129
|
+
const groupIndex = index - 1 - primaryGroup;
|
|
6130
|
+
if (groupIndex >= 0 && !(groupIndex % secondaryGroup)) separator = digit || patternDigit === "0" ? l10n.group : pad$1("?", options.nbsp);
|
|
6131
|
+
}
|
|
6132
|
+
digits += (digit || pad$1(patternDigit, options.nbsp)) + separator;
|
|
6115
6133
|
}
|
|
6116
|
-
digits
|
|
6117
|
-
}
|
|
6118
|
-
|
|
6119
|
-
} else counter.int += digitsStart(integer, section.int_p, token.num, counter.int);
|
|
6120
|
-
else if (tokenType === "frac") {
|
|
6134
|
+
output.push(digits);
|
|
6135
|
+
} else counter.int += digitsStart(integer, section.int_p, token.num, counter.int);
|
|
6136
|
+
} else if (tokenType === "frac") {
|
|
6121
6137
|
const offset = counter.frac;
|
|
6122
6138
|
for (let index = 0; index < length; index++) output.push(fraction[index + offset] || pad$1(token.num[index], options.nbsp));
|
|
6123
6139
|
counter.frac += length;
|
|
@@ -6147,13 +6163,16 @@ function runPart(value, part, options, locale, decimalValue = null) {
|
|
|
6147
6163
|
const shortYear = year % 100;
|
|
6148
6164
|
output.push(shortYear < 10 ? "0" : "", shortYear);
|
|
6149
6165
|
} else if (tokenType === "month") output.push(token.pad && month < 10 ? "0" : "", month);
|
|
6150
|
-
else if (tokenType === "monthname-single")
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
else
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
else if (
|
|
6166
|
+
else if (tokenType === "monthname-single") {
|
|
6167
|
+
if (section.date_system === 6) output.push(l10n.mmmm6[month - 1].charAt(0));
|
|
6168
|
+
else output.push(l10n.mmmm[month - 1].charAt(0));
|
|
6169
|
+
} else if (tokenType === "monthname-short") {
|
|
6170
|
+
if (section.date_system === 6) output.push(l10n.mmm6[month - 1]);
|
|
6171
|
+
else output.push(l10n.mmm[month - 1]);
|
|
6172
|
+
} else if (tokenType === "monthname") {
|
|
6173
|
+
if (section.date_system === 6) output.push(l10n.mmmm6[month - 1]);
|
|
6174
|
+
else output.push(l10n.mmmm[month - 1]);
|
|
6175
|
+
} else if (token.type === "weekday-short") output.push(l10n.ddd[weekday]);
|
|
6157
6176
|
else if (tokenType === "weekday") output.push(l10n.dddd[weekday]);
|
|
6158
6177
|
else if (tokenType === "day") output.push(token.pad && day < 10 ? "0" : "", day);
|
|
6159
6178
|
else if (tokenType === "hour") {
|
|
@@ -6671,7 +6690,7 @@ const tokenHandlers = [
|
|
|
6671
6690
|
],
|
|
6672
6691
|
[
|
|
6673
6692
|
TOKEN_ESCAPED,
|
|
6674
|
-
/^\\(
|
|
6693
|
+
/^\\([\s\S])/,
|
|
6675
6694
|
1
|
|
6676
6695
|
],
|
|
6677
6696
|
[
|
|
@@ -6893,11 +6912,13 @@ function parsePattern(pattern) {
|
|
|
6893
6912
|
volatile: true
|
|
6894
6913
|
}));
|
|
6895
6914
|
if (partitions.length < 3) partitions.push(clonePart(partitions[0]));
|
|
6896
|
-
if (partitions.length < 4)
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6915
|
+
if (partitions.length < 4) {
|
|
6916
|
+
if (textPartition) partitions.push(textPartition);
|
|
6917
|
+
else {
|
|
6918
|
+
const text = parseFormatSection(tokenize("@"));
|
|
6919
|
+
text.generated = true;
|
|
6920
|
+
partitions.push(text);
|
|
6921
|
+
}
|
|
6901
6922
|
}
|
|
6902
6923
|
partitions[0].condition = [">", 0];
|
|
6903
6924
|
partitions[1].condition = ["<", 0];
|
|
@@ -7402,7 +7423,7 @@ function parseTime(value, options = {}) {
|
|
|
7402
7423
|
const secondsFormat = secondsPart ? ":ss" : "";
|
|
7403
7424
|
const ampmFormat = ampm ? " AM/PM" : "";
|
|
7404
7425
|
return {
|
|
7405
|
-
v: (hours * 60 * 60 + minutes * 60 + seconds + milliseconds) /
|
|
7426
|
+
v: (hours * 60 * 60 + minutes * 60 + seconds + milliseconds) / 86400,
|
|
7406
7427
|
z: `${hourFormat}:mm${secondsFormat}${ampmFormat}`
|
|
7407
7428
|
};
|
|
7408
7429
|
}
|
|
@@ -7482,7 +7503,8 @@ function prepareFormatterData(pattern, shouldThrow = false) {
|
|
|
7482
7503
|
function format(pattern, value, options = {}) {
|
|
7483
7504
|
const resolvedOptions = Object.assign({}, defaultOptions, options);
|
|
7484
7505
|
const data = prepareFormatterData(pattern, resolvedOptions.throws);
|
|
7485
|
-
|
|
7506
|
+
const normalizedValue = dateToSerial(value, resolvedOptions) ?? value;
|
|
7507
|
+
return formatValue(normalizedValue, data, resolvedOptions);
|
|
7486
7508
|
}
|
|
7487
7509
|
/**
|
|
7488
7510
|
* Find the color appropriate to a value as dictated by a format pattern.
|
|
@@ -7490,19 +7512,23 @@ function format(pattern, value, options = {}) {
|
|
|
7490
7512
|
function formatColor(pattern, value, options) {
|
|
7491
7513
|
const resolvedOptions = Object.assign({}, defaultOptions, options);
|
|
7492
7514
|
const data = prepareFormatterData(pattern, resolvedOptions.throws);
|
|
7493
|
-
|
|
7515
|
+
const normalizedValue = dateToSerial(value, resolvedOptions) ?? value;
|
|
7516
|
+
return formatColor$1(normalizedValue, data, resolvedOptions);
|
|
7494
7517
|
}
|
|
7495
7518
|
/** Determine if a given format pattern is a date pattern. */
|
|
7496
7519
|
function isDateFormat(pattern) {
|
|
7497
|
-
|
|
7520
|
+
const data = prepareFormatterData(pattern, false);
|
|
7521
|
+
return isDate(data.partitions);
|
|
7498
7522
|
}
|
|
7499
7523
|
/** Determine if a given format pattern is a percentage pattern. */
|
|
7500
7524
|
function isPercentFormat(pattern) {
|
|
7501
|
-
|
|
7525
|
+
const data = prepareFormatterData(pattern, false);
|
|
7526
|
+
return isPercent(data.partitions);
|
|
7502
7527
|
}
|
|
7503
7528
|
/** Determine if a given format pattern is a text only pattern. */
|
|
7504
7529
|
function isTextFormat$1(pattern) {
|
|
7505
|
-
|
|
7530
|
+
const data = prepareFormatterData(pattern, false);
|
|
7531
|
+
return isText(data.partitions);
|
|
7506
7532
|
}
|
|
7507
7533
|
/** Determine if a given format pattern is valid. */
|
|
7508
7534
|
function isValidFormat(pattern) {
|
|
@@ -7527,7 +7553,8 @@ function getFormatDateInfo(pattern) {
|
|
|
7527
7553
|
}
|
|
7528
7554
|
/** Completes omitted components in a calendar-date or clock pattern for editing; elapsed durations return null. */
|
|
7529
7555
|
function getDateTimeEditPattern(pattern, value) {
|
|
7530
|
-
|
|
7556
|
+
const data = prepareFormatterData(pattern, false);
|
|
7557
|
+
return createDateTimeEditPattern(data.partitions, value);
|
|
7531
7558
|
}
|
|
7532
7559
|
/** A dictionary of the types used to identify token variants. */
|
|
7533
7560
|
const tokenTypes = Object.freeze({
|
|
@@ -7778,7 +7805,8 @@ function createLiteralRegExp(value, flags) {
|
|
|
7778
7805
|
* regular-expression syntax is treated as literal text. Matching is case-insensitive.
|
|
7779
7806
|
*/
|
|
7780
7807
|
function createFromWildcard(pattern) {
|
|
7781
|
-
|
|
7808
|
+
const source = escapeRegExp$1(pattern).replace(/\\\*/g, ".*").replace(/\\\?/g, ".");
|
|
7809
|
+
return createRegExpFromSafeFragment(`^${source}$`, "i");
|
|
7782
7810
|
}
|
|
7783
7811
|
|
|
7784
7812
|
//#endregion
|
|
@@ -8032,8 +8060,10 @@ function mapObjectMatrix(o, callback) {
|
|
|
8032
8060
|
const colNumber = Number(col);
|
|
8033
8061
|
const value = columns[colNumber];
|
|
8034
8062
|
const resultValue = callback(rowNumber, colNumber, value);
|
|
8035
|
-
if (resultValue !== void 0)
|
|
8036
|
-
|
|
8063
|
+
if (resultValue !== void 0) {
|
|
8064
|
+
if (result[rowNumber]) result[rowNumber][colNumber] = resultValue;
|
|
8065
|
+
else result[rowNumber] = { [colNumber]: resultValue };
|
|
8066
|
+
}
|
|
8037
8067
|
}
|
|
8038
8068
|
}
|
|
8039
8069
|
return result;
|
|
@@ -8072,8 +8102,14 @@ function concatMatrixArray(source, target) {
|
|
|
8072
8102
|
const targetLength = targetKeys.length;
|
|
8073
8103
|
const containerArray = {};
|
|
8074
8104
|
let master = 0;
|
|
8075
|
-
for (let i = 0; i < srcLength; i++, master++)
|
|
8076
|
-
|
|
8105
|
+
for (let i = 0; i < srcLength; i++, master++) {
|
|
8106
|
+
const key = srcKeys[i];
|
|
8107
|
+
containerArray[master] = srcArray[key];
|
|
8108
|
+
}
|
|
8109
|
+
for (let i = 0; i < targetLength; i++, master++) {
|
|
8110
|
+
const key = targetKeys[i];
|
|
8111
|
+
containerArray[master] = targetArray[key];
|
|
8112
|
+
}
|
|
8077
8113
|
return containerArray;
|
|
8078
8114
|
}
|
|
8079
8115
|
function sliceMatrixArray(start, end, matrixArray) {
|
|
@@ -8291,7 +8327,8 @@ var ObjectMatrix = class ObjectMatrix {
|
|
|
8291
8327
|
const row = {};
|
|
8292
8328
|
let insertColumn = 0;
|
|
8293
8329
|
for (let c = startColumn; c <= endColumn; c++) {
|
|
8294
|
-
|
|
8330
|
+
const value = this.getValue(r, c);
|
|
8331
|
+
row[insertColumn] = value;
|
|
8295
8332
|
insertColumn++;
|
|
8296
8333
|
}
|
|
8297
8334
|
objectMatrix.setRow(insertRow, row);
|
|
@@ -8910,8 +8947,13 @@ function deepCompare(arg1, arg2) {
|
|
|
8910
8947
|
function isSameStyleTextRun(tr1, tr2) {
|
|
8911
8948
|
const ts1 = tr1.ts || {};
|
|
8912
8949
|
const ts2 = tr2.ts || {};
|
|
8913
|
-
if (tr1.sId !== tr2.sId) return false;
|
|
8914
|
-
|
|
8950
|
+
if (tr1.sId !== tr2.sId || !deepCompare(ts1, ts2)) return false;
|
|
8951
|
+
const metadataKeys = /* @__PURE__ */ new Set([...Object.keys(tr1), ...Object.keys(tr2)]);
|
|
8952
|
+
for (const key of metadataKeys) {
|
|
8953
|
+
if (key === "st" || key === "ed" || key === "ts" || key === "sId") continue;
|
|
8954
|
+
if (!deepCompare(tr1[key], tr2[key])) return false;
|
|
8955
|
+
}
|
|
8956
|
+
return true;
|
|
8915
8957
|
}
|
|
8916
8958
|
function checkForSubstrings(searchString, substrings) {
|
|
8917
8959
|
return substrings.some((substring) => searchString.indexOf(substring) > -1);
|
|
@@ -8919,7 +8961,7 @@ function checkForSubstrings(searchString, substrings) {
|
|
|
8919
8961
|
|
|
8920
8962
|
//#endregion
|
|
8921
8963
|
//#region src/shared/date-kit.ts
|
|
8922
|
-
const SECOND = 1e3
|
|
8964
|
+
const SECOND = 1e3;
|
|
8923
8965
|
const MINUTE = 60 * SECOND;
|
|
8924
8966
|
const HOUR = 60 * MINUTE;
|
|
8925
8967
|
const DAY = 24 * HOUR;
|
|
@@ -9164,9 +9206,7 @@ function setDatePart(date, isUTC, part, value) {
|
|
|
9164
9206
|
case "second":
|
|
9165
9207
|
next.setUTCSeconds(value);
|
|
9166
9208
|
break;
|
|
9167
|
-
case "millisecond":
|
|
9168
|
-
next.setUTCMilliseconds(value);
|
|
9169
|
-
break;
|
|
9209
|
+
case "millisecond": next.setUTCMilliseconds(value);
|
|
9170
9210
|
}
|
|
9171
9211
|
return next;
|
|
9172
9212
|
}
|
|
@@ -9189,9 +9229,7 @@ function setDatePart(date, isUTC, part, value) {
|
|
|
9189
9229
|
case "second":
|
|
9190
9230
|
next.setSeconds(value);
|
|
9191
9231
|
break;
|
|
9192
|
-
case "millisecond":
|
|
9193
|
-
next.setMilliseconds(value);
|
|
9194
|
-
break;
|
|
9232
|
+
case "millisecond": next.setMilliseconds(value);
|
|
9195
9233
|
}
|
|
9196
9234
|
return next;
|
|
9197
9235
|
}
|
|
@@ -9840,7 +9878,7 @@ function createIdByMathRandom(size, alphabet) {
|
|
|
9840
9878
|
}
|
|
9841
9879
|
function createIdByCrypto(size, alphabet, getCryptoRandomValues) {
|
|
9842
9880
|
const safeByteCutoff = 256 - 256 % alphabet.length;
|
|
9843
|
-
const step = Math.ceil(
|
|
9881
|
+
const step = Math.ceil(409.6 * size / safeByteCutoff);
|
|
9844
9882
|
let id = "";
|
|
9845
9883
|
while (id.length < size) {
|
|
9846
9884
|
const bytes = getCryptoRandomValues(new Uint8Array(step));
|
|
@@ -10278,7 +10316,6 @@ _defineProperty(Rectangle, "moveOffset", (range, offsetX, offsetY) => {
|
|
|
10278
10316
|
default:
|
|
10279
10317
|
_range.startRow += offsetY;
|
|
10280
10318
|
_range.startColumn += offsetX;
|
|
10281
|
-
break;
|
|
10282
10319
|
}
|
|
10283
10320
|
switch (range.endAbsoluteRefType) {
|
|
10284
10321
|
case 1:
|
|
@@ -10292,7 +10329,6 @@ _defineProperty(Rectangle, "moveOffset", (range, offsetX, offsetY) => {
|
|
|
10292
10329
|
default:
|
|
10293
10330
|
_range.endRow += offsetY;
|
|
10294
10331
|
_range.endColumn += offsetX;
|
|
10295
|
-
break;
|
|
10296
10332
|
}
|
|
10297
10333
|
return _range;
|
|
10298
10334
|
});
|
|
@@ -10400,35 +10436,6 @@ function splitIntoGrid(ranges) {
|
|
|
10400
10436
|
return result;
|
|
10401
10437
|
}
|
|
10402
10438
|
/**
|
|
10403
|
-
* Horizontal Merging
|
|
10404
|
-
* @param ranges no overlap ranges
|
|
10405
|
-
* @returns merged ranges
|
|
10406
|
-
*/
|
|
10407
|
-
function mergeHorizontalRanges(ranges) {
|
|
10408
|
-
ranges.sort((a, b) => a.startRow - b.startRow || a.startColumn - b.startColumn);
|
|
10409
|
-
const rowGroups = {};
|
|
10410
|
-
for (const range of ranges) {
|
|
10411
|
-
if (!rowGroups[range.startRow]) rowGroups[range.startRow] = [];
|
|
10412
|
-
rowGroups[range.startRow].push(range);
|
|
10413
|
-
}
|
|
10414
|
-
const mergedRanges = [];
|
|
10415
|
-
for (const row in rowGroups) {
|
|
10416
|
-
const rangesInRow = rowGroups[+row];
|
|
10417
|
-
rangesInRow.sort((a, b) => a.startColumn - b.startColumn);
|
|
10418
|
-
let currentRange = rangesInRow[0];
|
|
10419
|
-
for (let i = 1; i < rangesInRow.length; i++) {
|
|
10420
|
-
const nextRange = rangesInRow[i];
|
|
10421
|
-
if (nextRange.startColumn <= currentRange.endColumn + 1 && nextRange.startRow === currentRange.startRow && nextRange.endRow === currentRange.endRow) currentRange.endColumn = Math.max(currentRange.endColumn, nextRange.endColumn);
|
|
10422
|
-
else {
|
|
10423
|
-
mergedRanges.push(currentRange);
|
|
10424
|
-
currentRange = nextRange;
|
|
10425
|
-
}
|
|
10426
|
-
}
|
|
10427
|
-
mergedRanges.push(currentRange);
|
|
10428
|
-
}
|
|
10429
|
-
return mergedRanges;
|
|
10430
|
-
}
|
|
10431
|
-
/**
|
|
10432
10439
|
* Vertical Merging
|
|
10433
10440
|
* @param ranges no overlap ranges
|
|
10434
10441
|
* @returns merged ranges
|
|
@@ -10463,7 +10470,37 @@ function mergeVerticalRanges(ranges) {
|
|
|
10463
10470
|
* @returns ranges
|
|
10464
10471
|
*/
|
|
10465
10472
|
function mergeRanges(ranges) {
|
|
10466
|
-
|
|
10473
|
+
const events = /* @__PURE__ */ new Map();
|
|
10474
|
+
for (const range of ranges) for (const [row, add] of [[range.startRow, true], [range.endRow + 1, false]]) {
|
|
10475
|
+
const entries = events.get(row) ?? [];
|
|
10476
|
+
entries.push({
|
|
10477
|
+
range,
|
|
10478
|
+
add
|
|
10479
|
+
});
|
|
10480
|
+
events.set(row, entries);
|
|
10481
|
+
}
|
|
10482
|
+
const rows = [...events.keys()].sort((a, b) => a - b);
|
|
10483
|
+
const active = /* @__PURE__ */ new Set();
|
|
10484
|
+
const horizontalMerged = [];
|
|
10485
|
+
for (let index = 0; index < rows.length - 1; index++) {
|
|
10486
|
+
const startRow = rows[index];
|
|
10487
|
+
const endRow = rows[index + 1] - 1;
|
|
10488
|
+
for (const { range, add } of events.get(startRow)) if (add) active.add(range);
|
|
10489
|
+
else active.delete(range);
|
|
10490
|
+
const intervals = [...active].sort((a, b) => a.startColumn - b.startColumn || a.endColumn - b.endColumn);
|
|
10491
|
+
let current;
|
|
10492
|
+
for (const range of intervals) if (current && range.startColumn <= current.endColumn + 1) current.endColumn = Math.max(current.endColumn, range.endColumn);
|
|
10493
|
+
else {
|
|
10494
|
+
current = {
|
|
10495
|
+
startRow,
|
|
10496
|
+
endRow,
|
|
10497
|
+
startColumn: range.startColumn,
|
|
10498
|
+
endColumn: range.endColumn
|
|
10499
|
+
};
|
|
10500
|
+
horizontalMerged.push(current);
|
|
10501
|
+
}
|
|
10502
|
+
}
|
|
10503
|
+
return mergeVerticalRanges(horizontalMerged);
|
|
10467
10504
|
}
|
|
10468
10505
|
function multiSubtractSingleRange(ranges, toDelete) {
|
|
10469
10506
|
const res = [];
|
|
@@ -10506,10 +10543,10 @@ function getIntersectRange(src, target) {
|
|
|
10506
10543
|
* @returns A tuple containing the start and end of the overlap, or null if there is no overlap.
|
|
10507
10544
|
*/
|
|
10508
10545
|
function getOverlap1D(start1, end1, start2, end2) {
|
|
10509
|
-
const s1 = isNaN(start1) ? -Infinity : start1;
|
|
10510
|
-
const e1 = isNaN(end1) ? Infinity : end1;
|
|
10511
|
-
const s2 = isNaN(start2) ? -Infinity : start2;
|
|
10512
|
-
const e2 = isNaN(end2) ? Infinity : end2;
|
|
10546
|
+
const s1 = Number.isNaN(start1) ? -Infinity : start1;
|
|
10547
|
+
const e1 = Number.isNaN(end1) ? Infinity : end1;
|
|
10548
|
+
const s2 = Number.isNaN(start2) ? -Infinity : start2;
|
|
10549
|
+
const e2 = Number.isNaN(end2) ? Infinity : end2;
|
|
10513
10550
|
const start = Math.max(s1, s2);
|
|
10514
10551
|
const end = Math.min(e1, e2);
|
|
10515
10552
|
if (start <= end) return [start === -Infinity ? NaN : start, end === Infinity ? NaN : end];
|
|
@@ -10548,8 +10585,8 @@ function determineRangeType(srcType, targetType, startRow, endRow, startColumn,
|
|
|
10548
10585
|
* @returns The inferred rangeType.
|
|
10549
10586
|
*/
|
|
10550
10587
|
function inferRangeType(startRow, endRow, startColumn, endColumn) {
|
|
10551
|
-
const hasRow = !isNaN(startRow) && !isNaN(endRow);
|
|
10552
|
-
const hasColumn = !isNaN(startColumn) && !isNaN(endColumn);
|
|
10588
|
+
const hasRow = !Number.isNaN(startRow) && !Number.isNaN(endRow);
|
|
10589
|
+
const hasColumn = !Number.isNaN(startColumn) && !Number.isNaN(endColumn);
|
|
10553
10590
|
if (hasRow && hasColumn) return 0;
|
|
10554
10591
|
else if (hasRow) return 1;
|
|
10555
10592
|
else if (hasColumn) return 2;
|
|
@@ -11670,6 +11707,14 @@ let DrawingTypeEnum = /* @__PURE__ */ function(DrawingTypeEnum) {
|
|
|
11670
11707
|
* Block element, allows host products to place embeddable unit-backed blocks as drawing objects.
|
|
11671
11708
|
*/
|
|
11672
11709
|
DrawingTypeEnum[DrawingTypeEnum["DRAWING_BLOCK"] = 9] = "DRAWING_BLOCK";
|
|
11710
|
+
/**
|
|
11711
|
+
* Spreadsheet Slicer control.
|
|
11712
|
+
*/
|
|
11713
|
+
DrawingTypeEnum[DrawingTypeEnum["DRAWING_SLICER"] = 10] = "DRAWING_SLICER";
|
|
11714
|
+
/**
|
|
11715
|
+
* Spreadsheet Timeline control.
|
|
11716
|
+
*/
|
|
11717
|
+
DrawingTypeEnum[DrawingTypeEnum["DRAWING_TIMELINE"] = 11] = "DRAWING_TIMELINE";
|
|
11673
11718
|
return DrawingTypeEnum;
|
|
11674
11719
|
}({});
|
|
11675
11720
|
|
|
@@ -11755,6 +11800,10 @@ function throttle(fn, wait = 16) {
|
|
|
11755
11800
|
fn.apply(this, args);
|
|
11756
11801
|
}, wait);
|
|
11757
11802
|
} else {
|
|
11803
|
+
if (timer) {
|
|
11804
|
+
clearTimeout(timer);
|
|
11805
|
+
timer = null;
|
|
11806
|
+
}
|
|
11758
11807
|
lastTime = now;
|
|
11759
11808
|
fn.apply(this, args);
|
|
11760
11809
|
}
|
|
@@ -11910,9 +11959,7 @@ function rgbToHsl([r, g, b]) {
|
|
|
11910
11959
|
case g:
|
|
11911
11960
|
h = (b - r) / d + 2;
|
|
11912
11961
|
break;
|
|
11913
|
-
case b:
|
|
11914
|
-
h = (r - g) / d + 4;
|
|
11915
|
-
break;
|
|
11962
|
+
case b: h = (r - g) / d + 4;
|
|
11916
11963
|
}
|
|
11917
11964
|
h /= 6;
|
|
11918
11965
|
}
|
|
@@ -12428,8 +12475,10 @@ async function calculateDocumentStatistics(dataStream, options) {
|
|
|
12428
12475
|
let processedWordCharacters = 0;
|
|
12429
12476
|
for (const word of wordSegmenter.segment(fragment)) {
|
|
12430
12477
|
throwIfAborted(signal);
|
|
12431
|
-
if (word.isWordLike && !EAST_ASIAN_CHARACTER.test(word.segment))
|
|
12432
|
-
|
|
12478
|
+
if (word.isWordLike && !EAST_ASIAN_CHARACTER.test(word.segment)) {
|
|
12479
|
+
if (KOREAN_CHARACTER.test(word.segment)) statistics.asianCharactersAndKoreanWords += 1;
|
|
12480
|
+
else statistics.nonAsianWords += 1;
|
|
12481
|
+
}
|
|
12433
12482
|
processedWordCharacters += word.segment.length;
|
|
12434
12483
|
if (processedWordCharacters >= YIELD_INTERVAL) {
|
|
12435
12484
|
processedWordCharacters = 0;
|
|
@@ -12596,6 +12645,8 @@ let DocumentFlavor = /* @__PURE__ */ function(DocumentFlavor) {
|
|
|
12596
12645
|
DocumentFlavor[DocumentFlavor["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
12597
12646
|
DocumentFlavor[DocumentFlavor["TRADITIONAL"] = 1] = "TRADITIONAL";
|
|
12598
12647
|
DocumentFlavor[DocumentFlavor["MODERN"] = 2] = "MODERN";
|
|
12648
|
+
/** DrawingML text semantics for host-prepared shape and slide text models. */
|
|
12649
|
+
DocumentFlavor[DocumentFlavor["DRAWINGML"] = 3] = "DRAWINGML";
|
|
12599
12650
|
return DocumentFlavor;
|
|
12600
12651
|
}({});
|
|
12601
12652
|
let GridType = /* @__PURE__ */ function(GridType) {
|
|
@@ -13328,7 +13379,7 @@ function getEmptySnapshot$1(unitID = generateRandomId(6), locale = "enUS", title
|
|
|
13328
13379
|
marginBottom: 72,
|
|
13329
13380
|
marginRight: 72,
|
|
13330
13381
|
marginLeft: 72,
|
|
13331
|
-
autoHyphenation: 1,
|
|
13382
|
+
autoHyphenation: documentFlavor === 3 ? 0 : 1,
|
|
13332
13383
|
doNotHyphenateCaps: 0,
|
|
13333
13384
|
consecutiveHyphenLimit: 2,
|
|
13334
13385
|
defaultHeaderId: "",
|
|
@@ -13608,15 +13659,14 @@ function insertTextRuns(body, insertBody, textLength, currentIndex) {
|
|
|
13608
13659
|
* @param textLength The length of the inserted content text.
|
|
13609
13660
|
* @param currentIndex Determining the index where the content will be inserted into the current content.
|
|
13610
13661
|
*/
|
|
13611
|
-
function insertParagraphs(body, insertBody, textLength, currentIndex,
|
|
13662
|
+
function insertParagraphs(body, insertBody, textLength, currentIndex, isUpdate = false, originalDataStream = body.dataStream) {
|
|
13612
13663
|
var _insertBody$paragraph;
|
|
13613
13664
|
if (!body.paragraphs && !((_insertBody$paragraph = insertBody.paragraphs) === null || _insertBody$paragraph === void 0 ? void 0 : _insertBody$paragraph.length)) return;
|
|
13614
13665
|
body.paragraphs ??= [];
|
|
13615
13666
|
const { paragraphs } = body;
|
|
13616
13667
|
const { paragraphs: insertParagraphs } = insertBody;
|
|
13617
|
-
normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs, currentIndex, {
|
|
13668
|
+
if (!isUpdate) normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs, currentIndex, {
|
|
13618
13669
|
freshenSplitParagraph: true,
|
|
13619
|
-
preserveMissingParagraphIds,
|
|
13620
13670
|
preserveExplicitSplitParagraphIds: Boolean(insertBody[RESTORE_INSERTED_PARAGRAPH_IDS]),
|
|
13621
13671
|
preserveExplicitParagraphIds: Boolean(insertBody[PRESERVE_INSERTED_PARAGRAPH_IDS]),
|
|
13622
13672
|
dataStream: originalDataStream
|
|
@@ -13671,7 +13721,7 @@ function normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs,
|
|
|
13671
13721
|
insertParagraphs[i] = cloneInsertedParagraphWithId(insertParagraphs[i], existingParagraphIds, options.preserveMissingParagraphIds ?? false);
|
|
13672
13722
|
continue;
|
|
13673
13723
|
}
|
|
13674
|
-
insertParagraphs[i] = options.freshenSplitParagraph
|
|
13724
|
+
insertParagraphs[i] = options.freshenSplitParagraph ? cloneParagraphWithId({
|
|
13675
13725
|
...insertParagraphs[i],
|
|
13676
13726
|
paragraphId: splitParagraphId
|
|
13677
13727
|
}, existingParagraphIds) : splitRemainderParagraph;
|
|
@@ -13893,18 +13943,19 @@ function mergeContinuousRanges(ranges) {
|
|
|
13893
13943
|
if (ranges.length <= 1) return ranges;
|
|
13894
13944
|
ranges.sort((a, b) => a.startIndex - b.startIndex);
|
|
13895
13945
|
const mergedRanges = [];
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13946
|
+
const latestById = /* @__PURE__ */ new Map();
|
|
13947
|
+
for (const range of ranges) {
|
|
13948
|
+
const nextRange = {
|
|
13949
|
+
...range,
|
|
13950
|
+
rangeId: getRootId(range.rangeId)
|
|
13951
|
+
};
|
|
13952
|
+
const currentRange = latestById.get(nextRange.rangeId);
|
|
13953
|
+
if (currentRange && nextRange.rangeType === currentRange.rangeType && shallowEqual(currentRange.properties, nextRange.properties) && currentRange.endIndex + 1 >= nextRange.startIndex) currentRange.endIndex = Math.max(currentRange.endIndex, nextRange.endIndex);
|
|
13902
13954
|
else {
|
|
13903
|
-
mergedRanges.push(
|
|
13904
|
-
|
|
13955
|
+
mergedRanges.push(nextRange);
|
|
13956
|
+
latestById.set(nextRange.rangeId, nextRange);
|
|
13905
13957
|
}
|
|
13906
13958
|
}
|
|
13907
|
-
mergedRanges.push(currentRange);
|
|
13908
13959
|
const idMap = Object.create(null);
|
|
13909
13960
|
for (let i = 0, len = mergedRanges.length; i < len; i++) {
|
|
13910
13961
|
const range = mergedRanges[i];
|
|
@@ -13917,19 +13968,19 @@ function mergeContinuousRanges(ranges) {
|
|
|
13917
13968
|
return mergedRanges;
|
|
13918
13969
|
}
|
|
13919
13970
|
function splitCustomRangesByIndex(customRanges, currentIndex) {
|
|
13920
|
-
const
|
|
13921
|
-
const
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
}
|
|
13971
|
+
const matches = customRanges.filter((range) => range.rangeType !== 1 && range.rangeType !== 2 && range.rangeType !== 3 && range.startIndex < currentIndex && range.endIndex >= currentIndex);
|
|
13972
|
+
for (const matched of matches) {
|
|
13973
|
+
const index = customRanges.indexOf(matched);
|
|
13974
|
+
customRanges.splice(index, 1, {
|
|
13975
|
+
...matched,
|
|
13976
|
+
endIndex: currentIndex - 1,
|
|
13977
|
+
properties: { ...matched.properties }
|
|
13978
|
+
}, {
|
|
13979
|
+
...matched,
|
|
13980
|
+
startIndex: currentIndex,
|
|
13981
|
+
properties: { ...matched.properties }
|
|
13982
|
+
});
|
|
13983
|
+
}
|
|
13933
13984
|
}
|
|
13934
13985
|
function mergeContinuousDecorations(ranges) {
|
|
13935
13986
|
if (ranges.length <= 1) return ranges;
|
|
@@ -13970,6 +14021,10 @@ function insertCustomRanges(body, insertBody, textLength, currentIndex) {
|
|
|
13970
14021
|
for (let i = 0, len = customRanges.length; i < len; i++) {
|
|
13971
14022
|
const customRange = customRanges[i];
|
|
13972
14023
|
const { startIndex } = customRange;
|
|
14024
|
+
if ((customRange.rangeType === 1 || customRange.rangeType === 2 || customRange.rangeType === 3) && startIndex < currentIndex && customRange.endIndex >= currentIndex) {
|
|
14025
|
+
customRange.endIndex += textLength;
|
|
14026
|
+
continue;
|
|
14027
|
+
}
|
|
13973
14028
|
if (startIndex >= currentIndex) {
|
|
13974
14029
|
customRange.startIndex += textLength;
|
|
13975
14030
|
customRange.endIndex += textLength;
|
|
@@ -13979,6 +14034,15 @@ function insertCustomRanges(body, insertBody, textLength, currentIndex) {
|
|
|
13979
14034
|
if (insertBody.customRanges) {
|
|
13980
14035
|
for (let i = 0, len = insertBody.customRanges.length; i < len; i++) {
|
|
13981
14036
|
const customRange = insertBody.customRanges[i];
|
|
14037
|
+
const existingSdt = customRange.rangeType === 2 ? customRanges.find((range) => range.rangeType === 2 && range.rangeId === customRange.rangeId) : void 0;
|
|
14038
|
+
if (existingSdt) {
|
|
14039
|
+
existingSdt.startIndex = Math.min(existingSdt.startIndex, currentIndex + customRange.startIndex);
|
|
14040
|
+
existingSdt.endIndex = Math.max(existingSdt.endIndex, currentIndex + customRange.endIndex);
|
|
14041
|
+
existingSdt.properties = Tools.deepClone(customRange.properties);
|
|
14042
|
+
existingSdt.wholeEntity = customRange.wholeEntity;
|
|
14043
|
+
customRanges.splice(customRanges.indexOf(existingSdt), 0, ...insertRanges.splice(0));
|
|
14044
|
+
continue;
|
|
14045
|
+
}
|
|
13982
14046
|
customRange.startIndex += currentIndex;
|
|
13983
14047
|
customRange.endIndex += currentIndex;
|
|
13984
14048
|
insertRanges.push(customRange);
|
|
@@ -14255,6 +14319,8 @@ function deleteCustomRanges(body, textLength, currentIndex) {
|
|
|
14255
14319
|
const { customRanges } = body;
|
|
14256
14320
|
const removeCustomRanges = [];
|
|
14257
14321
|
if (customRanges) {
|
|
14322
|
+
const originalSdtLengths = new Map(customRanges.filter((range) => range.rangeType === 2).map((range) => [range, range.endIndex - range.startIndex]));
|
|
14323
|
+
const coincidentSdts = /* @__PURE__ */ new Map();
|
|
14258
14324
|
const newCustomRanges = [];
|
|
14259
14325
|
for (let i = 0, len = customRanges.length; i < len; i++) {
|
|
14260
14326
|
const customRange = customRanges[i];
|
|
@@ -14264,8 +14330,21 @@ function deleteCustomRanges(body, textLength, currentIndex) {
|
|
|
14264
14330
|
continue;
|
|
14265
14331
|
}
|
|
14266
14332
|
Object.assign(customRange, transformed);
|
|
14333
|
+
if (customRange.rangeType === 2) {
|
|
14334
|
+
const key = `${customRange.startIndex}:${customRange.endIndex}`;
|
|
14335
|
+
const positions = coincidentSdts.get(key) ?? [];
|
|
14336
|
+
positions.push(newCustomRanges.length);
|
|
14337
|
+
coincidentSdts.set(key, positions);
|
|
14338
|
+
}
|
|
14267
14339
|
newCustomRanges.push(customRange);
|
|
14268
14340
|
}
|
|
14341
|
+
for (const positions of coincidentSdts.values()) {
|
|
14342
|
+
if (positions.length < 2) continue;
|
|
14343
|
+
const ordered = positions.map((index) => newCustomRanges[index]).sort((left, right) => originalSdtLengths.get(left) - originalSdtLengths.get(right));
|
|
14344
|
+
positions.forEach((index, offset) => {
|
|
14345
|
+
newCustomRanges[index] = ordered[offset];
|
|
14346
|
+
});
|
|
14347
|
+
}
|
|
14269
14348
|
body.customRanges = mergeContinuousRanges(newCustomRanges);
|
|
14270
14349
|
}
|
|
14271
14350
|
return removeCustomRanges;
|
|
@@ -14850,8 +14929,10 @@ function coverTextRuns(updateDataTextRuns, originTextRuns, coverType) {
|
|
|
14850
14929
|
const tempTopTextRun = newUpdateTextRuns[newUpdateTextRuns.length - 1];
|
|
14851
14930
|
const updateLastTextRun = updateDataTextRuns[updateLength - 1];
|
|
14852
14931
|
const removeLastTextRun = originTextRuns[removeLength - 1];
|
|
14853
|
-
if (tempTopTextRun && tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed))
|
|
14854
|
-
|
|
14932
|
+
if (tempTopTextRun && tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed)) {
|
|
14933
|
+
if (updateLastTextRun.ed > removeLastTextRun.ed) newUpdateTextRuns.push(updateLastTextRun);
|
|
14934
|
+
else newUpdateTextRuns.push(removeLastTextRun);
|
|
14935
|
+
}
|
|
14855
14936
|
return normalizeTextRuns(newUpdateTextRuns);
|
|
14856
14937
|
}
|
|
14857
14938
|
function updateParagraphs(body, updateBody, textLength, currentIndex, coverType) {
|
|
@@ -15113,12 +15194,35 @@ function updateCustomRanges(body, updateBody, textLength, currentIndex, _coverTy
|
|
|
15113
15194
|
if (!updateDataCustomRanges) return [];
|
|
15114
15195
|
updateDataCustomRanges.forEach((customRange) => {
|
|
15115
15196
|
const { startIndex, endIndex } = customRange;
|
|
15197
|
+
const existingSdt = customRange.rangeType === 2 ? newCustomRanges.find((range) => range.rangeType === 2 && range.rangeId === customRange.rangeId) : void 0;
|
|
15198
|
+
if (existingSdt) {
|
|
15199
|
+
if (startIndex > 0) existingSdt.startIndex = startIndex + currentIndex;
|
|
15200
|
+
if (endIndex < textLength - 1) existingSdt.endIndex = endIndex + currentIndex;
|
|
15201
|
+
existingSdt.properties = Tools.deepClone(customRange.properties);
|
|
15202
|
+
existingSdt.wholeEntity = customRange.wholeEntity;
|
|
15203
|
+
return;
|
|
15204
|
+
}
|
|
15116
15205
|
newCustomRanges.push({
|
|
15117
15206
|
...customRange,
|
|
15118
15207
|
startIndex: startIndex + currentIndex,
|
|
15119
15208
|
endIndex: endIndex + currentIndex
|
|
15120
15209
|
});
|
|
15121
15210
|
});
|
|
15211
|
+
const updateOrder = new Map(updateDataCustomRanges.map((range, index) => [range.rangeId, index]));
|
|
15212
|
+
const coincidentSdts = /* @__PURE__ */ new Map();
|
|
15213
|
+
newCustomRanges.forEach((range, index) => {
|
|
15214
|
+
if (range.rangeType !== 2 || !updateOrder.has(range.rangeId)) return;
|
|
15215
|
+
const key = `${range.startIndex}:${range.endIndex}`;
|
|
15216
|
+
const positions = coincidentSdts.get(key) ?? [];
|
|
15217
|
+
positions.push(index);
|
|
15218
|
+
coincidentSdts.set(key, positions);
|
|
15219
|
+
});
|
|
15220
|
+
for (const positions of coincidentSdts.values()) {
|
|
15221
|
+
const ordered = positions.map((index) => newCustomRanges[index]).sort((left, right) => updateOrder.get(left.rangeId) - updateOrder.get(right.rangeId));
|
|
15222
|
+
positions.forEach((position, index) => {
|
|
15223
|
+
newCustomRanges[position] = ordered[index];
|
|
15224
|
+
});
|
|
15225
|
+
}
|
|
15122
15226
|
body.customRanges = mergeContinuousRanges(newCustomRanges);
|
|
15123
15227
|
return removeCustomRanges;
|
|
15124
15228
|
}
|
|
@@ -15465,7 +15569,9 @@ const setParagraphStyle = (params) => {
|
|
|
15465
15569
|
var _segment$getBody, _segment$getBody2;
|
|
15466
15570
|
const { textRanges, segmentId, document: docDataModel, style, paragraphTextRun, cursor, deleteLen, textX: _textX } = params;
|
|
15467
15571
|
const segment = docDataModel.getSelfOrHeaderFooterModel(segmentId);
|
|
15468
|
-
const
|
|
15572
|
+
const paragraphs = (segment === null || segment === void 0 || (_segment$getBody = segment.getBody()) === null || _segment$getBody === void 0 ? void 0 : _segment$getBody.paragraphs) ?? [];
|
|
15573
|
+
const dataStream = (segment === null || segment === void 0 || (_segment$getBody2 = segment.getBody()) === null || _segment$getBody2 === void 0 ? void 0 : _segment$getBody2.dataStream) ?? "";
|
|
15574
|
+
const currentParagraphs = getParagraphsInRanges(textRanges, paragraphs, dataStream);
|
|
15469
15575
|
const memoryCursor = new MemoryCursor();
|
|
15470
15576
|
if (cursor) memoryCursor.moveCursorTo(cursor);
|
|
15471
15577
|
const textX = _textX ?? new TextX();
|
|
@@ -15696,6 +15802,7 @@ function getDocxExportExcludedRangeSlice(body, startOffset, endOffset) {
|
|
|
15696
15802
|
function getBodySlice(body, startOffset, endOffset, returnEmptyArray = true, type = 1, structuralRangeMode = 0) {
|
|
15697
15803
|
const { dataStream } = body;
|
|
15698
15804
|
const docBody = { dataStream: dataStream.slice(startOffset, endOffset) };
|
|
15805
|
+
if (body.renderedPageBreaks != null) docBody.renderedPageBreaks = body.renderedPageBreaks.filter((offset) => offset >= startOffset && offset < endOffset).map((offset) => offset - startOffset);
|
|
15699
15806
|
if (body["__textXPreserveParagraphIds"]) docBody[PRESERVE_INSERTED_PARAGRAPH_IDS] = true;
|
|
15700
15807
|
docBody.textRuns = getTextRunSlice(body, startOffset, endOffset, returnEmptyArray);
|
|
15701
15808
|
const newTables = getTableSlice(body, startOffset, endOffset, structuralRangeMode);
|
|
@@ -15714,7 +15821,7 @@ function getBodySlice(body, startOffset, endOffset, returnEmptyArray = true, typ
|
|
|
15714
15821
|
else if (returnEmptyArray) docBody.customDecorations = [];
|
|
15715
15822
|
}
|
|
15716
15823
|
const { customRanges } = getCustomRangeSlice(body, startOffset, endOffset);
|
|
15717
|
-
if (customRanges) docBody.customRanges = customRanges;
|
|
15824
|
+
if (customRanges) docBody.customRanges = type === 0 ? customRanges.filter((range) => range.rangeType !== 1 || docBody.dataStream[range.startIndex] === "" && docBody.dataStream[range.endIndex] === "") : customRanges;
|
|
15718
15825
|
else if (returnEmptyArray) docBody.customRanges = [];
|
|
15719
15826
|
docBody.customBlocks = getCustomBlockSlice(body, startOffset, endOffset);
|
|
15720
15827
|
if (body.docxRawCustomBlocks != null) docBody.docxRawCustomBlocks = getDocxRawCustomBlockSlice(body, startOffset, endOffset) ?? [];
|
|
@@ -15730,6 +15837,7 @@ function getBodySliceForSplitTextXAction(body, startOffset, endOffset, returnEmp
|
|
|
15730
15837
|
}
|
|
15731
15838
|
function shiftBodyMetadata(body, leftOffset, rightOffset) {
|
|
15732
15839
|
var _body$textRuns, _body$paragraphs, _body$customBlocks, _body$docxRawCustomBl, _body$docxRawBlocks, _body$docxExportExclu, _body$customRanges, _body$customDecoratio, _body$tables, _body$columnGroups;
|
|
15840
|
+
if (body.renderedPageBreaks != null) body.renderedPageBreaks = body.renderedPageBreaks.map((offset) => offset + leftOffset);
|
|
15733
15841
|
(_body$textRuns = body.textRuns) === null || _body$textRuns === void 0 || _body$textRuns.forEach((textRun) => {
|
|
15734
15842
|
textRun.st += leftOffset;
|
|
15735
15843
|
textRun.ed += leftOffset;
|
|
@@ -15826,12 +15934,17 @@ function composeTextRuns(updateDataTextRuns, originTextRuns, coverType) {
|
|
|
15826
15934
|
function composeCustomRanges(updateDataCustomRanges, originCustomRanges, coverType) {
|
|
15827
15935
|
if (updateDataCustomRanges == null || originCustomRanges == null) return updateDataCustomRanges ?? originCustomRanges;
|
|
15828
15936
|
if (originCustomRanges.length === 0 || updateDataCustomRanges.length === 0) return updateDataCustomRanges;
|
|
15829
|
-
if (
|
|
15830
|
-
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15937
|
+
if (coverType === 1) return updateDataCustomRanges.map((range) => ({ ...range }));
|
|
15938
|
+
const updates = new Map(updateDataCustomRanges.map((range) => [range.rangeId, range]));
|
|
15939
|
+
return [...originCustomRanges.filter((range) => !updateDataCustomRanges.some((update) => range.rangeType === 0 && update.rangeType === 0 && update.rangeId !== range.rangeId && update.startIndex === range.startIndex && update.endIndex === range.endIndex)).map((range) => {
|
|
15940
|
+
const update = updates.get(range.rangeId);
|
|
15941
|
+
if (update == null) return range;
|
|
15942
|
+
updates.delete(range.rangeId);
|
|
15943
|
+
return {
|
|
15944
|
+
...range,
|
|
15945
|
+
...update
|
|
15946
|
+
};
|
|
15947
|
+
}), ...updates.values()];
|
|
15835
15948
|
}
|
|
15836
15949
|
function composeCustomDecorations(updateDataCustomDecorations, originCustomDecorations, coverType) {
|
|
15837
15950
|
if (originCustomDecorations.length === 0 || updateDataCustomDecorations.length === 0) return updateDataCustomDecorations;
|
|
@@ -15845,6 +15958,7 @@ function composeCustomDecorations(updateDataCustomDecorations, originCustomDecor
|
|
|
15845
15958
|
function composeBody(thisBody, otherBody, coverType = 0) {
|
|
15846
15959
|
if (otherBody.dataStream !== "") throw new Error("Cannot compose other body with non-empty dataStream");
|
|
15847
15960
|
const retBody = { dataStream: thisBody.dataStream };
|
|
15961
|
+
if (thisBody.renderedPageBreaks != null) retBody.renderedPageBreaks = [...thisBody.renderedPageBreaks];
|
|
15848
15962
|
if (thisBody["__textXPreserveParagraphIds"] || otherBody["__textXPreserveParagraphIds"]) retBody[PRESERVE_INSERTED_PARAGRAPH_IDS] = true;
|
|
15849
15963
|
const { textRuns: thisTextRuns, paragraphs: thisParagraphs = [], customRanges: thisCustomRanges, customDecorations: thisCustomDecorations = [], columnGroups: thisColumnGroups = [], blockRanges: thisBlockRanges = [] } = thisBody;
|
|
15850
15964
|
const { textRuns: otherTextRuns, paragraphs: otherParagraphs = [], customRanges: otherCustomRanges, customDecorations: otherCustomDecorations = [], columnGroups: otherColumnGroups = [], blockRanges: otherBlockRanges = [] } = otherBody;
|
|
@@ -15896,6 +16010,8 @@ function composeColumnGroups(thisRanges, otherRanges) {
|
|
|
15896
16010
|
return Array.from(byId.values()).sort((left, right) => left.startIndex - right.startIndex);
|
|
15897
16011
|
}
|
|
15898
16012
|
function isUselessRetainAction(action) {
|
|
16013
|
+
var _action$rangeUpdates;
|
|
16014
|
+
if ((_action$rangeUpdates = action.rangeUpdates) === null || _action$rangeUpdates === void 0 ? void 0 : _action$rangeUpdates.length) return false;
|
|
15899
16015
|
const { body } = action;
|
|
15900
16016
|
if (body == null) return true;
|
|
15901
16017
|
const { textRuns, paragraphs, customRanges, customBlocks, docxRawCustomBlocks, docxRawBlocks, docxExportExcludedRanges, customDecorations, tables, columnGroups, blockRanges } = body;
|
|
@@ -16000,9 +16116,12 @@ var ActionIterator = class {
|
|
|
16000
16116
|
//#endregion
|
|
16001
16117
|
//#region src/docs/data-model/text-x/apply-utils/delete-apply.ts
|
|
16002
16118
|
function updateAttributeByDelete(body, textLength, currentIndex) {
|
|
16119
|
+
var _body$renderedPageBre;
|
|
16003
16120
|
const { dataStream } = body;
|
|
16004
16121
|
const startIndex = currentIndex;
|
|
16005
16122
|
const endIndex = currentIndex + textLength;
|
|
16123
|
+
const removedRenderedPageBreaks = (_body$renderedPageBre = body.renderedPageBreaks) === null || _body$renderedPageBre === void 0 ? void 0 : _body$renderedPageBre.filter((offset) => offset >= startIndex && offset < endIndex).map((offset) => offset - startIndex);
|
|
16124
|
+
if (body.renderedPageBreaks != null) body.renderedPageBreaks = body.renderedPageBreaks.filter((offset) => offset < startIndex || offset >= endIndex).map((offset) => offset >= endIndex ? offset - textLength : offset);
|
|
16006
16125
|
const removeTextRuns = deleteTextRuns(body, textLength, currentIndex);
|
|
16007
16126
|
const removeParagraphs = deleteParagraphs(body, textLength, currentIndex);
|
|
16008
16127
|
const removeSectionBreaks = deleteSectionBreaks(body, textLength, currentIndex);
|
|
@@ -16022,6 +16141,7 @@ function updateAttributeByDelete(body, textLength, currentIndex) {
|
|
|
16022
16141
|
}
|
|
16023
16142
|
return {
|
|
16024
16143
|
dataStream: removeDataStream,
|
|
16144
|
+
renderedPageBreaks: removedRenderedPageBreaks,
|
|
16025
16145
|
textRuns: removeTextRuns,
|
|
16026
16146
|
paragraphs: removeParagraphs,
|
|
16027
16147
|
sectionBreaks: removeSectionBreaks,
|
|
@@ -16042,6 +16162,7 @@ function updateAttributeByDelete(body, textLength, currentIndex) {
|
|
|
16042
16162
|
function updateAttributeByInsert(body, insertBody, textLength, currentIndex) {
|
|
16043
16163
|
const originalDataStream = body.dataStream;
|
|
16044
16164
|
body.dataStream = insertTextToContent(body.dataStream, currentIndex, insertBody.dataStream);
|
|
16165
|
+
if (body.renderedPageBreaks != null || insertBody.renderedPageBreaks != null) body.renderedPageBreaks = [...(body.renderedPageBreaks ?? []).map((offset) => offset >= currentIndex ? offset + textLength : offset), ...(insertBody.renderedPageBreaks ?? []).map((offset) => offset + currentIndex)].sort((left, right) => left - right);
|
|
16045
16166
|
insertTextRuns(body, insertBody, textLength, currentIndex);
|
|
16046
16167
|
insertParagraphs(body, insertBody, textLength, currentIndex, false, originalDataStream);
|
|
16047
16168
|
insertSectionBreaks(body, insertBody, textLength, currentIndex);
|
|
@@ -16056,6 +16177,220 @@ function updateAttributeByInsert(body, insertBody, textLength, currentIndex) {
|
|
|
16056
16177
|
insertCustomDecorations(body, insertBody, textLength, currentIndex);
|
|
16057
16178
|
}
|
|
16058
16179
|
|
|
16180
|
+
//#endregion
|
|
16181
|
+
//#region src/docs/data-model/text-x/custom-range-update.ts
|
|
16182
|
+
function getChangedPropertyPaths(before, after, path = []) {
|
|
16183
|
+
if (Tools.diffValue(before, after)) return [];
|
|
16184
|
+
if (after && typeof after === "object" && !Array.isArray(after) && (before == null || typeof before === "object" && !Array.isArray(before))) {
|
|
16185
|
+
const previous = before ?? {};
|
|
16186
|
+
const next = after;
|
|
16187
|
+
const keys = Array.from(/* @__PURE__ */ new Set([...Object.keys(previous), ...Object.keys(next)]));
|
|
16188
|
+
if (!keys.length && path.length) return [path];
|
|
16189
|
+
return keys.flatMap((key) => getChangedPropertyPaths(previous[key], next[key], [...path, key]));
|
|
16190
|
+
}
|
|
16191
|
+
return [path];
|
|
16192
|
+
}
|
|
16193
|
+
function validatePropertyPaths(paths) {
|
|
16194
|
+
if (!Array.isArray(paths) || paths.some((path) => !Array.isArray(path) || !path.length || path.some((key) => typeof key !== "string" || [
|
|
16195
|
+
"__proto__",
|
|
16196
|
+
"prototype",
|
|
16197
|
+
"constructor"
|
|
16198
|
+
].includes(key)))) throw new Error("Invalid custom range property paths.");
|
|
16199
|
+
}
|
|
16200
|
+
function patchRangeProperties(target, source, paths) {
|
|
16201
|
+
validatePropertyPaths(paths);
|
|
16202
|
+
const result = Tools.deepClone(target);
|
|
16203
|
+
for (const path of paths) {
|
|
16204
|
+
let current = result.properties ??= {};
|
|
16205
|
+
let value = source.properties;
|
|
16206
|
+
const parents = [];
|
|
16207
|
+
for (let index = 0; index < path.length; index++) {
|
|
16208
|
+
const key = path[index];
|
|
16209
|
+
value = value && typeof value === "object" ? value[key] : void 0;
|
|
16210
|
+
if (index === path.length - 1) {
|
|
16211
|
+
if (value === void 0) delete current[key];
|
|
16212
|
+
else current[key] = Tools.deepClone(value);
|
|
16213
|
+
} else {
|
|
16214
|
+
if (!current[key] || typeof current[key] !== "object" || Array.isArray(current[key])) current[key] = {};
|
|
16215
|
+
parents.push({
|
|
16216
|
+
object: current,
|
|
16217
|
+
key,
|
|
16218
|
+
value
|
|
16219
|
+
});
|
|
16220
|
+
current = current[key];
|
|
16221
|
+
}
|
|
16222
|
+
}
|
|
16223
|
+
for (const parent of parents.reverse()) if (parent.value === void 0 && Object.keys(parent.object[parent.key]).length === 0) delete parent.object[parent.key];
|
|
16224
|
+
}
|
|
16225
|
+
if (source.properties === void 0 && !Object.keys(result.properties ?? {}).length) delete result.properties;
|
|
16226
|
+
return result;
|
|
16227
|
+
}
|
|
16228
|
+
function composeRangeUpdate(first, second) {
|
|
16229
|
+
if (!first || !second.propertyPaths || !second.range) return second;
|
|
16230
|
+
if (!first.range) return first;
|
|
16231
|
+
const propertyPaths = first.propertyPaths && [...first.propertyPaths, ...second.propertyPaths.filter((path) => !first.propertyPaths.some((parent) => parent.length <= path.length && parent.every((key, index) => path[index] === key)))];
|
|
16232
|
+
return {
|
|
16233
|
+
...first,
|
|
16234
|
+
range: patchRangeProperties(first.range, second.range, second.propertyPaths),
|
|
16235
|
+
propertyPaths
|
|
16236
|
+
};
|
|
16237
|
+
}
|
|
16238
|
+
function transformRangeUpdate(update, concurrent, priority) {
|
|
16239
|
+
if (!concurrent || !update.range) return [update];
|
|
16240
|
+
if (!concurrent.range) return [];
|
|
16241
|
+
if (!update.propertyPaths || !concurrent.propertyPaths) return priority === "left" ? [{
|
|
16242
|
+
...update,
|
|
16243
|
+
propertyPaths: void 0
|
|
16244
|
+
}] : [];
|
|
16245
|
+
const propertyPaths = update.propertyPaths.filter((path) => priority === "left" || !concurrent.propertyPaths.some((other) => path.slice(0, Math.min(path.length, other.length)).every((key, index) => other[index] === key))).map((path) => concurrent.propertyPaths.find((other) => other.length < path.length && other.every((key, index) => path[index] === key)) ?? path);
|
|
16246
|
+
return propertyPaths.length ? [{
|
|
16247
|
+
...update,
|
|
16248
|
+
propertyPaths
|
|
16249
|
+
}] : [];
|
|
16250
|
+
}
|
|
16251
|
+
function getRangeUpdates(actions) {
|
|
16252
|
+
const updates = /* @__PURE__ */ new Map();
|
|
16253
|
+
for (const action of actions) if (action.t === "r") for (const update of action.rangeUpdates ?? []) updates.set(update.rangeId, composeRangeUpdate(updates.get(update.rangeId), update));
|
|
16254
|
+
return updates.size ? Tools.deepClone(Array.from(updates.values())) : [];
|
|
16255
|
+
}
|
|
16256
|
+
function withoutRangeUpdates(actions) {
|
|
16257
|
+
return actions.flatMap((action) => {
|
|
16258
|
+
if (action.t === "i" && action.len > 1 && Array.from(action.body.dataStream).every((token) => token === "" || token === "")) return Array.from(action.body.dataStream, (_, index) => ({
|
|
16259
|
+
...action,
|
|
16260
|
+
len: 1,
|
|
16261
|
+
body: getBodySliceForSplitTextXAction(action.body, index, index + 1, false)
|
|
16262
|
+
}));
|
|
16263
|
+
if (action.t !== "r" || !action.rangeUpdates) return [action];
|
|
16264
|
+
const { rangeUpdates, oldRangeUpdates, ...textAction } = action;
|
|
16265
|
+
return textAction.len === 0 && !textAction.body ? [] : [textAction];
|
|
16266
|
+
});
|
|
16267
|
+
}
|
|
16268
|
+
function appendRangeUpdates(actions, updates) {
|
|
16269
|
+
return (updates === null || updates === void 0 ? void 0 : updates.length) ? [...actions, {
|
|
16270
|
+
t: "r",
|
|
16271
|
+
len: 0,
|
|
16272
|
+
rangeUpdates: updates
|
|
16273
|
+
}] : actions;
|
|
16274
|
+
}
|
|
16275
|
+
function validateRangeUpdates(updates, resultLength) {
|
|
16276
|
+
for (const { rangeId, range, nextRangeId, propertyPaths } of updates ?? []) {
|
|
16277
|
+
if (propertyPaths !== void 0) {
|
|
16278
|
+
validatePropertyPaths(propertyPaths);
|
|
16279
|
+
if (!range) throw new Error("Invalid custom range property paths.");
|
|
16280
|
+
}
|
|
16281
|
+
if (typeof rangeId !== "string" || !rangeId || nextRangeId !== void 0 && nextRangeId !== null && typeof nextRangeId !== "string" || range !== null && (range == null || typeof range !== "object" || Array.isArray(range) || range.rangeId !== rangeId || !Number.isInteger(range.startIndex) || !Number.isInteger(range.endIndex) || range.startIndex < 0 || range.endIndex < range.startIndex || range.endIndex >= resultLength)) throw new Error("Invalid custom range identity or bounds.");
|
|
16282
|
+
}
|
|
16283
|
+
}
|
|
16284
|
+
function applyRangeUpdates(doc, updates) {
|
|
16285
|
+
if (!(updates === null || updates === void 0 ? void 0 : updates.length)) return;
|
|
16286
|
+
const ranges = doc.customRanges ?? [];
|
|
16287
|
+
for (const { rangeId, range, nextRangeId, propertyPaths } of [...updates].reverse()) {
|
|
16288
|
+
const index = ranges.findIndex((item) => item.rangeId === rangeId);
|
|
16289
|
+
if (range && propertyPaths) {
|
|
16290
|
+
if (index >= 0) ranges[index] = patchRangeProperties(ranges[index], range, propertyPaths);
|
|
16291
|
+
continue;
|
|
16292
|
+
}
|
|
16293
|
+
if (range) {
|
|
16294
|
+
if (nextRangeId !== void 0) {
|
|
16295
|
+
if (index >= 0) ranges.splice(index, 1);
|
|
16296
|
+
const nextIndex = ranges.findIndex((item) => item.rangeId === nextRangeId);
|
|
16297
|
+
ranges.splice(nextIndex < 0 ? ranges.length : nextIndex, 0, Tools.deepClone(range));
|
|
16298
|
+
} else if (index >= 0) ranges[index] = Tools.deepClone(range);
|
|
16299
|
+
else ranges.push(Tools.deepClone(range));
|
|
16300
|
+
} else if (index >= 0) ranges.splice(index, 1);
|
|
16301
|
+
}
|
|
16302
|
+
doc.customRanges = ranges;
|
|
16303
|
+
}
|
|
16304
|
+
function moveRangeUpdates(updates, actions, preserveProperties = false) {
|
|
16305
|
+
return updates.map((update) => {
|
|
16306
|
+
var _body$customRanges;
|
|
16307
|
+
const { rangeId, range } = update;
|
|
16308
|
+
if (!range && preserveProperties) return update;
|
|
16309
|
+
const body = {
|
|
16310
|
+
dataStream: "",
|
|
16311
|
+
customRanges: range ? [Tools.deepClone(range)] : []
|
|
16312
|
+
};
|
|
16313
|
+
let offset = 0;
|
|
16314
|
+
for (const action of actions) {
|
|
16315
|
+
var _action$body;
|
|
16316
|
+
if (action.t === "i") {
|
|
16317
|
+
var _action$body$customRa;
|
|
16318
|
+
insertCustomRanges(body, {
|
|
16319
|
+
dataStream: "",
|
|
16320
|
+
customRanges: Tools.deepClone((_action$body$customRa = action.body.customRanges) === null || _action$body$customRa === void 0 ? void 0 : _action$body$customRa.filter((item) => item.rangeId === rangeId))
|
|
16321
|
+
}, action.len, offset);
|
|
16322
|
+
} else if (action.t === "d") {
|
|
16323
|
+
deleteCustomRanges(body, action.len, offset);
|
|
16324
|
+
continue;
|
|
16325
|
+
} else if ((_action$body = action.body) === null || _action$body === void 0 ? void 0 : _action$body.customRanges) updateAttribute(body, {
|
|
16326
|
+
dataStream: "",
|
|
16327
|
+
customRanges: Tools.deepClone(action.body.customRanges.filter((item) => item.rangeId === rangeId))
|
|
16328
|
+
}, action.len, offset, action.coverType ?? 0);
|
|
16329
|
+
offset += action.len;
|
|
16330
|
+
}
|
|
16331
|
+
const moved = (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.find((item) => item.rangeId === rangeId);
|
|
16332
|
+
return {
|
|
16333
|
+
...update,
|
|
16334
|
+
propertyPaths: moved ? update.propertyPaths : void 0,
|
|
16335
|
+
range: moved && range && preserveProperties ? {
|
|
16336
|
+
...Tools.deepClone(range),
|
|
16337
|
+
startIndex: moved.startIndex,
|
|
16338
|
+
endIndex: moved.endIndex
|
|
16339
|
+
} : moved ?? null
|
|
16340
|
+
};
|
|
16341
|
+
});
|
|
16342
|
+
}
|
|
16343
|
+
/** A concurrent metadata payload must not resurrect an explicitly removed identity. */
|
|
16344
|
+
function reconcileRangeUpdates(actions, updates) {
|
|
16345
|
+
const byId = new Map(updates === null || updates === void 0 ? void 0 : updates.map((update) => [update.rangeId, update]));
|
|
16346
|
+
if (!byId.size) return actions;
|
|
16347
|
+
return actions.map((action) => {
|
|
16348
|
+
var _action$body2;
|
|
16349
|
+
if (!((_action$body2 = action.body) === null || _action$body2 === void 0 ? void 0 : _action$body2.customRanges)) return action;
|
|
16350
|
+
return {
|
|
16351
|
+
...action,
|
|
16352
|
+
body: {
|
|
16353
|
+
...action.body,
|
|
16354
|
+
customRanges: action.body.customRanges.flatMap((range) => {
|
|
16355
|
+
if (!byId.has(range.rangeId)) return [range];
|
|
16356
|
+
const updated = byId.get(range.rangeId);
|
|
16357
|
+
if (!updated.range) return [];
|
|
16358
|
+
return [{
|
|
16359
|
+
...updated.propertyPaths ? patchRangeProperties(range, updated.range, updated.propertyPaths) : Tools.deepClone(updated.range),
|
|
16360
|
+
startIndex: range.startIndex,
|
|
16361
|
+
endIndex: range.endIndex
|
|
16362
|
+
}];
|
|
16363
|
+
})
|
|
16364
|
+
}
|
|
16365
|
+
};
|
|
16366
|
+
});
|
|
16367
|
+
}
|
|
16368
|
+
/** Dropping a concurrent restoration also drops its delimiters, not its text. */
|
|
16369
|
+
function dropRemovedRangeAnchors(actions, suppressed, updates) {
|
|
16370
|
+
if (!suppressed.length) return appendRangeUpdates(actions, updates);
|
|
16371
|
+
const kept = [];
|
|
16372
|
+
const removed = [];
|
|
16373
|
+
let offset = 0;
|
|
16374
|
+
let deletedEnd = 0;
|
|
16375
|
+
for (const action of actions) {
|
|
16376
|
+
var _action$body3;
|
|
16377
|
+
const token = (_action$body3 = action.body) === null || _action$body3 === void 0 ? void 0 : _action$body3.dataStream;
|
|
16378
|
+
if (action.t === "i" && action.len === 1 && suppressed.some((range) => token === "" && offset === range.startIndex || token === "" && offset === range.endIndex)) {
|
|
16379
|
+
if (offset > deletedEnd) removed.push({
|
|
16380
|
+
t: "r",
|
|
16381
|
+
len: offset - deletedEnd
|
|
16382
|
+
});
|
|
16383
|
+
removed.push({
|
|
16384
|
+
t: "d",
|
|
16385
|
+
len: 1
|
|
16386
|
+
});
|
|
16387
|
+
deletedEnd = offset + 1;
|
|
16388
|
+
} else kept.push(action);
|
|
16389
|
+
if (action.t !== "d") offset += action.len;
|
|
16390
|
+
}
|
|
16391
|
+
return appendRangeUpdates(kept, moveRangeUpdates(updates, removed));
|
|
16392
|
+
}
|
|
16393
|
+
|
|
16059
16394
|
//#endregion
|
|
16060
16395
|
//#region src/docs/data-model/text-x/apply.ts
|
|
16061
16396
|
function updateApply(doc, updateBody, textLength, currentIndex, coverType = 0) {
|
|
@@ -16070,6 +16405,16 @@ function insertApply(doc, insertBody, textLength, currentIndex) {
|
|
|
16070
16405
|
updateAttributeByInsert(doc, insertBody, textLength, currentIndex);
|
|
16071
16406
|
}
|
|
16072
16407
|
function textXApply(doc, actions) {
|
|
16408
|
+
if (actions.some((action) => action.t !== "r" && action.valueRangeId !== void 0 && (typeof action.valueRangeId !== "string" || !action.valueRangeId))) throw new Error("Invalid scalar value range identity.");
|
|
16409
|
+
const updates = getRangeUpdates(actions);
|
|
16410
|
+
if (updates.length) {
|
|
16411
|
+
const resultLength = actions.reduce((length, action) => {
|
|
16412
|
+
if (action.t === "i") return length + action.len;
|
|
16413
|
+
if (action.t === "d") return length - action.len;
|
|
16414
|
+
return length;
|
|
16415
|
+
}, doc.dataStream.length);
|
|
16416
|
+
validateRangeUpdates(updates, resultLength);
|
|
16417
|
+
}
|
|
16073
16418
|
const memoryCursor = new MemoryCursor();
|
|
16074
16419
|
memoryCursor.reset();
|
|
16075
16420
|
actions.forEach((action) => {
|
|
@@ -16094,6 +16439,7 @@ function textXApply(doc, actions) {
|
|
|
16094
16439
|
default: throw new Error(`Unknown action type for action: ${action}.`);
|
|
16095
16440
|
}
|
|
16096
16441
|
});
|
|
16442
|
+
applyRangeUpdates(doc, updates);
|
|
16097
16443
|
return doc;
|
|
16098
16444
|
}
|
|
16099
16445
|
function onlyHasDataStream$1(body) {
|
|
@@ -16188,8 +16534,10 @@ function transformTextRuns(originTextRuns, targetTextRuns, originCoverType, targ
|
|
|
16188
16534
|
const tempTopTextRun = newUpdateTextRuns[newUpdateTextRuns.length - 1];
|
|
16189
16535
|
const updateLastTextRun = targetTextRuns[updateLength - 1];
|
|
16190
16536
|
const removeLastTextRun = originTextRuns[removeLength - 1];
|
|
16191
|
-
if (tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed))
|
|
16192
|
-
|
|
16537
|
+
if (tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed)) {
|
|
16538
|
+
if (updateLastTextRun.ed > removeLastTextRun.ed) newUpdateTextRuns.push(updateLastTextRun);
|
|
16539
|
+
else newUpdateTextRuns.push(removeLastTextRun);
|
|
16540
|
+
}
|
|
16193
16541
|
return normalizeTextRuns(newUpdateTextRuns, true);
|
|
16194
16542
|
}
|
|
16195
16543
|
function transformCustomRanges(originCustomRanges, targetCustomRanges, originCoverType, targetCoverType, transformType) {
|
|
@@ -16217,23 +16565,25 @@ function transformParagraph(originParagraph, targetParagraph, originCoverType, t
|
|
|
16217
16565
|
if (targetParagraph.paragraphStyle) {
|
|
16218
16566
|
paragraph.paragraphStyle = Tools.deepClone(targetParagraph.paragraphStyle);
|
|
16219
16567
|
if (originParagraph.paragraphStyle) {
|
|
16220
|
-
if (originCoverType === 1)
|
|
16221
|
-
if (
|
|
16568
|
+
if (originCoverType === 1) {
|
|
16569
|
+
if (targetCoverType === 1) {
|
|
16570
|
+
if (transformType === 1) paragraph.paragraphStyle = { ...originParagraph.paragraphStyle };
|
|
16571
|
+
} else if (transformType === 1) {
|
|
16572
|
+
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
16573
|
+
for (const key of keys) if (originParagraph.paragraphStyle[key] !== void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
16574
|
+
} else {
|
|
16575
|
+
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
16576
|
+
for (const key of keys) if (paragraph.paragraphStyle[key] === void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
16577
|
+
}
|
|
16578
|
+
} else if (targetCoverType === 1) {
|
|
16579
|
+
if (transformType === 1) {
|
|
16580
|
+
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
16581
|
+
for (const key of keys) if (originParagraph.paragraphStyle[key] !== void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
16582
|
+
} else {
|
|
16583
|
+
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
16584
|
+
for (const key of keys) if (paragraph.paragraphStyle[key] === void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
16585
|
+
}
|
|
16222
16586
|
} else if (transformType === 1) {
|
|
16223
|
-
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
16224
|
-
for (const key of keys) if (originParagraph.paragraphStyle[key] !== void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
16225
|
-
} else {
|
|
16226
|
-
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
16227
|
-
for (const key of keys) if (paragraph.paragraphStyle[key] === void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
16228
|
-
}
|
|
16229
|
-
else if (targetCoverType === 1) if (transformType === 1) {
|
|
16230
|
-
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
16231
|
-
for (const key of keys) if (originParagraph.paragraphStyle[key] !== void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
16232
|
-
} else {
|
|
16233
|
-
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
16234
|
-
for (const key of keys) if (paragraph.paragraphStyle[key] === void 0) paragraph.paragraphStyle[key] = originParagraph.paragraphStyle[key];
|
|
16235
|
-
}
|
|
16236
|
-
else if (transformType === 1) {
|
|
16237
16587
|
const keys = Object.keys(originParagraph.paragraphStyle);
|
|
16238
16588
|
for (const key of keys) if (paragraph.paragraphStyle[key]) delete paragraph.paragraphStyle[key];
|
|
16239
16589
|
}
|
|
@@ -16328,6 +16678,33 @@ function transformBlockRanges(thisBlockRanges, otherBlockRanges, priority) {
|
|
|
16328
16678
|
function onlyHasDataStream(body) {
|
|
16329
16679
|
return Object.keys(body).length === 1;
|
|
16330
16680
|
}
|
|
16681
|
+
function getValueRangeIds(actions) {
|
|
16682
|
+
return new Set(actions.flatMap((action) => action.t !== "r" && action.valueRangeId ? [action.valueRangeId] : []));
|
|
16683
|
+
}
|
|
16684
|
+
function withoutValueRangeMetadata(actions, suppressed) {
|
|
16685
|
+
return actions.map((action) => {
|
|
16686
|
+
var _action$body, _body$customRanges;
|
|
16687
|
+
if (!((_action$body = action.body) === null || _action$body === void 0 || (_action$body = _action$body.customRanges) === null || _action$body === void 0 ? void 0 : _action$body.some((range) => suppressed.has(range.rangeId)))) return action;
|
|
16688
|
+
const body = {
|
|
16689
|
+
...action.body,
|
|
16690
|
+
customRanges: action.body.customRanges.filter((range) => !suppressed.has(range.rangeId))
|
|
16691
|
+
};
|
|
16692
|
+
if (!((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.length)) delete body.customRanges;
|
|
16693
|
+
return {
|
|
16694
|
+
...action,
|
|
16695
|
+
body
|
|
16696
|
+
};
|
|
16697
|
+
});
|
|
16698
|
+
}
|
|
16699
|
+
function insertedAnchorPriority(first, second, priority) {
|
|
16700
|
+
if ((first === null || first === void 0 ? void 0 : first.t) !== "i" || (second === null || second === void 0 ? void 0 : second.t) !== "i") return priority === "left";
|
|
16701
|
+
const firstText = first.body.dataStream;
|
|
16702
|
+
const secondText = second.body.dataStream;
|
|
16703
|
+
if (firstText === secondText) return priority === "left";
|
|
16704
|
+
if (firstText === "" || secondText === "") return true;
|
|
16705
|
+
if (firstText === "" || secondText === "") return false;
|
|
16706
|
+
return priority === "left";
|
|
16707
|
+
}
|
|
16331
16708
|
function normalizeInsertActionParagraphIds(body, doc, currentIndex, reservedParagraphIds) {
|
|
16332
16709
|
normalizeInsertedParagraphIdsForDocument(doc.paragraphs, body.paragraphs, currentIndex, {
|
|
16333
16710
|
freshenSplitParagraph: false,
|
|
@@ -16344,6 +16721,15 @@ var TextX = class TextX {
|
|
|
16344
16721
|
return textXApply(doc, actions);
|
|
16345
16722
|
}
|
|
16346
16723
|
static compose(thisActions, otherActions) {
|
|
16724
|
+
const thisUpdates = getRangeUpdates(thisActions);
|
|
16725
|
+
const otherUpdates = getRangeUpdates(otherActions);
|
|
16726
|
+
if (thisUpdates.length || otherUpdates.length) {
|
|
16727
|
+
const thisText = withoutRangeUpdates(thisActions);
|
|
16728
|
+
const otherText = withoutRangeUpdates(otherActions);
|
|
16729
|
+
const updates = new Map(moveRangeUpdates(thisUpdates, otherText).map((update) => [update.rangeId, update]));
|
|
16730
|
+
for (const update of otherUpdates) updates.set(update.rangeId, composeRangeUpdate(updates.get(update.rangeId), update));
|
|
16731
|
+
return appendRangeUpdates(TextX.compose(thisText, otherText), Array.from(updates.values()));
|
|
16732
|
+
}
|
|
16347
16733
|
const thisIter = new ActionIterator(thisActions);
|
|
16348
16734
|
const otherIter = new ActionIterator(otherActions);
|
|
16349
16735
|
const textX = new TextX();
|
|
@@ -16353,22 +16739,24 @@ var TextX = class TextX {
|
|
|
16353
16739
|
const length = Math.min(thisIter.peekLength(), otherIter.peekLength());
|
|
16354
16740
|
const thisAction = thisIter.next(length);
|
|
16355
16741
|
const otherAction = otherIter.next(length);
|
|
16356
|
-
if (thisAction.t === "i" && otherAction.t === "r")
|
|
16357
|
-
|
|
16358
|
-
|
|
16359
|
-
body: composeBody(thisAction.body, otherAction.body, otherAction.coverType)
|
|
16360
|
-
});
|
|
16361
|
-
else if (thisAction.t === "r" && otherAction.t === "r") if (thisAction.body == null && otherAction.body == null) textX.push(thisAction.len !== Number.POSITIVE_INFINITY ? thisAction : otherAction);
|
|
16362
|
-
else if (thisAction.body && otherAction.body) {
|
|
16363
|
-
const coverType = thisAction.coverType === 1 || otherAction.coverType === 1 ? 1 : 0;
|
|
16364
|
-
textX.push({
|
|
16742
|
+
if (thisAction.t === "i" && otherAction.t === "r") {
|
|
16743
|
+
if (otherAction.body == null) textX.push(thisAction);
|
|
16744
|
+
else textX.push({
|
|
16365
16745
|
...thisAction,
|
|
16366
|
-
t: "r",
|
|
16367
|
-
coverType,
|
|
16368
16746
|
body: composeBody(thisAction.body, otherAction.body, otherAction.coverType)
|
|
16369
16747
|
});
|
|
16370
|
-
} else
|
|
16371
|
-
|
|
16748
|
+
} else if (thisAction.t === "r" && otherAction.t === "r") {
|
|
16749
|
+
if (thisAction.body == null && otherAction.body == null) textX.push(thisAction.len !== Number.POSITIVE_INFINITY ? thisAction : otherAction);
|
|
16750
|
+
else if (thisAction.body && otherAction.body) {
|
|
16751
|
+
const coverType = thisAction.coverType === 1 || otherAction.coverType === 1 ? 1 : 0;
|
|
16752
|
+
textX.push({
|
|
16753
|
+
...thisAction,
|
|
16754
|
+
t: "r",
|
|
16755
|
+
coverType,
|
|
16756
|
+
body: composeBody(thisAction.body, otherAction.body, otherAction.coverType)
|
|
16757
|
+
});
|
|
16758
|
+
} else textX.push(thisAction.body ? thisAction : otherAction);
|
|
16759
|
+
} else if (thisAction.t === "r" && otherAction.t === "d") textX.push(otherAction);
|
|
16372
16760
|
else if (thisAction.t === "i" && otherAction.t === "d") {}
|
|
16373
16761
|
}
|
|
16374
16762
|
textX.trimEndUselessRetainAction();
|
|
@@ -16399,17 +16787,37 @@ var TextX = class TextX {
|
|
|
16399
16787
|
* 2) If the other body property exists, then execute the TransformBody logic to override it
|
|
16400
16788
|
*/
|
|
16401
16789
|
static transform(thisActions, otherActions, priority = "right") {
|
|
16790
|
+
const thisUpdates = getRangeUpdates(thisActions);
|
|
16791
|
+
const otherUpdates = getRangeUpdates(otherActions);
|
|
16792
|
+
if (thisUpdates.length || otherUpdates.length) {
|
|
16793
|
+
const thisText = withoutRangeUpdates(thisActions);
|
|
16794
|
+
const otherText = withoutRangeUpdates(otherActions);
|
|
16795
|
+
const otherAfterThis = TextX._transform(thisText, otherText, priority, true);
|
|
16796
|
+
const movedUpdates = moveRangeUpdates(thisUpdates, otherAfterThis, true);
|
|
16797
|
+
const updates = movedUpdates.flatMap((update) => transformRangeUpdate(update, otherUpdates.find((item) => item.rangeId === update.rangeId), priority));
|
|
16798
|
+
const suppressed = movedUpdates.flatMap((update) => update.range && otherUpdates.some((other) => other.rangeId === update.rangeId && !other.range) ? [update.range] : []);
|
|
16799
|
+
return dropRemovedRangeAnchors(reconcileRangeUpdates(TextX._transform(otherText, thisText, priority === "left" ? "right" : "left", true), otherUpdates), suppressed, updates);
|
|
16800
|
+
}
|
|
16402
16801
|
return this._transform(otherActions, thisActions, priority === "left" ? "right" : "left");
|
|
16403
16802
|
}
|
|
16404
|
-
static _transform(thisActions, otherActions, priority = "right") {
|
|
16405
|
-
const
|
|
16406
|
-
const
|
|
16803
|
+
static _transform(thisActions, otherActions, priority = "right", rangeAnchorAffinity = false) {
|
|
16804
|
+
const thisValues = getValueRangeIds(thisActions);
|
|
16805
|
+
const conflicts = new Set(Array.from(getValueRangeIds(otherActions)).filter((id) => thisValues.has(id)));
|
|
16806
|
+
const thisIter = new ActionIterator(conflicts.size && priority === "right" ? withoutValueRangeMetadata(thisActions, conflicts) : thisActions);
|
|
16807
|
+
const otherIter = new ActionIterator(conflicts.size && priority === "left" ? withoutValueRangeMetadata(otherActions, conflicts) : otherActions);
|
|
16407
16808
|
const textX = new TextX();
|
|
16408
|
-
while (thisIter.hasNext() || otherIter.hasNext()) if (thisIter.peekType() === "i" && (priority === "left" || otherIter.peekType() !== "i")) {
|
|
16809
|
+
while (thisIter.hasNext() || otherIter.hasNext()) if (thisIter.peekType() === "i" && ((rangeAnchorAffinity ? insertedAnchorPriority(thisIter.peek(), otherIter.peek(), priority) : priority === "left") || otherIter.peekType() !== "i")) {
|
|
16409
16810
|
const thisAction = thisIter.next();
|
|
16410
|
-
|
|
16411
|
-
|
|
16412
|
-
|
|
16811
|
+
if (thisAction.t === "i" && thisAction.valueRangeId && conflicts.has(thisAction.valueRangeId) && priority === "right") textX.push({
|
|
16812
|
+
t: "d",
|
|
16813
|
+
len: thisAction.len,
|
|
16814
|
+
valueRangeId: thisAction.valueRangeId
|
|
16815
|
+
});
|
|
16816
|
+
else textX.retain(thisAction.len);
|
|
16817
|
+
} else if (otherIter.peekType() === "i") {
|
|
16818
|
+
const otherAction = otherIter.next();
|
|
16819
|
+
if (otherAction.t !== "i" || !otherAction.valueRangeId || !conflicts.has(otherAction.valueRangeId) || priority !== "left") textX.push(otherAction);
|
|
16820
|
+
} else {
|
|
16413
16821
|
const length = Math.min(thisIter.peekLength(), otherIter.peekLength());
|
|
16414
16822
|
const thisAction = thisIter.next(length);
|
|
16415
16823
|
const otherAction = otherIter.next(length);
|
|
@@ -16455,11 +16863,20 @@ var TextX = class TextX {
|
|
|
16455
16863
|
return actions.length === 0;
|
|
16456
16864
|
}
|
|
16457
16865
|
static invert(actions) {
|
|
16866
|
+
if (getRangeUpdates(actions).length) {
|
|
16867
|
+
const restored = actions.flatMap((action) => {
|
|
16868
|
+
if (action.t !== "r" || !action.rangeUpdates) return [];
|
|
16869
|
+
if (!action.oldRangeUpdates) throw new Error("makeInvertible must capture custom ranges before inversion.");
|
|
16870
|
+
return action.oldRangeUpdates;
|
|
16871
|
+
});
|
|
16872
|
+
return appendRangeUpdates(TextX.invert(withoutRangeUpdates(actions)), Tools.deepClone(restored));
|
|
16873
|
+
}
|
|
16458
16874
|
const invertedActions = [];
|
|
16459
16875
|
for (const action of actions) if (action.t === "i") invertedActions.push({
|
|
16460
16876
|
t: "d",
|
|
16461
16877
|
len: action.len,
|
|
16462
|
-
body: action.body
|
|
16878
|
+
body: action.body,
|
|
16879
|
+
valueRangeId: action.valueRangeId
|
|
16463
16880
|
});
|
|
16464
16881
|
else if (action.t === "d") {
|
|
16465
16882
|
var _action$body$paragrap;
|
|
@@ -16471,7 +16888,8 @@ var TextX = class TextX {
|
|
|
16471
16888
|
invertedActions.push({
|
|
16472
16889
|
t: "i",
|
|
16473
16890
|
body: action.body,
|
|
16474
|
-
len: action.len
|
|
16891
|
+
len: action.len,
|
|
16892
|
+
valueRangeId: action.valueRangeId
|
|
16475
16893
|
});
|
|
16476
16894
|
} else if (action.body != null) {
|
|
16477
16895
|
if (action.oldBody == null) throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");
|
|
@@ -16491,6 +16909,16 @@ var TextX = class TextX {
|
|
|
16491
16909
|
const reservedParagraphIds = /* @__PURE__ */ new Set();
|
|
16492
16910
|
const reservedSectionIds = /* @__PURE__ */ new Set();
|
|
16493
16911
|
for (const action of actions) {
|
|
16912
|
+
if (action.t === "r" && action.rangeUpdates) action.oldRangeUpdates = action.rangeUpdates.map(({ rangeId, propertyPaths }) => {
|
|
16913
|
+
var _doc$customRanges, _ref;
|
|
16914
|
+
const index = ((_doc$customRanges = doc.customRanges) === null || _doc$customRanges === void 0 ? void 0 : _doc$customRanges.findIndex((range) => range.rangeId === rangeId)) ?? -1;
|
|
16915
|
+
return {
|
|
16916
|
+
rangeId,
|
|
16917
|
+
range: index < 0 ? null : Tools.deepClone(doc.customRanges[index]),
|
|
16918
|
+
nextRangeId: index < 0 ? void 0 : ((_ref = doc.customRanges[index + 1]) === null || _ref === void 0 ? void 0 : _ref.rangeId) ?? null,
|
|
16919
|
+
propertyPaths: index < 0 ? void 0 : propertyPaths
|
|
16920
|
+
};
|
|
16921
|
+
});
|
|
16494
16922
|
if (action.t === "i") {
|
|
16495
16923
|
normalizeInsertActionParagraphIds(action.body, doc, index, reservedParagraphIds);
|
|
16496
16924
|
normalizeInsertedSectionIdsForDocument(doc.sectionBreaks, action.body.sectionBreaks, reservedSectionIds);
|
|
@@ -16507,6 +16935,19 @@ var TextX = class TextX {
|
|
|
16507
16935
|
"columnGroups",
|
|
16508
16936
|
"blockRanges"
|
|
16509
16937
|
]) if (action.body[field] == null) delete body[field];
|
|
16938
|
+
if (action.body.paragraphs == null) delete body.paragraphs;
|
|
16939
|
+
else {
|
|
16940
|
+
var _body$paragraphs;
|
|
16941
|
+
const previousParagraphs = new Map((_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 ? void 0 : _body$paragraphs.map((paragraph) => [paragraph.startIndex, paragraph]));
|
|
16942
|
+
action.body.paragraphs = action.body.paragraphs.map((paragraph) => {
|
|
16943
|
+
const previous = previousParagraphs.get(paragraph.startIndex);
|
|
16944
|
+
if (!previous || paragraph.paragraphId != null && paragraph.paragraphId !== previous.paragraphId) return paragraph;
|
|
16945
|
+
const formatting = { ...paragraph };
|
|
16946
|
+
Reflect.deleteProperty(formatting, "paragraphId");
|
|
16947
|
+
Reflect.deleteProperty(previous, "paragraphId");
|
|
16948
|
+
return formatting;
|
|
16949
|
+
});
|
|
16950
|
+
}
|
|
16510
16951
|
action.oldBody = {
|
|
16511
16952
|
...body,
|
|
16512
16953
|
dataStream: ""
|
|
@@ -16518,6 +16959,28 @@ var TextX = class TextX {
|
|
|
16518
16959
|
}
|
|
16519
16960
|
return invertibleActions;
|
|
16520
16961
|
}
|
|
16962
|
+
/** Edits only changed property leaves; does not replace range identity, bounds or peer properties. */
|
|
16963
|
+
updateCustomRangeProperties(range, properties) {
|
|
16964
|
+
const propertyPaths = getChangedPropertyPaths(range.properties ?? {}, properties);
|
|
16965
|
+
if (propertyPaths.length) this.updateCustomRanges([{
|
|
16966
|
+
rangeId: range.rangeId,
|
|
16967
|
+
range: {
|
|
16968
|
+
...range,
|
|
16969
|
+
properties
|
|
16970
|
+
},
|
|
16971
|
+
propertyPaths
|
|
16972
|
+
}]);
|
|
16973
|
+
return this;
|
|
16974
|
+
}
|
|
16975
|
+
/** Updates identities after all text edits; range positions refer to the resulting document. */
|
|
16976
|
+
updateCustomRanges(updates) {
|
|
16977
|
+
this.push({
|
|
16978
|
+
t: "r",
|
|
16979
|
+
len: 0,
|
|
16980
|
+
rangeUpdates: updates
|
|
16981
|
+
});
|
|
16982
|
+
return this;
|
|
16983
|
+
}
|
|
16521
16984
|
insert(len, body) {
|
|
16522
16985
|
const insertAction = {
|
|
16523
16986
|
t: "i",
|
|
@@ -16560,9 +17023,9 @@ var TextX = class TextX {
|
|
|
16560
17023
|
let index = this._actions.length;
|
|
16561
17024
|
let lastAction = this._actions[index - 1];
|
|
16562
17025
|
const newAction = Tools.deepClone(args[0]);
|
|
16563
|
-
if (newAction.t === "r" && newAction.len === 0 && newAction.body == null) return this;
|
|
17026
|
+
if (newAction.t === "r" && newAction.len === 0 && newAction.body == null && !newAction.rangeUpdates) return this;
|
|
16564
17027
|
if (typeof lastAction === "object") {
|
|
16565
|
-
if (lastAction.t === "d" && newAction.t === "d") {
|
|
17028
|
+
if (lastAction.t === "d" && newAction.t === "d" && lastAction.valueRangeId === newAction.valueRangeId) {
|
|
16566
17029
|
lastAction.len += newAction.len;
|
|
16567
17030
|
return this;
|
|
16568
17031
|
}
|
|
@@ -16574,11 +17037,11 @@ var TextX = class TextX {
|
|
|
16574
17037
|
return this;
|
|
16575
17038
|
}
|
|
16576
17039
|
}
|
|
16577
|
-
if (lastAction.t === "r" && newAction.t === "r" && lastAction.body == null && newAction.body == null) {
|
|
17040
|
+
if (lastAction.t === "r" && newAction.t === "r" && lastAction.body == null && newAction.body == null && !lastAction.rangeUpdates && !newAction.rangeUpdates) {
|
|
16578
17041
|
lastAction.len += newAction.len;
|
|
16579
17042
|
return this;
|
|
16580
17043
|
}
|
|
16581
|
-
if (lastAction.t === "i" && onlyHasDataStream(lastAction.body) && newAction.t === "i" && onlyHasDataStream(newAction.body)) {
|
|
17044
|
+
if (lastAction.t === "i" && onlyHasDataStream(lastAction.body) && newAction.t === "i" && onlyHasDataStream(newAction.body) && lastAction.valueRangeId === newAction.valueRangeId) {
|
|
16582
17045
|
lastAction.len += newAction.len;
|
|
16583
17046
|
lastAction.body.dataStream += newAction.body.dataStream;
|
|
16584
17047
|
return this;
|
|
@@ -17379,8 +17842,10 @@ function mergeSelections(selections) {
|
|
|
17379
17842
|
}
|
|
17380
17843
|
function isIntervalCoveredBySelections(interval, selections, body, implicitTokens) {
|
|
17381
17844
|
let cursor = interval.startOffset;
|
|
17845
|
+
let intersectsSelection = false;
|
|
17382
17846
|
for (const selection of selections) {
|
|
17383
17847
|
if (selection.endOffset <= cursor || selection.startOffset >= interval.endOffset) continue;
|
|
17848
|
+
intersectsSelection = true;
|
|
17384
17849
|
const selectionStart = Math.max(selection.startOffset, interval.startOffset);
|
|
17385
17850
|
const selectionEnd = Math.min(selection.endOffset, interval.endOffset);
|
|
17386
17851
|
for (let offset = cursor; offset < selectionStart; offset++) if (!implicitTokens.has(body.dataStream[offset])) return false;
|
|
@@ -17388,7 +17853,7 @@ function isIntervalCoveredBySelections(interval, selections, body, implicitToken
|
|
|
17388
17853
|
if (cursor >= interval.endOffset) return true;
|
|
17389
17854
|
}
|
|
17390
17855
|
for (let offset = cursor; offset < interval.endOffset; offset++) if (!implicitTokens.has(body.dataStream[offset])) return false;
|
|
17391
|
-
return
|
|
17856
|
+
return intersectsSelection;
|
|
17392
17857
|
}
|
|
17393
17858
|
function addCoveredIntervals(selections, intervals, body, implicitTokens) {
|
|
17394
17859
|
const expanded = [...selections];
|
|
@@ -17575,13 +18040,14 @@ function normalizeSelectionsForStructuralSentinels(selections, body, insertBody)
|
|
|
17575
18040
|
collapsed: true
|
|
17576
18041
|
}];
|
|
17577
18042
|
}
|
|
17578
|
-
function deleteSelectionTextX(selections, body, memoryCursor = 0, insertBody = null, keepBullet = true) {
|
|
18043
|
+
function deleteSelectionTextX(selections, body, memoryCursor = 0, insertBody = null, keepBullet = true, documentFlavor) {
|
|
17579
18044
|
const normalizedSelections = normalizeSelectionsForStructuralSentinels([...selections].sort((a, b) => a.startOffset - b.startOffset), body, insertBody);
|
|
17580
18045
|
const dos = [];
|
|
17581
18046
|
const { paragraphs = [] } = body;
|
|
17582
18047
|
const paragraphInRange = paragraphs === null || paragraphs === void 0 ? void 0 : paragraphs.find((p) => p.startIndex >= normalizedSelections[0].startOffset && p.startIndex < normalizedSelections[0].endOffset);
|
|
17583
18048
|
let cursor = memoryCursor;
|
|
17584
18049
|
normalizedSelections.forEach((selection) => {
|
|
18050
|
+
var _emptiedParagraph$par;
|
|
17585
18051
|
const { startOffset, endOffset } = selection;
|
|
17586
18052
|
if (startOffset > cursor) {
|
|
17587
18053
|
dos.push({
|
|
@@ -17597,6 +18063,25 @@ function deleteSelectionTextX(selections, body, memoryCursor = 0, insertBody = n
|
|
|
17597
18063
|
});
|
|
17598
18064
|
cursor = endOffset;
|
|
17599
18065
|
}
|
|
18066
|
+
const emptiedParagraph = documentFlavor === 2 && normalizedSelections.length === 1 && !insertBody && startOffset < endOffset ? paragraphs.find((paragraph) => paragraph.startIndex === endOffset && getParagraphContentStartOffset(body, paragraph) === startOffset) : void 0;
|
|
18067
|
+
if (emptiedParagraph && ((_emptiedParagraph$par = emptiedParagraph.paragraphStyle) === null || _emptiedParagraph$par === void 0 ? void 0 : _emptiedParagraph$par.paragraphMarkTextStyle) == null) {
|
|
18068
|
+
var _body$textRuns;
|
|
18069
|
+
const textStyle = ((_body$textRuns = body.textRuns) === null || _body$textRuns === void 0 || (_body$textRuns = _body$textRuns.find((run) => run.st <= startOffset && run.ed > startOffset)) === null || _body$textRuns === void 0 ? void 0 : _body$textRuns.ts) ?? {};
|
|
18070
|
+
dos.push({
|
|
18071
|
+
t: "r",
|
|
18072
|
+
len: 1,
|
|
18073
|
+
body: {
|
|
18074
|
+
dataStream: "",
|
|
18075
|
+
textRuns: [{
|
|
18076
|
+
st: 0,
|
|
18077
|
+
ed: 1,
|
|
18078
|
+
ts: { ...textStyle }
|
|
18079
|
+
}]
|
|
18080
|
+
},
|
|
18081
|
+
coverType: 1
|
|
18082
|
+
});
|
|
18083
|
+
cursor++;
|
|
18084
|
+
}
|
|
17600
18085
|
});
|
|
17601
18086
|
if (insertBody) dos.push({
|
|
17602
18087
|
t: "i",
|
|
@@ -17800,7 +18285,13 @@ function removeDrawingReferences(documentData, selections, body = documentData.b
|
|
|
17800
18285
|
const prefix = footnote ? ["notes", segmentId] : [];
|
|
17801
18286
|
const drawings = source.drawings ?? {};
|
|
17802
18287
|
const drawingOrder = source.drawingsOrder ?? [];
|
|
17803
|
-
const
|
|
18288
|
+
const removedIds = new Set(getCustomBlockIdsInSelections(body, selections));
|
|
18289
|
+
let previousSize = -1;
|
|
18290
|
+
while (previousSize !== removedIds.size) {
|
|
18291
|
+
previousSize = removedIds.size;
|
|
18292
|
+
for (const drawing of Object.values(drawings)) if (drawing.groupId && removedIds.has(drawing.groupId)) removedIds.add(drawing.drawingId);
|
|
18293
|
+
}
|
|
18294
|
+
const blockIds = [...removedIds].sort((left, right) => drawingOrder.indexOf(right) - drawingOrder.indexOf(left));
|
|
17804
18295
|
const jsonX = JSONX.getInstance();
|
|
17805
18296
|
const actions = [];
|
|
17806
18297
|
for (const blockId of blockIds) {
|
|
@@ -20670,14 +21161,16 @@ function scanDocumentStructuralTokens(dataStream) {
|
|
|
20670
21161
|
function validateTableMetadata(body, scan, issues, context) {
|
|
20671
21162
|
const pairedTables = scan.tableRanges.pairs;
|
|
20672
21163
|
const metadataStarts = /* @__PURE__ */ new Set();
|
|
20673
|
-
|
|
21164
|
+
const parents = [];
|
|
20674
21165
|
const tables = sortStructuralRanges(body.tables ?? []);
|
|
20675
21166
|
for (const table of tables) {
|
|
20676
21167
|
metadataStarts.add(table.startIndex);
|
|
20677
21168
|
if (!Number.isInteger(table.startIndex) || body.dataStream[table.startIndex] !== "") issues.push(createIssue(context, "table-start-token-mismatch", "Table startIndex must point to a table start sentinel.", table.startIndex));
|
|
20678
21169
|
if (!Number.isInteger(table.endIndex) || table.endIndex <= table.startIndex || table.endIndex > body.dataStream.length || body.dataStream[table.endIndex - 1] !== "" || pairedTables.get(table.startIndex) !== table.endIndex) issues.push(createIssue(context, "table-end-token-mismatch", "Table endIndex must be the exclusive boundary immediately after a table end sentinel.", table.endIndex));
|
|
20679
|
-
|
|
20680
|
-
|
|
21170
|
+
while (parents.length > 0 && parents[parents.length - 1].endIndex <= table.startIndex) parents.pop();
|
|
21171
|
+
const parent = parents[parents.length - 1];
|
|
21172
|
+
if (parent && (table.startIndex === parent.startIndex || table.endIndex >= parent.endIndex)) issues.push(createIssue(context, "overlapping-table", "Table ranges may nest but must not cross or duplicate.", table.startIndex));
|
|
21173
|
+
parents.push(table);
|
|
20681
21174
|
}
|
|
20682
21175
|
for (const startIndex of pairedTables.keys()) if (!metadataStarts.has(startIndex)) issues.push(createIssue(context, "missing-table-metadata", "Table token range must have a table metadata entry.", startIndex));
|
|
20683
21176
|
}
|
|
@@ -20738,14 +21231,13 @@ function validateStructuralContainers(body, issues, context) {
|
|
|
20738
21231
|
const columnGroupStack = [];
|
|
20739
21232
|
const columnStack = [];
|
|
20740
21233
|
const tableStack = [];
|
|
20741
|
-
const tableRowStack = [];
|
|
20742
|
-
const tableCellStack = [];
|
|
20743
21234
|
const tokenPattern = new RegExp(DOCUMENT_STRUCTURAL_TOKEN_PATTERN_SOURCE, "g");
|
|
20744
21235
|
for (const match of body.dataStream.matchAll(tokenPattern)) {
|
|
20745
21236
|
const i = match.index;
|
|
20746
21237
|
const char = match[0];
|
|
20747
21238
|
const column = columnStack[columnStack.length - 1];
|
|
20748
|
-
const
|
|
21239
|
+
const table = tableStack[tableStack.length - 1];
|
|
21240
|
+
const cell = table === null || table === void 0 ? void 0 : table.cell;
|
|
20749
21241
|
if (char === "\r") {
|
|
20750
21242
|
if (column) column.hasChild = true;
|
|
20751
21243
|
if (cell) cell.hasParagraph = true;
|
|
@@ -20761,33 +21253,69 @@ function validateStructuralContainers(body, issues, context) {
|
|
|
20761
21253
|
const closedColumn = columnStack.pop();
|
|
20762
21254
|
if (!closedColumn) issues.push(createIssue(context, "unbalanced-column-group", "Column end token has no matching column start.", i));
|
|
20763
21255
|
else if (!closedColumn.hasChild) issues.push(createIssue(context, "empty-column", "Column must contain at least one paragraph or section child.", closedColumn.startIndex));
|
|
20764
|
-
} else if (char === "")
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
else if (char === "
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
|
|
20773
|
-
|
|
20774
|
-
|
|
20775
|
-
else if (char === "
|
|
20776
|
-
|
|
20777
|
-
if (
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20781
|
-
|
|
20782
|
-
} else
|
|
20783
|
-
|
|
20784
|
-
issues.push(createIssue(context, "
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
21256
|
+
} else if (char === "") {
|
|
21257
|
+
if (columnStack.length > 0 || columnGroupStack.length === 0) {
|
|
21258
|
+
issues.push(createIssue(context, "unbalanced-column-group", "Column group closes while a column is still open.", i));
|
|
21259
|
+
columnStack.length = 0;
|
|
21260
|
+
} else columnGroupStack.pop();
|
|
21261
|
+
} else if (char === "") {
|
|
21262
|
+
if (table && !cell) issues.push(createIssue(context, "unbalanced-table", "Nested table must be inside a parent cell.", i));
|
|
21263
|
+
tableStack.push({ inRow: false });
|
|
21264
|
+
} else if (char === "\x1B") {
|
|
21265
|
+
if (!table || table.inRow) issues.push(createIssue(context, "unbalanced-table", "Table row must start inside a table without an open row.", i));
|
|
21266
|
+
if (table) table.inRow = true;
|
|
21267
|
+
} else if (char === "") {
|
|
21268
|
+
if (!(table === null || table === void 0 ? void 0 : table.inRow) || cell) issues.push(createIssue(context, "unbalanced-table", "Table cell must start inside a row without an open cell.", i));
|
|
21269
|
+
if (table) table.cell = {
|
|
21270
|
+
startIndex: i,
|
|
21271
|
+
hasParagraph: false,
|
|
21272
|
+
hasSectionBreak: false
|
|
21273
|
+
};
|
|
21274
|
+
} else if (char === "") {
|
|
21275
|
+
if (!cell) issues.push(createIssue(context, "unbalanced-table", "Table cell end token has no matching start.", i));
|
|
21276
|
+
else if (!cell.hasParagraph || !cell.hasSectionBreak) issues.push(createIssue(context, "empty-table-cell", "Table cell must contain a paragraph and section break child.", cell.startIndex));
|
|
21277
|
+
if (table) table.cell = void 0;
|
|
21278
|
+
} else if (char === "") {
|
|
21279
|
+
if (!(table === null || table === void 0 ? void 0 : table.inRow) || cell) issues.push(createIssue(context, "unbalanced-table", "Table row closes while a cell is still open.", i));
|
|
21280
|
+
if (table) table.inRow = false;
|
|
21281
|
+
} else if (char === "") {
|
|
21282
|
+
if (!table || table.inRow || cell) issues.push(createIssue(context, "unbalanced-table", "Table closes while a row or cell is still open.", i));
|
|
21283
|
+
tableStack.pop();
|
|
21284
|
+
}
|
|
20788
21285
|
}
|
|
20789
21286
|
if (columnGroupStack.length > 0 || columnStack.length > 0) issues.push(createIssue(context, "unbalanced-column-group", "Column group or column token is not closed.", body.dataStream.length));
|
|
20790
|
-
if (tableStack.length > 0
|
|
21287
|
+
if (tableStack.length > 0) issues.push(createIssue(context, "unbalanced-table", "Table, row, or cell token is not closed.", body.dataStream.length));
|
|
21288
|
+
}
|
|
21289
|
+
function validateCustomRangeMetadata(body, issues, context) {
|
|
21290
|
+
const pairs = /* @__PURE__ */ new Map();
|
|
21291
|
+
const starts = [];
|
|
21292
|
+
for (let index = 0; index < body.dataStream.length; index++) {
|
|
21293
|
+
const token = body.dataStream[index];
|
|
21294
|
+
if (token === "") starts.push(index);
|
|
21295
|
+
else if (token === "") {
|
|
21296
|
+
const start = starts.pop();
|
|
21297
|
+
if (start == null) issues.push(createIssue(context, "unbalanced-custom-range", "Custom range end token has no matching start.", index));
|
|
21298
|
+
else pairs.set(start, index);
|
|
21299
|
+
}
|
|
21300
|
+
}
|
|
21301
|
+
for (const start of starts) issues.push(createIssue(context, "unbalanced-custom-range", "Custom range start token has no matching end.", start));
|
|
21302
|
+
const ranges = body.customRanges ?? [];
|
|
21303
|
+
const ids = /* @__PURE__ */ new Set();
|
|
21304
|
+
for (const range of ranges) {
|
|
21305
|
+
if (ids.has(range.rangeId)) issues.push(createIssue(context, "duplicate-custom-range-id", "Custom range ids must be unique.", range.startIndex));
|
|
21306
|
+
ids.add(range.rangeId);
|
|
21307
|
+
if (range.rangeType !== 1) continue;
|
|
21308
|
+
if (body.dataStream[range.startIndex] !== "" || body.dataStream[range.endIndex] !== "" || pairs.get(range.startIndex) !== range.endIndex) issues.push(createIssue(context, "custom-range-token-mismatch", "Field metadata must point to a matching custom range token pair.", range.startIndex));
|
|
21309
|
+
}
|
|
21310
|
+
for (const [start, end] of pairs) if (!ranges.some((range) => range.startIndex === start && range.endIndex === end)) issues.push(createIssue(context, "missing-custom-range-metadata", "Custom range token pair has no metadata.", start));
|
|
21311
|
+
const sortedFields = ranges.filter((range) => range.rangeType === 1).slice().sort((left, right) => left.startIndex - right.startIndex || right.endIndex - left.endIndex);
|
|
21312
|
+
const parents = [];
|
|
21313
|
+
for (const range of sortedFields) {
|
|
21314
|
+
while (parents.length > 0 && parents[parents.length - 1].endIndex < range.startIndex) parents.pop();
|
|
21315
|
+
const parent = parents[parents.length - 1];
|
|
21316
|
+
if (parent && range.endIndex > parent.endIndex) issues.push(createIssue(context, "crossing-custom-range", "Field ranges may nest but must not cross.", range.startIndex));
|
|
21317
|
+
parents.push(range);
|
|
21318
|
+
}
|
|
20791
21319
|
}
|
|
20792
21320
|
function validateDocBodyStructure(body, context = { segmentType: "body" }) {
|
|
20793
21321
|
const issues = [];
|
|
@@ -20800,6 +21328,7 @@ function validateDocBodyStructure(body, context = { segmentType: "body" }) {
|
|
|
20800
21328
|
validateColumnGroupMetadata(body, scan, issues, context);
|
|
20801
21329
|
validateCustomBlockMetadata(body, scan, issues, context);
|
|
20802
21330
|
validateStructuralContainers(body, issues, context);
|
|
21331
|
+
validateCustomRangeMetadata(body, issues, context);
|
|
20803
21332
|
if (context.segmentType === "header" || context.segmentType === "footer") {
|
|
20804
21333
|
for (const range of body.customRanges ?? []) if (range.rangeType === 8 || range.rangeType === 9) issues.push(createIssue(context, "invalid-note-reference", "Note references are only supported in the document body.", range.startIndex));
|
|
20805
21334
|
}
|
|
@@ -20942,6 +21471,37 @@ function resolveSectionHeaderFooterReferences(documentStyle, sections, sectionIn
|
|
|
20942
21471
|
return result;
|
|
20943
21472
|
}
|
|
20944
21473
|
|
|
21474
|
+
//#endregion
|
|
21475
|
+
//#region src/docs/sdt-binding.ts
|
|
21476
|
+
function getSdtBindingKey(range) {
|
|
21477
|
+
var _range$properties;
|
|
21478
|
+
const binding = (_range$properties = range.properties) === null || _range$properties === void 0 ? void 0 : _range$properties.dataBinding;
|
|
21479
|
+
if (!(binding === null || binding === void 0 ? void 0 : binding.storeItemID) || !binding.xpath) return;
|
|
21480
|
+
return JSON.stringify([
|
|
21481
|
+
binding.storeItemID.toLowerCase(),
|
|
21482
|
+
binding.xpath,
|
|
21483
|
+
binding.prefixMappings ?? ""
|
|
21484
|
+
]);
|
|
21485
|
+
}
|
|
21486
|
+
/** Scalar XML values, independent of the control's display label or date format. */
|
|
21487
|
+
function getSdtBindingValue(body, range) {
|
|
21488
|
+
if (range.properties.showingPlaceholder) return "";
|
|
21489
|
+
if (range.properties.kind === "checkbox") {
|
|
21490
|
+
var _range$properties$che;
|
|
21491
|
+
return ((_range$properties$che = range.properties.checkbox) === null || _range$properties$che === void 0 ? void 0 : _range$properties$che.checked) ? "true" : "false";
|
|
21492
|
+
}
|
|
21493
|
+
const text = body.dataStream.slice(range.startIndex, range.endIndex + 1).replace(/^[\x00-\x08\x0A-\x1F]+|[\x00-\x08\x0A-\x1F]+$/g, "");
|
|
21494
|
+
if (range.properties.kind === "date") {
|
|
21495
|
+
var _range$properties$dat;
|
|
21496
|
+
return ((_range$properties$dat = range.properties.date) === null || _range$properties$dat === void 0 ? void 0 : _range$properties$dat.fullDate) ?? text;
|
|
21497
|
+
}
|
|
21498
|
+
if (range.properties.kind === "dropDownList" || range.properties.kind === "comboBox") {
|
|
21499
|
+
var _range$properties$lis;
|
|
21500
|
+
return ((_range$properties$lis = range.properties.listItems) === null || _range$properties$lis === void 0 || (_range$properties$lis = _range$properties$lis.find((item) => item.displayText === text)) === null || _range$properties$lis === void 0 ? void 0 : _range$properties$lis.value) ?? text;
|
|
21501
|
+
}
|
|
21502
|
+
return ["text", "richText"].includes(range.properties.kind) ? text : void 0;
|
|
21503
|
+
}
|
|
21504
|
+
|
|
20945
21505
|
//#endregion
|
|
20946
21506
|
//#region src/observer/observable.ts
|
|
20947
21507
|
/**
|
|
@@ -21721,7 +22281,7 @@ function createDocumentModelWithStyle(content, textStyle, config = {}) {
|
|
|
21721
22281
|
const marginBottom = (paddingData === null || paddingData === void 0 ? void 0 : paddingData.b) ?? DEFAULT_PADDING_DATA.b;
|
|
21722
22282
|
const marginLeft = (paddingData === null || paddingData === void 0 ? void 0 : paddingData.l) ?? DEFAULT_PADDING_DATA.l;
|
|
21723
22283
|
const { vertexAngle, centerAngle } = convertTextRotation(textRotation);
|
|
21724
|
-
|
|
22284
|
+
const documentData = {
|
|
21725
22285
|
id: "d",
|
|
21726
22286
|
body: {
|
|
21727
22287
|
dataStream: `${content}${"\r\n"}`,
|
|
@@ -21764,7 +22324,8 @@ function createDocumentModelWithStyle(content, textStyle, config = {}) {
|
|
|
21764
22324
|
},
|
|
21765
22325
|
drawings: {},
|
|
21766
22326
|
drawingsOrder: []
|
|
21767
|
-
}
|
|
22327
|
+
};
|
|
22328
|
+
return new DocumentDataModel(documentData);
|
|
21768
22329
|
}
|
|
21769
22330
|
function extractOtherStyle(style) {
|
|
21770
22331
|
if (!style) return {};
|
|
@@ -22016,7 +22577,8 @@ var ColumnManager = class {
|
|
|
22016
22577
|
const columnData = {};
|
|
22017
22578
|
let index = 0;
|
|
22018
22579
|
for (let i = columnPos; i < columnPos + numColumns; i++) {
|
|
22019
|
-
|
|
22580
|
+
const data = this.getColumn(i);
|
|
22581
|
+
columnData[index] = data ?? {
|
|
22020
22582
|
w: this._config.defaultColumnWidth,
|
|
22021
22583
|
hd: 0
|
|
22022
22584
|
};
|
|
@@ -22393,14 +22955,16 @@ var Range = class Range {
|
|
|
22393
22955
|
getFontSize() {
|
|
22394
22956
|
var _this$getValue, _p$body3;
|
|
22395
22957
|
const p = ((_this$getValue = this.getValue()) === null || _this$getValue === void 0 ? void 0 : _this$getValue.p) || {};
|
|
22396
|
-
if (p && Array.isArray((_p$body3 = p.body) === null || _p$body3 === void 0 ? void 0 : _p$body3.textRuns) && p.body.textRuns.length > 0)
|
|
22397
|
-
|
|
22398
|
-
|
|
22399
|
-
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22958
|
+
if (p && Array.isArray((_p$body3 = p.body) === null || _p$body3 === void 0 ? void 0 : _p$body3.textRuns) && p.body.textRuns.length > 0) {
|
|
22959
|
+
if (p.body.textRuns.some((textRun) => {
|
|
22960
|
+
var _textRun$ts;
|
|
22961
|
+
return (textRun === null || textRun === void 0 || (_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) != null;
|
|
22962
|
+
})) return Math.max(...p.body.textRuns.map((textRun) => {
|
|
22963
|
+
var _textRun$ts2;
|
|
22964
|
+
return (textRun === null || textRun === void 0 || (_textRun$ts2 = textRun.ts) === null || _textRun$ts2 === void 0 ? void 0 : _textRun$ts2.fs) || 0;
|
|
22965
|
+
}));
|
|
22966
|
+
else return this.getFontSizes()[0][0];
|
|
22967
|
+
}
|
|
22404
22968
|
return this.getFontSizes()[0][0];
|
|
22405
22969
|
}
|
|
22406
22970
|
/**
|
|
@@ -22696,7 +23260,8 @@ var RowManager = class {
|
|
|
22696
23260
|
const rowData = {};
|
|
22697
23261
|
let index = 0;
|
|
22698
23262
|
for (let i = rowPos; i < rowPos + numRows; i++) {
|
|
22699
|
-
|
|
23263
|
+
const data = this.getRow(i);
|
|
23264
|
+
rowData[index] = data ?? {
|
|
22700
23265
|
h: this._config.defaultRowHeight,
|
|
22701
23266
|
hd: 0
|
|
22702
23267
|
};
|
|
@@ -23680,13 +24245,18 @@ var Worksheet = class {
|
|
|
23680
24245
|
setColumnCount(count) {
|
|
23681
24246
|
this._snapshot.columnCount = count;
|
|
23682
24247
|
}
|
|
23683
|
-
/**
|
|
23684
|
-
* isSheetHidden
|
|
23685
|
-
* @returns hidden status of sheet
|
|
23686
|
-
*/
|
|
24248
|
+
/** Returns 0 for visible, 1 for either hidden state, preserving the existing predicate API. */
|
|
23687
24249
|
isSheetHidden() {
|
|
24250
|
+
return this._snapshot.hidden === 0 ? 0 : 1;
|
|
24251
|
+
}
|
|
24252
|
+
/** Returns the complete persisted state, including VERY_HIDDEN (2). */
|
|
24253
|
+
getHiddenState() {
|
|
23688
24254
|
return this._snapshot.hidden;
|
|
23689
24255
|
}
|
|
24256
|
+
/** Model mutation primitive. User-facing changes must go through worksheet hide/show commands. */
|
|
24257
|
+
setHiddenState(hidden) {
|
|
24258
|
+
this._snapshot.hidden = hidden;
|
|
24259
|
+
}
|
|
23690
24260
|
/**
|
|
23691
24261
|
* Returns true if the sheet's gridlines are hidden; otherwise returns false. Gridlines are visible by default.
|
|
23692
24262
|
* @returns {boolean} Gridlines Hidden Status.
|
|
@@ -24393,11 +24963,11 @@ let Workbook = class Workbook extends UnitModel {
|
|
|
24393
24963
|
const { sheetOrder } = this._snapshot;
|
|
24394
24964
|
return this._worksheets.get(sheetOrder[index]);
|
|
24395
24965
|
}
|
|
24396
|
-
getHiddenWorksheets() {
|
|
24397
|
-
return this.getSheets().filter((s) => s.
|
|
24966
|
+
getHiddenWorksheets(includeVeryHidden = true) {
|
|
24967
|
+
return this.getSheets().filter((s) => s.isSheetHidden() === 1).filter((s) => includeVeryHidden || s.getHiddenState() !== 2).map((s) => s.getConfig().id);
|
|
24398
24968
|
}
|
|
24399
24969
|
getUnhiddenWorksheets() {
|
|
24400
|
-
return this.getSheets().filter((s) => s.
|
|
24970
|
+
return this.getSheets().filter((s) => s.isSheetHidden() !== 1).map((s) => s.getConfig().id);
|
|
24401
24971
|
}
|
|
24402
24972
|
load(config) {
|
|
24403
24973
|
this._snapshot = config;
|
|
@@ -25105,20 +25675,23 @@ let LocalUndoRedoService = class LocalUndoRedoService extends Disposable {
|
|
|
25105
25675
|
redoStack.length = 0;
|
|
25106
25676
|
const activeGroup = this._activeGroups.get(unitID);
|
|
25107
25677
|
const lastItem = this._pitchUndoElement(unitID);
|
|
25108
|
-
if (activeGroup)
|
|
25109
|
-
|
|
25110
|
-
|
|
25111
|
-
|
|
25112
|
-
|
|
25113
|
-
|
|
25114
|
-
|
|
25115
|
-
|
|
25116
|
-
|
|
25117
|
-
|
|
25118
|
-
|
|
25119
|
-
|
|
25120
|
-
|
|
25121
|
-
|
|
25678
|
+
if (activeGroup) {
|
|
25679
|
+
if (lastItem && this._itemGroups.get(lastItem) === activeGroup.id) {
|
|
25680
|
+
if (activeGroup.mode === "replace") lastItem.redoMutations = item.redoMutations;
|
|
25681
|
+
else {
|
|
25682
|
+
lastItem.redoMutations.push(...item.redoMutations);
|
|
25683
|
+
lastItem.undoMutations.unshift(...item.undoMutations);
|
|
25684
|
+
}
|
|
25685
|
+
} else {
|
|
25686
|
+
appendNewItem(item);
|
|
25687
|
+
this._itemGroups.set(item, activeGroup.id);
|
|
25688
|
+
}
|
|
25689
|
+
} else if (this._batchingStatus.has(item.unitID)) {
|
|
25690
|
+
if (this._batchingStatus.get(item.unitID) === 0 || !lastItem) {
|
|
25691
|
+
appendNewItem(item);
|
|
25692
|
+
this._batchingStatus.set(item.unitID, 1);
|
|
25693
|
+
} else this._tryBatchingElements(lastItem, item);
|
|
25694
|
+
} else appendNewItem(item);
|
|
25122
25695
|
function appendNewItem(item) {
|
|
25123
25696
|
undoStack.push(item);
|
|
25124
25697
|
if (undoStack.length > historyLimit) undoStack.splice(0, 1);
|
|
@@ -25235,13 +25808,14 @@ let LocalUndoRedoService = class LocalUndoRedoService extends Disposable {
|
|
|
25235
25808
|
const isFocusSheet = this._contextService.getContextValue(FOCUSING_SHEET);
|
|
25236
25809
|
const isFocusFormulaEditor = this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR);
|
|
25237
25810
|
const isFocusEditor = this._contextService.getContextValue(EDITOR_ACTIVATED);
|
|
25238
|
-
if (isFocusSheet)
|
|
25239
|
-
|
|
25240
|
-
|
|
25241
|
-
|
|
25242
|
-
|
|
25243
|
-
|
|
25244
|
-
|
|
25811
|
+
if (isFocusSheet) {
|
|
25812
|
+
if (isFocusFormulaEditor && isFocusEditor) unitID = DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
25813
|
+
else if (isFocusEditor) unitID = DOCS_NORMAL_EDITOR_UNIT_ID_KEY;
|
|
25814
|
+
else {
|
|
25815
|
+
var _this$_univerInstance;
|
|
25816
|
+
unitID = ((_this$_univerInstance = this._univerInstanceService.getFocusedUnit()) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId()) ?? "";
|
|
25817
|
+
}
|
|
25818
|
+
} else {
|
|
25245
25819
|
var _this$_univerInstance2;
|
|
25246
25820
|
unitID = ((_this$_univerInstance2 = this._univerInstanceService.getFocusedUnit()) === null || _this$_univerInstance2 === void 0 ? void 0 : _this$_univerInstance2.getUnitId()) ?? "";
|
|
25247
25821
|
}
|
|
@@ -25838,12 +26412,13 @@ var PermissionService = class extends Disposable {
|
|
|
25838
26412
|
return permissionPoint;
|
|
25839
26413
|
}
|
|
25840
26414
|
composePermission$(permissionIdList) {
|
|
25841
|
-
|
|
26415
|
+
const subjectList = permissionIdList.map((id) => {
|
|
25842
26416
|
var _this$_permissionPoin;
|
|
25843
26417
|
const subject = (_this$_permissionPoin = this._permissionPointMap) === null || _this$_permissionPoin === void 0 ? void 0 : _this$_permissionPoin.get(id);
|
|
25844
26418
|
if (!subject) throw new Error(`[PermissionService]: ${id} permissionPoint does not exist!`);
|
|
25845
26419
|
return subject.asObservable();
|
|
25846
|
-
})
|
|
26420
|
+
});
|
|
26421
|
+
return combineLatest(subjectList).pipe(map$1((list) => {
|
|
25847
26422
|
return list;
|
|
25848
26423
|
}));
|
|
25849
26424
|
}
|
|
@@ -25968,8 +26543,10 @@ let PluginService = class PluginService {
|
|
|
25968
26543
|
this._pluginRegistry.set(ctor.pluginName, item);
|
|
25969
26544
|
this._logService.debug("[PluginService]", `Plugin "${ctor.pluginName}" registered.`);
|
|
25970
26545
|
const { type } = ctor;
|
|
25971
|
-
if (this._loadedPluginTypes.has(type))
|
|
25972
|
-
|
|
26546
|
+
if (this._loadedPluginTypes.has(type)) {
|
|
26547
|
+
if (type === UniverInstanceType.UNIVER_UNKNOWN) this._loadFromPlugins([item]);
|
|
26548
|
+
else this._flushType(type);
|
|
26549
|
+
}
|
|
25973
26550
|
}
|
|
25974
26551
|
startPluginsForType(type) {
|
|
25975
26552
|
if (this._loadedPluginTypes.has(type)) return;
|
|
@@ -26058,9 +26635,7 @@ let PluginService = class PluginService {
|
|
|
26058
26635
|
case 2:
|
|
26059
26636
|
p.onRendered();
|
|
26060
26637
|
break;
|
|
26061
|
-
case 3:
|
|
26062
|
-
p.onSteady();
|
|
26063
|
-
break;
|
|
26638
|
+
case 3: p.onSteady();
|
|
26064
26639
|
}
|
|
26065
26640
|
});
|
|
26066
26641
|
}
|
|
@@ -26542,12 +27117,13 @@ var RTree = class {
|
|
|
26542
27117
|
remove(search) {
|
|
26543
27118
|
const { unitId, sheetId: subUnitId, range, id } = search;
|
|
26544
27119
|
const { startRow, startColumn, endRow, endColumn } = range;
|
|
26545
|
-
if (this._enableOneCellCache)
|
|
26546
|
-
|
|
26547
|
-
|
|
26548
|
-
|
|
26549
|
-
|
|
26550
|
-
|
|
27120
|
+
if (this._enableOneCellCache) {
|
|
27121
|
+
if (startRow === endRow && startColumn === endColumn) this._removeOneCellCache(unitId, subUnitId, range.startRow, range.startColumn, id);
|
|
27122
|
+
else {
|
|
27123
|
+
this._removeCellCacheByRange(search);
|
|
27124
|
+
this._removeRTreeItem(search);
|
|
27125
|
+
}
|
|
27126
|
+
} else this._removeRTreeItem(search);
|
|
26551
27127
|
}
|
|
26552
27128
|
bulkRemove(searchList) {
|
|
26553
27129
|
for (const search of searchList) this.remove(search);
|
|
@@ -26657,11 +27233,15 @@ function cloneCellData(cell) {
|
|
|
26657
27233
|
if (cell === null || cell === void 0) return cell;
|
|
26658
27234
|
const result = {};
|
|
26659
27235
|
if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
|
|
26660
|
-
if (cell.s !== void 0)
|
|
26661
|
-
|
|
27236
|
+
if (cell.s !== void 0) {
|
|
27237
|
+
if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
|
|
27238
|
+
else result.s = cloneValue(cell.s);
|
|
27239
|
+
}
|
|
26662
27240
|
if (cell.v !== void 0) result.v = cell.v;
|
|
26663
27241
|
if (cell.t !== void 0) result.t = cell.t;
|
|
26664
27242
|
if (cell.f !== void 0) result.f = cell.f;
|
|
27243
|
+
if (cell.ft !== void 0) result.ft = cell.ft;
|
|
27244
|
+
if (cell.fd !== void 0) result.fd = cell.fd;
|
|
26665
27245
|
if (cell.ref !== void 0) result.ref = cell.ref;
|
|
26666
27246
|
if (cell.xf !== void 0) result.xf = cell.xf;
|
|
26667
27247
|
if (cell.si !== void 0) result.si = cell.si;
|
|
@@ -26676,17 +27256,7 @@ function cloneCellData(cell) {
|
|
|
26676
27256
|
*/
|
|
26677
27257
|
function cloneCellDataWithSpanAndDisplay(cell) {
|
|
26678
27258
|
if (cell === null || cell === void 0) return cell;
|
|
26679
|
-
const result =
|
|
26680
|
-
if (cell.p !== void 0) result.p = cell.p === null ? null : cloneValue(cell.p);
|
|
26681
|
-
if (cell.s !== void 0) if (cell.s === null || typeof cell.s === "string") result.s = cell.s;
|
|
26682
|
-
else result.s = cloneValue(cell.s);
|
|
26683
|
-
if (cell.v !== void 0) result.v = cell.v;
|
|
26684
|
-
if (cell.t !== void 0) result.t = cell.t;
|
|
26685
|
-
if (cell.f !== void 0) result.f = cell.f;
|
|
26686
|
-
if (cell.ref !== void 0) result.ref = cell.ref;
|
|
26687
|
-
if (cell.xf !== void 0) result.xf = cell.xf;
|
|
26688
|
-
if (cell.si !== void 0) result.si = cell.si;
|
|
26689
|
-
if (cell.custom !== void 0) result.custom = cell.custom === null ? null : cloneValue(cell.custom);
|
|
27259
|
+
const result = cloneCellData(cell);
|
|
26690
27260
|
if (cell.rowSpan !== void 0) result.rowSpan = cell.rowSpan;
|
|
26691
27261
|
if (cell.colSpan !== void 0) result.colSpan = cell.colSpan;
|
|
26692
27262
|
if (cell.displayV !== void 0) result.displayV = cell.displayV;
|
|
@@ -26736,8 +27306,10 @@ function cloneRowColumnData(data) {
|
|
|
26736
27306
|
if ("ah" in item && item.ah !== void 0) cloned.ah = item.ah;
|
|
26737
27307
|
if ("hd" in item && item.hd !== void 0) cloned.hd = item.hd;
|
|
26738
27308
|
if ("w" in item && item.w !== void 0) cloned.w = item.w;
|
|
26739
|
-
if ("s" in item && item.s !== void 0)
|
|
26740
|
-
|
|
27309
|
+
if ("s" in item && item.s !== void 0) {
|
|
27310
|
+
if (item.s === null || typeof item.s === "string") cloned.s = item.s;
|
|
27311
|
+
else cloned.s = cloneValue(item.s);
|
|
27312
|
+
}
|
|
26741
27313
|
if ("custom" in item && item.custom !== void 0) cloned.custom = item.custom === null ? null : cloneValue(item.custom);
|
|
26742
27314
|
result[idx] = cloned;
|
|
26743
27315
|
}
|
|
@@ -26791,6 +27363,12 @@ function cloneWorksheetData(worksheet) {
|
|
|
26791
27363
|
defaultRowHeight: worksheet.defaultRowHeight,
|
|
26792
27364
|
showGridlines: worksheet.showGridlines,
|
|
26793
27365
|
rightToLeft: worksheet.rightToLeft,
|
|
27366
|
+
backgroundImage: worksheet.backgroundImage ? {
|
|
27367
|
+
source: worksheet.backgroundImage.source,
|
|
27368
|
+
imageSourceType: worksheet.backgroundImage.imageSourceType,
|
|
27369
|
+
scaleX: worksheet.backgroundImage.scaleX,
|
|
27370
|
+
scaleY: worksheet.backgroundImage.scaleY
|
|
27371
|
+
} : void 0,
|
|
26794
27372
|
freeze: {
|
|
26795
27373
|
xSplit: worksheet.freeze.xSplit,
|
|
26796
27374
|
ySplit: worksheet.freeze.ySplit,
|
|
@@ -26811,8 +27389,10 @@ function cloneWorksheetData(worksheet) {
|
|
|
26811
27389
|
columnData: cloneRowColumnData(worksheet.columnData)
|
|
26812
27390
|
};
|
|
26813
27391
|
if (worksheet.gridlinesColor !== void 0) result.gridlinesColor = worksheet.gridlinesColor;
|
|
26814
|
-
if (worksheet.defaultStyle !== void 0)
|
|
26815
|
-
|
|
27392
|
+
if (worksheet.defaultStyle !== void 0) {
|
|
27393
|
+
if (worksheet.defaultStyle === null || typeof worksheet.defaultStyle === "string") result.defaultStyle = worksheet.defaultStyle;
|
|
27394
|
+
else result.defaultStyle = cloneValue(worksheet.defaultStyle);
|
|
27395
|
+
}
|
|
26816
27396
|
if (worksheet.custom !== void 0) result.custom = worksheet.custom === null ? null : cloneValue(worksheet.custom);
|
|
26817
27397
|
return result;
|
|
26818
27398
|
}
|
|
@@ -27011,7 +27591,8 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
27011
27591
|
}
|
|
27012
27592
|
_fillDefaultGapThemeColors(config) {
|
|
27013
27593
|
if (config.defaultBackgroundColor && config.defaultStripeColor) return config;
|
|
27014
|
-
const
|
|
27594
|
+
const baseColor = this._injector.get(ThemeService).getColorFromTheme("primary.500");
|
|
27595
|
+
const { r, g, b } = new ColorKit(baseColor).toRgb();
|
|
27015
27596
|
return {
|
|
27016
27597
|
...config,
|
|
27017
27598
|
defaultBackgroundColor: config.defaultBackgroundColor ?? `rgba(${r}, ${g}, ${b}, 0.025)`,
|
|
@@ -27140,7 +27721,8 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
27140
27721
|
const columnCount = this._columnWidthAccumulation.length - 1;
|
|
27141
27722
|
for (let i = startColumn; i >= endColumn; i--) {
|
|
27142
27723
|
const column = i;
|
|
27143
|
-
|
|
27724
|
+
const cell = this.worksheet.getCell(row, column);
|
|
27725
|
+
if (!isCellCoverable(cell) && column !== startColumn || this.intersectMergeRange(row, column)) {
|
|
27144
27726
|
if (column === startColumn) return column;
|
|
27145
27727
|
return column + 1 > columnCount ? columnCount : column + 1;
|
|
27146
27728
|
}
|
|
@@ -27153,7 +27735,8 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
27153
27735
|
}
|
|
27154
27736
|
for (let i = startColumn; i <= endColumn; i++) {
|
|
27155
27737
|
const column = i;
|
|
27156
|
-
|
|
27738
|
+
const cell = this.worksheet.getCell(row, column);
|
|
27739
|
+
if (!isCellCoverable(cell) && column !== startColumn || this.intersectMergeRange(row, column)) {
|
|
27157
27740
|
if (column === startColumn) return column;
|
|
27158
27741
|
return column - 1 < 0 ? 0 : column - 1;
|
|
27159
27742
|
}
|
|
@@ -27829,6 +28412,41 @@ let DataValidationType = /* @__PURE__ */ function(DataValidationType) {
|
|
|
27829
28412
|
return DataValidationType;
|
|
27830
28413
|
}({});
|
|
27831
28414
|
|
|
28415
|
+
//#endregion
|
|
28416
|
+
//#region src/types/enum/record-filter.ts
|
|
28417
|
+
/**
|
|
28418
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
28419
|
+
*
|
|
28420
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
28421
|
+
* you may not use this file except in compliance with the License.
|
|
28422
|
+
* You may obtain a copy of the License at
|
|
28423
|
+
*
|
|
28424
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
28425
|
+
*
|
|
28426
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
28427
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28428
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28429
|
+
* See the License for the specific language governing permissions and
|
|
28430
|
+
* limitations under the License.
|
|
28431
|
+
*/
|
|
28432
|
+
/** Typed record identities shared by compact Table and external report filters. */
|
|
28433
|
+
let RecordValueType = /* @__PURE__ */ function(RecordValueType) {
|
|
28434
|
+
RecordValueType["Blank"] = "blank";
|
|
28435
|
+
RecordValueType["String"] = "string";
|
|
28436
|
+
RecordValueType["Number"] = "number";
|
|
28437
|
+
RecordValueType["Date"] = "date";
|
|
28438
|
+
RecordValueType["Boolean"] = "boolean";
|
|
28439
|
+
RecordValueType["Error"] = "error";
|
|
28440
|
+
return RecordValueType;
|
|
28441
|
+
}({});
|
|
28442
|
+
/** Values are wire identifiers; an absent native Table filter represents All. */
|
|
28443
|
+
let FilterSelectionMode = /* @__PURE__ */ function(FilterSelectionMode) {
|
|
28444
|
+
FilterSelectionMode["All"] = "all";
|
|
28445
|
+
FilterSelectionMode["Include"] = "include";
|
|
28446
|
+
FilterSelectionMode["Exclude"] = "exclude";
|
|
28447
|
+
return FilterSelectionMode;
|
|
28448
|
+
}({});
|
|
28449
|
+
|
|
27832
28450
|
//#endregion
|
|
27833
28451
|
//#region src/services/resource-loader/resource-loader.service.ts
|
|
27834
28452
|
let ResourceLoaderService = class ResourceLoaderService extends Disposable {
|
|
@@ -27873,11 +28491,9 @@ let ResourceLoaderService = class ResourceLoaderService extends Disposable {
|
|
|
27873
28491
|
loadHookResource(hook, workbook.getUnitId(), workbook.getSnapshot().resources, "Workbook");
|
|
27874
28492
|
});
|
|
27875
28493
|
break;
|
|
27876
|
-
case UniverInstanceType.UNIVER_BASE:
|
|
27877
|
-
|
|
27878
|
-
|
|
27879
|
-
});
|
|
27880
|
-
break;
|
|
28494
|
+
case UniverInstanceType.UNIVER_BASE: this._univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_BASE).forEach((base) => {
|
|
28495
|
+
loadHookResource(hook, base.getUnitId(), base.getSnapshot().resources, "Base");
|
|
28496
|
+
});
|
|
27881
28497
|
}
|
|
27882
28498
|
});
|
|
27883
28499
|
};
|
|
@@ -27889,7 +28505,8 @@ let ResourceLoaderService = class ResourceLoaderService extends Disposable {
|
|
|
27889
28505
|
}));
|
|
27890
28506
|
this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_DOC).subscribe((event) => {
|
|
27891
28507
|
const { unit: doc } = event;
|
|
27892
|
-
|
|
28508
|
+
const unitId = doc.getUnitId();
|
|
28509
|
+
if (!isInternalEditorID(unitId)) this._resourceManagerService.loadResources(doc.getUnitId(), doc.getSnapshot().resources);
|
|
27893
28510
|
}));
|
|
27894
28511
|
this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SLIDE).subscribe((event) => {
|
|
27895
28512
|
const { unit: slide } = event;
|
|
@@ -28123,4 +28740,4 @@ function createUniverInjector(parentInjector, override) {
|
|
|
28123
28740
|
installShims();
|
|
28124
28741
|
|
|
28125
28742
|
//#endregion
|
|
28126
|
-
export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BASE_RECORD_ID_FIELD_ID, BASE_RECORD_ID_FIELD_NAME, BORDER_KEYS, BORDER_STYLE_KEYS, BaseConditionalColorOperator, BaseConditionalColorTarget, BaseConditionalDateMode, BaseDataModel, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseHierarchyInvalidReason, BaseRecordLinkRole, BaseSortDirection, BaseViewType, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnLayoutType, ColumnResponsiveType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DateSystem, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, EDITOR_ACTIVATED, EXCEL_1904_OFFSET, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_BOARD, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LOCALE_META, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, OBJECT_PERMISSION_CONFIG_KEY, ObjectMatrix, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PARAGRAPH_ID_PREFIX, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RESTORE_INSERTED_PARAGRAPH_IDS, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, RegionService, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextParagraphBuilder, RichTextRunBuilder, RichTextValue, RxDisposable, SECTION_ID_PREFIX, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TabStopAlignment, TabStopLeader, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, allocateBaseFormulaTableName, assertBaseTableRecordIdentity, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneBodyWithFreshParagraphIds, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneParagraphWithId, cloneSectionBreakWithId, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, containsInteriorInsertionOffset, containsStreamIndex, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createBaseFormulaTableNameMap, createBaseFormulaTableReferenceNormalizer, createBaseRecordIdField, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, excelDateSerial, excelDateTimePartsToSerial, excelDateTimeSerial, excelSerialToDate, excelSerialToDateTime, excelSerialToDateTimeParts, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBaseFormulaTableName, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCustomBlockIdsInSelections, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDateSystemMaxSerial, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getDrawingOrderIndex, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, getNumfmtLocaleTag, getNumfmtParseValueFilter, getOriginCellValue, getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset, getParagraphsSlice, getPlainText, getReverseDirection, getRichTextEditPath, getSectionBreakSlice, getSectionHeaderFooterReferenceKey, getEmptySnapshot$2 as getSheetsEmptySnapshot, getSingleDataStreamChange, getTableCellTokenInterval, getTableRangeInterval, getTableRowTokenInterval, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, intersectsOperationalIntervals, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBaseRecordIdFieldName, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSafeUrl, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidBaseRecordId, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, migrateBaseFormulaTableNames, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBaseFormulaTableName, normalizeBaseFormulaTableReferences, normalizeBody, normalizeDrawingOrderIndex, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, numberToABC, numberToListABC, api_exports as numfmt, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, setWith, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };
|
|
28743
|
+
export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BASE_RECORD_ID_FIELD_ID, BASE_RECORD_ID_FIELD_NAME, BORDER_KEYS, BORDER_STYLE_KEYS, BaseConditionalColorOperator, BaseConditionalColorTarget, BaseConditionalDateMode, BaseDataModel, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, BaseHierarchyInvalidReason, BaseRecordLinkRole, BaseSortDirection, BaseViewType, BaselineOffset, BlockType, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, BulletAlignment, COLORS, COLOR_STYLE_KEYS, COMMAND_LOG_EXECUTION_CONFIG_KEY, CanceledError, CellModeEnum, CellValueType, ColorKit, ColorType, ColumnLayoutType, ColumnResponsiveType, ColumnSeparatorType, CommandService, CommandType, CommonHideTypes, ConfigService, ContextService, CopyPasteType, CustomCommandExecutionError, CustomDecorationType, CustomRangeType, DEFAULT_CELL, DEFAULT_DOC, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_DOCUMENT_SUB_COMPONENT_ID, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_NUMBER_FORMAT, DEFAULT_RANGE, DEFAULT_RANGE_ARRAY, DEFAULT_SELECTION, DEFAULT_STYLES, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DataValidationErrorStyle, DataValidationImeMode, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DateSystem, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, EDITOR_ACTIVATED, EXCEL_1904_OFFSET, EXTENSION_NAMES, ErrorService, EventState, EventSubject, FOCUSING_BOARD, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_SLIDE, FOCUSING_UNIT, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FORMULA_EDITOR_ACTIVATED, FilterSelectionMode, FollowNumberWithType, FontItalic, FontStyleType, FontWeight, FormulaType, GridType, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, IImageIoService, ILocalStorageService, ILogService, IMentionIOService, IPermissionService, IResourceLoaderService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IURLImageService, IUndoRedoService, IUniverInstanceService, ImageCacheMap, ImageSourceType, ImageUploadStatusType, Inject, InjectSelf, Injector, InterceptorEffectEnum, InterceptorManager, InterpolationPointType, json1 as JSON1, JSONX, LOCALE_META, LRUHelper, LRUMap, LifecycleService, LifecycleStages, LifecycleUnreachableError, ListGlyphType, LocalUndoRedoService, LocaleService, LocaleType, LogLevel, LookUp, MAX_COLUMN_COUNT, MAX_ROW_COUNT, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, Many, MemoryCursor, MentionIOLocalService, MentionType, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NamedStyleType, NilCommand, NumberUnitType, OBJECT_PERMISSION_CONFIG_KEY, ObjectMatrix, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PADDING_KEYS, PAGE_SIZE, PAPER_TYPES, PARAGRAPH_ID_PREFIX, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, PaperType, ParagraphElementType, ParagraphStyleBuilder, ParagraphStyleValue, PermissionService, PermissionStatus, Plugin, PluginService, PositionedObjectLayoutType, PresetListType, ProtectionType, Quantity, QuickListType, QuickListTypeMap, RANGE_DIRECTION, RANGE_TYPE, RBush, RCDisposable, RESTORE_INSERTED_PARAGRAPH_IDS, RGBA_PAREN, RGB_PAREN, ROTATE_BUFFER_VALUE, RTree, Range, RecordValueType, Rectangle, RediError, RedoCommand, RedoCommandId, RefAlias, RegionService, Registry, RegistryAsMap, RelativeDate, ResourceManagerService, RichTextBuilder, RichTextParagraphBuilder, RichTextRunBuilder, RichTextValue, RxDisposable, SECTION_ID_PREFIX, SHEET_EDITOR_UNITS, STYLE_KEYS, SectionType, Self, SheetSkeleton, SheetTypes, SheetViewModel, Skeleton, SkipSelf, SliceBodyType, SpacingRule, Styles, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, THEME_COLORS, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TabStopAlignment, TabStopLeader, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WorksheetHiddenState, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, allocateBaseFormulaTableName, assertBaseTableRecordIdentity, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneBodyWithFreshParagraphIds, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneParagraphWithId, cloneSectionBreakWithId, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, containsInteriorInsertionOffset, containsStreamIndex, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createBaseFormulaTableNameMap, createBaseFormulaTableReferenceNormalizer, createBaseRecordIdField, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, excelDateSerial, excelDateTimePartsToSerial, excelDateTimeSerial, excelSerialToDate, excelSerialToDateTime, excelSerialToDateTimeParts, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getBaseFormulaTableName, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCustomBlockIdsInSelections, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDateSystemMaxSerial, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getDrawingOrderIndex, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, getNumfmtLocaleTag, getNumfmtParseValueFilter, getOriginCellValue, getParagraphContentStartOffset, getParagraphContentStartOffsets, getParagraphFollowingBlockOffset, getParagraphsSlice, getPlainText, getReverseDirection, getRichTextEditPath, getSdtBindingKey, getSdtBindingValue, getSectionBreakSlice, getSectionHeaderFooterReferenceKey, getEmptySnapshot$2 as getSheetsEmptySnapshot, getSingleDataStreamChange, getTableCellTokenInterval, getTableRangeInterval, getTableRowTokenInterval, getTableSlice, getTextRunSlice, getTransformOffsetX, getTransformOffsetY, getWorksheetUID, groupBy, handleStyleToString, hashAlgorithm, horizontalLineSegmentsSubtraction, insertMatrixArray, insertTextToContent, intersectsOperationalIntervals, invertColorByHSL, invertColorByMatrix, isAsyncDependencyItem, isAsyncHook, isBaseRecordIdFieldName, isBlackColor, isBooleanString, isCellCoverable, isCellV, isClassDependencyItem, isCommentEditorID, isCtor, isDefaultFormat, isDisposable, isEmptyCell, isFactoryDependencyItem, isFormulaId, isFormulaString, isICellData, isInternalEditorID, isNodeEnv, isNotNullOrUndefined, isNullCell, isNumeric, isPatternEqualWithoutDecimal, isRangesEqual, isRealNum, isSafeNumeric, isSafeUrl, isSameStyleTextRun, isTextFormat, isUnitRangesEqual, isValidBaseRecordId, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, migrateBaseFormulaTableNames, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBaseFormulaTableName, normalizeBaseFormulaTableReferences, normalizeBody, normalizeDrawingOrderIndex, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, numberToABC, numberToListABC, api_exports as numfmt, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, setWith, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };
|