@univerjs/core 1.0.0-alpha.8 → 1.0.0-beta.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 +1 -1
- package/lib/cjs/index.js +551 -458
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +547 -465
- package/lib/facade.js +1 -1
- package/lib/index.js +547 -465
- package/lib/types/bases/index.d.ts +3 -2
- package/lib/types/bases/record-identity.d.ts +22 -0
- package/lib/types/bases/typedef.d.ts +241 -32
- package/lib/types/docs/data-model/index.d.ts +1 -1
- package/lib/types/docs/data-model/rich-text-builder.d.ts +17 -8
- package/lib/types/facade/f-event.d.ts +9 -9
- package/lib/types/shared/cache/image-cache.d.ts +1 -1
- package/lib/types/sheets/sheet-skeleton.d.ts +1 -1
- package/lib/types/types/enum/text-style.d.ts +3 -1
- package/lib/types/types/interfaces/i-document-data.d.ts +20 -0
- package/lib/types/types/interfaces/i-need-check-disposable.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +22 -21
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BehaviorSubject, Observable, ReplaySubject, Subject, Subscription, combineLatest, debounceTime, distinctUntilChanged, filter, firstValueFrom, map, merge as merge$1, of, skip, take, takeWhile, tap, timer } from "rxjs";
|
|
2
2
|
import { ObjectScope, UnitRole, UniverType as UniverInstanceType } from "@univerjs/protocol";
|
|
3
3
|
import { debounceTime as debounceTime$1, filter as filter$1, first, map as map$1 } from "rxjs/operators";
|
|
4
|
-
import { Inject,
|
|
4
|
+
import { Inject, InjectSelf, Injector, LookUp, Many, Optional, Quantity, RediError, Self, SkipSelf, WithNew, createIdentifier, forwardRef, isAsyncDependencyItem, isAsyncHook, isClassDependencyItem, isCtor, isDisposable, isFactoryDependencyItem, isValueDependencyItem, setDependencies } from "@wendellhu/redi";
|
|
5
5
|
import { debounce, get, merge, mergeWith, set } from "lodash-es";
|
|
6
6
|
import RBush, { default as RBush$1 } from "rbush";
|
|
7
7
|
import AsyncLock from "async-lock";
|
|
@@ -1469,6 +1469,8 @@ let TextDecoration = /* @__PURE__ */ function(TextDecoration) {
|
|
|
1469
1469
|
TextDecoration[TextDecoration["WAVY_DOUBLE"] = 15] = "WAVY_DOUBLE";
|
|
1470
1470
|
TextDecoration[TextDecoration["WAVY_HEAVY"] = 16] = "WAVY_HEAVY";
|
|
1471
1471
|
TextDecoration[TextDecoration["WORDS"] = 17] = "WORDS";
|
|
1472
|
+
TextDecoration[TextDecoration["SINGLE_ACCOUNTING"] = 18] = "SINGLE_ACCOUNTING";
|
|
1473
|
+
TextDecoration[TextDecoration["DOUBLE_ACCOUNTING"] = 19] = "DOUBLE_ACCOUNTING";
|
|
1472
1474
|
return TextDecoration;
|
|
1473
1475
|
}({});
|
|
1474
1476
|
/**
|
|
@@ -1640,7 +1642,7 @@ let ThemeColors = /* @__PURE__ */ function(ThemeColors) {
|
|
|
1640
1642
|
//#endregion
|
|
1641
1643
|
//#region package.json
|
|
1642
1644
|
var name = "@univerjs/core";
|
|
1643
|
-
var version = "1.0.0-
|
|
1645
|
+
var version = "1.0.0-beta.0";
|
|
1644
1646
|
|
|
1645
1647
|
//#endregion
|
|
1646
1648
|
//#region src/common/array.ts
|
|
@@ -1849,9 +1851,8 @@ var ConfigService = class {
|
|
|
1849
1851
|
return this._config.get(id);
|
|
1850
1852
|
}
|
|
1851
1853
|
setConfig(id, value, options) {
|
|
1852
|
-
var _this$_config$get;
|
|
1853
1854
|
const { merge: isMerge = false } = options || {};
|
|
1854
|
-
let nextValue =
|
|
1855
|
+
let nextValue = this._config.get(id) ?? {};
|
|
1855
1856
|
if (isMerge) nextValue = merge(nextValue, value);
|
|
1856
1857
|
else nextValue = value;
|
|
1857
1858
|
this._config.set(id, nextValue);
|
|
@@ -1900,8 +1901,7 @@ var ContextService = class extends Disposable {
|
|
|
1900
1901
|
this._contextMap.clear();
|
|
1901
1902
|
}
|
|
1902
1903
|
getContextValue(key) {
|
|
1903
|
-
|
|
1904
|
-
return (_this$_contextMap$get = this._contextMap.get(key)) !== null && _this$_contextMap$get !== void 0 ? _this$_contextMap$get : false;
|
|
1904
|
+
return this._contextMap.get(key) ?? false;
|
|
1905
1905
|
}
|
|
1906
1906
|
setContextValue(key, value) {
|
|
1907
1907
|
this._contextMap.set(key, value);
|
|
@@ -2159,7 +2159,7 @@ let CommandService = class CommandService extends Disposable {
|
|
|
2159
2159
|
params
|
|
2160
2160
|
};
|
|
2161
2161
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
2162
|
-
const _options = options
|
|
2162
|
+
const _options = options ?? {};
|
|
2163
2163
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
2164
2164
|
if (this._disposed) {
|
|
2165
2165
|
stackItemDisposable.dispose();
|
|
@@ -2199,13 +2199,12 @@ let CommandService = class CommandService extends Disposable {
|
|
|
2199
2199
|
if (command.type === 2) {
|
|
2200
2200
|
const triggerCommand = findLast(this._commandExecutionStack, (item) => item.type === 0);
|
|
2201
2201
|
if (triggerCommand) {
|
|
2202
|
-
|
|
2203
|
-
commandInfo.params = (_commandInfo$params = commandInfo.params) !== null && _commandInfo$params !== void 0 ? _commandInfo$params : {};
|
|
2202
|
+
commandInfo.params = commandInfo.params ?? {};
|
|
2204
2203
|
commandInfo.params.trigger = triggerCommand.id;
|
|
2205
2204
|
}
|
|
2206
2205
|
}
|
|
2207
2206
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
2208
|
-
const _options = options
|
|
2207
|
+
const _options = options ?? {};
|
|
2209
2208
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
2210
2209
|
if (this._disposed) {
|
|
2211
2210
|
stackItemDisposable.dispose();
|
|
@@ -3293,12 +3292,11 @@ const COLORS = {
|
|
|
3293
3292
|
};
|
|
3294
3293
|
var ColorKit = class ColorKit {
|
|
3295
3294
|
static mix(color1, color2, amount) {
|
|
3296
|
-
var _rgb1$a, _rgb2$a;
|
|
3297
3295
|
amount = Math.min(1, Math.max(0, amount));
|
|
3298
3296
|
const rgb1 = new ColorKit(color1).toRgb();
|
|
3299
3297
|
const rgb2 = new ColorKit(color2).toRgb();
|
|
3300
|
-
const alpha1 =
|
|
3301
|
-
const alpha2 =
|
|
3298
|
+
const alpha1 = rgb1.a ?? 1;
|
|
3299
|
+
const alpha2 = rgb2.a ?? 1;
|
|
3302
3300
|
const rgba = {
|
|
3303
3301
|
r: (rgb2.r - rgb1.r) * amount + rgb1.r,
|
|
3304
3302
|
g: (rgb2.g - rgb1.g) * amount + rgb1.g,
|
|
@@ -3403,8 +3401,7 @@ var ColorKit = class ColorKit {
|
|
|
3403
3401
|
return (r * 299 + g * 587 + b * 114) / 1e3;
|
|
3404
3402
|
}
|
|
3405
3403
|
getAlpha() {
|
|
3406
|
-
|
|
3407
|
-
return (_this$_color$a = this._color.a) !== null && _this$_color$a !== void 0 ? _this$_color$a : 1;
|
|
3404
|
+
return this._color.a ?? 1;
|
|
3408
3405
|
}
|
|
3409
3406
|
isDark() {
|
|
3410
3407
|
return this.getBrightness() < 128;
|
|
@@ -3996,7 +3993,6 @@ const dateCodes = [
|
|
|
3996
3993
|
["hm", 9]
|
|
3997
3994
|
];
|
|
3998
3995
|
function info(partitions, currencyId = null) {
|
|
3999
|
-
var _positive$scale;
|
|
4000
3996
|
const [partPositive, partNegative] = partitions;
|
|
4001
3997
|
if (!partPositive) throw new TypeError("Cannot read properties of undefined (reading 'frac_max')");
|
|
4002
3998
|
const positive = isParsedSection$1(partPositive) ? partPositive : void 0;
|
|
@@ -4008,8 +4004,8 @@ function info(partitions, currencyId = null) {
|
|
|
4008
4004
|
isDate: isDate(partitions),
|
|
4009
4005
|
isText: isText(partitions),
|
|
4010
4006
|
isPercent: isPercent(partitions),
|
|
4011
|
-
maxDecimals: (positive === null || positive === void 0 ? void 0 : positive.general) ? 9 : fracMax
|
|
4012
|
-
scale: (
|
|
4007
|
+
maxDecimals: (positive === null || positive === void 0 ? void 0 : positive.general) ? 9 : fracMax ?? 0,
|
|
4008
|
+
scale: (positive === null || positive === void 0 ? void 0 : positive.scale) ?? 1,
|
|
4013
4009
|
color: 0,
|
|
4014
4010
|
parentheses: 0,
|
|
4015
4011
|
grouped: (positive === null || positive === void 0 ? void 0 : positive.grouping) ? 1 : 0,
|
|
@@ -4092,11 +4088,10 @@ function info(partitions, currencyId = null) {
|
|
|
4092
4088
|
return Object.freeze(output);
|
|
4093
4089
|
}
|
|
4094
4090
|
function dateInfo(partitions) {
|
|
4095
|
-
var _positive$date;
|
|
4096
4091
|
const [partPositive] = partitions;
|
|
4097
4092
|
if (!partPositive) throw new TypeError("Cannot read properties of undefined (reading 'date')");
|
|
4098
4093
|
const positive = isParsedSection$1(partPositive) ? partPositive : void 0;
|
|
4099
|
-
const date = (
|
|
4094
|
+
const date = (positive === null || positive === void 0 ? void 0 : positive.date) ?? 0;
|
|
4100
4095
|
return {
|
|
4101
4096
|
year: !!(date & 2),
|
|
4102
4097
|
month: !!(date & 4),
|
|
@@ -5672,8 +5667,7 @@ function getAbsoluteDecimal(value) {
|
|
|
5672
5667
|
} : value;
|
|
5673
5668
|
}
|
|
5674
5669
|
function getDecimalExponent(value) {
|
|
5675
|
-
|
|
5676
|
-
return (_value$exponent = value === null || value === void 0 ? void 0 : value.exponent) !== null && _value$exponent !== void 0 ? _value$exponent : 0;
|
|
5670
|
+
return (value === null || value === void 0 ? void 0 : value.exponent) ?? 0;
|
|
5677
5671
|
}
|
|
5678
5672
|
function usesShortestSignificand(value) {
|
|
5679
5673
|
return !value || value.exponent < -308;
|
|
@@ -5859,7 +5853,6 @@ function legacyRound(number, places = 0) {
|
|
|
5859
5853
|
return Math.round(number);
|
|
5860
5854
|
}
|
|
5861
5855
|
function runPart(value, part, options, locale, decimalValue = null) {
|
|
5862
|
-
var _options$grouping$, _options$grouping$2;
|
|
5863
5856
|
const section = part;
|
|
5864
5857
|
let renderValue = value;
|
|
5865
5858
|
let numericValue = value;
|
|
@@ -5922,8 +5915,8 @@ function runPart(value, part, options, locale, decimalValue = null) {
|
|
|
5922
5915
|
const roundedInteger = Math.abs(Number.isSafeInteger(numericValue) && places === 0 ? numericValue : legacyRound(numericValue, places));
|
|
5923
5916
|
integer += roundedInteger < 1 ? "" : Math.floor(roundedInteger);
|
|
5924
5917
|
}
|
|
5925
|
-
const primaryGroup =
|
|
5926
|
-
const secondaryGroup =
|
|
5918
|
+
const primaryGroup = options.grouping[0] ?? 3;
|
|
5919
|
+
const secondaryGroup = options.grouping[1] ?? primaryGroup;
|
|
5927
5920
|
if (section.dec_fractions) fraction = roundedNumber ? roundedNumber.fraction : String(legacyRound(numericValue, section.frac_max)).split(".")[1] || "";
|
|
5928
5921
|
const fixedSlash = !section.error && (section.num_p.includes("0") || section.den_p.includes("0"));
|
|
5929
5922
|
let haveFraction = fixedSlash;
|
|
@@ -6600,7 +6593,7 @@ function dateToSerial(date, options) {
|
|
|
6600
6593
|
let timestamp = null;
|
|
6601
6594
|
if (Array.isArray(date)) {
|
|
6602
6595
|
const [year, month, day, hours, minutes, seconds] = date;
|
|
6603
|
-
timestamp = dateUTC(year, month == null ? 0 : month - 1, day
|
|
6596
|
+
timestamp = dateUTC(year, month == null ? 0 : month - 1, day ?? 1, hours || 0, minutes || 0, seconds || 0);
|
|
6604
6597
|
} else if (date instanceof Date) {
|
|
6605
6598
|
timestamp = date.getTime();
|
|
6606
6599
|
if (!(options === null || options === void 0 ? void 0 : options.ignoreTimezone)) {
|
|
@@ -6924,6 +6917,7 @@ function isValidDate(year, month, day) {
|
|
|
6924
6917
|
} else if ((month === 4 || month === 6 || month === 9 || month === 11) && day > 30 || (month === 1 || month === 3 || month === 5 || month === 7 || month === 8 || month === 10 || month === 12) && day > 31) return false;
|
|
6925
6918
|
return true;
|
|
6926
6919
|
}
|
|
6920
|
+
const dateLocaleLookupCache = /* @__PURE__ */ new WeakMap();
|
|
6927
6921
|
const matchRec = (string, data, skipPeriod = false) => {
|
|
6928
6922
|
for (const item of data) if (string.startsWith(item[0])) {
|
|
6929
6923
|
let length = item[0].length;
|
|
@@ -7034,23 +7028,39 @@ const getLookups = (values, symbol) => {
|
|
|
7034
7028
|
lookups.sort((a, b) => b[0].length - a[0].length);
|
|
7035
7029
|
return lookups;
|
|
7036
7030
|
};
|
|
7031
|
+
const tokensMatch = (values, cachedValues) => values.length === cachedValues.length && values.every((value, index) => value === cachedValues[index]);
|
|
7032
|
+
const getDateLocaleLookups = (locale) => {
|
|
7033
|
+
let cached = dateLocaleLookupCache.get(locale);
|
|
7034
|
+
if (!cached || !tokensMatch(locale.mmmm, cached.mmmm) || !tokensMatch(locale.mmm, cached.mmm) || !tokensMatch(locale.dddd, cached.dddd) || !tokensMatch(locale.ddd, cached.ddd)) {
|
|
7035
|
+
cached = {
|
|
7036
|
+
lookups: {
|
|
7037
|
+
mon: getLookups(locale.mmmm, "F").concat(getLookups(locale.mmm, "M")),
|
|
7038
|
+
mp: locale.mmm[0].endsWith("."),
|
|
7039
|
+
day: getLookups(locale.dddd, "l").concat(getLookups(locale.ddd, "D")),
|
|
7040
|
+
dp: locale.ddd[0].endsWith(".")
|
|
7041
|
+
},
|
|
7042
|
+
mmmm: [...locale.mmmm],
|
|
7043
|
+
mmm: [...locale.mmm],
|
|
7044
|
+
dddd: [...locale.dddd],
|
|
7045
|
+
ddd: [...locale.ddd]
|
|
7046
|
+
};
|
|
7047
|
+
dateLocaleLookupCache.set(locale, cached);
|
|
7048
|
+
}
|
|
7049
|
+
return cached.lookups;
|
|
7050
|
+
};
|
|
7037
7051
|
/** Parse a date or datetime string and return its serial value and format. */
|
|
7038
7052
|
function parseDate(value, options = {}) {
|
|
7039
|
-
var _date$year, _date$day;
|
|
7040
7053
|
const l10n = getLocale(options.locale || "") || defaultLocale;
|
|
7041
7054
|
const localeData = {
|
|
7042
|
-
|
|
7043
|
-
mp: l10n.mmm[0].at(-1) === ".",
|
|
7044
|
-
day: getLookups(l10n.dddd, "l").concat(getLookups(l10n.ddd, "D")),
|
|
7045
|
-
dp: l10n.ddd[0].at(-1) === ".",
|
|
7055
|
+
...getDateLocaleLookups(l10n),
|
|
7046
7056
|
locale: options.locale
|
|
7047
7057
|
};
|
|
7048
7058
|
const date = nextToken(normDateStr(value), l10n.preferMDY ? dateTrieMD : dateTrieDM, { path: "" }, localeData);
|
|
7049
7059
|
if (!date) return null;
|
|
7050
7060
|
if (date.sep === "." && date.path.length === 3) return null;
|
|
7051
7061
|
if (date.month == null || date._mon == null) return null;
|
|
7052
|
-
const year = +(
|
|
7053
|
-
const day =
|
|
7062
|
+
const year = +(date.year ?? currentYear);
|
|
7063
|
+
const day = date.day ?? "1";
|
|
7054
7064
|
let epoch = -Infinity;
|
|
7055
7065
|
if (year < 1900) return null;
|
|
7056
7066
|
else if (year <= 1900 && date.month <= 2) epoch = 25568;
|
|
@@ -7115,8 +7125,7 @@ function parseBool(value, options = {}) {
|
|
|
7115
7125
|
}
|
|
7116
7126
|
/** Parse a spreadsheet input as a number, date, time, or boolean. */
|
|
7117
7127
|
function parseValue(value, options) {
|
|
7118
|
-
|
|
7119
|
-
return (_ref = (_ref2 = (_parseNumber = parseNumber(value, options)) !== null && _parseNumber !== void 0 ? _parseNumber : parseDate(value, options)) !== null && _ref2 !== void 0 ? _ref2 : parseTime(value, options)) !== null && _ref !== void 0 ? _ref : parseBool(value, options);
|
|
7128
|
+
return parseNumber(value, options) ?? parseDate(value, options) ?? parseTime(value, options) ?? parseBool(value, options);
|
|
7120
7129
|
}
|
|
7121
7130
|
|
|
7122
7131
|
//#endregion
|
|
@@ -7177,19 +7186,17 @@ function prepareFormatterData(pattern, shouldThrow = false) {
|
|
|
7177
7186
|
* Formats a value as a string and returns the result.
|
|
7178
7187
|
*/
|
|
7179
7188
|
function format(pattern, value, options = {}) {
|
|
7180
|
-
var _handleDates;
|
|
7181
7189
|
const resolvedOptions = Object.assign({}, defaultOptions, options);
|
|
7182
7190
|
const data = prepareFormatterData(pattern, resolvedOptions.throws);
|
|
7183
|
-
return formatValue(
|
|
7191
|
+
return formatValue(dateToSerial(value, resolvedOptions) ?? value, data, resolvedOptions);
|
|
7184
7192
|
}
|
|
7185
7193
|
/**
|
|
7186
7194
|
* Find the color appropriate to a value as dictated by a format pattern.
|
|
7187
7195
|
*/
|
|
7188
7196
|
function formatColor(pattern, value, options) {
|
|
7189
|
-
var _handleDates2;
|
|
7190
7197
|
const resolvedOptions = Object.assign({}, defaultOptions, options);
|
|
7191
7198
|
const data = prepareFormatterData(pattern, resolvedOptions.throws);
|
|
7192
|
-
return formatColor$1(
|
|
7199
|
+
return formatColor$1(dateToSerial(value, resolvedOptions) ?? value, data, resolvedOptions);
|
|
7193
7200
|
}
|
|
7194
7201
|
/** Determine if a given format pattern is a date pattern. */
|
|
7195
7202
|
function isDateFormat(pattern) {
|
|
@@ -7659,8 +7666,7 @@ const CURRENCY_SYMBOL_PREFIX_REG = new RegExp(`^${regexp.charset(...Array.from(n
|
|
|
7659
7666
|
* Get the numfmt parse value, and filter out the parse error.
|
|
7660
7667
|
*/
|
|
7661
7668
|
const getNumfmtParseValueFilter = (value) => {
|
|
7662
|
-
|
|
7663
|
-
const parseData = (_ref = (_parseDate = parseDate(value)) !== null && _parseDate !== void 0 ? _parseDate : parseTime(value)) !== null && _ref !== void 0 ? _ref : parseNumber(value);
|
|
7669
|
+
const parseData = parseDate(value) ?? parseTime(value) ?? parseNumber(value);
|
|
7664
7670
|
if (!parseData) return null;
|
|
7665
7671
|
const { z } = parseData;
|
|
7666
7672
|
if (z) {
|
|
@@ -8379,20 +8385,20 @@ function handleStyleToString(style, isCell = false) {
|
|
|
8379
8385
|
["bd", () => {
|
|
8380
8386
|
var _style$bd, _style$bd3, _style$bd5, _style$bd7;
|
|
8381
8387
|
if ((_style$bd = style.bd) === null || _style$bd === void 0 ? void 0 : _style$bd.b) {
|
|
8382
|
-
var _style$bd2
|
|
8383
|
-
str += `border-bottom: ${getBorderStyle((_style$bd2 = style.bd) === null || _style$bd2 === void 0 ? void 0 : _style$bd2.b.s)} ${
|
|
8388
|
+
var _style$bd2;
|
|
8389
|
+
str += `border-bottom: ${getBorderStyle((_style$bd2 = style.bd) === null || _style$bd2 === void 0 ? void 0 : _style$bd2.b.s)} ${getColorStyle(style.bd.b.cl) ?? ""}; `;
|
|
8384
8390
|
}
|
|
8385
8391
|
if ((_style$bd3 = style.bd) === null || _style$bd3 === void 0 ? void 0 : _style$bd3.t) {
|
|
8386
|
-
var _style$bd4
|
|
8387
|
-
str += `border-top: ${getBorderStyle((_style$bd4 = style.bd) === null || _style$bd4 === void 0 ? void 0 : _style$bd4.t.s)} ${
|
|
8392
|
+
var _style$bd4;
|
|
8393
|
+
str += `border-top: ${getBorderStyle((_style$bd4 = style.bd) === null || _style$bd4 === void 0 ? void 0 : _style$bd4.t.s)} ${getColorStyle(style.bd.t.cl) ?? ""}; `;
|
|
8388
8394
|
}
|
|
8389
8395
|
if ((_style$bd5 = style.bd) === null || _style$bd5 === void 0 ? void 0 : _style$bd5.r) {
|
|
8390
|
-
var _style$bd6
|
|
8391
|
-
str += `border-right: ${getBorderStyle((_style$bd6 = style.bd) === null || _style$bd6 === void 0 ? void 0 : _style$bd6.r.s)} ${
|
|
8396
|
+
var _style$bd6;
|
|
8397
|
+
str += `border-right: ${getBorderStyle((_style$bd6 = style.bd) === null || _style$bd6 === void 0 ? void 0 : _style$bd6.r.s)} ${getColorStyle(style.bd.r.cl) ?? ""}; `;
|
|
8392
8398
|
}
|
|
8393
8399
|
if ((_style$bd7 = style.bd) === null || _style$bd7 === void 0 ? void 0 : _style$bd7.l) {
|
|
8394
|
-
var _style$bd8
|
|
8395
|
-
str += `border-left: ${getBorderStyle((_style$bd8 = style.bd) === null || _style$bd8 === void 0 ? void 0 : _style$bd8.l.s)} ${
|
|
8400
|
+
var _style$bd8;
|
|
8401
|
+
str += `border-left: ${getBorderStyle((_style$bd8 = style.bd) === null || _style$bd8 === void 0 ? void 0 : _style$bd8.l.s)} ${getColorStyle(style.bd.l.cl) ?? ""}; `;
|
|
8396
8402
|
}
|
|
8397
8403
|
}],
|
|
8398
8404
|
["cl", () => {
|
|
@@ -8809,8 +8815,7 @@ function parseDateString(input, isUTC) {
|
|
|
8809
8815
|
return new Date(text);
|
|
8810
8816
|
}
|
|
8811
8817
|
function normalizeUnit(unit) {
|
|
8812
|
-
|
|
8813
|
-
return (_UNIT_ALIASES$unit = UNIT_ALIASES[unit]) !== null && _UNIT_ALIASES$unit !== void 0 ? _UNIT_ALIASES$unit : UNIT_ALIASES[String(unit).toLowerCase()];
|
|
8818
|
+
return UNIT_ALIASES[unit] ?? UNIT_ALIASES[String(unit).toLowerCase()];
|
|
8814
8819
|
}
|
|
8815
8820
|
function daysInMonth(year, month, isUTC) {
|
|
8816
8821
|
return isUTC ? new Date(Date.UTC(year, month, 0)).getUTCDate() : new Date(year, month, 0).getDate();
|
|
@@ -8929,10 +8934,7 @@ function ordinal(value) {
|
|
|
8929
8934
|
}
|
|
8930
8935
|
}
|
|
8931
8936
|
function replaceLocalizedTokens(template) {
|
|
8932
|
-
return template.replace(/LLLL|LLL|LL|L|llll|lll|ll|l/g, (token) =>
|
|
8933
|
-
var _LOCALIZED_FORMAT_MAP;
|
|
8934
|
-
return (_LOCALIZED_FORMAT_MAP = LOCALIZED_FORMAT_MAP[token]) !== null && _LOCALIZED_FORMAT_MAP !== void 0 ? _LOCALIZED_FORMAT_MAP : token;
|
|
8935
|
-
});
|
|
8937
|
+
return template.replace(/LLLL|LLL|LL|L|llll|lll|ll|l/g, (token) => LOCALIZED_FORMAT_MAP[token] ?? token);
|
|
8936
8938
|
}
|
|
8937
8939
|
function formatDate(date, template, isUTC) {
|
|
8938
8940
|
const parts = getDateParts(date, isUTC);
|
|
@@ -8974,13 +8976,7 @@ function formatDate(date, template, isUTC) {
|
|
|
8974
8976
|
const escapedBlocks = [];
|
|
8975
8977
|
return replaceLocalizedTokens(template.replace(/\[([^\]]+)]/g, (_, value) => {
|
|
8976
8978
|
return `\u0000${escapedBlocks.push(value) - 1}\u0000`;
|
|
8977
|
-
})).replace(/YYYY|YY|MMMM|MMM|MM|M|DD|Do|D|dddd|ddd|dd|d|HH|H|hh|h|mm|m|ss|s|SSS|A|a|Qo|Q|X|x|ZZ|Z/g, (token) =>
|
|
8978
|
-
var _tokenMap$token;
|
|
8979
|
-
return (_tokenMap$token = tokenMap[token]) !== null && _tokenMap$token !== void 0 ? _tokenMap$token : token;
|
|
8980
|
-
}).replace(/\u0000(\d+)\u0000/g, (_, indexText) => {
|
|
8981
|
-
var _escapedBlocks$Number;
|
|
8982
|
-
return (_escapedBlocks$Number = escapedBlocks[Number(indexText)]) !== null && _escapedBlocks$Number !== void 0 ? _escapedBlocks$Number : "";
|
|
8983
|
-
});
|
|
8979
|
+
})).replace(/YYYY|YY|MMMM|MMM|MM|M|DD|Do|D|dddd|ddd|dd|d|HH|H|hh|h|mm|m|ss|s|SSS|A|a|Qo|Q|X|x|ZZ|Z/g, (token) => tokenMap[token] ?? token).replace(/\u0000(\d+)\u0000/g, (_, indexText) => escapedBlocks[Number(indexText)] ?? "");
|
|
8984
8980
|
}
|
|
8985
8981
|
function createDateKit(input) {
|
|
8986
8982
|
return new DateKitImpl(toDate(input, false), false);
|
|
@@ -10639,8 +10635,8 @@ var Range = class Range {
|
|
|
10639
10635
|
* Returns the underline of the cells in the range.
|
|
10640
10636
|
*/
|
|
10641
10637
|
getUnderline() {
|
|
10642
|
-
var
|
|
10643
|
-
const { p } =
|
|
10638
|
+
var _p$body;
|
|
10639
|
+
const { p } = this.getValue() ?? {};
|
|
10644
10640
|
if (p && Array.isArray((_p$body = p.body) === null || _p$body === void 0 ? void 0 : _p$body.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("ul", p.body) === 1 ? { s: 1 } : { s: 0 };
|
|
10645
10641
|
return this.getUnderlines()[0][0];
|
|
10646
10642
|
}
|
|
@@ -10660,8 +10656,8 @@ var Range = class Range {
|
|
|
10660
10656
|
* Returns the strikeThrough of the cells in the range.
|
|
10661
10657
|
*/
|
|
10662
10658
|
getStrikeThrough() {
|
|
10663
|
-
var
|
|
10664
|
-
const { p } =
|
|
10659
|
+
var _p$body2;
|
|
10660
|
+
const { p } = this.getValue() ?? {};
|
|
10665
10661
|
if (p && Array.isArray((_p$body2 = p.body) === null || _p$body2 === void 0 ? void 0 : _p$body2.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("st", p.body) === 1 ? { s: 1 } : { s: 0 };
|
|
10666
10662
|
return this.getStrikeThroughs()[0][0];
|
|
10667
10663
|
}
|
|
@@ -10675,8 +10671,8 @@ var Range = class Range {
|
|
|
10675
10671
|
* Returns the font size in point size of the cell in the top-left corner of the range.
|
|
10676
10672
|
*/
|
|
10677
10673
|
getFontSize() {
|
|
10678
|
-
var _this$
|
|
10679
|
-
const p = ((_this$
|
|
10674
|
+
var _this$getValue, _p$body3;
|
|
10675
|
+
const p = ((_this$getValue = this.getValue()) === null || _this$getValue === void 0 ? void 0 : _this$getValue.p) || {};
|
|
10680
10676
|
if (p && Array.isArray((_p$body3 = p.body) === null || _p$body3 === void 0 ? void 0 : _p$body3.textRuns) && p.body.textRuns.length > 0) if (p.body.textRuns.some((textRun) => {
|
|
10681
10677
|
var _textRun$ts;
|
|
10682
10678
|
return (textRun === null || textRun === void 0 || (_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) != null;
|
|
@@ -10706,8 +10702,8 @@ var Range = class Range {
|
|
|
10706
10702
|
* Returns the font style ('italic' or 'normal') of the cell in the top-left corner of the range.
|
|
10707
10703
|
*/
|
|
10708
10704
|
getFontStyle() {
|
|
10709
|
-
var
|
|
10710
|
-
const { p } =
|
|
10705
|
+
var _p$body4;
|
|
10706
|
+
const { p } = this.getValue() ?? {};
|
|
10711
10707
|
if (p && Array.isArray((_p$body4 = p.body) === null || _p$body4 === void 0 ? void 0 : _p$body4.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("it", p.body) === 1 ? 1 : 0;
|
|
10712
10708
|
return this._getFontStyles()[0][0];
|
|
10713
10709
|
}
|
|
@@ -10724,8 +10720,8 @@ var Range = class Range {
|
|
|
10724
10720
|
* otherwise return FontWeight.NORMAL.
|
|
10725
10721
|
*/
|
|
10726
10722
|
getFontWeight() {
|
|
10727
|
-
var
|
|
10728
|
-
const { p } =
|
|
10723
|
+
var _p$body5;
|
|
10724
|
+
const { p } = this.getValue() ?? {};
|
|
10729
10725
|
if (p && Array.isArray((_p$body5 = p.body) === null || _p$body5 === void 0 ? void 0 : _p$body5.textRuns) && p.body.textRuns.length > 0) return isAllFormatInTextRuns("bl", p.body) === 1 ? 1 : 0;
|
|
10730
10726
|
return this._getFontWeights()[0][0];
|
|
10731
10727
|
}
|
|
@@ -11900,7 +11896,6 @@ function ABCToNumber(a) {
|
|
|
11900
11896
|
const orderA = "A".charCodeAt(0);
|
|
11901
11897
|
"Z".charCodeAt(0);
|
|
11902
11898
|
const order_a = "a".charCodeAt(0);
|
|
11903
|
-
"z".charCodeAt(0);
|
|
11904
11899
|
/**
|
|
11905
11900
|
* column subscript number to letters
|
|
11906
11901
|
* @param n number
|
|
@@ -11997,26 +11992,25 @@ let BaseFieldType = /* @__PURE__ */ function(BaseFieldType) {
|
|
|
11997
11992
|
BaseFieldType["Checkbox"] = "checkbox";
|
|
11998
11993
|
BaseFieldType["Link"] = "link";
|
|
11999
11994
|
BaseFieldType["Formula"] = "formula";
|
|
12000
|
-
BaseFieldType["Lookup"] = "lookup";
|
|
12001
|
-
BaseFieldType["Flow"] = "flow";
|
|
12002
|
-
BaseFieldType["Button"] = "button";
|
|
12003
11995
|
BaseFieldType["Numbering"] = "numbering";
|
|
12004
11996
|
BaseFieldType["Phone"] = "phone";
|
|
12005
11997
|
BaseFieldType["Email"] = "email";
|
|
12006
|
-
BaseFieldType["Location"] = "location";
|
|
12007
|
-
BaseFieldType["Barcode"] = "barcode";
|
|
12008
11998
|
BaseFieldType["Progress"] = "progress";
|
|
12009
11999
|
BaseFieldType["Currency"] = "currency";
|
|
12010
12000
|
BaseFieldType["Rating"] = "rating";
|
|
12011
|
-
BaseFieldType["
|
|
12001
|
+
BaseFieldType["RecordLink"] = "recordLink";
|
|
12012
12002
|
BaseFieldType["RecordId"] = "recordId";
|
|
12013
12003
|
BaseFieldType["CreatedBy"] = "createdBy";
|
|
12014
12004
|
BaseFieldType["UpdatedBy"] = "updatedBy";
|
|
12015
12005
|
BaseFieldType["CreatedAt"] = "createdAt";
|
|
12016
12006
|
BaseFieldType["UpdatedAt"] = "updatedAt";
|
|
12017
|
-
BaseFieldType["Summary"] = "summary";
|
|
12018
12007
|
return BaseFieldType;
|
|
12019
12008
|
}({});
|
|
12009
|
+
/** Semantic roles supported by Base RecordLink fields. */
|
|
12010
|
+
let BaseRecordLinkRole = /* @__PURE__ */ function(BaseRecordLinkRole) {
|
|
12011
|
+
BaseRecordLinkRole["Parent"] = "parent";
|
|
12012
|
+
return BaseRecordLinkRole;
|
|
12013
|
+
}({});
|
|
12020
12014
|
let BaseViewType = /* @__PURE__ */ function(BaseViewType) {
|
|
12021
12015
|
BaseViewType["Grid"] = "grid";
|
|
12022
12016
|
BaseViewType["Kanban"] = "kanban";
|
|
@@ -12025,6 +12019,56 @@ let BaseViewType = /* @__PURE__ */ function(BaseViewType) {
|
|
|
12025
12019
|
BaseViewType["Gallery"] = "gallery";
|
|
12026
12020
|
return BaseViewType;
|
|
12027
12021
|
}({});
|
|
12022
|
+
/** Where a Base conditional color is painted when its condition matches. */
|
|
12023
|
+
const BaseConditionalColorTarget = {
|
|
12024
|
+
/** Paint only the cell in the rule's field. */
|
|
12025
|
+
CELL: "cell",
|
|
12026
|
+
/** Paint the complete record row. */
|
|
12027
|
+
ROW: "row",
|
|
12028
|
+
/** Paint the rule's field column unconditionally; operator, operand, and date mode are ignored. */
|
|
12029
|
+
COLUMN: "column"
|
|
12030
|
+
};
|
|
12031
|
+
/**
|
|
12032
|
+
* Operators supported by Base conditional coloring rules.
|
|
12033
|
+
*
|
|
12034
|
+
* Text, select, person, and similar fields support equality, containment, and
|
|
12035
|
+
* empty checks. Number, currency, progress, and rating fields support equality,
|
|
12036
|
+
* numeric comparison, and empty checks. Date-like fields support equality,
|
|
12037
|
+
* before/after, and empty checks. Checkbox fields support equality only.
|
|
12038
|
+
*/
|
|
12039
|
+
const BaseConditionalColorOperator = {
|
|
12040
|
+
IS: "is",
|
|
12041
|
+
IS_NOT: "isNot",
|
|
12042
|
+
CONTAINS: "contains",
|
|
12043
|
+
NOT_CONTAINS: "notContains",
|
|
12044
|
+
IS_EMPTY: "isEmpty",
|
|
12045
|
+
IS_NOT_EMPTY: "isNotEmpty",
|
|
12046
|
+
GREATER_THAN: "greaterThan",
|
|
12047
|
+
LESS_THAN: "lessThan",
|
|
12048
|
+
BEFORE: "before",
|
|
12049
|
+
AFTER: "after"
|
|
12050
|
+
};
|
|
12051
|
+
/**
|
|
12052
|
+
* Relative or exact date windows supported by date conditional coloring rules.
|
|
12053
|
+
*
|
|
12054
|
+
* With `IS`, dates inside the selected window match. `IS_NOT` matches dates
|
|
12055
|
+
* outside it, `BEFORE` matches dates before its start, and `AFTER` matches
|
|
12056
|
+
* dates after its end. Relative windows do not use an operand; `EXACT` does.
|
|
12057
|
+
*/
|
|
12058
|
+
const BaseConditionalDateMode = {
|
|
12059
|
+
EXACT: "exact",
|
|
12060
|
+
TODAY: "today",
|
|
12061
|
+
TOMORROW: "tomorrow",
|
|
12062
|
+
YESTERDAY: "yesterday",
|
|
12063
|
+
THIS_WEEK: "thisWeek",
|
|
12064
|
+
LAST_WEEK: "lastWeek",
|
|
12065
|
+
THIS_MONTH: "thisMonth",
|
|
12066
|
+
LAST_MONTH: "lastMonth",
|
|
12067
|
+
PAST_7_DAYS: "past7",
|
|
12068
|
+
NEXT_7_DAYS: "next7",
|
|
12069
|
+
PAST_30_DAYS: "past30",
|
|
12070
|
+
NEXT_30_DAYS: "next30"
|
|
12071
|
+
};
|
|
12028
12072
|
let BaseFilterOperator = /* @__PURE__ */ function(BaseFilterOperator) {
|
|
12029
12073
|
BaseFilterOperator["IS"] = "is";
|
|
12030
12074
|
BaseFilterOperator["IS_NOT"] = "isNot";
|
|
@@ -12050,18 +12094,58 @@ let BaseSortDirection = /* @__PURE__ */ function(BaseSortDirection) {
|
|
|
12050
12094
|
BaseSortDirection["DESC"] = "desc";
|
|
12051
12095
|
return BaseSortDirection;
|
|
12052
12096
|
}({});
|
|
12097
|
+
/** Why a stored Parent link cannot participate in the effective hierarchy. */
|
|
12098
|
+
let BaseHierarchyInvalidReason = /* @__PURE__ */ function(BaseHierarchyInvalidReason) {
|
|
12099
|
+
BaseHierarchyInvalidReason["MissingParent"] = "missingParent";
|
|
12100
|
+
BaseHierarchyInvalidReason["SelfParent"] = "selfParent";
|
|
12101
|
+
BaseHierarchyInvalidReason["Cycle"] = "cycle";
|
|
12102
|
+
BaseHierarchyInvalidReason["MaxDepth"] = "maxDepth";
|
|
12103
|
+
return BaseHierarchyInvalidReason;
|
|
12104
|
+
}({});
|
|
12105
|
+
|
|
12106
|
+
//#endregion
|
|
12107
|
+
//#region src/bases/record-identity.ts
|
|
12108
|
+
const BASE_RECORD_ID_FIELD_ID = "__record_id";
|
|
12109
|
+
const BASE_RECORD_ID_FIELD_NAME = "record-id";
|
|
12110
|
+
const BASE_RECORD_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
12111
|
+
function createBaseRecordIdField() {
|
|
12112
|
+
return {
|
|
12113
|
+
id: BASE_RECORD_ID_FIELD_ID,
|
|
12114
|
+
name: BASE_RECORD_ID_FIELD_NAME,
|
|
12115
|
+
type: "recordId",
|
|
12116
|
+
config: {},
|
|
12117
|
+
system: true,
|
|
12118
|
+
readonly: true
|
|
12119
|
+
};
|
|
12120
|
+
}
|
|
12121
|
+
function isValidBaseRecordId(recordId) {
|
|
12122
|
+
return BASE_RECORD_ID_PATTERN.test(recordId);
|
|
12123
|
+
}
|
|
12124
|
+
function isBaseRecordIdFieldName(name) {
|
|
12125
|
+
return name.trim().toLowerCase() === BASE_RECORD_ID_FIELD_NAME;
|
|
12126
|
+
}
|
|
12127
|
+
function assertBaseTableRecordIdentity(table) {
|
|
12128
|
+
const recordIdField = table.fields[BASE_RECORD_ID_FIELD_ID];
|
|
12129
|
+
const recordIdFields = Object.values(table.fields).filter((field) => field.type === "recordId");
|
|
12130
|
+
if (!recordIdField || recordIdFields.length !== 1 || recordIdField.type !== "recordId" || recordIdField.name !== "record-id" || recordIdField.system !== true || recordIdField.readonly !== true || table.fieldOrder[0] !== "__record_id" || table.primaryFieldId === "__record_id" || !table.fields[table.primaryFieldId]) throw new Error(`[BaseDataModel]: table "${table.id}" has an invalid record-id system field.`);
|
|
12131
|
+
const conflictingField = Object.values(table.fields).find((field) => {
|
|
12132
|
+
return field.id !== "__record_id" && isBaseRecordIdFieldName(field.name);
|
|
12133
|
+
});
|
|
12134
|
+
if (conflictingField) throw new Error(`[BaseDataModel]: field name "${conflictingField.name}" is reserved for the record-id system field.`);
|
|
12135
|
+
for (const [recordKey, record] of Object.entries(table.records)) if (record.id !== recordKey || !isValidBaseRecordId(record.id) || record.values["__record_id"] !== record.id) throw new Error(`[BaseDataModel]: record "${recordKey}" has an invalid record-id projection.`);
|
|
12136
|
+
}
|
|
12053
12137
|
|
|
12054
12138
|
//#endregion
|
|
12055
12139
|
//#region src/bases/empty-snapshot.ts
|
|
12056
12140
|
function createDefaultBaseTableSnapshot(options) {
|
|
12057
|
-
|
|
12058
|
-
const
|
|
12059
|
-
const
|
|
12060
|
-
const
|
|
12061
|
-
const
|
|
12141
|
+
const now = options.now ?? Date.now();
|
|
12142
|
+
const primaryFieldId = options.primaryFieldId ?? generateRandomId(6);
|
|
12143
|
+
const gridViewId = options.gridViewId ?? generateRandomId(6);
|
|
12144
|
+
const recordCount = options.recordCount ?? 0;
|
|
12145
|
+
const recordIdField = createBaseRecordIdField();
|
|
12062
12146
|
const primaryField = {
|
|
12063
12147
|
id: primaryFieldId,
|
|
12064
|
-
name:
|
|
12148
|
+
name: options.primaryFieldName ?? "Name",
|
|
12065
12149
|
type: "text",
|
|
12066
12150
|
config: { placeholder: "bases.fieldConfig.textPlaceholder" }
|
|
12067
12151
|
};
|
|
@@ -12074,7 +12158,7 @@ function createDefaultBaseTableSnapshot(options) {
|
|
|
12074
12158
|
const recordId = `${options.id}-record-${index + 1}`;
|
|
12075
12159
|
records[recordId] = {
|
|
12076
12160
|
id: recordId,
|
|
12077
|
-
values: {},
|
|
12161
|
+
values: { [BASE_RECORD_ID_FIELD_ID]: recordId },
|
|
12078
12162
|
orderKey: String(index + 1).padStart(4, "0"),
|
|
12079
12163
|
createdAt: now,
|
|
12080
12164
|
updatedAt: now
|
|
@@ -12082,29 +12166,41 @@ function createDefaultBaseTableSnapshot(options) {
|
|
|
12082
12166
|
recordOrder.push(recordId);
|
|
12083
12167
|
rowIndex[recordId] = index;
|
|
12084
12168
|
rowId[index] = recordId;
|
|
12085
|
-
cellData[index] = {
|
|
12169
|
+
cellData[index] = { 0: {
|
|
12170
|
+
v: recordId,
|
|
12171
|
+
t: 1
|
|
12172
|
+
} };
|
|
12086
12173
|
}
|
|
12087
12174
|
const gridView = {
|
|
12088
12175
|
id: gridViewId,
|
|
12089
12176
|
tableId: options.id,
|
|
12090
12177
|
name: "Grid",
|
|
12091
12178
|
type: "grid",
|
|
12092
|
-
fieldOrder: [primaryFieldId],
|
|
12093
|
-
fieldSettings: {},
|
|
12179
|
+
fieldOrder: [BASE_RECORD_ID_FIELD_ID, primaryFieldId],
|
|
12180
|
+
fieldSettings: { [BASE_RECORD_ID_FIELD_ID]: { hidden: true } },
|
|
12094
12181
|
config: { frozenFieldCount: 1 }
|
|
12095
12182
|
};
|
|
12096
12183
|
return {
|
|
12097
12184
|
id: options.id,
|
|
12098
12185
|
name: options.name,
|
|
12099
12186
|
primaryFieldId,
|
|
12100
|
-
fieldOrder: [primaryFieldId],
|
|
12101
|
-
fields: {
|
|
12187
|
+
fieldOrder: [BASE_RECORD_ID_FIELD_ID, primaryFieldId],
|
|
12188
|
+
fields: {
|
|
12189
|
+
[BASE_RECORD_ID_FIELD_ID]: recordIdField,
|
|
12190
|
+
[primaryFieldId]: primaryField
|
|
12191
|
+
},
|
|
12102
12192
|
records,
|
|
12103
12193
|
recordOrder,
|
|
12104
12194
|
rowIndex,
|
|
12105
12195
|
rowId,
|
|
12106
|
-
colIndex: {
|
|
12107
|
-
|
|
12196
|
+
colIndex: {
|
|
12197
|
+
[BASE_RECORD_ID_FIELD_ID]: 0,
|
|
12198
|
+
[primaryFieldId]: 1
|
|
12199
|
+
},
|
|
12200
|
+
colId: {
|
|
12201
|
+
0: BASE_RECORD_ID_FIELD_ID,
|
|
12202
|
+
1: primaryFieldId
|
|
12203
|
+
},
|
|
12108
12204
|
cellData,
|
|
12109
12205
|
resources: {
|
|
12110
12206
|
attachmentSets: {},
|
|
@@ -12122,13 +12218,13 @@ function getEmptySnapshot(unitId = generateRandomId(), name = "", locale = "zhCN
|
|
|
12122
12218
|
name,
|
|
12123
12219
|
locale,
|
|
12124
12220
|
appVersion: version,
|
|
12125
|
-
schemaVersion:
|
|
12221
|
+
schemaVersion: 2,
|
|
12126
12222
|
tableOrder: [tableId],
|
|
12127
12223
|
tables: { [tableId]: createDefaultBaseTableSnapshot({
|
|
12128
12224
|
id: tableId,
|
|
12129
12225
|
name: "Table 1",
|
|
12130
12226
|
now,
|
|
12131
|
-
recordCount:
|
|
12227
|
+
recordCount: 0
|
|
12132
12228
|
}) },
|
|
12133
12229
|
createdAt: now,
|
|
12134
12230
|
updatedAt: now
|
|
@@ -12182,8 +12278,7 @@ var BaseDataModel = class extends UnitModel {
|
|
|
12182
12278
|
this._name$.next(snapshot.name);
|
|
12183
12279
|
}
|
|
12184
12280
|
getRev() {
|
|
12185
|
-
|
|
12186
|
-
return (_this$_snapshot$rev = this._snapshot.rev) !== null && _this$_snapshot$rev !== void 0 ? _this$_snapshot$rev : 1;
|
|
12281
|
+
return this._snapshot.rev ?? 1;
|
|
12187
12282
|
}
|
|
12188
12283
|
incrementRev() {
|
|
12189
12284
|
this._snapshot.rev = this.getRev() + 1;
|
|
@@ -12197,27 +12292,28 @@ var BaseDataModel = class extends UnitModel {
|
|
|
12197
12292
|
}
|
|
12198
12293
|
};
|
|
12199
12294
|
function normalizeBaseSnapshot(snapshot) {
|
|
12200
|
-
var _snapshot$tables;
|
|
12201
12295
|
delete snapshot.compress;
|
|
12202
12296
|
delete snapshot.kind;
|
|
12203
|
-
Object.values(
|
|
12297
|
+
Object.values(snapshot.tables ?? {}).forEach((table) => {
|
|
12298
|
+
assertBaseTableRecordIdentity(table);
|
|
12204
12299
|
normalizeBaseTable(table);
|
|
12300
|
+
assertMaterializedRecordIdentity(table);
|
|
12205
12301
|
});
|
|
12206
12302
|
return snapshot;
|
|
12207
12303
|
}
|
|
12208
12304
|
function isNormalizedBaseSnapshot(snapshot) {
|
|
12209
|
-
|
|
12210
|
-
return Object.values((_snapshot$tables2 = snapshot.tables) !== null && _snapshot$tables2 !== void 0 ? _snapshot$tables2 : {}).every((table) => isNormalizedBaseTable(table));
|
|
12305
|
+
return Object.values(snapshot.tables ?? {}).every((table) => isNormalizedBaseTable(table));
|
|
12211
12306
|
}
|
|
12212
12307
|
function isNormalizedBaseTable(table) {
|
|
12213
|
-
|
|
12214
|
-
const
|
|
12215
|
-
|
|
12308
|
+
const records = table.records ?? {};
|
|
12309
|
+
const fields = table.fields ?? {};
|
|
12310
|
+
assertBaseTableRecordIdentity(table);
|
|
12216
12311
|
if (!Array.isArray(table.recordOrder) || !table.rowIndex || !table.rowId || !table.colIndex || !table.colId || !table.cellData || !table.resources || !table.resources.attachmentSets || !table.resources.attachments) return false;
|
|
12217
12312
|
if (Object.keys(records).length !== table.recordOrder.length) return false;
|
|
12218
12313
|
for (let index = 0; index < table.recordOrder.length; index++) {
|
|
12314
|
+
var _table$cellData$index;
|
|
12219
12315
|
const recordId = table.recordOrder[index];
|
|
12220
|
-
if (!records[recordId] || table.rowIndex[recordId] !== index || table.rowId[index] !== recordId) return false;
|
|
12316
|
+
if (!records[recordId] || table.rowIndex[recordId] !== index || table.rowId[index] !== recordId || ((_table$cellData$index = table.cellData[index]) === null || _table$cellData$index === void 0 || (_table$cellData$index = _table$cellData$index[0]) === null || _table$cellData$index === void 0 ? void 0 : _table$cellData$index.v) !== recordId) return false;
|
|
12221
12317
|
}
|
|
12222
12318
|
for (let index = 0; index < table.fieldOrder.length; index++) {
|
|
12223
12319
|
const fieldId = table.fieldOrder[index];
|
|
@@ -12227,10 +12323,9 @@ function isNormalizedBaseTable(table) {
|
|
|
12227
12323
|
return true;
|
|
12228
12324
|
}
|
|
12229
12325
|
function normalizeBaseTable(table) {
|
|
12230
|
-
var _table$records2, _table$fields2;
|
|
12231
12326
|
hydrateCompressedCellData(table);
|
|
12232
|
-
const records =
|
|
12233
|
-
const fields =
|
|
12327
|
+
const records = table.records ?? {};
|
|
12328
|
+
const fields = table.fields ?? {};
|
|
12234
12329
|
const orderedRecordIds = getOrderedRecordIds(table, records);
|
|
12235
12330
|
const orderedFieldIds = getOrderedFieldIds(table, fields);
|
|
12236
12331
|
table.recordOrder = orderedRecordIds;
|
|
@@ -12245,8 +12340,7 @@ function hydrateCompressedCellData(table) {
|
|
|
12245
12340
|
if (compressedCellData && !table.cellData) {
|
|
12246
12341
|
table.cellData = Object.create(null);
|
|
12247
12342
|
compressedCellData.forEach(([row, col, cell]) => {
|
|
12248
|
-
|
|
12249
|
-
table.cellData[row] = (_row = table.cellData[row]) !== null && _row !== void 0 ? _row : {};
|
|
12343
|
+
table.cellData[row] = table.cellData[row] ?? {};
|
|
12250
12344
|
const { c: _compressed, ...cellData } = cell;
|
|
12251
12345
|
table.cellData[row][col] = cellData;
|
|
12252
12346
|
});
|
|
@@ -12254,8 +12348,8 @@ function hydrateCompressedCellData(table) {
|
|
|
12254
12348
|
}
|
|
12255
12349
|
}
|
|
12256
12350
|
function getOrderedRecordIds(table, records) {
|
|
12257
|
-
var _table$recordOrder
|
|
12258
|
-
const orderedRecordIds = (
|
|
12351
|
+
var _table$recordOrder;
|
|
12352
|
+
const orderedRecordIds = ((_table$recordOrder = table.recordOrder) === null || _table$recordOrder === void 0 ? void 0 : _table$recordOrder.filter((recordId) => records[recordId])) ?? [];
|
|
12259
12353
|
const orderedRecordIdSet = new Set(orderedRecordIds);
|
|
12260
12354
|
const missingRecords = Object.values(records).filter((record) => !orderedRecordIdSet.has(record.id));
|
|
12261
12355
|
if (!missingRecords.length) return orderedRecordIds;
|
|
@@ -12275,12 +12369,10 @@ function cloneBaseTableMutableMaps(table) {
|
|
|
12275
12369
|
table.resources.attachments = { ...table.resources.attachments };
|
|
12276
12370
|
}
|
|
12277
12371
|
function normalizeExistingCellData(table, fields) {
|
|
12278
|
-
|
|
12279
|
-
Object.entries((_table$cellData = table.cellData) !== null && _table$cellData !== void 0 ? _table$cellData : {}).forEach(([rowKey, rowData]) => {
|
|
12280
|
-
var _row2;
|
|
12372
|
+
Object.entries(table.cellData ?? {}).forEach(([rowKey, rowData]) => {
|
|
12281
12373
|
const row = Number(rowKey);
|
|
12282
12374
|
table.cellData[row] = { ...rowData };
|
|
12283
|
-
Object.entries(
|
|
12375
|
+
Object.entries(table.cellData[row] ?? {}).forEach(([colKey, cell]) => {
|
|
12284
12376
|
var _table$colId;
|
|
12285
12377
|
const col = Number(colKey);
|
|
12286
12378
|
const fieldId = (_table$colId = table.colId) === null || _table$colId === void 0 ? void 0 : _table$colId[col];
|
|
@@ -12289,44 +12381,58 @@ function normalizeExistingCellData(table, fields) {
|
|
|
12289
12381
|
});
|
|
12290
12382
|
}
|
|
12291
12383
|
function rebuildRowIndexes(table, records, orderedRecordIds) {
|
|
12292
|
-
var _table$rowIndex;
|
|
12293
12384
|
orderedRecordIds.forEach((recordId, index) => {
|
|
12294
12385
|
if (table.rowIndex[recordId] == null) table.rowIndex[recordId] = index;
|
|
12295
12386
|
});
|
|
12296
|
-
Object.entries(
|
|
12387
|
+
Object.entries(table.rowIndex ?? {}).forEach(([recordId, row]) => {
|
|
12297
12388
|
if (records[recordId]) table.rowId[row] = recordId;
|
|
12298
12389
|
});
|
|
12299
12390
|
}
|
|
12300
12391
|
function rebuildColumnIndexes(table, fields, orderedFieldIds) {
|
|
12301
|
-
var _table$colIndex;
|
|
12302
12392
|
orderedFieldIds.forEach((fieldId, index) => {
|
|
12303
12393
|
if (table.colIndex[fieldId] == null) table.colIndex[fieldId] = index;
|
|
12304
12394
|
});
|
|
12305
|
-
Object.entries(
|
|
12395
|
+
Object.entries(table.colIndex ?? {}).forEach(([fieldId, col]) => {
|
|
12306
12396
|
if (fields[fieldId]) table.colId[col] = fieldId;
|
|
12307
12397
|
});
|
|
12308
12398
|
}
|
|
12309
12399
|
function hydrateRecordCellData(table, records, fields) {
|
|
12400
|
+
const rowIndex = table.rowIndex ?? {};
|
|
12401
|
+
const colIndex = table.colIndex ?? {};
|
|
12402
|
+
const cellData = table.cellData ?? {};
|
|
12403
|
+
table.rowIndex = rowIndex;
|
|
12404
|
+
table.colIndex = colIndex;
|
|
12405
|
+
table.cellData = cellData;
|
|
12310
12406
|
Object.values(records).forEach((record) => {
|
|
12311
|
-
|
|
12312
|
-
const row = table.rowIndex[record.id];
|
|
12407
|
+
const row = rowIndex[record.id];
|
|
12313
12408
|
if (row == null) return;
|
|
12314
|
-
|
|
12315
|
-
|
|
12409
|
+
cellData[row] = { ...cellData[row] };
|
|
12410
|
+
cellData[row][0] = {
|
|
12411
|
+
v: record.id,
|
|
12412
|
+
t: 1
|
|
12413
|
+
};
|
|
12414
|
+
Object.entries(record.values ?? {}).forEach(([fieldId, value]) => {
|
|
12316
12415
|
const field = fields[fieldId];
|
|
12317
12416
|
if ((field === null || field === void 0 ? void 0 : field.type) === "attachment") writeAttachmentResources(table, record.id, fieldId, value);
|
|
12318
|
-
const col =
|
|
12417
|
+
const col = colIndex[fieldId];
|
|
12319
12418
|
if (col == null) return;
|
|
12320
|
-
const existingCell =
|
|
12419
|
+
const existingCell = cellData[row][col];
|
|
12321
12420
|
if (existingCell != null) {
|
|
12322
|
-
|
|
12323
|
-
if (shouldRefreshCellDataFromRecord(existingCell, field, value))
|
|
12421
|
+
cellData[row][col] = normalizeBaseCellData(existingCell, field);
|
|
12422
|
+
if (shouldRefreshCellDataFromRecord(existingCell, field, value)) cellData[row][col] = toBaseCellData(value, field);
|
|
12324
12423
|
return;
|
|
12325
12424
|
}
|
|
12326
|
-
|
|
12425
|
+
cellData[row][col] = toBaseCellData(value, field);
|
|
12327
12426
|
});
|
|
12328
12427
|
});
|
|
12329
12428
|
}
|
|
12429
|
+
function assertMaterializedRecordIdentity(table) {
|
|
12430
|
+
for (const record of Object.values(table.records)) {
|
|
12431
|
+
var _table$rowIndex, _table$colIndex, _table$colId2, _table$cellData;
|
|
12432
|
+
const row = (_table$rowIndex = table.rowIndex) === null || _table$rowIndex === void 0 ? void 0 : _table$rowIndex[record.id];
|
|
12433
|
+
if (row == null || ((_table$colIndex = table.colIndex) === null || _table$colIndex === void 0 ? void 0 : _table$colIndex["__record_id"]) !== 0 || ((_table$colId2 = table.colId) === null || _table$colId2 === void 0 ? void 0 : _table$colId2[0]) !== "__record_id" || ((_table$cellData = table.cellData) === null || _table$cellData === void 0 || (_table$cellData = _table$cellData[row]) === null || _table$cellData === void 0 || (_table$cellData = _table$cellData[0]) === null || _table$cellData === void 0 ? void 0 : _table$cellData.v) !== record.id) throw new Error(`[BaseDataModel]: record "${record.id}" is missing its record-id cell projection.`);
|
|
12434
|
+
}
|
|
12435
|
+
}
|
|
12330
12436
|
function toBaseCellData(value, field) {
|
|
12331
12437
|
if (isBaseCellData(value)) {
|
|
12332
12438
|
if ((field === null || field === void 0 ? void 0 : field.type) === "attachment") return {
|
|
@@ -12345,10 +12451,9 @@ function toBaseCellData(value, field) {
|
|
|
12345
12451
|
t: 1
|
|
12346
12452
|
};
|
|
12347
12453
|
if ((field === null || field === void 0 ? void 0 : field.type) === "link" && value && typeof value === "object" && !Array.isArray(value)) {
|
|
12348
|
-
var _ref, _link$text;
|
|
12349
12454
|
const link = value;
|
|
12350
12455
|
return {
|
|
12351
|
-
v: String(
|
|
12456
|
+
v: String(link.text ?? link.url ?? ""),
|
|
12352
12457
|
t: 1
|
|
12353
12458
|
};
|
|
12354
12459
|
}
|
|
@@ -12382,8 +12487,7 @@ function writeAttachmentResources(table, recordId, fieldId, value) {
|
|
|
12382
12487
|
table.resources.attachments = { ...table.resources.attachments };
|
|
12383
12488
|
const key = `${fieldId}${BASE_ATTACHMENT_RESOURCE_KEY_SEPARATOR}${recordId}`;
|
|
12384
12489
|
table.resources.attachmentSets[key] = attachments.map((attachment, index) => {
|
|
12385
|
-
|
|
12386
|
-
const id = String((_attachment$id = attachment.id) !== null && _attachment$id !== void 0 ? _attachment$id : `${key}${BASE_ATTACHMENT_RESOURCE_KEY_SEPARATOR}${index}`);
|
|
12490
|
+
const id = String(attachment.id ?? `${key}${BASE_ATTACHMENT_RESOURCE_KEY_SEPARATOR}${index}`);
|
|
12387
12491
|
const normalizedAttachment = {
|
|
12388
12492
|
...attachment,
|
|
12389
12493
|
id
|
|
@@ -12412,6 +12516,7 @@ function normalizeAttachmentValue(value) {
|
|
|
12412
12516
|
return attachments;
|
|
12413
12517
|
}
|
|
12414
12518
|
function shouldRefreshCellDataFromRecord(cell, field, value) {
|
|
12519
|
+
if ((field === null || field === void 0 ? void 0 : field.type) === "recordId") return cell.v !== value;
|
|
12415
12520
|
if ((field === null || field === void 0 ? void 0 : field.type) === "attachment") return cell.v !== "";
|
|
12416
12521
|
if (isListField(field)) return Array.isArray(value) && (cell.v == null || cell.v === "");
|
|
12417
12522
|
return false;
|
|
@@ -12440,9 +12545,8 @@ function primitiveText(value) {
|
|
|
12440
12545
|
if (value == null) return "";
|
|
12441
12546
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return String(value);
|
|
12442
12547
|
if (typeof value === "object") {
|
|
12443
|
-
var _ref2, _ref3, _record$id;
|
|
12444
12548
|
const record = value;
|
|
12445
|
-
return String(
|
|
12549
|
+
return String(record.id ?? record.name ?? record.text ?? "");
|
|
12446
12550
|
}
|
|
12447
12551
|
return String(value);
|
|
12448
12552
|
}
|
|
@@ -12454,7 +12558,7 @@ function inferPrimitiveType(value) {
|
|
|
12454
12558
|
}
|
|
12455
12559
|
function normalizeBaseCellValueType(type, value) {
|
|
12456
12560
|
if (type === 1 || type === 2 || type === 3 || type === 4 || type == null) return type;
|
|
12457
|
-
return inferPrimitiveType(value
|
|
12561
|
+
return inferPrimitiveType(value ?? null);
|
|
12458
12562
|
}
|
|
12459
12563
|
|
|
12460
12564
|
//#endregion
|
|
@@ -12624,10 +12728,7 @@ var InterceptorManager = class {
|
|
|
12624
12728
|
if (!this._interceptorsByName.has(key)) this._interceptorsByName.set(key, []);
|
|
12625
12729
|
const interceptors = this._interceptorsByName.get(key);
|
|
12626
12730
|
interceptors.push(interceptor);
|
|
12627
|
-
this._interceptorsByName.set(key, interceptors.sort((a, b) =>
|
|
12628
|
-
var _b$priority, _a$priority;
|
|
12629
|
-
return ((_b$priority = b.priority) !== null && _b$priority !== void 0 ? _b$priority : 0) - ((_a$priority = a.priority) !== null && _a$priority !== void 0 ? _a$priority : 0);
|
|
12630
|
-
}));
|
|
12731
|
+
this._interceptorsByName.set(key, interceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0)));
|
|
12631
12732
|
return () => remove(this._interceptorsByName.get(key), interceptor);
|
|
12632
12733
|
}
|
|
12633
12734
|
getInterceptPoints() {
|
|
@@ -12683,10 +12784,7 @@ var AsyncInterceptorManager = class {
|
|
|
12683
12784
|
if (!this._asyncInterceptorsByName.has(key)) this._asyncInterceptorsByName.set(key, []);
|
|
12684
12785
|
const interceptors = this._asyncInterceptorsByName.get(key);
|
|
12685
12786
|
interceptors.push(interceptor);
|
|
12686
|
-
this._asyncInterceptorsByName.set(key, interceptors.sort((a, b) =>
|
|
12687
|
-
var _b$priority2, _a$priority2;
|
|
12688
|
-
return ((_b$priority2 = b.priority) !== null && _b$priority2 !== void 0 ? _b$priority2 : 0) - ((_a$priority2 = a.priority) !== null && _a$priority2 !== void 0 ? _a$priority2 : 0);
|
|
12689
|
-
}));
|
|
12787
|
+
this._asyncInterceptorsByName.set(key, interceptors.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0)));
|
|
12690
12788
|
return () => remove(this._asyncInterceptorsByName.get(key), interceptor);
|
|
12691
12789
|
}
|
|
12692
12790
|
getInterceptPoints() {
|
|
@@ -13079,10 +13177,9 @@ function createParagraphId(existingIds) {
|
|
|
13079
13177
|
return paragraphId;
|
|
13080
13178
|
}
|
|
13081
13179
|
function cloneBodyWithFreshParagraphIds(body, _scope) {
|
|
13082
|
-
var _cloned$paragraphs;
|
|
13083
13180
|
const cloned = cloneBody(body);
|
|
13084
13181
|
const existingIds = /* @__PURE__ */ new Set();
|
|
13085
|
-
for (const paragraph of
|
|
13182
|
+
for (const paragraph of cloned.paragraphs ?? []) paragraph.paragraphId = createParagraphId(existingIds);
|
|
13086
13183
|
return cloned;
|
|
13087
13184
|
}
|
|
13088
13185
|
function cloneParagraphWithId(paragraph, existingIds, preserveId) {
|
|
@@ -13454,13 +13551,12 @@ function normalizeTextRuns(textRuns, reserveEmptyTextRun = false) {
|
|
|
13454
13551
|
* @param currentIndex Determining the index where the content will be inserted into the current content.
|
|
13455
13552
|
*/
|
|
13456
13553
|
function insertTextRuns(body, insertBody, textLength, currentIndex) {
|
|
13457
|
-
var _insertBody$textRuns;
|
|
13458
13554
|
const { textRuns } = body;
|
|
13459
13555
|
if (textRuns == null) return;
|
|
13460
13556
|
const newTextRuns = [];
|
|
13461
13557
|
const len = textRuns.length;
|
|
13462
13558
|
let hasInserted = false;
|
|
13463
|
-
const insertTextRuns =
|
|
13559
|
+
const insertTextRuns = insertBody.textRuns ?? [];
|
|
13464
13560
|
if (insertTextRuns.length) for (const insertTextRun of insertTextRuns) {
|
|
13465
13561
|
insertTextRun.st += currentIndex;
|
|
13466
13562
|
insertTextRun.ed += currentIndex;
|
|
@@ -13508,9 +13604,9 @@ function insertTextRuns(body, insertBody, textLength, currentIndex) {
|
|
|
13508
13604
|
* @param currentIndex Determining the index where the content will be inserted into the current content.
|
|
13509
13605
|
*/
|
|
13510
13606
|
function insertParagraphs(body, insertBody, textLength, currentIndex, preserveMissingParagraphIds = false, originalDataStream = body.dataStream) {
|
|
13511
|
-
var _insertBody$paragraph
|
|
13607
|
+
var _insertBody$paragraph;
|
|
13512
13608
|
if (!body.paragraphs && !((_insertBody$paragraph = insertBody.paragraphs) === null || _insertBody$paragraph === void 0 ? void 0 : _insertBody$paragraph.length)) return;
|
|
13513
|
-
|
|
13609
|
+
body.paragraphs ??= [];
|
|
13514
13610
|
const { paragraphs } = body;
|
|
13515
13611
|
const { paragraphs: insertParagraphs } = insertBody;
|
|
13516
13612
|
normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs, currentIndex, {
|
|
@@ -13543,7 +13639,6 @@ function insertParagraphs(body, insertBody, textLength, currentIndex, preserveMi
|
|
|
13543
13639
|
}
|
|
13544
13640
|
}
|
|
13545
13641
|
function normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs, currentIndex, options) {
|
|
13546
|
-
var _options$reservedPara;
|
|
13547
13642
|
if (!paragraphs || !(insertParagraphs === null || insertParagraphs === void 0 ? void 0 : insertParagraphs.length)) return;
|
|
13548
13643
|
const splitParagraph = getParagraphSplitByInsert(paragraphs, currentIndex, options.dataStream);
|
|
13549
13644
|
const firstSplitInsertIndex = splitParagraph ? getFirstInsertedParagraphIndex(insertParagraphs) : -1;
|
|
@@ -13553,12 +13648,11 @@ function normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs,
|
|
|
13553
13648
|
const existingParagraphIds = collectParagraphIds(paragraphs);
|
|
13554
13649
|
const preservedInsertedParagraphIds = /* @__PURE__ */ new Set();
|
|
13555
13650
|
if (splitParagraphId) existingParagraphIds.delete(splitParagraphId);
|
|
13556
|
-
for (const paragraphId of
|
|
13651
|
+
for (const paragraphId of options.reservedParagraphIds ?? []) existingParagraphIds.add(paragraphId);
|
|
13557
13652
|
let splitRemainderParagraph;
|
|
13558
13653
|
if (splitParagraphId && firstSplitInsertIndex !== -1 && !shouldPreserveExplicitSplitParagraphId) {
|
|
13559
|
-
var _options$preserveMiss;
|
|
13560
13654
|
const firstInsertParagraph = insertParagraphs[firstSplitInsertIndex];
|
|
13561
|
-
splitRemainderParagraph = firstInsertedParagraphId != null && firstInsertedParagraphId !== splitParagraphId ? cloneInsertedParagraphWithId(firstInsertParagraph, existingParagraphIds,
|
|
13655
|
+
splitRemainderParagraph = firstInsertedParagraphId != null && firstInsertedParagraphId !== splitParagraphId ? cloneInsertedParagraphWithId(firstInsertParagraph, existingParagraphIds, options.preserveMissingParagraphIds ?? false) : cloneParagraphWithId(firstInsertParagraph, existingParagraphIds, false);
|
|
13562
13656
|
if (options.freshenSplitParagraph && splitRemainderParagraph.paragraphId) splitParagraph.paragraphId = splitRemainderParagraph.paragraphId;
|
|
13563
13657
|
}
|
|
13564
13658
|
for (let i = 0, len = insertParagraphs.length; i < len; i++) {
|
|
@@ -13569,8 +13663,7 @@ function normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs,
|
|
|
13569
13663
|
continue;
|
|
13570
13664
|
}
|
|
13571
13665
|
if (i !== firstSplitInsertIndex || splitParagraphId == null || shouldPreserveExplicitSplitParagraphId) {
|
|
13572
|
-
|
|
13573
|
-
insertParagraphs[i] = cloneInsertedParagraphWithId(insertParagraphs[i], existingParagraphIds, (_options$preserveMiss2 = options.preserveMissingParagraphIds) !== null && _options$preserveMiss2 !== void 0 ? _options$preserveMiss2 : false);
|
|
13666
|
+
insertParagraphs[i] = cloneInsertedParagraphWithId(insertParagraphs[i], existingParagraphIds, options.preserveMissingParagraphIds ?? false);
|
|
13574
13667
|
continue;
|
|
13575
13668
|
}
|
|
13576
13669
|
insertParagraphs[i] = options.freshenSplitParagraph || firstInsertedParagraphId == null || firstInsertedParagraphId === splitParagraphId ? cloneParagraphWithId({
|
|
@@ -13579,13 +13672,13 @@ function normalizeInsertedParagraphIdsForDocument(paragraphs, insertParagraphs,
|
|
|
13579
13672
|
}, existingParagraphIds) : splitRemainderParagraph;
|
|
13580
13673
|
}
|
|
13581
13674
|
for (const insertParagraph of insertParagraphs) if (insertParagraph.paragraphId) {
|
|
13582
|
-
var _options$
|
|
13583
|
-
(_options$
|
|
13675
|
+
var _options$reservedPara;
|
|
13676
|
+
(_options$reservedPara = options.reservedParagraphIds) === null || _options$reservedPara === void 0 || _options$reservedPara.add(insertParagraph.paragraphId);
|
|
13584
13677
|
}
|
|
13585
13678
|
}
|
|
13586
13679
|
function collectParagraphIds(paragraphs) {
|
|
13587
13680
|
const paragraphIds = /* @__PURE__ */ new Set();
|
|
13588
|
-
for (const paragraph of paragraphs
|
|
13681
|
+
for (const paragraph of paragraphs ?? []) if (paragraph.paragraphId) paragraphIds.add(paragraph.paragraphId);
|
|
13589
13682
|
return paragraphIds;
|
|
13590
13683
|
}
|
|
13591
13684
|
function cloneInsertedParagraphWithId(insertParagraph, existingParagraphIds, preserveMissingParagraphIds) {
|
|
@@ -13626,9 +13719,9 @@ function getFirstInsertedParagraphIndex(insertParagraphs) {
|
|
|
13626
13719
|
return index;
|
|
13627
13720
|
}
|
|
13628
13721
|
function insertSectionBreaks(body, insertBody, textLength, currentIndex) {
|
|
13629
|
-
var _insertBody$sectionBr
|
|
13722
|
+
var _insertBody$sectionBr;
|
|
13630
13723
|
if (!body.sectionBreaks && !((_insertBody$sectionBr = insertBody.sectionBreaks) === null || _insertBody$sectionBr === void 0 ? void 0 : _insertBody$sectionBr.length)) return;
|
|
13631
|
-
|
|
13724
|
+
body.sectionBreaks ??= [];
|
|
13632
13725
|
const { sectionBreaks } = body;
|
|
13633
13726
|
const insertSectionBreaks = insertBody.sectionBreaks;
|
|
13634
13727
|
normalizeInsertedSectionIdsForDocument(sectionBreaks, insertSectionBreaks);
|
|
@@ -13655,9 +13748,8 @@ function insertSectionBreaks(body, insertBody, textLength, currentIndex) {
|
|
|
13655
13748
|
}
|
|
13656
13749
|
}
|
|
13657
13750
|
function normalizeInsertedSectionIdsForDocument(sectionBreaks, insertSectionBreaks, reservedSectionIds = /* @__PURE__ */ new Set()) {
|
|
13658
|
-
var _sectionBreaks$map;
|
|
13659
13751
|
if (!(insertSectionBreaks === null || insertSectionBreaks === void 0 ? void 0 : insertSectionBreaks.length)) return;
|
|
13660
|
-
const existingSectionIds = new Set((
|
|
13752
|
+
const existingSectionIds = new Set((sectionBreaks === null || sectionBreaks === void 0 ? void 0 : sectionBreaks.map((sectionBreak) => sectionBreak.sectionId)) ?? []);
|
|
13661
13753
|
for (const sectionId of reservedSectionIds) existingSectionIds.add(sectionId);
|
|
13662
13754
|
for (let i = 0; i < insertSectionBreaks.length; i++) {
|
|
13663
13755
|
insertSectionBreaks[i] = cloneSectionBreakWithId(insertSectionBreaks[i], existingSectionIds);
|
|
@@ -14711,7 +14803,7 @@ function updateParagraphs(body, updateBody, textLength, currentIndex, coverType)
|
|
|
14711
14803
|
if (updateStartIndex === removeStartIndex) {
|
|
14712
14804
|
splitUpdateParagraphs.push({
|
|
14713
14805
|
startIndex: updateStartIndex,
|
|
14714
|
-
paragraphId: updateParagraphId
|
|
14806
|
+
paragraphId: updateParagraphId ?? removeParagraphId,
|
|
14715
14807
|
paragraphStyle: newParagraphStyle,
|
|
14716
14808
|
bullet: newBullet
|
|
14717
14809
|
});
|
|
@@ -14981,7 +15073,7 @@ function isSegmentIntersects(start, end, start2, end2) {
|
|
|
14981
15073
|
}
|
|
14982
15074
|
function getParagraphsInRange(activeRange, paragraphs, dataStream, paragraphRanges) {
|
|
14983
15075
|
const { startOffset, endOffset } = activeRange;
|
|
14984
|
-
const fullParagraphs = paragraphRanges
|
|
15076
|
+
const fullParagraphs = paragraphRanges ?? transformParagraphs(paragraphs, dataStream);
|
|
14985
15077
|
const results = [];
|
|
14986
15078
|
let start = -1;
|
|
14987
15079
|
for (let i = 0; i < fullParagraphs.length; i++) {
|
|
@@ -15029,10 +15121,10 @@ function transformParagraphs(paragraphs, dataStream) {
|
|
|
15029
15121
|
//#endregion
|
|
15030
15122
|
//#region src/docs/data-model/text-x/build-utils/paragraph.ts
|
|
15031
15123
|
const switchParagraphBullet = (params) => {
|
|
15032
|
-
var _docDataModel$getSelf
|
|
15124
|
+
var _docDataModel$getSelf;
|
|
15033
15125
|
const { paragraphs: currentParagraphs, segmentId, document: docDataModel } = params;
|
|
15034
15126
|
let listType = params.listType;
|
|
15035
|
-
const paragraphs = (_docDataModel$getSelf =
|
|
15127
|
+
const paragraphs = ((_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf === void 0 || (_docDataModel$getSelf = _docDataModel$getSelf.getBody()) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.paragraphs) ?? [];
|
|
15036
15128
|
const isAlreadyList = currentParagraphs.every((paragraph) => {
|
|
15037
15129
|
var _paragraph$bullet;
|
|
15038
15130
|
return ((_paragraph$bullet = paragraph.bullet) === null || _paragraph$bullet === void 0 ? void 0 : _paragraph$bullet.listType.indexOf(listType)) === 0;
|
|
@@ -15054,7 +15146,6 @@ const switchParagraphBullet = (params) => {
|
|
|
15054
15146
|
memoryCursor.reset();
|
|
15055
15147
|
const textX = new TextX();
|
|
15056
15148
|
for (const paragraph of currentParagraphs) {
|
|
15057
|
-
var _bullet$nestingLevel;
|
|
15058
15149
|
const { startIndex, paragraphId, paragraphStyle = {}, bullet } = paragraph;
|
|
15059
15150
|
textX.push({
|
|
15060
15151
|
t: "r",
|
|
@@ -15074,7 +15165,7 @@ const switchParagraphBullet = (params) => {
|
|
|
15074
15165
|
paragraphId,
|
|
15075
15166
|
paragraphStyle: { ...paragraphStyle },
|
|
15076
15167
|
bullet: {
|
|
15077
|
-
nestingLevel: (
|
|
15168
|
+
nestingLevel: (bullet === null || bullet === void 0 ? void 0 : bullet.nestingLevel) ?? 0,
|
|
15078
15169
|
textStyle: { fs: 20 },
|
|
15079
15170
|
listType,
|
|
15080
15171
|
listId
|
|
@@ -15088,9 +15179,9 @@ const switchParagraphBullet = (params) => {
|
|
|
15088
15179
|
return textX;
|
|
15089
15180
|
};
|
|
15090
15181
|
const toggleChecklistParagraph = (params) => {
|
|
15091
|
-
var _docDataModel$
|
|
15182
|
+
var _docDataModel$getSelf2;
|
|
15092
15183
|
const { paragraphIndex, segmentId, document: docDataModel } = params;
|
|
15093
|
-
const paragraphs = (_docDataModel$
|
|
15184
|
+
const paragraphs = (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 || (_docDataModel$getSelf2 = _docDataModel$getSelf2.getBody()) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.paragraphs;
|
|
15094
15185
|
if (paragraphs == null) return false;
|
|
15095
15186
|
const currentParagraph = paragraphs.find((p) => p.startIndex === paragraphIndex);
|
|
15096
15187
|
if (!(currentParagraph === null || currentParagraph === void 0 ? void 0 : currentParagraph.bullet) || currentParagraph.bullet.listType.indexOf("CHECK_LIST") === -1) return false;
|
|
@@ -15124,15 +15215,14 @@ const toggleChecklistParagraph = (params) => {
|
|
|
15124
15215
|
return textX;
|
|
15125
15216
|
};
|
|
15126
15217
|
const setParagraphBullet = (params) => {
|
|
15127
|
-
var _docDataModel$
|
|
15218
|
+
var _docDataModel$getSelf3;
|
|
15128
15219
|
const { paragraphs: currentParagraphs, listType, listId: explicitListId, segmentId, document: docDataModel } = params;
|
|
15129
|
-
if (((_docDataModel$
|
|
15130
|
-
const listId = explicitListId
|
|
15220
|
+
if (((_docDataModel$getSelf3 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf3 === void 0 || (_docDataModel$getSelf3 = _docDataModel$getSelf3.getBody()) === null || _docDataModel$getSelf3 === void 0 ? void 0 : _docDataModel$getSelf3.paragraphs) == null) return false;
|
|
15221
|
+
const listId = explicitListId ?? generateRandomId(6);
|
|
15131
15222
|
const memoryCursor = new MemoryCursor();
|
|
15132
15223
|
memoryCursor.reset();
|
|
15133
15224
|
const textX = new TextX();
|
|
15134
15225
|
for (const paragraph of currentParagraphs) {
|
|
15135
|
-
var _bullet$nestingLevel2;
|
|
15136
15226
|
const { startIndex, paragraphId, paragraphStyle = {}, bullet } = paragraph;
|
|
15137
15227
|
textX.push({
|
|
15138
15228
|
t: "r",
|
|
@@ -15148,7 +15238,7 @@ const setParagraphBullet = (params) => {
|
|
|
15148
15238
|
paragraphId,
|
|
15149
15239
|
paragraphStyle,
|
|
15150
15240
|
bullet: {
|
|
15151
|
-
nestingLevel: (
|
|
15241
|
+
nestingLevel: (bullet === null || bullet === void 0 ? void 0 : bullet.nestingLevel) ?? 0,
|
|
15152
15242
|
textStyle: (bullet === null || bullet === void 0 ? void 0 : bullet.listType) === listType ? bullet.textStyle : { fs: 20 },
|
|
15153
15243
|
listType,
|
|
15154
15244
|
listId
|
|
@@ -15183,17 +15273,15 @@ const PARAGRAPH_CONTAINER_TOKENS = /* @__PURE__ */ new Set([
|
|
|
15183
15273
|
""
|
|
15184
15274
|
]);
|
|
15185
15275
|
function getParagraphContentStartOffset(body, paragraph) {
|
|
15186
|
-
var _body$paragraphs;
|
|
15187
15276
|
let previousParagraph;
|
|
15188
|
-
for (const candidate of
|
|
15277
|
+
for (const candidate of body.paragraphs ?? []) if (candidate.startIndex < paragraph.startIndex && (!previousParagraph || candidate.startIndex > previousParagraph.startIndex)) previousParagraph = candidate;
|
|
15189
15278
|
let startOffset = previousParagraph ? previousParagraph.startIndex + 1 : 0;
|
|
15190
15279
|
while (startOffset < paragraph.startIndex && PARAGRAPH_CONTAINER_TOKENS.has(body.dataStream[startOffset])) startOffset++;
|
|
15191
15280
|
return startOffset;
|
|
15192
15281
|
}
|
|
15193
15282
|
function getParagraphContentStartOffsets(body) {
|
|
15194
|
-
var _body$paragraphs2;
|
|
15195
15283
|
const startOffsets = /* @__PURE__ */ new Map();
|
|
15196
|
-
const paragraphs = [...
|
|
15284
|
+
const paragraphs = [...body.paragraphs ?? []].sort((left, right) => left.startIndex - right.startIndex);
|
|
15197
15285
|
for (let index = 0; index < paragraphs.length; index++) {
|
|
15198
15286
|
const paragraph = paragraphs[index];
|
|
15199
15287
|
let startOffset = index > 0 ? paragraphs[index - 1].startIndex + 1 : 0;
|
|
@@ -15203,21 +15291,20 @@ function getParagraphContentStartOffsets(body) {
|
|
|
15203
15291
|
return startOffsets;
|
|
15204
15292
|
}
|
|
15205
15293
|
function getParagraphFollowingBlockOffset(body, paragraph) {
|
|
15206
|
-
|
|
15207
|
-
const containingBlock = ((_body$blockRanges = body.blockRanges) !== null && _body$blockRanges !== void 0 ? _body$blockRanges : []).find((blockRange) => {
|
|
15294
|
+
const containingBlock = (body.blockRanges ?? []).find((blockRange) => {
|
|
15208
15295
|
const interval = getBlockRangeInterval(blockRange);
|
|
15209
15296
|
return paragraph.startIndex > interval.startOffset && paragraph.startIndex < interval.endOffset - 1;
|
|
15210
15297
|
});
|
|
15211
15298
|
return containingBlock ? getBlockRangeInterval(containingBlock).endOffset : paragraph.startIndex + 1;
|
|
15212
15299
|
}
|
|
15213
15300
|
const changeParagraphBulletNestLevel = (params) => {
|
|
15214
|
-
var _docDataModel$
|
|
15301
|
+
var _docDataModel$getBody;
|
|
15215
15302
|
const { paragraphs: currentParagraphs, document: docDataModel, type } = params;
|
|
15216
15303
|
const memoryCursor = new MemoryCursor();
|
|
15217
15304
|
memoryCursor.reset();
|
|
15218
15305
|
const textX = new TextX();
|
|
15219
|
-
const customLists =
|
|
15220
|
-
const tables = (_docDataModel$getBody =
|
|
15306
|
+
const customLists = docDataModel.getSnapshot().lists ?? {};
|
|
15307
|
+
const tables = ((_docDataModel$getBody = docDataModel.getBody()) === null || _docDataModel$getBody === void 0 ? void 0 : _docDataModel$getBody.tables) ?? [];
|
|
15221
15308
|
const lists = {
|
|
15222
15309
|
...PRESET_LIST_TYPE,
|
|
15223
15310
|
...customLists
|
|
@@ -15258,13 +15345,13 @@ const changeParagraphBulletNestLevel = (params) => {
|
|
|
15258
15345
|
return textX;
|
|
15259
15346
|
};
|
|
15260
15347
|
const setParagraphStyle = (params) => {
|
|
15261
|
-
var _segment$getBody
|
|
15348
|
+
var _segment$getBody, _segment$getBody2;
|
|
15262
15349
|
const { textRanges, segmentId, document: docDataModel, style, paragraphTextRun, cursor, deleteLen, textX: _textX } = params;
|
|
15263
15350
|
const segment = docDataModel.getSelfOrHeaderFooterModel(segmentId);
|
|
15264
|
-
const currentParagraphs = getParagraphsInRanges(textRanges, (
|
|
15351
|
+
const currentParagraphs = getParagraphsInRanges(textRanges, (segment === null || segment === void 0 || (_segment$getBody = segment.getBody()) === null || _segment$getBody === void 0 ? void 0 : _segment$getBody.paragraphs) ?? [], (segment === null || segment === void 0 || (_segment$getBody2 = segment.getBody()) === null || _segment$getBody2 === void 0 ? void 0 : _segment$getBody2.dataStream) ?? "");
|
|
15265
15352
|
const memoryCursor = new MemoryCursor();
|
|
15266
15353
|
if (cursor) memoryCursor.moveCursorTo(cursor);
|
|
15267
|
-
const textX = _textX
|
|
15354
|
+
const textX = _textX ?? new TextX();
|
|
15268
15355
|
currentParagraphs.sort((a, b) => a.startIndex - b.startIndex);
|
|
15269
15356
|
const start = Math.max(0, currentParagraphs[0].paragraphStart - 1);
|
|
15270
15357
|
if (start > memoryCursor.cursor) {
|
|
@@ -15428,8 +15515,7 @@ function getParagraphsSlice(body, startOffset, endOffset, type = 1) {
|
|
|
15428
15515
|
const sortedParagraphs = [...paragraphs].sort((a, b) => a.startIndex - b.startIndex);
|
|
15429
15516
|
const paragraphStartOffsets = getParagraphContentStartOffsets(body);
|
|
15430
15517
|
for (const paragraph of sortedParagraphs) {
|
|
15431
|
-
|
|
15432
|
-
const paragraphStart = (_paragraphStartOffset = paragraphStartOffsets.get(paragraph.startIndex)) !== null && _paragraphStartOffset !== void 0 ? _paragraphStartOffset : 0;
|
|
15518
|
+
const paragraphStart = paragraphStartOffsets.get(paragraph.startIndex) ?? 0;
|
|
15433
15519
|
const paragraphEnd = paragraph.startIndex;
|
|
15434
15520
|
if (paragraphEnd >= startOffset && paragraphEnd < endOffset || Math.max(paragraphStart, startOffset) < Math.min(paragraphEnd, endOffset)) {
|
|
15435
15521
|
const copy = Tools.deepClone(paragraph);
|
|
@@ -15580,11 +15666,11 @@ function getCustomDecorationSlice(body, startOffset, endOffset) {
|
|
|
15580
15666
|
return customDecorationSlice;
|
|
15581
15667
|
}
|
|
15582
15668
|
function composeTextRuns(updateDataTextRuns, originTextRuns, coverType) {
|
|
15583
|
-
if (updateDataTextRuns == null || originTextRuns == null) return updateDataTextRuns
|
|
15669
|
+
if (updateDataTextRuns == null || originTextRuns == null) return updateDataTextRuns ?? originTextRuns;
|
|
15584
15670
|
return coverTextRuns(updateDataTextRuns, originTextRuns, coverType);
|
|
15585
15671
|
}
|
|
15586
15672
|
function composeCustomRanges(updateDataCustomRanges, originCustomRanges, coverType) {
|
|
15587
|
-
if (updateDataCustomRanges == null || originCustomRanges == null) return updateDataCustomRanges
|
|
15673
|
+
if (updateDataCustomRanges == null || originCustomRanges == null) return updateDataCustomRanges ?? originCustomRanges;
|
|
15588
15674
|
if (originCustomRanges.length === 0 || updateDataCustomRanges.length === 0) return updateDataCustomRanges;
|
|
15589
15675
|
if (originCustomRanges.length > 1 || updateDataCustomRanges.length > 1) throw new Error("Cannot cover multiple customRanges");
|
|
15590
15676
|
if (coverType === 1) return [{ ...updateDataCustomRanges[0] }];
|
|
@@ -16413,7 +16499,7 @@ const isEmptyDocument = (dataStream) => {
|
|
|
16413
16499
|
return getPlainText(dataStream).replaceAll("\r", "") === "";
|
|
16414
16500
|
};
|
|
16415
16501
|
const fromPlainText = (text) => {
|
|
16416
|
-
const dataStream = text.replace(/\n/g, "\r");
|
|
16502
|
+
const dataStream = text.replace(/\r\n?|\n/g, "\r");
|
|
16417
16503
|
const paragraphs = [];
|
|
16418
16504
|
const existingParagraphIds = /* @__PURE__ */ new Set();
|
|
16419
16505
|
const customRanges = [];
|
|
@@ -16489,18 +16575,16 @@ var DocumentDataModelSimple = class extends UnitModel {
|
|
|
16489
16575
|
throw new Error("Method not implemented.");
|
|
16490
16576
|
}
|
|
16491
16577
|
constructor(snapshot) {
|
|
16492
|
-
var _this$snapshot$title;
|
|
16493
16578
|
super();
|
|
16494
16579
|
_defineProperty(this, "type", UniverInstanceType.UNIVER_DOC);
|
|
16495
16580
|
_defineProperty(this, "_name$", new BehaviorSubject(""));
|
|
16496
16581
|
_defineProperty(this, "name$", this._name$.asObservable());
|
|
16497
16582
|
_defineProperty(this, "snapshot", void 0);
|
|
16498
16583
|
this.snapshot = createDocumentSnapshot(snapshot);
|
|
16499
|
-
this._name$.next(
|
|
16584
|
+
this._name$.next(this.snapshot.title ?? "No Title");
|
|
16500
16585
|
}
|
|
16501
16586
|
getRev() {
|
|
16502
|
-
|
|
16503
|
-
return (_this$snapshot$rev = this.snapshot.rev) !== null && _this$snapshot$rev !== void 0 ? _this$snapshot$rev : 1;
|
|
16587
|
+
return this.snapshot.rev ?? 1;
|
|
16504
16588
|
}
|
|
16505
16589
|
incrementRev() {
|
|
16506
16590
|
this.snapshot.rev = this.getRev() + 1;
|
|
@@ -16536,8 +16620,7 @@ var DocumentDataModelSimple = class extends UnitModel {
|
|
|
16536
16620
|
return this.snapshot;
|
|
16537
16621
|
}
|
|
16538
16622
|
getBulletPresetList() {
|
|
16539
|
-
|
|
16540
|
-
const customLists = (_this$snapshot$lists = this.snapshot.lists) !== null && _this$snapshot$lists !== void 0 ? _this$snapshot$lists : {};
|
|
16623
|
+
const customLists = this.snapshot.lists ?? {};
|
|
16541
16624
|
return {
|
|
16542
16625
|
...PRESET_LIST_TYPE,
|
|
16543
16626
|
...customLists
|
|
@@ -16576,8 +16659,8 @@ var DocumentDataModelSimple = class extends UnitModel {
|
|
|
16576
16659
|
const { documentStyle } = this.snapshot;
|
|
16577
16660
|
if (!documentStyle.pageSize) {
|
|
16578
16661
|
documentStyle.pageSize = {
|
|
16579
|
-
width: width
|
|
16580
|
-
height: height
|
|
16662
|
+
width: width ?? Number.POSITIVE_INFINITY,
|
|
16663
|
+
height: height ?? Number.POSITIVE_INFINITY
|
|
16581
16664
|
};
|
|
16582
16665
|
return;
|
|
16583
16666
|
}
|
|
@@ -16611,16 +16694,15 @@ var DocumentDataModelSimple = class extends UnitModel {
|
|
|
16611
16694
|
};
|
|
16612
16695
|
var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple {
|
|
16613
16696
|
constructor(snapshot) {
|
|
16614
|
-
var _this$snapshot$id, _this$snapshot$title2;
|
|
16615
16697
|
super(Tools.isEmptyObject(snapshot) ? getEmptySnapshot$1() : snapshot);
|
|
16616
16698
|
_defineProperty(this, "_unitId", void 0);
|
|
16617
16699
|
_defineProperty(this, "headerModelMap", /* @__PURE__ */ new Map());
|
|
16618
16700
|
_defineProperty(this, "footerModelMap", /* @__PURE__ */ new Map());
|
|
16619
16701
|
_defineProperty(this, "change$", new BehaviorSubject(0));
|
|
16620
16702
|
const UNIT_ID_LENGTH = 6;
|
|
16621
|
-
this._unitId =
|
|
16703
|
+
this._unitId = this.snapshot.id ?? generateRandomId(UNIT_ID_LENGTH);
|
|
16622
16704
|
this._initializeHeaderFooterModel();
|
|
16623
|
-
this._name$.next(
|
|
16705
|
+
this._name$.next(this.snapshot.title ?? "");
|
|
16624
16706
|
}
|
|
16625
16707
|
dispose() {
|
|
16626
16708
|
super.dispose();
|
|
@@ -16698,8 +16780,8 @@ var DocumentDataModel = class DocumentDataModel extends DocumentDataModelSimple
|
|
|
16698
16780
|
this._unitId = unitId;
|
|
16699
16781
|
}
|
|
16700
16782
|
getPlainText() {
|
|
16701
|
-
var _this$getBody
|
|
16702
|
-
return getPlainText((
|
|
16783
|
+
var _this$getBody;
|
|
16784
|
+
return getPlainText(((_this$getBody = this.getBody()) === null || _this$getBody === void 0 ? void 0 : _this$getBody.dataStream) ?? "");
|
|
16703
16785
|
}
|
|
16704
16786
|
};
|
|
16705
16787
|
|
|
@@ -16729,8 +16811,7 @@ function _resolveNamedParagraphStyle(styles, styleId) {
|
|
|
16729
16811
|
return resolve(styleId);
|
|
16730
16812
|
}
|
|
16731
16813
|
function resolveDocumentParagraphStyle(documentStyle, paragraphStyle, options = {}) {
|
|
16732
|
-
|
|
16733
|
-
const legacyStyle = ((_options$useLegacyMod = options.useLegacyModernDefaults) !== null && _options$useLegacyMod !== void 0 ? _options$useLegacyMod : (documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 2) ? {
|
|
16814
|
+
const legacyStyle = options.useLegacyModernDefaults ?? (documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor) === 2 ? {
|
|
16734
16815
|
lineSpacing: DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING,
|
|
16735
16816
|
spaceAbove: { v: 0 },
|
|
16736
16817
|
spaceBelow: { v: 12 }
|
|
@@ -16746,7 +16827,7 @@ function resolveDocumentParagraphStyle(documentStyle, paragraphStyle, options =
|
|
|
16746
16827
|
}
|
|
16747
16828
|
const definedParagraphStyle = _definedStyle(paragraphStyle);
|
|
16748
16829
|
const referencedParagraphStyle = _resolveNamedParagraphStyle(options.styles, options.paragraphStyleId);
|
|
16749
|
-
const namedStyleType =
|
|
16830
|
+
const namedStyleType = definedParagraphStyle.namedStyleType ?? referencedParagraphStyle.namedStyleType;
|
|
16750
16831
|
const namedStyle = namedStyleType == null ? null : NAMED_STYLE_SPACE_MAP[namedStyleType];
|
|
16751
16832
|
return Tools.deepClone({
|
|
16752
16833
|
...documentDefaults,
|
|
@@ -16912,10 +16993,10 @@ function getIntersectingCustomRanges(startIndex, endIndex, customRanges, rangeTy
|
|
|
16912
16993
|
return relativeCustomRanges;
|
|
16913
16994
|
}
|
|
16914
16995
|
function getSelectionForAddCustomRange(range, body) {
|
|
16915
|
-
var
|
|
16916
|
-
const ranges = getIntersectingCustomRanges(range.startOffset, range.collapsed ? range.startOffset : range.endOffset - 1,
|
|
16917
|
-
const startOffset = Math.min(range.startOffset, (
|
|
16918
|
-
const endOffset = Math.max(range.endOffset, ((
|
|
16996
|
+
var _ranges$, _ranges;
|
|
16997
|
+
const ranges = getIntersectingCustomRanges(range.startOffset, range.collapsed ? range.startOffset : range.endOffset - 1, body.customRanges ?? []);
|
|
16998
|
+
const startOffset = Math.min(range.startOffset, ((_ranges$ = ranges[0]) === null || _ranges$ === void 0 ? void 0 : _ranges$.startIndex) ?? Infinity);
|
|
16999
|
+
const endOffset = Math.max(range.endOffset, (((_ranges = ranges[ranges.length - 1]) === null || _ranges === void 0 ? void 0 : _ranges.endIndex) ?? -Infinity) + 1);
|
|
16919
17000
|
return {
|
|
16920
17001
|
startOffset,
|
|
16921
17002
|
endOffset,
|
|
@@ -16926,7 +17007,7 @@ function getSelectionForAddCustomRange(range, body) {
|
|
|
16926
17007
|
//#endregion
|
|
16927
17008
|
//#region src/docs/data-model/text-x/build-utils/text-x-utils.ts
|
|
16928
17009
|
function deleteCustomRangeTextX(params) {
|
|
16929
|
-
var _documentDataModel$ge
|
|
17010
|
+
var _documentDataModel$ge;
|
|
16930
17011
|
const { rangeId, segmentId, documentDataModel, insert } = params;
|
|
16931
17012
|
const range = (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge === void 0 || (_documentDataModel$ge = _documentDataModel$ge.getBody()) === null || _documentDataModel$ge === void 0 || (_documentDataModel$ge = _documentDataModel$ge.customRanges) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.find((r) => r.rangeId === rangeId);
|
|
16932
17013
|
if (!range) return false;
|
|
@@ -16950,7 +17031,7 @@ function deleteCustomRangeTextX(params) {
|
|
|
16950
17031
|
body: insert,
|
|
16951
17032
|
len: insert.dataStream.length
|
|
16952
17033
|
});
|
|
16953
|
-
const end = endIndex + 1 + ((
|
|
17034
|
+
const end = endIndex + 1 + ((insert === null || insert === void 0 ? void 0 : insert.dataStream.length) ?? 0);
|
|
16954
17035
|
textX.selections = [{
|
|
16955
17036
|
startOffset: end,
|
|
16956
17037
|
endOffset: end,
|
|
@@ -16964,17 +17045,16 @@ function addCustomRangeTextX(param) {
|
|
|
16964
17045
|
const textX = new TextX();
|
|
16965
17046
|
let changed = false;
|
|
16966
17047
|
ranges.forEach((range) => {
|
|
16967
|
-
var _body$customRanges, _body$paragraphs, _body$customBlocks;
|
|
16968
17048
|
const actualRange = getSelectionForAddCustomRange(range, body);
|
|
16969
17049
|
if (!actualRange) return false;
|
|
16970
17050
|
if (!body) return false;
|
|
16971
17051
|
const { startOffset, endOffset } = actualRange;
|
|
16972
|
-
const customRanges =
|
|
17052
|
+
const customRanges = body.customRanges ?? [];
|
|
16973
17053
|
const addCustomRange = (startIndex, endIndex, index) => {
|
|
16974
|
-
var _relativeCustomRanges, _relativeCustomRanges2
|
|
17054
|
+
var _relativeCustomRanges, _relativeCustomRanges2;
|
|
16975
17055
|
const relativeCustomRanges = getIntersectingCustomRanges(startIndex, endIndex, customRanges, rangeType);
|
|
16976
|
-
const rangeStartIndex = Math.min((_relativeCustomRanges =
|
|
16977
|
-
const rangeEndIndex = Math.max((
|
|
17056
|
+
const rangeStartIndex = Math.min(((_relativeCustomRanges = relativeCustomRanges[0]) === null || _relativeCustomRanges === void 0 ? void 0 : _relativeCustomRanges.startIndex) ?? Infinity, startIndex);
|
|
17057
|
+
const rangeEndIndex = Math.max(((_relativeCustomRanges2 = relativeCustomRanges[relativeCustomRanges.length - 1]) === null || _relativeCustomRanges2 === void 0 ? void 0 : _relativeCustomRanges2.endIndex) ?? -Infinity, endIndex);
|
|
16978
17058
|
const customRange = {
|
|
16979
17059
|
rangeId: index ? `${rangeId}$${index}` : rangeId,
|
|
16980
17060
|
rangeType,
|
|
@@ -16998,8 +17078,8 @@ function addCustomRangeTextX(param) {
|
|
|
16998
17078
|
});
|
|
16999
17079
|
cursor = rangeEndIndex + 1;
|
|
17000
17080
|
};
|
|
17001
|
-
const relativeParagraphs = (
|
|
17002
|
-
const customBlocks = (
|
|
17081
|
+
const relativeParagraphs = (body.paragraphs ?? []).filter((p) => p.startIndex < endOffset && p.startIndex > startOffset);
|
|
17082
|
+
const customBlocks = (body.customBlocks ?? []).filter((block) => block.startIndex < endOffset && block.startIndex > startOffset);
|
|
17003
17083
|
excludePointsFromRange([startOffset, endOffset - 1], [...relativeParagraphs.map((p) => p.startIndex), ...customBlocks.map((b) => b.startIndex)]).forEach(([start, end], i) => addCustomRange(start, end, i));
|
|
17004
17084
|
changed = true;
|
|
17005
17085
|
textX.selections = [{
|
|
@@ -17029,8 +17109,7 @@ function protectDeletedColumnBoundaryTokens(body, selections, protectedOffsets)
|
|
|
17029
17109
|
}
|
|
17030
17110
|
}
|
|
17031
17111
|
function protectPartiallyDeletedBlockBoundaryTokens(body, selections, protectedOffsets) {
|
|
17032
|
-
|
|
17033
|
-
for (const blockRange of (_body$blockRanges = body.blockRanges) !== null && _body$blockRanges !== void 0 ? _body$blockRanges : []) {
|
|
17112
|
+
for (const blockRange of body.blockRanges ?? []) {
|
|
17034
17113
|
const blockInterval = getBlockRangeInterval(blockRange);
|
|
17035
17114
|
if (selections.some((selection) => selection.startOffset <= blockInterval.startOffset && selection.endOffset >= blockInterval.endOffset)) continue;
|
|
17036
17115
|
if (isOffsetDeleted(blockRange.startIndex, selections)) protectedOffsets.add(blockRange.startIndex);
|
|
@@ -17038,8 +17117,7 @@ function protectPartiallyDeletedBlockBoundaryTokens(body, selections, protectedO
|
|
|
17038
17117
|
}
|
|
17039
17118
|
}
|
|
17040
17119
|
function collectBlockTextContainers(body) {
|
|
17041
|
-
|
|
17042
|
-
const blockRanges = [...(_body$blockRanges2 = body.blockRanges) !== null && _body$blockRanges2 !== void 0 ? _body$blockRanges2 : []].sort((left, right) => left.startIndex - right.startIndex);
|
|
17120
|
+
const blockRanges = [...body.blockRanges ?? []].sort((left, right) => left.startIndex - right.startIndex);
|
|
17043
17121
|
const containers = blockRanges.map((blockRange) => {
|
|
17044
17122
|
const atomicRange = getBlockRangeInterval(blockRange);
|
|
17045
17123
|
return {
|
|
@@ -17067,8 +17145,8 @@ function collectBlockTextContainers(body) {
|
|
|
17067
17145
|
}
|
|
17068
17146
|
if (index >= 0) containers[index][key].push(offset);
|
|
17069
17147
|
};
|
|
17070
|
-
(
|
|
17071
|
-
(
|
|
17148
|
+
(body.paragraphs ?? []).forEach((paragraph) => assignPoint(paragraph.startIndex, "paragraphs"));
|
|
17149
|
+
(body.sectionBreaks ?? []).forEach((sectionBreak) => assignPoint(sectionBreak.startIndex, "sectionBreaks"));
|
|
17072
17150
|
return containers;
|
|
17073
17151
|
}
|
|
17074
17152
|
function collectStructuralTextContainers(body) {
|
|
@@ -17121,10 +17199,9 @@ function collectStructuralTextContainers(body) {
|
|
|
17121
17199
|
return containers;
|
|
17122
17200
|
}
|
|
17123
17201
|
function protectRequiredContainerChildren(container, selections, insertBody, insertOffset, protectedOffsets) {
|
|
17124
|
-
var _insertBody$dataStrea;
|
|
17125
17202
|
if (isAtomicContainerDeleted(container, selections)) return;
|
|
17126
17203
|
const insertAppliesToContainer = insertBody && isInsertInContainer(insertOffset, container);
|
|
17127
|
-
const insertDataStream = (
|
|
17204
|
+
const insertDataStream = (insertBody === null || insertBody === void 0 ? void 0 : insertBody.dataStream) ?? "";
|
|
17128
17205
|
const insertHasParagraph = insertDataStream.includes("\r");
|
|
17129
17206
|
const insertHasSectionBreak = insertDataStream.includes("\n");
|
|
17130
17207
|
if (container.require === "paragraph-or-section") {
|
|
@@ -17333,12 +17410,12 @@ const replaceSelectionTextRuns = (params) => {
|
|
|
17333
17410
|
t: "r",
|
|
17334
17411
|
body: isTextRunsEqual(textRunsSlice, oldTextRunsSlice) ? void 0 : {
|
|
17335
17412
|
textRuns: textRunsSlice === null || textRunsSlice === void 0 ? void 0 : textRunsSlice.map((textRun) => {
|
|
17336
|
-
var _textRun$ts, _textRun$
|
|
17413
|
+
var _textRun$ts, _textRun$ts2, _textRun$ts3;
|
|
17337
17414
|
return {
|
|
17338
17415
|
...textRun,
|
|
17339
17416
|
ts: {
|
|
17340
17417
|
...textRun.ts,
|
|
17341
|
-
cl: ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 || (_textRun$ts = _textRun$ts.cl) === null || _textRun$ts === void 0 || (_textRun$ts = _textRun$ts.rgb) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.includes(".")) ? { rgb: themeService.getColorFromTheme((
|
|
17418
|
+
cl: ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 || (_textRun$ts = _textRun$ts.cl) === null || _textRun$ts === void 0 || (_textRun$ts = _textRun$ts.rgb) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.includes(".")) ? { rgb: themeService.getColorFromTheme(((_textRun$ts2 = textRun.ts) === null || _textRun$ts2 === void 0 || (_textRun$ts2 = _textRun$ts2.cl) === null || _textRun$ts2 === void 0 ? void 0 : _textRun$ts2.rgb) ?? "") } : (_textRun$ts3 = textRun.ts) === null || _textRun$ts3 === void 0 ? void 0 : _textRun$ts3.cl
|
|
17342
17419
|
}
|
|
17343
17420
|
};
|
|
17344
17421
|
}),
|
|
@@ -17390,7 +17467,7 @@ function getCustomBlockIdsInSelections(body, selections) {
|
|
|
17390
17467
|
return customBlockIds;
|
|
17391
17468
|
}
|
|
17392
17469
|
const addDrawing = (param) => {
|
|
17393
|
-
var _documentDataModel$ge, _documentDataModel$ge2
|
|
17470
|
+
var _documentDataModel$ge, _documentDataModel$ge2;
|
|
17394
17471
|
const { selection, documentDataModel, drawings } = param;
|
|
17395
17472
|
const { collapsed, startOffset, segmentId } = selection;
|
|
17396
17473
|
const textX = new TextX();
|
|
@@ -17398,21 +17475,20 @@ const addDrawing = (param) => {
|
|
|
17398
17475
|
const rawActions = [];
|
|
17399
17476
|
const body = (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.getBody();
|
|
17400
17477
|
if (!body) return false;
|
|
17401
|
-
const drawingOrderLength = (_documentDataModel$ge2 =
|
|
17478
|
+
const drawingOrderLength = ((_documentDataModel$ge2 = documentDataModel.getSnapshot().drawingsOrder) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.length) ?? 0;
|
|
17402
17479
|
let removeDrawingLen = 0;
|
|
17403
|
-
const insertOffset = collapsed ? normalizeDrawingInsertOffset(body, startOffset
|
|
17480
|
+
const insertOffset = collapsed ? normalizeDrawingInsertOffset(body, startOffset ?? 0) : startOffset ?? 0;
|
|
17404
17481
|
if (collapsed) {
|
|
17405
17482
|
if (insertOffset > 0) textX.push({
|
|
17406
17483
|
t: "r",
|
|
17407
17484
|
len: insertOffset
|
|
17408
17485
|
});
|
|
17409
17486
|
} else {
|
|
17410
|
-
var _documentDataModel$ge4, _documentDataModel$ge5;
|
|
17411
17487
|
const dos = deleteSelectionTextX([selection], body, 0, null, false);
|
|
17412
17488
|
textX.push(...dos);
|
|
17413
17489
|
const removedCustomBlockIds = getCustomBlockIdsInSelections(body, [selection]);
|
|
17414
|
-
const drawings =
|
|
17415
|
-
const drawingOrder =
|
|
17490
|
+
const drawings = documentDataModel.getDrawings() ?? {};
|
|
17491
|
+
const drawingOrder = documentDataModel.getDrawingsOrder() ?? [];
|
|
17416
17492
|
const sortedRemovedCustomBlockIds = removedCustomBlockIds.sort((a, b) => {
|
|
17417
17493
|
if (drawingOrder.indexOf(a) > drawingOrder.indexOf(b)) return -1;
|
|
17418
17494
|
else if (drawingOrder.indexOf(a) < drawingOrder.indexOf(b)) return 1;
|
|
@@ -17450,7 +17526,16 @@ const addDrawing = (param) => {
|
|
|
17450
17526
|
}, null);
|
|
17451
17527
|
};
|
|
17452
17528
|
function normalizeDrawingInsertOffset(body, offset) {
|
|
17453
|
-
|
|
17529
|
+
const { dataStream } = body;
|
|
17530
|
+
if (offset === 0 && dataStream[0] === "\r") return 1;
|
|
17531
|
+
if (dataStream[offset] === "\n" && dataStream[offset - 1] === "\r" && isInsideTableCell(dataStream, offset)) return offset - 1;
|
|
17532
|
+
return offset;
|
|
17533
|
+
}
|
|
17534
|
+
function isInsideTableCell(dataStream, offset) {
|
|
17535
|
+
let cellDepth = 0;
|
|
17536
|
+
for (let index = 0; index < offset; index++) if (dataStream[index] === "") cellDepth++;
|
|
17537
|
+
else if (dataStream[index] === "") cellDepth = Math.max(0, cellDepth - 1);
|
|
17538
|
+
return cellDepth > 0;
|
|
17454
17539
|
}
|
|
17455
17540
|
function buildDrawingInsertBody(body, drawings, insertOffset) {
|
|
17456
17541
|
var _body$paragraphs;
|
|
@@ -17530,8 +17615,8 @@ function collectNewStructuralStartOffsets(previousBody, nextBody) {
|
|
|
17530
17615
|
return Array.from(new Set(offsets)).sort((left, right) => left - right);
|
|
17531
17616
|
}
|
|
17532
17617
|
function collectNewStartOffsets(previousItems, nextItems, getId) {
|
|
17533
|
-
const previousIds = new Set((previousItems
|
|
17534
|
-
return (nextItems
|
|
17618
|
+
const previousIds = new Set((previousItems ?? []).map(getId));
|
|
17619
|
+
return (nextItems ?? []).filter((item) => !previousIds.has(getId(item))).map((item) => item.startIndex);
|
|
17535
17620
|
}
|
|
17536
17621
|
|
|
17537
17622
|
//#endregion
|
|
@@ -17625,8 +17710,7 @@ function normalizeBody$1(body) {
|
|
|
17625
17710
|
return body;
|
|
17626
17711
|
}
|
|
17627
17712
|
function normalizeData(data) {
|
|
17628
|
-
|
|
17629
|
-
data.body = normalizeBody$1((_data$body = data.body) !== null && _data$body !== void 0 ? _data$body : { dataStream: "" });
|
|
17713
|
+
data.body = normalizeBody$1(data.body ?? { dataStream: "" });
|
|
17630
17714
|
if (!data.drawingsOrder) data.drawingsOrder = [];
|
|
17631
17715
|
if (!data.drawings) data.drawings = {};
|
|
17632
17716
|
if (!data.documentStyle) data.documentStyle = {};
|
|
@@ -17669,8 +17753,8 @@ function normalizeRichTextParagraphStyle(style) {
|
|
|
17669
17753
|
};
|
|
17670
17754
|
}
|
|
17671
17755
|
function hasRichTextContent(data) {
|
|
17672
|
-
var _data$body
|
|
17673
|
-
return ((_data$body
|
|
17756
|
+
var _data$body;
|
|
17757
|
+
return (((_data$body = data.body) === null || _data$body === void 0 ? void 0 : _data$body.dataStream) ?? "").replace(/\r|\n/g, "").length > 0;
|
|
17674
17758
|
}
|
|
17675
17759
|
/**
|
|
17676
17760
|
* Represents a read-only font style value object.
|
|
@@ -19073,8 +19157,8 @@ var RichTextValue = class RichTextValue {
|
|
|
19073
19157
|
* ```
|
|
19074
19158
|
*/
|
|
19075
19159
|
toPlainText() {
|
|
19076
|
-
var _this$_data$body
|
|
19077
|
-
return BuildTextUtils.transform.getPlainText((
|
|
19160
|
+
var _this$_data$body;
|
|
19161
|
+
return BuildTextUtils.transform.getPlainText(((_this$_data$body = this._data.body) === null || _this$_data$body === void 0 ? void 0 : _this$_data$body.dataStream) ?? "").replaceAll("\r", "\n");
|
|
19078
19162
|
}
|
|
19079
19163
|
/**
|
|
19080
19164
|
* Gets the paragraph style of the current RichTextValue instance
|
|
@@ -19112,14 +19196,13 @@ var RichTextValue = class RichTextValue {
|
|
|
19112
19196
|
* ```
|
|
19113
19197
|
*/
|
|
19114
19198
|
getParagraphs() {
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
return paragraphs.map((paragraph) => {
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
});
|
|
19199
|
+
const body = this._data.body;
|
|
19200
|
+
if (!body) return [];
|
|
19201
|
+
const startOffsets = getParagraphContentStartOffsets(body);
|
|
19202
|
+
return (body.paragraphs ?? []).map((paragraph) => RichTextBuilder.create(createParagraphSnapshot(this._data, paragraph.paragraphId, {
|
|
19203
|
+
startOffset: startOffsets.get(paragraph.startIndex) ?? 0,
|
|
19204
|
+
endOffset: paragraph.startIndex
|
|
19205
|
+
})));
|
|
19123
19206
|
}
|
|
19124
19207
|
/**
|
|
19125
19208
|
* Gets the text runs of the current RichTextValue instance
|
|
@@ -19131,8 +19214,8 @@ var RichTextValue = class RichTextValue {
|
|
|
19131
19214
|
* ```
|
|
19132
19215
|
*/
|
|
19133
19216
|
getTextRuns() {
|
|
19134
|
-
var _this$_data$
|
|
19135
|
-
return ((
|
|
19217
|
+
var _this$_data$body4;
|
|
19218
|
+
return (((_this$_data$body4 = this._data.body) === null || _this$_data$body4 === void 0 ? void 0 : _this$_data$body4.textRuns) ?? []).map((t) => ({
|
|
19136
19219
|
...t,
|
|
19137
19220
|
ts: t.ts ? TextStyleValue.create(t.ts) : null
|
|
19138
19221
|
}));
|
|
@@ -19147,8 +19230,8 @@ var RichTextValue = class RichTextValue {
|
|
|
19147
19230
|
* ```
|
|
19148
19231
|
*/
|
|
19149
19232
|
getLinks() {
|
|
19150
|
-
var _this$_data$
|
|
19151
|
-
return (
|
|
19233
|
+
var _this$_data$body5;
|
|
19234
|
+
return ((_this$_data$body5 = this._data.body) === null || _this$_data$body5 === void 0 || (_this$_data$body5 = _this$_data$body5.customRanges) === null || _this$_data$body5 === void 0 ? void 0 : _this$_data$body5.filter((r) => r.rangeType === 0)) ?? [];
|
|
19152
19235
|
}
|
|
19153
19236
|
/**
|
|
19154
19237
|
* Gets the data of the current RichTextValue instance
|
|
@@ -19204,19 +19287,22 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19204
19287
|
* @returns {RichTextBuilder} A new RichTextBuilder instance
|
|
19205
19288
|
*/
|
|
19206
19289
|
static create(data) {
|
|
19207
|
-
return new RichTextBuilder(data
|
|
19290
|
+
return new RichTextBuilder(data ?? RichTextBuilder.newEmptyData());
|
|
19208
19291
|
}
|
|
19209
19292
|
constructor(data) {
|
|
19210
19293
|
super(data);
|
|
19211
19294
|
_defineProperty(this, "_doc", void 0);
|
|
19212
19295
|
_defineProperty(this, "_trackedRanges", /* @__PURE__ */ new Set());
|
|
19296
|
+
_defineProperty(this, "_childHandleRevision", 0);
|
|
19213
19297
|
this._doc = new DocumentDataModel(data);
|
|
19214
19298
|
}
|
|
19215
19299
|
/**
|
|
19216
19300
|
* Returns editable paragraph handles backed by this detached rich-text builder.
|
|
19217
19301
|
*
|
|
19218
|
-
* Paragraph boundaries come from the document model rather than splitting plain text.
|
|
19219
|
-
*
|
|
19302
|
+
* Paragraph boundaries come from the document model rather than splitting plain text. Handles stay aligned across
|
|
19303
|
+
* edits made through their child run handles, so callers can safely iterate from the first paragraph to the last.
|
|
19304
|
+
* Direct builder edits that change text or run boundaries invalidate previously returned paragraph and run handles;
|
|
19305
|
+
* query them again after calling methods such as `insertText()`, `setStyle()`, `setLink()`, or `delete()`.
|
|
19220
19306
|
*
|
|
19221
19307
|
* @returns Editable paragraphs in document order.
|
|
19222
19308
|
* @example
|
|
@@ -19231,14 +19317,10 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19231
19317
|
* ```
|
|
19232
19318
|
*/
|
|
19233
19319
|
getParagraphs() {
|
|
19234
|
-
var _body$paragraphs;
|
|
19235
19320
|
const body = this._data.body;
|
|
19236
19321
|
if (!body) return [];
|
|
19237
19322
|
const startOffsets = getParagraphContentStartOffsets(body);
|
|
19238
|
-
return (
|
|
19239
|
-
var _startOffsets$get;
|
|
19240
|
-
return this._createParagraphBuilder(paragraph.paragraphId, (_startOffsets$get = startOffsets.get(paragraph.startIndex)) !== null && _startOffsets$get !== void 0 ? _startOffsets$get : 0, paragraph.startIndex);
|
|
19241
|
-
});
|
|
19323
|
+
return (body.paragraphs ?? []).map((paragraph) => this._createParagraphBuilder(paragraph.paragraphId, startOffsets.get(paragraph.startIndex) ?? 0, paragraph.startIndex));
|
|
19242
19324
|
}
|
|
19243
19325
|
/**
|
|
19244
19326
|
* Returns editable text-run handles for all paragraph text in this builder.
|
|
@@ -19262,7 +19344,6 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19262
19344
|
}
|
|
19263
19345
|
/** @internal */
|
|
19264
19346
|
_createTextRunBuilders(range) {
|
|
19265
|
-
var _body$textRuns, _body$customRanges, _body$customDecoratio;
|
|
19266
19347
|
const body = this._data.body;
|
|
19267
19348
|
if (!body || range.startOffset >= range.endOffset) return [];
|
|
19268
19349
|
const boundaries = /* @__PURE__ */ new Set([range.startOffset, range.endOffset]);
|
|
@@ -19274,9 +19355,9 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19274
19355
|
boundaries.add(end);
|
|
19275
19356
|
}
|
|
19276
19357
|
};
|
|
19277
|
-
for (const textRun of
|
|
19278
|
-
for (const customRange of
|
|
19279
|
-
for (const decoration of
|
|
19358
|
+
for (const textRun of body.textRuns ?? []) addRangeBoundaries(textRun.st, textRun.ed);
|
|
19359
|
+
for (const customRange of body.customRanges ?? []) addRangeBoundaries(customRange.startIndex, customRange.endIndex + 1);
|
|
19360
|
+
for (const decoration of body.customDecorations ?? []) addRangeBoundaries(decoration.startIndex, decoration.endIndex + 1);
|
|
19280
19361
|
for (let offset = range.startOffset; offset < range.endOffset; offset++) if (NON_EDITABLE_RICH_TEXT_TOKENS.has(body.dataStream[offset])) {
|
|
19281
19362
|
boundaries.add(offset);
|
|
19282
19363
|
boundaries.add(offset + 1);
|
|
@@ -19284,12 +19365,11 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19284
19365
|
const offsets = [...boundaries].sort((left, right) => left - right);
|
|
19285
19366
|
const runs = [];
|
|
19286
19367
|
for (let index = 0; index < offsets.length - 1; index++) {
|
|
19287
|
-
var _body$textRuns2;
|
|
19288
19368
|
const startOffset = offsets[index];
|
|
19289
19369
|
const endOffset = offsets[index + 1];
|
|
19290
19370
|
if (startOffset >= endOffset || endOffset - startOffset === 1 && NON_EDITABLE_RICH_TEXT_TOKENS.has(body.dataStream[startOffset])) continue;
|
|
19291
|
-
const sourceRun = (
|
|
19292
|
-
runs.push(new RichTextRunBuilder(this, this._trackRange(startOffset, endOffset), sourceRun === null || sourceRun === void 0 ? void 0 : sourceRun.ts, sourceRun === null || sourceRun === void 0 ? void 0 : sourceRun.sId, Boolean(sourceRun)));
|
|
19371
|
+
const sourceRun = (body.textRuns ?? []).find((textRun) => textRun.st <= startOffset && textRun.ed >= endOffset);
|
|
19372
|
+
runs.push(new RichTextRunBuilder(this, this._trackRange(startOffset, endOffset), sourceRun === null || sourceRun === void 0 ? void 0 : sourceRun.ts, sourceRun === null || sourceRun === void 0 ? void 0 : sourceRun.sId, Boolean(sourceRun), this._childHandleRevision));
|
|
19293
19373
|
}
|
|
19294
19374
|
return runs;
|
|
19295
19375
|
}
|
|
@@ -19333,7 +19413,11 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19333
19413
|
this._rebaseTrackedRanges(startOffset, endOffset, text.length);
|
|
19334
19414
|
}
|
|
19335
19415
|
_createParagraphBuilder(paragraphId, startOffset, endOffset) {
|
|
19336
|
-
return new RichTextParagraphBuilder(this, paragraphId, this._trackRange(startOffset, endOffset));
|
|
19416
|
+
return new RichTextParagraphBuilder(this, paragraphId, this._trackRange(startOffset, endOffset), this._childHandleRevision);
|
|
19417
|
+
}
|
|
19418
|
+
/** @internal */
|
|
19419
|
+
_assertChildHandleRevision(revision) {
|
|
19420
|
+
if (revision !== this._childHandleRevision) throw new Error("Rich text child handle is no longer valid.");
|
|
19337
19421
|
}
|
|
19338
19422
|
_trackRange(startOffset, endOffset) {
|
|
19339
19423
|
const range = {
|
|
@@ -19360,6 +19444,10 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19360
19444
|
trackedRange.endOffset = mapEnd(trackedRange.endOffset);
|
|
19361
19445
|
}
|
|
19362
19446
|
}
|
|
19447
|
+
_invalidateChildHandles() {
|
|
19448
|
+
this._childHandleRevision++;
|
|
19449
|
+
this._trackedRanges.clear();
|
|
19450
|
+
}
|
|
19363
19451
|
/**
|
|
19364
19452
|
* Appends plain text to the rich text.
|
|
19365
19453
|
*
|
|
@@ -19400,13 +19488,12 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19400
19488
|
* ```
|
|
19401
19489
|
*/
|
|
19402
19490
|
align(alignment) {
|
|
19403
|
-
|
|
19404
|
-
const
|
|
19405
|
-
const renderConfig = (_documentStyle$render = documentStyle.renderConfig) !== null && _documentStyle$render !== void 0 ? _documentStyle$render : documentStyle.renderConfig = {};
|
|
19491
|
+
const documentStyle = this._data.documentStyle ??= {};
|
|
19492
|
+
const renderConfig = documentStyle.renderConfig ??= {};
|
|
19406
19493
|
if (alignment.horizontal !== void 0) {
|
|
19407
|
-
var _this$_data$
|
|
19494
|
+
var _this$_data$body6;
|
|
19408
19495
|
renderConfig.horizontalAlign = alignment.horizontal;
|
|
19409
|
-
for (const paragraph of (
|
|
19496
|
+
for (const paragraph of ((_this$_data$body6 = this._data.body) === null || _this$_data$body6 === void 0 ? void 0 : _this$_data$body6.paragraphs) ?? []) paragraph.paragraphStyle = {
|
|
19410
19497
|
...paragraph.paragraphStyle,
|
|
19411
19498
|
horizontalAlign: alignment.horizontal
|
|
19412
19499
|
};
|
|
@@ -19446,18 +19533,17 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19446
19533
|
* ```
|
|
19447
19534
|
*/
|
|
19448
19535
|
columns(options) {
|
|
19449
|
-
var _this$_data2, _this$_data2$body, _body$sectionBreaks, _options$spacing;
|
|
19450
19536
|
if (!Number.isInteger(options.count) || options.count < 1) throw new RangeError("Rich text column count must be a positive integer.");
|
|
19451
|
-
const body =
|
|
19452
|
-
const sectionBreaks =
|
|
19537
|
+
const body = this._data.body ??= { dataStream: "\r\n" };
|
|
19538
|
+
const sectionBreaks = body.sectionBreaks ??= [];
|
|
19453
19539
|
if (!sectionBreaks.length) {
|
|
19454
|
-
var _body$dataStream
|
|
19540
|
+
var _body$dataStream;
|
|
19455
19541
|
sectionBreaks.push({
|
|
19456
19542
|
sectionId: createSectionId(/* @__PURE__ */ new Set()),
|
|
19457
|
-
startIndex: Math.max(0, ((
|
|
19543
|
+
startIndex: Math.max(0, (((_body$dataStream = body.dataStream) === null || _body$dataStream === void 0 ? void 0 : _body$dataStream.length) ?? 0) - 1)
|
|
19458
19544
|
});
|
|
19459
19545
|
}
|
|
19460
|
-
const spacing = Math.max(0,
|
|
19546
|
+
const spacing = Math.max(0, options.spacing ?? 0);
|
|
19461
19547
|
const columns = options.count === 1 ? void 0 : Array.from({ length: options.count }, (_, index) => ({
|
|
19462
19548
|
width: 0,
|
|
19463
19549
|
paddingEnd: index === options.count - 1 ? 0 : spacing
|
|
@@ -19467,14 +19553,15 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19467
19553
|
return this;
|
|
19468
19554
|
}
|
|
19469
19555
|
/**
|
|
19470
|
-
* Appends one text span with
|
|
19556
|
+
* Appends one text span with an optional style.
|
|
19471
19557
|
*
|
|
19472
19558
|
* Prefer this method when combining multiple styles, because the style object is local to the inserted text and does
|
|
19473
19559
|
* not leak into following calls.
|
|
19474
19560
|
*
|
|
19475
19561
|
* @param text Text to append.
|
|
19476
|
-
* @param style
|
|
19477
|
-
* `color`, and `background` are supported alongside native
|
|
19562
|
+
* @param style Optional text style for this span. When omitted, the span is appended as unstyled text. Agent-friendly
|
|
19563
|
+
* aliases such as `bold`, `italic`, `fontFamily`, `fontSize`, `color`, and `background` are supported alongside native
|
|
19564
|
+
* document text style fields.
|
|
19478
19565
|
* @returns The current builder for chaining.
|
|
19479
19566
|
* @example
|
|
19480
19567
|
* ```ts
|
|
@@ -19485,18 +19572,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19485
19572
|
*/
|
|
19486
19573
|
span(text, style) {
|
|
19487
19574
|
if (!text) return this;
|
|
19488
|
-
return this.
|
|
19489
|
-
id: "d",
|
|
19490
|
-
documentStyle: {},
|
|
19491
|
-
body: {
|
|
19492
|
-
dataStream: text,
|
|
19493
|
-
textRuns: [{
|
|
19494
|
-
st: 0,
|
|
19495
|
-
ed: text.length,
|
|
19496
|
-
ts: normalizeRichTextSpanStyle(style)
|
|
19497
|
-
}]
|
|
19498
|
-
}
|
|
19499
|
-
}));
|
|
19575
|
+
return style ? this.insertText(text, normalizeRichTextSpanStyle(style)) : this.insertText(text);
|
|
19500
19576
|
}
|
|
19501
19577
|
/**
|
|
19502
19578
|
* Appends bold text.
|
|
@@ -19570,22 +19646,19 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19570
19646
|
* ```
|
|
19571
19647
|
*/
|
|
19572
19648
|
listItem(text, options = {}) {
|
|
19573
|
-
var
|
|
19574
|
-
const listType =
|
|
19575
|
-
const currentParagraph = (_this$_data$
|
|
19649
|
+
var _this$_data$body7, _options$listId, _this$_data$body8;
|
|
19650
|
+
const listType = options.type ?? "BULLET_LIST";
|
|
19651
|
+
const currentParagraph = (_this$_data$body7 = this._data.body) === null || _this$_data$body7 === void 0 || (_this$_data$body7 = _this$_data$body7.paragraphs) === null || _this$_data$body7 === void 0 ? void 0 : _this$_data$body7.slice(-1)[0];
|
|
19576
19652
|
const currentBullet = currentParagraph === null || currentParagraph === void 0 ? void 0 : currentParagraph.bullet;
|
|
19577
19653
|
const listId = ((_options$listId = options.listId) === null || _options$listId === void 0 ? void 0 : _options$listId.trim()) || ((currentBullet === null || currentBullet === void 0 ? void 0 : currentBullet.listType) === listType ? currentBullet.listId : generateRandomId());
|
|
19578
19654
|
if (hasRichTextContent(this._data)) this.paragraph(options.paragraphStyle);
|
|
19579
19655
|
else if (options.paragraphStyle) this.paragraph(options.paragraphStyle);
|
|
19580
|
-
const targetParagraph = (_this$_data$
|
|
19581
|
-
if (targetParagraph) {
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
nestingLevel: Math.max(0, Math.trunc((_options$level = options.level) !== null && _options$level !== void 0 ? _options$level : 0))
|
|
19587
|
-
};
|
|
19588
|
-
}
|
|
19656
|
+
const targetParagraph = (_this$_data$body8 = this._data.body) === null || _this$_data$body8 === void 0 || (_this$_data$body8 = _this$_data$body8.paragraphs) === null || _this$_data$body8 === void 0 ? void 0 : _this$_data$body8.slice(-1)[0];
|
|
19657
|
+
if (targetParagraph) targetParagraph.bullet = {
|
|
19658
|
+
listId,
|
|
19659
|
+
listType,
|
|
19660
|
+
nestingLevel: Math.max(0, Math.trunc(options.level ?? 0))
|
|
19661
|
+
};
|
|
19589
19662
|
return this.text(text);
|
|
19590
19663
|
}
|
|
19591
19664
|
/**
|
|
@@ -19606,20 +19679,20 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19606
19679
|
* ```
|
|
19607
19680
|
*/
|
|
19608
19681
|
paragraph(paragraphStyle) {
|
|
19609
|
-
var _this$_data$
|
|
19682
|
+
var _this$_data$body10, _this$_data$body11, _this$_data$body12;
|
|
19610
19683
|
const nextParagraphStyle = normalizeRichTextParagraphStyle(paragraphStyle);
|
|
19611
19684
|
if (!hasRichTextContent(this._data)) {
|
|
19612
19685
|
if (nextParagraphStyle) {
|
|
19613
|
-
var _this$_data$
|
|
19614
|
-
const firstParagraph = (_this$_data$
|
|
19686
|
+
var _this$_data$body9;
|
|
19687
|
+
const firstParagraph = (_this$_data$body9 = this._data.body) === null || _this$_data$body9 === void 0 || (_this$_data$body9 = _this$_data$body9.paragraphs) === null || _this$_data$body9 === void 0 ? void 0 : _this$_data$body9[0];
|
|
19615
19688
|
if (firstParagraph) firstParagraph.paragraphStyle = nextParagraphStyle;
|
|
19616
19689
|
}
|
|
19617
19690
|
return this;
|
|
19618
19691
|
}
|
|
19619
|
-
const currentParagraph = (_this$_data$
|
|
19692
|
+
const currentParagraph = (_this$_data$body10 = this._data.body) === null || _this$_data$body10 === void 0 || (_this$_data$body10 = _this$_data$body10.paragraphs) === null || _this$_data$body10 === void 0 ? void 0 : _this$_data$body10.slice(-1)[0];
|
|
19620
19693
|
const currentParagraphStyle = Tools.deepClone(currentParagraph === null || currentParagraph === void 0 ? void 0 : currentParagraph.paragraphStyle);
|
|
19621
19694
|
const currentParagraphBullet = Tools.deepClone(currentParagraph === null || currentParagraph === void 0 ? void 0 : currentParagraph.bullet);
|
|
19622
|
-
const startIndex = Math.max(0, ((
|
|
19695
|
+
const startIndex = Math.max(0, (((_this$_data$body11 = this._data.body) === null || _this$_data$body11 === void 0 ? void 0 : _this$_data$body11.dataStream.length) ?? 2) - 2);
|
|
19623
19696
|
this.insertRichText(startIndex, RichTextValue.create({
|
|
19624
19697
|
id: "d",
|
|
19625
19698
|
documentStyle: {},
|
|
@@ -19633,7 +19706,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19633
19706
|
}]
|
|
19634
19707
|
}
|
|
19635
19708
|
}));
|
|
19636
|
-
const nextParagraph = (_this$_data$
|
|
19709
|
+
const nextParagraph = (_this$_data$body12 = this._data.body) === null || _this$_data$body12 === void 0 || (_this$_data$body12 = _this$_data$body12.paragraphs) === null || _this$_data$body12 === void 0 ? void 0 : _this$_data$body12.slice(-1)[0];
|
|
19637
19710
|
if (nextParagraphStyle) {
|
|
19638
19711
|
if (nextParagraph) nextParagraph.paragraphStyle = nextParagraphStyle;
|
|
19639
19712
|
} else if (nextParagraph) delete nextParagraph.paragraphStyle;
|
|
@@ -19641,24 +19714,26 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19641
19714
|
return this;
|
|
19642
19715
|
}
|
|
19643
19716
|
insertText(start, text, style) {
|
|
19644
|
-
var _this$_data$
|
|
19645
|
-
let startIndex = ((
|
|
19717
|
+
var _this$_data$body13;
|
|
19718
|
+
let startIndex = (((_this$_data$body13 = this._data.body) === null || _this$_data$body13 === void 0 ? void 0 : _this$_data$body13.dataStream.length) ?? 2) - 2;
|
|
19646
19719
|
let insertText;
|
|
19647
19720
|
let insertStyle;
|
|
19648
19721
|
if (typeof start === "string") insertText = start;
|
|
19649
19722
|
else {
|
|
19650
19723
|
startIndex = Math.min(start, startIndex);
|
|
19651
|
-
insertText = text;
|
|
19724
|
+
insertText = typeof text === "string" ? text : "";
|
|
19652
19725
|
}
|
|
19653
19726
|
if (typeof text === "object") insertStyle = text instanceof TextStyleBuilder ? text.build() : text;
|
|
19654
19727
|
else insertStyle = style instanceof TextStyleBuilder ? style.build() : style;
|
|
19655
19728
|
if (!insertText) return this;
|
|
19729
|
+
const plainTextBody = BuildTextUtils.transform.fromPlainText(insertText);
|
|
19656
19730
|
const newBody = {
|
|
19657
|
-
dataStream:
|
|
19731
|
+
dataStream: plainTextBody.dataStream,
|
|
19732
|
+
paragraphs: plainTextBody.paragraphs,
|
|
19658
19733
|
textRuns: insertStyle ? [{
|
|
19659
19734
|
ts: insertStyle,
|
|
19660
|
-
st:
|
|
19661
|
-
ed:
|
|
19735
|
+
st: 0,
|
|
19736
|
+
ed: plainTextBody.dataStream.length
|
|
19662
19737
|
}] : []
|
|
19663
19738
|
};
|
|
19664
19739
|
const textX = BuildTextUtils.selection.replace({
|
|
@@ -19672,11 +19747,12 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19672
19747
|
});
|
|
19673
19748
|
if (!textX) throw new Error("Insert text failed, please check.");
|
|
19674
19749
|
TextX.apply(this._doc.getBody(), textX.serialize());
|
|
19750
|
+
this._invalidateChildHandles();
|
|
19675
19751
|
return this;
|
|
19676
19752
|
}
|
|
19677
19753
|
insertRichText(start, richText) {
|
|
19678
|
-
var _this$_data$
|
|
19679
|
-
let startIndex = ((
|
|
19754
|
+
var _this$_data$body14;
|
|
19755
|
+
let startIndex = (((_this$_data$body14 = this._data.body) === null || _this$_data$body14 === void 0 ? void 0 : _this$_data$body14.dataStream.length) ?? 2) - 2;
|
|
19680
19756
|
let insertText;
|
|
19681
19757
|
if (typeof start === "object") insertText = start instanceof RichTextValue ? start.getData() : start;
|
|
19682
19758
|
else {
|
|
@@ -19694,17 +19770,32 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19694
19770
|
});
|
|
19695
19771
|
if (!textX) throw new Error("Insert text failed, please check.");
|
|
19696
19772
|
TextX.apply(this._doc.getBody(), textX.serialize());
|
|
19773
|
+
this._invalidateChildHandles();
|
|
19697
19774
|
return this;
|
|
19698
19775
|
}
|
|
19699
19776
|
delete(start, count) {
|
|
19700
|
-
|
|
19701
|
-
|
|
19777
|
+
var _this$_data$body15;
|
|
19778
|
+
const terminalTokenLength = "\r".length + "\n".length;
|
|
19779
|
+
const contentLength = Math.max(0, (((_this$_data$body15 = this._data.body) === null || _this$_data$body15 === void 0 ? void 0 : _this$_data$body15.dataStream.length) ?? terminalTokenLength) - terminalTokenLength);
|
|
19780
|
+
let startOffset;
|
|
19781
|
+
let deleteCount;
|
|
19782
|
+
if (count === void 0) {
|
|
19783
|
+
if (start < 0) throw new RangeError("Delete count cannot be negative.");
|
|
19784
|
+
deleteCount = Math.min(start, contentLength);
|
|
19785
|
+
startOffset = contentLength - deleteCount;
|
|
19786
|
+
} else {
|
|
19787
|
+
if (start < 0 || count < 0) throw new RangeError("Delete range cannot be negative.");
|
|
19788
|
+
startOffset = Math.min(start, contentLength);
|
|
19789
|
+
deleteCount = Math.min(count, contentLength - startOffset);
|
|
19790
|
+
}
|
|
19791
|
+
if (deleteCount > 0) {
|
|
19702
19792
|
const actions = BuildTextUtils.selection.delete([{
|
|
19703
|
-
startOffset
|
|
19704
|
-
endOffset:
|
|
19793
|
+
startOffset,
|
|
19794
|
+
endOffset: startOffset + deleteCount,
|
|
19705
19795
|
collapsed: true
|
|
19706
19796
|
}], this._data.body);
|
|
19707
19797
|
TextX.apply(this._doc.getBody(), actions);
|
|
19798
|
+
this._invalidateChildHandles();
|
|
19708
19799
|
}
|
|
19709
19800
|
return this;
|
|
19710
19801
|
}
|
|
@@ -19735,6 +19826,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19735
19826
|
collapsed: true
|
|
19736
19827
|
}], newBody);
|
|
19737
19828
|
TextX.apply(this._doc.getBody(), actions);
|
|
19829
|
+
this._invalidateChildHandles();
|
|
19738
19830
|
return this;
|
|
19739
19831
|
}
|
|
19740
19832
|
/**
|
|
@@ -19763,9 +19855,11 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19763
19855
|
});
|
|
19764
19856
|
if (!textX) throw new Error("Insert text failed, please check.");
|
|
19765
19857
|
TextX.apply(this._doc.getBody(), textX.serialize());
|
|
19858
|
+
this._invalidateChildHandles();
|
|
19766
19859
|
return this;
|
|
19767
19860
|
}
|
|
19768
19861
|
cancelLink(start, end) {
|
|
19862
|
+
let changed = false;
|
|
19769
19863
|
if (typeof start === "string") {
|
|
19770
19864
|
const textX = BuildTextUtils.customRange.delete({
|
|
19771
19865
|
rangeId: start,
|
|
@@ -19773,6 +19867,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19773
19867
|
});
|
|
19774
19868
|
if (!textX) throw new Error("Insert text failed, please check.");
|
|
19775
19869
|
TextX.apply(this._doc.getBody(), textX.serialize());
|
|
19870
|
+
changed = true;
|
|
19776
19871
|
} else this.slice(start, end).getLinks().forEach((l) => {
|
|
19777
19872
|
const textX = BuildTextUtils.customRange.delete({
|
|
19778
19873
|
rangeId: l.rangeId,
|
|
@@ -19780,7 +19875,9 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19780
19875
|
});
|
|
19781
19876
|
if (!textX) throw new Error("Insert text failed, please check.");
|
|
19782
19877
|
TextX.apply(this._doc.getBody(), textX.serialize());
|
|
19878
|
+
changed = true;
|
|
19783
19879
|
});
|
|
19880
|
+
if (changed) this._invalidateChildHandles();
|
|
19784
19881
|
return this;
|
|
19785
19882
|
}
|
|
19786
19883
|
updateLink(id, url) {
|
|
@@ -19794,7 +19891,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19794
19891
|
let newBody;
|
|
19795
19892
|
let startIndex;
|
|
19796
19893
|
if (typeof start === "object") {
|
|
19797
|
-
var _this$_data$
|
|
19894
|
+
var _this$_data$body17;
|
|
19798
19895
|
newBody = {
|
|
19799
19896
|
dataStream: "\r",
|
|
19800
19897
|
paragraphs: [{
|
|
@@ -19803,7 +19900,7 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19803
19900
|
paragraphStyle: start.build()
|
|
19804
19901
|
}]
|
|
19805
19902
|
};
|
|
19806
|
-
startIndex = ((
|
|
19903
|
+
startIndex = (((_this$_data$body17 = this._data.body) === null || _this$_data$body17 === void 0 ? void 0 : _this$_data$body17.dataStream.length) ?? 2) - 2;
|
|
19807
19904
|
} else {
|
|
19808
19905
|
startIndex = start;
|
|
19809
19906
|
newBody = {
|
|
@@ -19853,18 +19950,21 @@ var RichTextBuilder = class RichTextBuilder extends RichTextValue {
|
|
|
19853
19950
|
*/
|
|
19854
19951
|
var RichTextParagraphBuilder = class extends RichTextValue {
|
|
19855
19952
|
/** @hideconstructor */
|
|
19856
|
-
constructor(_owner, _paragraphId, _range) {
|
|
19953
|
+
constructor(_owner, _paragraphId, _range, _revision) {
|
|
19857
19954
|
super(createParagraphSnapshot(_owner.getData(), _paragraphId, _range));
|
|
19858
19955
|
this._owner = _owner;
|
|
19859
19956
|
this._paragraphId = _paragraphId;
|
|
19860
19957
|
this._range = _range;
|
|
19958
|
+
this._revision = _revision;
|
|
19861
19959
|
}
|
|
19862
19960
|
/** Returns the persisted paragraph id. */
|
|
19863
19961
|
getId() {
|
|
19962
|
+
this._assertActive();
|
|
19864
19963
|
return this._paragraphId;
|
|
19865
19964
|
}
|
|
19866
19965
|
/** Returns the current paragraph range without its trailing paragraph marker. */
|
|
19867
19966
|
getRange() {
|
|
19967
|
+
this._assertActive();
|
|
19868
19968
|
return { ...this._range };
|
|
19869
19969
|
}
|
|
19870
19970
|
/**
|
|
@@ -19877,8 +19977,9 @@ var RichTextParagraphBuilder = class extends RichTextValue {
|
|
|
19877
19977
|
* ```
|
|
19878
19978
|
*/
|
|
19879
19979
|
getText() {
|
|
19880
|
-
var _this$_owner$getData
|
|
19881
|
-
|
|
19980
|
+
var _this$_owner$getData$;
|
|
19981
|
+
this._assertActive();
|
|
19982
|
+
return (((_this$_owner$getData$ = this._owner.getData().body) === null || _this$_owner$getData$ === void 0 ? void 0 : _this$_owner$getData$.dataStream) ?? "").slice(this._range.startOffset, this._range.endOffset);
|
|
19882
19983
|
}
|
|
19883
19984
|
toPlainText() {
|
|
19884
19985
|
return this.getText();
|
|
@@ -19888,34 +19989,42 @@ var RichTextParagraphBuilder = class extends RichTextValue {
|
|
|
19888
19989
|
* @returns Editable text runs in document order.
|
|
19889
19990
|
*/
|
|
19890
19991
|
getTextRuns() {
|
|
19992
|
+
this._assertActive();
|
|
19891
19993
|
return this._owner._createTextRunBuilders(this._range);
|
|
19892
19994
|
}
|
|
19893
19995
|
getParagraphStyle() {
|
|
19996
|
+
this._assertActive();
|
|
19894
19997
|
return ParagraphStyleValue.create(this._getParagraph().paragraphStyle);
|
|
19895
19998
|
}
|
|
19896
19999
|
getParagraphBullet() {
|
|
20000
|
+
this._assertActive();
|
|
19897
20001
|
return this._getParagraph().bullet;
|
|
19898
20002
|
}
|
|
19899
20003
|
getLinks() {
|
|
19900
|
-
var _this$getData$body
|
|
19901
|
-
|
|
20004
|
+
var _this$getData$body;
|
|
20005
|
+
this._assertActive();
|
|
20006
|
+
return ((_this$getData$body = this.getData().body) === null || _this$getData$body === void 0 || (_this$getData$body = _this$getData$body.customRanges) === null || _this$getData$body === void 0 ? void 0 : _this$getData$body.filter((range) => range.rangeType === 0)) ?? [];
|
|
19902
20007
|
}
|
|
19903
20008
|
/** Agent-friendly alias of `getParagraphBullet()`. */
|
|
19904
20009
|
getBullet() {
|
|
19905
20010
|
return this.getParagraphBullet();
|
|
19906
20011
|
}
|
|
19907
20012
|
getData() {
|
|
20013
|
+
this._assertActive();
|
|
19908
20014
|
return createParagraphSnapshot(this._owner.getData(), this._paragraphId, this._range);
|
|
19909
20015
|
}
|
|
19910
20016
|
copy() {
|
|
19911
20017
|
return RichTextBuilder.create(Tools.deepClone(this.getData()));
|
|
19912
20018
|
}
|
|
19913
20019
|
_getParagraph() {
|
|
19914
|
-
var _this$_owner$getData$
|
|
19915
|
-
const paragraph = (_this$_owner$getData$
|
|
20020
|
+
var _this$_owner$getData$2;
|
|
20021
|
+
const paragraph = (_this$_owner$getData$2 = this._owner.getData().body) === null || _this$_owner$getData$2 === void 0 || (_this$_owner$getData$2 = _this$_owner$getData$2.paragraphs) === null || _this$_owner$getData$2 === void 0 ? void 0 : _this$_owner$getData$2.find((item) => item.paragraphId === this._paragraphId);
|
|
19916
20022
|
if (!paragraph) throw new Error(`Rich text paragraph "${this._paragraphId}" was not found.`);
|
|
19917
20023
|
return paragraph;
|
|
19918
20024
|
}
|
|
20025
|
+
_assertActive() {
|
|
20026
|
+
this._owner._assertChildHandleRevision(this._revision);
|
|
20027
|
+
}
|
|
19919
20028
|
};
|
|
19920
20029
|
/**
|
|
19921
20030
|
* An editable text-run handle owned by a detached {@link RichTextBuilder}.
|
|
@@ -19925,38 +20034,45 @@ var RichTextParagraphBuilder = class extends RichTextValue {
|
|
|
19925
20034
|
*/
|
|
19926
20035
|
var RichTextRunBuilder = class {
|
|
19927
20036
|
/** @hideconstructor */
|
|
19928
|
-
constructor(_owner, _range, _textStyle, _styleId, _hasExplicitTextStyle) {
|
|
20037
|
+
constructor(_owner, _range, _textStyle, _styleId, _hasExplicitTextStyle, _revision) {
|
|
19929
20038
|
this._owner = _owner;
|
|
19930
20039
|
this._range = _range;
|
|
19931
20040
|
this._textStyle = _textStyle;
|
|
19932
20041
|
this._styleId = _styleId;
|
|
19933
20042
|
this._hasExplicitTextStyle = _hasExplicitTextStyle;
|
|
20043
|
+
this._revision = _revision;
|
|
19934
20044
|
_defineProperty(this, "_active", true);
|
|
19935
20045
|
}
|
|
19936
20046
|
/** Inclusive start offset, kept for compatibility with existing `getTextRuns()` callers. */
|
|
19937
20047
|
get st() {
|
|
20048
|
+
this._assertActive();
|
|
19938
20049
|
return this._range.startOffset;
|
|
19939
20050
|
}
|
|
19940
20051
|
/** Exclusive end offset, automatically updated after text replacement. */
|
|
19941
20052
|
get ed() {
|
|
20053
|
+
this._assertActive();
|
|
19942
20054
|
return this._range.endOffset;
|
|
19943
20055
|
}
|
|
19944
20056
|
/** Optional persisted style id. This is not a stable run identity. */
|
|
19945
20057
|
get sId() {
|
|
20058
|
+
this._assertActive();
|
|
19946
20059
|
return this._styleId;
|
|
19947
20060
|
}
|
|
19948
20061
|
/** Existing text-style value property exposed by `getTextRuns()`. */
|
|
19949
20062
|
get ts() {
|
|
20063
|
+
this._assertActive();
|
|
19950
20064
|
return this._textStyle ? TextStyleValue.create(this._textStyle) : null;
|
|
19951
20065
|
}
|
|
19952
20066
|
/** Returns the current run range. */
|
|
19953
20067
|
getRange() {
|
|
20068
|
+
this._assertActive();
|
|
19954
20069
|
return { ...this._range };
|
|
19955
20070
|
}
|
|
19956
20071
|
/** Returns the current run text. */
|
|
19957
20072
|
getText() {
|
|
19958
|
-
var _this$_owner$getData$
|
|
19959
|
-
|
|
20073
|
+
var _this$_owner$getData$3;
|
|
20074
|
+
this._assertActive();
|
|
20075
|
+
return (((_this$_owner$getData$3 = this._owner.getData().body) === null || _this$_owner$getData$3 === void 0 ? void 0 : _this$_owner$getData$3.dataStream) ?? "").slice(this._range.startOffset, this._range.endOffset);
|
|
19960
20076
|
}
|
|
19961
20077
|
/** Returns this run's explicit text style, or `null` for an unstyled text segment. */
|
|
19962
20078
|
getTextStyle() {
|
|
@@ -19964,6 +20080,7 @@ var RichTextRunBuilder = class {
|
|
|
19964
20080
|
}
|
|
19965
20081
|
/** Returns whether this segment is backed by an explicit document text run. */
|
|
19966
20082
|
hasTextStyle() {
|
|
20083
|
+
this._assertActive();
|
|
19967
20084
|
return this._hasExplicitTextStyle;
|
|
19968
20085
|
}
|
|
19969
20086
|
/**
|
|
@@ -19991,17 +20108,21 @@ var RichTextRunBuilder = class {
|
|
|
19991
20108
|
* ```
|
|
19992
20109
|
*/
|
|
19993
20110
|
setText(text) {
|
|
19994
|
-
|
|
20111
|
+
this._assertActive();
|
|
19995
20112
|
this._owner._replaceTextRun(this._range, text, this._textStyle, this._styleId, this._hasExplicitTextStyle);
|
|
19996
20113
|
if (!text) this._active = false;
|
|
19997
20114
|
return this;
|
|
19998
20115
|
}
|
|
20116
|
+
_assertActive() {
|
|
20117
|
+
if (!this._active) throw new Error("Rich text run handle is no longer valid.");
|
|
20118
|
+
this._owner._assertChildHandleRevision(this._revision);
|
|
20119
|
+
}
|
|
19999
20120
|
};
|
|
20000
20121
|
function createParagraphSnapshot(data, paragraphId, range) {
|
|
20001
|
-
var _body$
|
|
20122
|
+
var _body$paragraphs;
|
|
20002
20123
|
const { body, ...documentData } = data;
|
|
20003
20124
|
if (!body) throw new Error("Rich text body is not available.");
|
|
20004
|
-
const paragraph = (_body$
|
|
20125
|
+
const paragraph = (_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 ? void 0 : _body$paragraphs.find((item) => item.paragraphId === paragraphId);
|
|
20005
20126
|
if (!paragraph) throw new Error(`Rich text paragraph "${paragraphId}" was not found.`);
|
|
20006
20127
|
const paragraphBody = getBodySlice(body, range.startOffset, range.endOffset);
|
|
20007
20128
|
paragraphBody.paragraphs = [{
|
|
@@ -20048,13 +20169,9 @@ function validateMinimumRootSentinels(body, issues, context) {
|
|
|
20048
20169
|
if (!body.dataStream.includes("\n")) issues.push(createIssue(context, "missing-root-section-break", "Document body must contain at least one section break sentinel."));
|
|
20049
20170
|
}
|
|
20050
20171
|
function validateParagraphMetadata(body, issues, context) {
|
|
20051
|
-
var _body$paragraphs;
|
|
20052
20172
|
const metadataCounts = /* @__PURE__ */ new Map();
|
|
20053
|
-
for (const paragraph of
|
|
20054
|
-
else
|
|
20055
|
-
var _metadataCounts$get;
|
|
20056
|
-
metadataCounts.set(paragraph.startIndex, ((_metadataCounts$get = metadataCounts.get(paragraph.startIndex)) !== null && _metadataCounts$get !== void 0 ? _metadataCounts$get : 0) + 1);
|
|
20057
|
-
}
|
|
20173
|
+
for (const paragraph of body.paragraphs ?? []) if (body.dataStream[paragraph.startIndex] !== "\r") issues.push(createIssue(context, "paragraph-token-mismatch", "Paragraph metadata must point to a paragraph sentinel.", paragraph.startIndex));
|
|
20174
|
+
else metadataCounts.set(paragraph.startIndex, (metadataCounts.get(paragraph.startIndex) ?? 0) + 1);
|
|
20058
20175
|
validatePointMetadataDuplicates(metadataCounts, {
|
|
20059
20176
|
context,
|
|
20060
20177
|
duplicateCode: "duplicate-paragraph-metadata",
|
|
@@ -20062,20 +20179,13 @@ function validateParagraphMetadata(body, issues, context) {
|
|
|
20062
20179
|
}, issues);
|
|
20063
20180
|
}
|
|
20064
20181
|
function validateSectionBreakMetadata(body, issues, context) {
|
|
20065
|
-
var _body$sectionBreaks;
|
|
20066
20182
|
const metadataCounts = /* @__PURE__ */ new Map();
|
|
20067
20183
|
const sectionIds = /* @__PURE__ */ new Map();
|
|
20068
|
-
for (const sectionBreak of
|
|
20184
|
+
for (const sectionBreak of body.sectionBreaks ?? []) {
|
|
20069
20185
|
if (!sectionBreak.sectionId) issues.push(createIssue(context, "missing-section-id", "Section break metadata must have a stable section id.", sectionBreak.startIndex));
|
|
20070
|
-
else
|
|
20071
|
-
var _sectionIds$get;
|
|
20072
|
-
sectionIds.set(sectionBreak.sectionId, ((_sectionIds$get = sectionIds.get(sectionBreak.sectionId)) !== null && _sectionIds$get !== void 0 ? _sectionIds$get : 0) + 1);
|
|
20073
|
-
}
|
|
20186
|
+
else sectionIds.set(sectionBreak.sectionId, (sectionIds.get(sectionBreak.sectionId) ?? 0) + 1);
|
|
20074
20187
|
if (body.dataStream[sectionBreak.startIndex] !== "\n") issues.push(createIssue(context, "section-break-token-mismatch", "Section break metadata must point to a section break sentinel.", sectionBreak.startIndex));
|
|
20075
|
-
else
|
|
20076
|
-
var _metadataCounts$get2;
|
|
20077
|
-
metadataCounts.set(sectionBreak.startIndex, ((_metadataCounts$get2 = metadataCounts.get(sectionBreak.startIndex)) !== null && _metadataCounts$get2 !== void 0 ? _metadataCounts$get2 : 0) + 1);
|
|
20078
|
-
}
|
|
20188
|
+
else metadataCounts.set(sectionBreak.startIndex, (metadataCounts.get(sectionBreak.startIndex) ?? 0) + 1);
|
|
20079
20189
|
}
|
|
20080
20190
|
validatePointMetadataDuplicates(metadataCounts, {
|
|
20081
20191
|
context,
|
|
@@ -20104,11 +20214,10 @@ function collectPairedTokenRanges(dataStream, startToken, endToken, exclusiveEnd
|
|
|
20104
20214
|
};
|
|
20105
20215
|
}
|
|
20106
20216
|
function validateTableMetadata(body, issues, context) {
|
|
20107
|
-
var _body$tables;
|
|
20108
20217
|
const pairedTables = collectPairedTokenRanges(body.dataStream, "", "", true).pairs;
|
|
20109
20218
|
const metadataStarts = /* @__PURE__ */ new Set();
|
|
20110
20219
|
let previousTable;
|
|
20111
|
-
const tables = [...
|
|
20220
|
+
const tables = [...body.tables ?? []].sort((a, b) => a.startIndex - b.startIndex || a.endIndex - b.endIndex);
|
|
20112
20221
|
for (const table of tables) {
|
|
20113
20222
|
metadataStarts.add(table.startIndex);
|
|
20114
20223
|
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));
|
|
@@ -20119,10 +20228,9 @@ function validateTableMetadata(body, issues, context) {
|
|
|
20119
20228
|
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));
|
|
20120
20229
|
}
|
|
20121
20230
|
function validateBlockRangeMetadata(body, issues, context) {
|
|
20122
|
-
var _body$blockRanges;
|
|
20123
20231
|
const pairedBlocks = collectPairedTokenRanges(body.dataStream, "", "", false);
|
|
20124
20232
|
for (const index of [...pairedBlocks.unmatchedStarts, ...pairedBlocks.unmatchedEnds]) issues.push(createIssue(context, "unbalanced-block", "Block sentinel has no matching boundary.", index));
|
|
20125
|
-
const blockRanges = [...
|
|
20233
|
+
const blockRanges = [...body.blockRanges ?? []].sort((a, b) => a.startIndex - b.startIndex || a.endIndex - b.endIndex);
|
|
20126
20234
|
const metadataStarts = /* @__PURE__ */ new Set();
|
|
20127
20235
|
let previousBlockRange;
|
|
20128
20236
|
for (let i = 0; i < blockRanges.length; i++) {
|
|
@@ -20135,10 +20243,9 @@ function validateBlockRangeMetadata(body, issues, context) {
|
|
|
20135
20243
|
for (const startIndex of pairedBlocks.pairs.keys()) if (!metadataStarts.has(startIndex)) issues.push(createIssue(context, "missing-block-range-metadata", "Block token range must have a block metadata entry.", startIndex));
|
|
20136
20244
|
}
|
|
20137
20245
|
function validateColumnGroupMetadata(body, issues, context) {
|
|
20138
|
-
var _body$columnGroups;
|
|
20139
20246
|
const pairedColumnGroups = collectPairedTokenRanges(body.dataStream, "", "", false).pairs;
|
|
20140
20247
|
const metadataStarts = /* @__PURE__ */ new Set();
|
|
20141
|
-
const columnGroups = [...
|
|
20248
|
+
const columnGroups = [...body.columnGroups ?? []].sort((a, b) => a.startIndex - b.startIndex || a.endIndex - b.endIndex);
|
|
20142
20249
|
let previousColumnGroup;
|
|
20143
20250
|
for (const columnGroup of columnGroups) {
|
|
20144
20251
|
metadataStarts.add(columnGroup.startIndex);
|
|
@@ -20148,7 +20255,7 @@ function validateColumnGroupMetadata(body, issues, context) {
|
|
|
20148
20255
|
previousColumnGroup = columnGroup;
|
|
20149
20256
|
if (Array.isArray(columnGroup.columns)) {
|
|
20150
20257
|
let streamColumnCount = 0;
|
|
20151
|
-
const scanEnd = pairedEndIndex
|
|
20258
|
+
const scanEnd = pairedEndIndex ?? columnGroup.endIndex;
|
|
20152
20259
|
for (let index = columnGroup.startIndex + 1; index < scanEnd; index++) if (body.dataStream[index] === "") streamColumnCount++;
|
|
20153
20260
|
if (streamColumnCount !== columnGroup.columns.length) issues.push(createIssue(context, "column-group-column-count-mismatch", "Column group metadata column count must match the data stream.", columnGroup.startIndex));
|
|
20154
20261
|
}
|
|
@@ -20156,16 +20263,14 @@ function validateColumnGroupMetadata(body, issues, context) {
|
|
|
20156
20263
|
for (const startIndex of pairedColumnGroups.keys()) if (!metadataStarts.has(startIndex)) issues.push(createIssue(context, "missing-column-group-metadata", "Column group token range must have a metadata entry.", startIndex));
|
|
20157
20264
|
}
|
|
20158
20265
|
function validateCustomBlockMetadata(body, issues, context) {
|
|
20159
|
-
var _body$customBlocks;
|
|
20160
20266
|
const metadataCounts = /* @__PURE__ */ new Map();
|
|
20161
|
-
for (const customBlock of
|
|
20162
|
-
var _metadataCounts$get3;
|
|
20267
|
+
for (const customBlock of body.customBlocks ?? []) {
|
|
20163
20268
|
const { startIndex } = customBlock;
|
|
20164
20269
|
if (!Number.isInteger(startIndex) || body.dataStream[startIndex] !== "\b") {
|
|
20165
20270
|
issues.push(createIssue(context, "custom-block-token-mismatch", "Custom block startIndex must point to a custom block sentinel.", startIndex));
|
|
20166
20271
|
continue;
|
|
20167
20272
|
}
|
|
20168
|
-
metadataCounts.set(startIndex, (
|
|
20273
|
+
metadataCounts.set(startIndex, (metadataCounts.get(startIndex) ?? 0) + 1);
|
|
20169
20274
|
}
|
|
20170
20275
|
validatePointMetadataDuplicates(metadataCounts, {
|
|
20171
20276
|
context,
|
|
@@ -20240,14 +20345,13 @@ function validateDocBodyStructure(body, context = { segmentType: "body" }) {
|
|
|
20240
20345
|
return issues;
|
|
20241
20346
|
}
|
|
20242
20347
|
function validateDocumentStructure(snapshot) {
|
|
20243
|
-
var _snapshot$headers, _snapshot$footers;
|
|
20244
20348
|
const issues = [];
|
|
20245
20349
|
if (snapshot.body) issues.push(...validateDocBodyStructure(snapshot.body, { segmentType: "body" }));
|
|
20246
|
-
for (const [headerId, header] of Object.entries(
|
|
20350
|
+
for (const [headerId, header] of Object.entries(snapshot.headers ?? {})) issues.push(...validateDocBodyStructure(header.body, {
|
|
20247
20351
|
segmentType: "header",
|
|
20248
20352
|
segmentId: headerId
|
|
20249
20353
|
}));
|
|
20250
|
-
for (const [footerId, footer] of Object.entries(
|
|
20354
|
+
for (const [footerId, footer] of Object.entries(snapshot.footers ?? {})) issues.push(...validateDocBodyStructure(footer.body, {
|
|
20251
20355
|
segmentType: "footer",
|
|
20252
20356
|
segmentId: footerId
|
|
20253
20357
|
}));
|
|
@@ -20358,10 +20462,7 @@ var EventSubject = class extends Subject {
|
|
|
20358
20462
|
else ob = observer;
|
|
20359
20463
|
const subscription = super.subscribe(ob);
|
|
20360
20464
|
this._sortedObservers.push(ob);
|
|
20361
|
-
this._sortedObservers.sort((a, b) =>
|
|
20362
|
-
var _a$priority, _b$priority;
|
|
20363
|
-
return ((_a$priority = a.priority) !== null && _a$priority !== void 0 ? _a$priority : 0) - ((_b$priority = b.priority) !== null && _b$priority !== void 0 ? _b$priority : 0);
|
|
20364
|
-
});
|
|
20465
|
+
this._sortedObservers.sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
|
|
20365
20466
|
subscription.add(() => this._sortedObservers = this._sortedObservers.filter((o) => o !== ob));
|
|
20366
20467
|
return subscription;
|
|
20367
20468
|
}
|
|
@@ -21070,13 +21171,12 @@ const getDefaultBaselineOffset = (fontSize) => ({
|
|
|
21070
21171
|
spo: fontSize
|
|
21071
21172
|
});
|
|
21072
21173
|
function createDocumentModelWithStyle(content, textStyle, config = {}) {
|
|
21073
|
-
var _paddingData$t, _paddingData$r, _paddingData$b, _paddingData$l;
|
|
21074
21174
|
const contentLength = content.length;
|
|
21075
21175
|
const { textRotation, paddingData, horizontalAlign = 0, verticalAlign = 0, wrapStrategy = 0, cellValueType } = config;
|
|
21076
|
-
const marginTop = (
|
|
21077
|
-
const marginRight = (
|
|
21078
|
-
const marginBottom = (
|
|
21079
|
-
const marginLeft = (
|
|
21176
|
+
const marginTop = (paddingData === null || paddingData === void 0 ? void 0 : paddingData.t) ?? DEFAULT_PADDING_DATA.t;
|
|
21177
|
+
const marginRight = (paddingData === null || paddingData === void 0 ? void 0 : paddingData.r) ?? DEFAULT_PADDING_DATA.r;
|
|
21178
|
+
const marginBottom = (paddingData === null || paddingData === void 0 ? void 0 : paddingData.b) ?? DEFAULT_PADDING_DATA.b;
|
|
21179
|
+
const marginLeft = (paddingData === null || paddingData === void 0 ? void 0 : paddingData.l) ?? DEFAULT_PADDING_DATA.l;
|
|
21080
21180
|
const { vertexAngle, centerAngle } = convertTextRotation(textRotation);
|
|
21081
21181
|
return new DocumentDataModel({
|
|
21082
21182
|
id: "d",
|
|
@@ -21371,8 +21471,7 @@ var ColumnManager = class {
|
|
|
21371
21471
|
const columnData = {};
|
|
21372
21472
|
let index = 0;
|
|
21373
21473
|
for (let i = columnPos; i < columnPos + numColumns; i++) {
|
|
21374
|
-
|
|
21375
|
-
columnData[index] = data !== null && data !== void 0 ? data : {
|
|
21474
|
+
columnData[index] = this.getColumn(i) ?? {
|
|
21376
21475
|
w: this._config.defaultColumnWidth,
|
|
21377
21476
|
hd: 0
|
|
21378
21477
|
};
|
|
@@ -21393,8 +21492,8 @@ var ColumnManager = class {
|
|
|
21393
21492
|
* @returns {number} width of column
|
|
21394
21493
|
*/
|
|
21395
21494
|
getColumnWidth(columnPos) {
|
|
21396
|
-
var _this$_columnData$col2
|
|
21397
|
-
return (_this$_columnData$col2 =
|
|
21495
|
+
var _this$_columnData$col2;
|
|
21496
|
+
return ((_this$_columnData$col2 = this._columnData[columnPos]) === null || _this$_columnData$col2 === void 0 ? void 0 : _this$_columnData$col2.w) ?? this._config.defaultColumnWidth;
|
|
21398
21497
|
}
|
|
21399
21498
|
/**
|
|
21400
21499
|
* Set the width of column
|
|
@@ -21515,8 +21614,7 @@ var RowManager = class {
|
|
|
21515
21614
|
const rowData = {};
|
|
21516
21615
|
let index = 0;
|
|
21517
21616
|
for (let i = rowPos; i < rowPos + numRows; i++) {
|
|
21518
|
-
|
|
21519
|
-
rowData[index] = data !== null && data !== void 0 ? data : {
|
|
21617
|
+
rowData[index] = this.getRow(i) ?? {
|
|
21520
21618
|
h: this._config.defaultRowHeight,
|
|
21521
21619
|
hd: 0
|
|
21522
21620
|
};
|
|
@@ -21957,8 +22055,8 @@ var SheetViewModel = class extends Disposable {
|
|
|
21957
22055
|
return this.getRawCell(row, col);
|
|
21958
22056
|
}
|
|
21959
22057
|
getRowFiltered(row) {
|
|
21960
|
-
var _this$_rowFilteredInt
|
|
21961
|
-
return (_this$_rowFilteredInt =
|
|
22058
|
+
var _this$_rowFilteredInt;
|
|
22059
|
+
return ((_this$_rowFilteredInt = this._rowFilteredInterceptor) === null || _this$_rowFilteredInt === void 0 ? void 0 : _this$_rowFilteredInt.getRowFiltered(row)) ?? false;
|
|
21962
22060
|
}
|
|
21963
22061
|
registerCellContentInterceptor(interceptor) {
|
|
21964
22062
|
if (this._cellContentInterceptor) throw new Error("[SheetViewModel]: Interceptor already registered.");
|
|
@@ -21984,7 +22082,6 @@ const DEFAULT_CELL_DOCUMENT_MODEL_OPTION = {
|
|
|
21984
22082
|
*/
|
|
21985
22083
|
var Worksheet = class {
|
|
21986
22084
|
constructor(unitId, snapshot, _styles) {
|
|
21987
|
-
var _this$_snapshot$id;
|
|
21988
22085
|
this.unitId = unitId;
|
|
21989
22086
|
this._styles = _styles;
|
|
21990
22087
|
_defineProperty(this, "_sheetId", void 0);
|
|
@@ -21998,7 +22095,7 @@ var Worksheet = class {
|
|
|
21998
22095
|
_defineProperty(this, "_getCellHeight", void 0);
|
|
21999
22096
|
this._snapshot = mergeWorksheetSnapshotWithDefault(snapshot);
|
|
22000
22097
|
const { columnData, rowData, cellData } = this._snapshot;
|
|
22001
|
-
this._sheetId =
|
|
22098
|
+
this._sheetId = this._snapshot.id ?? generateRandomId(6);
|
|
22002
22099
|
this._cellData = new ObjectMatrix(cellData);
|
|
22003
22100
|
this._viewModel = new SheetViewModel((row, col) => this.getCellRaw(row, col));
|
|
22004
22101
|
this._rowManager = new RowManager(this._snapshot, this._viewModel, rowData);
|
|
@@ -22115,7 +22212,7 @@ var Worksheet = class {
|
|
|
22115
22212
|
const colStyle = this.getColumnStyle(col);
|
|
22116
22213
|
const cell = this.getCell(row, col);
|
|
22117
22214
|
const cellStyle = this._styles.getStyleByCell(cell);
|
|
22118
|
-
return
|
|
22215
|
+
return rowPriority ?? this._isRowStylePrecedeColumnStyle ? composeStyles(defaultStyle, colStyle, rowStyle, cell === null || cell === void 0 ? void 0 : cell.themeStyle, cellStyle) : composeStyles(defaultStyle, rowStyle, colStyle, cell === null || cell === void 0 ? void 0 : cell.themeStyle, cellStyle);
|
|
22119
22216
|
}
|
|
22120
22217
|
/**
|
|
22121
22218
|
* Get the composed style of the cell. If you want to get the style of the cell without merging row style,
|
|
@@ -22133,7 +22230,7 @@ var Worksheet = class {
|
|
|
22133
22230
|
const rowStyle = this.getRowStyle(row);
|
|
22134
22231
|
const colStyle = this.getColumnStyle(col);
|
|
22135
22232
|
const cellStyle = this._styles.getStyleByCell(cellData);
|
|
22136
|
-
return
|
|
22233
|
+
return rowPriority ?? this._isRowStylePrecedeColumnStyle ? composeStyles(defaultStyle, colStyle, rowStyle, cellData === null || cellData === void 0 ? void 0 : cellData.themeStyle, cellStyle) : composeStyles(defaultStyle, rowStyle, colStyle, cellData === null || cellData === void 0 ? void 0 : cellData.themeStyle, cellStyle);
|
|
22137
22234
|
}
|
|
22138
22235
|
/**
|
|
22139
22236
|
* Get the composed style of the cell without its own style.
|
|
@@ -22841,14 +22938,14 @@ var Worksheet = class {
|
|
|
22841
22938
|
};
|
|
22842
22939
|
}
|
|
22843
22940
|
_updateConfigAndGetDocumentModel(documentData, horizontalAlign, paddingData, renderConfig) {
|
|
22844
|
-
var _documentData$body
|
|
22941
|
+
var _documentData$body;
|
|
22845
22942
|
if (!renderConfig) return;
|
|
22846
22943
|
if (!((_documentData$body = documentData.body) === null || _documentData$body === void 0 ? void 0 : _documentData$body.dataStream)) return;
|
|
22847
22944
|
if (!documentData.documentStyle) documentData.documentStyle = {};
|
|
22848
|
-
documentData.documentStyle.marginTop =
|
|
22849
|
-
documentData.documentStyle.marginBottom =
|
|
22850
|
-
documentData.documentStyle.marginLeft =
|
|
22851
|
-
documentData.documentStyle.marginRight =
|
|
22945
|
+
documentData.documentStyle.marginTop = paddingData.t ?? 0;
|
|
22946
|
+
documentData.documentStyle.marginBottom = paddingData.b ?? 2;
|
|
22947
|
+
documentData.documentStyle.marginLeft = paddingData.l ?? 2;
|
|
22948
|
+
documentData.documentStyle.marginRight = paddingData.r ?? 2;
|
|
22852
22949
|
documentData.documentStyle.pageSize = {
|
|
22853
22950
|
width: Number.POSITIVE_INFINITY,
|
|
22854
22951
|
height: Number.POSITIVE_INFINITY
|
|
@@ -23045,8 +23142,7 @@ let Workbook = class Workbook extends UnitModel {
|
|
|
23045
23142
|
return this._unitId;
|
|
23046
23143
|
}
|
|
23047
23144
|
getRev() {
|
|
23048
|
-
|
|
23049
|
-
return (_this$_snapshot$rev = this._snapshot.rev) !== null && _this$_snapshot$rev !== void 0 ? _this$_snapshot$rev : 1;
|
|
23145
|
+
return this._snapshot.rev ?? 1;
|
|
23050
23146
|
}
|
|
23051
23147
|
incrementRev() {
|
|
23052
23148
|
this._snapshot.rev = this.getRev() + 1;
|
|
@@ -23330,10 +23426,7 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
|
|
|
23330
23426
|
return this._ctorByType.get(type);
|
|
23331
23427
|
}
|
|
23332
23428
|
getCurrentTypeOfUnit$(type) {
|
|
23333
|
-
return this.currentUnits$.pipe(map((units) =>
|
|
23334
|
-
var _units$get;
|
|
23335
|
-
return (_units$get = units.get(type)) !== null && _units$get !== void 0 ? _units$get : null;
|
|
23336
|
-
}), distinctUntilChanged());
|
|
23429
|
+
return this.currentUnits$.pipe(map((units) => units.get(type) ?? null), distinctUntilChanged());
|
|
23337
23430
|
}
|
|
23338
23431
|
getCurrentUnitOfType(type) {
|
|
23339
23432
|
return this._currentUnits.get(type);
|
|
@@ -23356,7 +23449,6 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
|
|
|
23356
23449
|
* @param unit The unit to be added.
|
|
23357
23450
|
*/
|
|
23358
23451
|
__addUnit(unit, options) {
|
|
23359
|
-
var _options$makeCurrent;
|
|
23360
23452
|
this._logService.debug(`[UniverInstanceService]: Adding unit with id ${unit.getUnitId()}`);
|
|
23361
23453
|
const type = unit.type;
|
|
23362
23454
|
if (!this._unitsByType.has(type)) this._unitsByType.set(type, []);
|
|
@@ -23369,7 +23461,7 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
|
|
|
23369
23461
|
unit,
|
|
23370
23462
|
options
|
|
23371
23463
|
});
|
|
23372
|
-
if ((
|
|
23464
|
+
if ((options === null || options === void 0 ? void 0 : options.makeCurrent) ?? true) this.setCurrentUnitForType(unit.getUnitId());
|
|
23373
23465
|
}
|
|
23374
23466
|
getTypeOfUnitDisposed$(type) {
|
|
23375
23467
|
return this.unitDisposed$.pipe(filter((unit) => unit.type === type));
|
|
@@ -23381,12 +23473,10 @@ let UniverInstanceService = class UniverInstanceService extends Disposable {
|
|
|
23381
23473
|
return unit;
|
|
23382
23474
|
}
|
|
23383
23475
|
getUnitCreateOptions(unitId) {
|
|
23384
|
-
|
|
23385
|
-
return (_this$_unitCreateOpti = this._unitCreateOptions.get(unitId)) !== null && _this$_unitCreateOpti !== void 0 ? _this$_unitCreateOpti : null;
|
|
23476
|
+
return this._unitCreateOptions.get(unitId) ?? null;
|
|
23386
23477
|
}
|
|
23387
23478
|
getAllUnitsForType(type) {
|
|
23388
|
-
|
|
23389
|
-
return (_this$_unitsByType$ge = this._unitsByType.get(type)) !== null && _this$_unitsByType$ge !== void 0 ? _this$_unitsByType$ge : [];
|
|
23479
|
+
return this._unitsByType.get(type) ?? [];
|
|
23390
23480
|
}
|
|
23391
23481
|
get focused() {
|
|
23392
23482
|
var _this$_getUnitById2;
|
|
@@ -23695,16 +23785,15 @@ var LocaleService = class extends Disposable {
|
|
|
23695
23785
|
* @param locales - Locale object
|
|
23696
23786
|
*/
|
|
23697
23787
|
load(locales) {
|
|
23698
|
-
|
|
23699
|
-
this._locales = merge((_this$_locales = this._locales) !== null && _this$_locales !== void 0 ? _this$_locales : {}, locales);
|
|
23788
|
+
this._locales = merge(this._locales ?? {}, locales);
|
|
23700
23789
|
}
|
|
23701
23790
|
setLocale(locale) {
|
|
23702
23791
|
this._currentLocale$.next(locale);
|
|
23703
23792
|
this.localeChanged$.next();
|
|
23704
23793
|
}
|
|
23705
23794
|
getLocales() {
|
|
23706
|
-
var _this$
|
|
23707
|
-
return (_this$
|
|
23795
|
+
var _this$_locales;
|
|
23796
|
+
return (_this$_locales = this._locales) === null || _this$_locales === void 0 ? void 0 : _this$_locales[this._currentLocale];
|
|
23708
23797
|
}
|
|
23709
23798
|
getCurrentLocale() {
|
|
23710
23799
|
return this._currentLocale;
|
|
@@ -23751,11 +23840,11 @@ let MentionIOLocalService = class MentionIOLocalService {
|
|
|
23751
23840
|
};
|
|
23752
23841
|
}
|
|
23753
23842
|
};
|
|
23754
|
-
MentionIOLocalService = __decorate([__decorateParam(0, Inject
|
|
23843
|
+
MentionIOLocalService = __decorate([__decorateParam(0, Inject(UserManagerService))], MentionIOLocalService);
|
|
23755
23844
|
|
|
23756
23845
|
//#endregion
|
|
23757
23846
|
//#region src/services/mention-io/type.ts
|
|
23758
|
-
const IMentionIOService = createIdentifier
|
|
23847
|
+
const IMentionIOService = createIdentifier("univer.service.mention-io");
|
|
23759
23848
|
|
|
23760
23849
|
//#endregion
|
|
23761
23850
|
//#region src/services/permission/type.ts
|
|
@@ -24431,12 +24520,12 @@ let LocalUndoRedoService = class LocalUndoRedoService extends Disposable {
|
|
|
24431
24520
|
if (isFocusSheet) if (isFocusFormulaEditor) unitID = DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
24432
24521
|
else if (isFocusEditor) unitID = DOCS_NORMAL_EDITOR_UNIT_ID_KEY;
|
|
24433
24522
|
else {
|
|
24434
|
-
var _this$_univerInstance
|
|
24435
|
-
unitID = (_this$_univerInstance =
|
|
24523
|
+
var _this$_univerInstance;
|
|
24524
|
+
unitID = ((_this$_univerInstance = this._univerInstanceService.getFocusedUnit()) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId()) ?? "";
|
|
24436
24525
|
}
|
|
24437
24526
|
else {
|
|
24438
|
-
var _this$
|
|
24439
|
-
unitID = (
|
|
24527
|
+
var _this$_univerInstance2;
|
|
24528
|
+
unitID = ((_this$_univerInstance2 = this._univerInstanceService.getFocusedUnit()) === null || _this$_univerInstance2 === void 0 ? void 0 : _this$_univerInstance2.getUnitId()) ?? "";
|
|
24440
24529
|
}
|
|
24441
24530
|
return unitID;
|
|
24442
24531
|
}
|
|
@@ -25031,7 +25120,7 @@ let Skeleton = class Skeleton extends Disposable {
|
|
|
25031
25120
|
}
|
|
25032
25121
|
_localeInitial() {}
|
|
25033
25122
|
};
|
|
25034
|
-
Skeleton = __decorate([__decorateParam(0, Inject
|
|
25123
|
+
Skeleton = __decorate([__decorateParam(0, Inject(LocaleService))], Skeleton);
|
|
25035
25124
|
|
|
25036
25125
|
//#endregion
|
|
25037
25126
|
//#region src/sheets/sheet-skeleton.ts
|
|
@@ -25112,9 +25201,8 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25112
25201
|
this.initConfig();
|
|
25113
25202
|
}
|
|
25114
25203
|
initConfig() {
|
|
25115
|
-
|
|
25116
|
-
this.
|
|
25117
|
-
this.worksheet.setIsRowStylePrecedeColumnStyle((_this$_configService$2 = this._configService.getConfig("isRowStylePrecedeColumnStyle")) !== null && _this$_configService$2 !== void 0 ? _this$_configService$2 : false);
|
|
25204
|
+
this._skipAutoHeightForMergedCells = !(this._configService.getConfig(AUTO_HEIGHT_FOR_MERGED_CELLS) ?? false);
|
|
25205
|
+
this.worksheet.setIsRowStylePrecedeColumnStyle(this._configService.getConfig("isRowStylePrecedeColumnStyle") ?? false);
|
|
25118
25206
|
}
|
|
25119
25207
|
resetCache() {}
|
|
25120
25208
|
/**
|
|
@@ -25200,28 +25288,27 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25200
25288
|
this._updateLayout();
|
|
25201
25289
|
}
|
|
25202
25290
|
_fillDefaultGapThemeColors(config) {
|
|
25203
|
-
var _config$defaultBackgr, _config$defaultStripe;
|
|
25204
25291
|
if (config.defaultBackgroundColor && config.defaultStripeColor) return config;
|
|
25205
25292
|
const { r, g, b } = new ColorKit(this._injector.get(ThemeService).getColorFromTheme("primary.500")).toRgb();
|
|
25206
25293
|
return {
|
|
25207
25294
|
...config,
|
|
25208
|
-
defaultBackgroundColor:
|
|
25209
|
-
defaultStripeColor:
|
|
25295
|
+
defaultBackgroundColor: config.defaultBackgroundColor ?? `rgba(${r}, ${g}, ${b}, 0.025)`,
|
|
25296
|
+
defaultStripeColor: config.defaultStripeColor ?? `rgba(${r}, ${g}, ${b}, 0.08)`
|
|
25210
25297
|
};
|
|
25211
25298
|
}
|
|
25212
25299
|
/**
|
|
25213
25300
|
* Get the gap size (in px) BEFORE the given row.
|
|
25214
25301
|
*/
|
|
25215
25302
|
getRowGapSize(row) {
|
|
25216
|
-
var _this$_gapConfig$rowG
|
|
25217
|
-
return (_this$_gapConfig$rowG =
|
|
25303
|
+
var _this$_gapConfig$rowG;
|
|
25304
|
+
return ((_this$_gapConfig$rowG = this._gapConfig.rowGaps) === null || _this$_gapConfig$rowG === void 0 || (_this$_gapConfig$rowG = _this$_gapConfig$rowG[row]) === null || _this$_gapConfig$rowG === void 0 ? void 0 : _this$_gapConfig$rowG.size) ?? 0;
|
|
25218
25305
|
}
|
|
25219
25306
|
/**
|
|
25220
25307
|
* Get the gap size (in px) BEFORE the given column.
|
|
25221
25308
|
*/
|
|
25222
25309
|
getColGapSize(col) {
|
|
25223
|
-
var _this$_gapConfig$colG
|
|
25224
|
-
return (_this$_gapConfig$colG =
|
|
25310
|
+
var _this$_gapConfig$colG;
|
|
25311
|
+
return ((_this$_gapConfig$colG = this._gapConfig.colGaps) === null || _this$_gapConfig$colG === void 0 || (_this$_gapConfig$colG = _this$_gapConfig$colG[col]) === null || _this$_gapConfig$colG === void 0 ? void 0 : _this$_gapConfig$colG.size) ?? 0;
|
|
25225
25312
|
}
|
|
25226
25313
|
/**
|
|
25227
25314
|
* Returns a gap size getter object for use with coordinate utility functions.
|
|
@@ -25241,11 +25328,11 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25241
25328
|
const { rowGaps } = this._gapConfig;
|
|
25242
25329
|
if (!rowGaps) return -1;
|
|
25243
25330
|
for (const rowStr of Object.keys(rowGaps)) {
|
|
25244
|
-
var _rowGaps$row
|
|
25331
|
+
var _rowGaps$row;
|
|
25245
25332
|
const row = Number(rowStr);
|
|
25246
|
-
const gapSize = (
|
|
25333
|
+
const gapSize = ((_rowGaps$row = rowGaps[row]) === null || _rowGaps$row === void 0 ? void 0 : _rowGaps$row.size) ?? 0;
|
|
25247
25334
|
if (gapSize <= 0) continue;
|
|
25248
|
-
const gapStart =
|
|
25335
|
+
const gapStart = this._rowHeightAccumulation[row - 1] ?? 0;
|
|
25249
25336
|
const gapEnd = gapStart + gapSize;
|
|
25250
25337
|
if (y >= gapStart && y < gapEnd) return row;
|
|
25251
25338
|
}
|
|
@@ -25259,11 +25346,11 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25259
25346
|
const { colGaps } = this._gapConfig;
|
|
25260
25347
|
if (!colGaps) return -1;
|
|
25261
25348
|
for (const colStr of Object.keys(colGaps)) {
|
|
25262
|
-
var _colGaps$col
|
|
25349
|
+
var _colGaps$col;
|
|
25263
25350
|
const col = Number(colStr);
|
|
25264
|
-
const gapSize = (
|
|
25351
|
+
const gapSize = ((_colGaps$col = colGaps[col]) === null || _colGaps$col === void 0 ? void 0 : _colGaps$col.size) ?? 0;
|
|
25265
25352
|
if (gapSize <= 0) continue;
|
|
25266
|
-
const gapStart =
|
|
25353
|
+
const gapStart = this._columnWidthAccumulation[col - 1] ?? 0;
|
|
25267
25354
|
const gapEnd = gapStart + gapSize;
|
|
25268
25355
|
if (x >= gapStart && x < gapEnd) return col;
|
|
25269
25356
|
}
|
|
@@ -25274,7 +25361,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25274
25361
|
const rowHeightAccumulation = [];
|
|
25275
25362
|
const data = rowData;
|
|
25276
25363
|
for (let r = 0; r < rowCount; r++) {
|
|
25277
|
-
var _this$_gapConfig$
|
|
25364
|
+
var _this$_gapConfig$rowG2;
|
|
25278
25365
|
let rowHeight = defaultRowHeight;
|
|
25279
25366
|
if (this.worksheet.getRowFiltered(r)) rowHeight = 0;
|
|
25280
25367
|
else if (data[r] != null) {
|
|
@@ -25285,7 +25372,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25285
25372
|
else rowHeight = h;
|
|
25286
25373
|
if (rowDataItem.hd === 1) rowHeight = 0;
|
|
25287
25374
|
}
|
|
25288
|
-
const gapSize = (
|
|
25375
|
+
const gapSize = ((_this$_gapConfig$rowG2 = this._gapConfig.rowGaps) === null || _this$_gapConfig$rowG2 === void 0 || (_this$_gapConfig$rowG2 = _this$_gapConfig$rowG2[r]) === null || _this$_gapConfig$rowG2 === void 0 ? void 0 : _this$_gapConfig$rowG2.size) ?? 0;
|
|
25289
25376
|
rowTotalHeight += gapSize;
|
|
25290
25377
|
rowTotalHeight += rowHeight;
|
|
25291
25378
|
rowHeightAccumulation.push(rowTotalHeight);
|
|
@@ -25303,7 +25390,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25303
25390
|
const columnWidthAccumulation = [];
|
|
25304
25391
|
const data = columnData;
|
|
25305
25392
|
for (let c = 0; c < colCount; c++) {
|
|
25306
|
-
var _this$_gapConfig$
|
|
25393
|
+
var _this$_gapConfig$colG2;
|
|
25307
25394
|
let columnWidth = defaultColumnWidth;
|
|
25308
25395
|
if (data[c] != null) {
|
|
25309
25396
|
const columnDataItem = data[c];
|
|
@@ -25311,7 +25398,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25311
25398
|
if (columnDataItem.w != null) columnWidth = columnDataItem.w;
|
|
25312
25399
|
if (columnDataItem.hd === 1) columnWidth = 0;
|
|
25313
25400
|
}
|
|
25314
|
-
const gapSize = (
|
|
25401
|
+
const gapSize = ((_this$_gapConfig$colG2 = this._gapConfig.colGaps) === null || _this$_gapConfig$colG2 === void 0 || (_this$_gapConfig$colG2 = _this$_gapConfig$colG2[c]) === null || _this$_gapConfig$colG2 === void 0 ? void 0 : _this$_gapConfig$colG2.size) ?? 0;
|
|
25315
25402
|
columnTotalWidth += gapSize;
|
|
25316
25403
|
columnTotalWidth += columnWidth;
|
|
25317
25404
|
columnWidthAccumulation.push(columnTotalWidth);
|
|
@@ -25497,8 +25584,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25497
25584
|
offsetY = getTransformOffsetY(offsetY, scaleY, scrollXY, this.columnHeaderHeightAndMarginTop);
|
|
25498
25585
|
let row = searchArray(rowHeightAccumulation, offsetY, options === null || options === void 0 ? void 0 : options.firstMatch);
|
|
25499
25586
|
if (options === null || options === void 0 ? void 0 : options.closeFirst) {
|
|
25500
|
-
|
|
25501
|
-
if (Math.abs(rowHeightAccumulation[row] - offsetY) < Math.abs(offsetY - ((_rowHeightAccumulatio = rowHeightAccumulation[row - 1]) !== null && _rowHeightAccumulatio !== void 0 ? _rowHeightAccumulatio : 0))) row = row + 1;
|
|
25587
|
+
if (Math.abs(rowHeightAccumulation[row] - offsetY) < Math.abs(offsetY - (rowHeightAccumulation[row - 1] ?? 0))) row = row + 1;
|
|
25502
25588
|
}
|
|
25503
25589
|
return row;
|
|
25504
25590
|
}
|
|
@@ -25510,8 +25596,7 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25510
25596
|
const { columnWidthAccumulation } = this;
|
|
25511
25597
|
let column = searchArray(columnWidthAccumulation, offsetX, options === null || options === void 0 ? void 0 : options.firstMatch);
|
|
25512
25598
|
if (options === null || options === void 0 ? void 0 : options.closeFirst) {
|
|
25513
|
-
|
|
25514
|
-
if (Math.abs(columnWidthAccumulation[column] - offsetX) < Math.abs(offsetX - ((_columnWidthAccumulat = columnWidthAccumulation[column - 1]) !== null && _columnWidthAccumulat !== void 0 ? _columnWidthAccumulat : 0))) column = column + 1;
|
|
25599
|
+
if (Math.abs(columnWidthAccumulation[column] - offsetX) < Math.abs(offsetX - (columnWidthAccumulation[column - 1] ?? 0))) column = column + 1;
|
|
25515
25600
|
}
|
|
25516
25601
|
return column;
|
|
25517
25602
|
}
|
|
@@ -25646,14 +25731,14 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25646
25731
|
};
|
|
25647
25732
|
}
|
|
25648
25733
|
_updateConfigAndGetDocumentModel(documentData, horizontalAlign, paddingData, renderConfig) {
|
|
25649
|
-
var _documentData$body
|
|
25734
|
+
var _documentData$body;
|
|
25650
25735
|
if (!renderConfig) return;
|
|
25651
25736
|
if (!((_documentData$body = documentData.body) === null || _documentData$body === void 0 ? void 0 : _documentData$body.dataStream)) return;
|
|
25652
25737
|
if (!documentData.documentStyle) documentData.documentStyle = {};
|
|
25653
|
-
documentData.documentStyle.marginTop =
|
|
25654
|
-
documentData.documentStyle.marginBottom =
|
|
25655
|
-
documentData.documentStyle.marginLeft =
|
|
25656
|
-
documentData.documentStyle.marginRight =
|
|
25738
|
+
documentData.documentStyle.marginTop = paddingData.t ?? 0;
|
|
25739
|
+
documentData.documentStyle.marginBottom = paddingData.b ?? 2;
|
|
25740
|
+
documentData.documentStyle.marginLeft = paddingData.l ?? 2;
|
|
25741
|
+
documentData.documentStyle.marginRight = paddingData.r ?? 2;
|
|
25657
25742
|
documentData.documentStyle.pageSize = {
|
|
25658
25743
|
width: Number.POSITIVE_INFINITY,
|
|
25659
25744
|
height: Number.POSITIVE_INFINITY
|
|
@@ -25686,10 +25771,10 @@ let SheetSkeleton = class SheetSkeleton extends Skeleton {
|
|
|
25686
25771
|
}
|
|
25687
25772
|
};
|
|
25688
25773
|
SheetSkeleton = __decorate([
|
|
25689
|
-
__decorateParam(2, Inject
|
|
25774
|
+
__decorateParam(2, Inject(LocaleService)),
|
|
25690
25775
|
__decorateParam(3, IContextService),
|
|
25691
25776
|
__decorateParam(4, IConfigService),
|
|
25692
|
-
__decorateParam(5, Inject
|
|
25777
|
+
__decorateParam(5, Inject(Injector))
|
|
25693
25778
|
], SheetSkeleton);
|
|
25694
25779
|
/**
|
|
25695
25780
|
* Not same as getCellWithCoordByIndex, Only the coordinates of the corresponding cells in rows and columns are considered, without taking into account the merged data.
|
|
@@ -25728,10 +25813,9 @@ function getCellCoordByIndexSimple(row, column, rowHeightAccumulation, columnWid
|
|
|
25728
25813
|
* @returns {ICellWithCoord} The cell position information of the specified row and column, including the position information of the cell and the merge information of the cell
|
|
25729
25814
|
*/
|
|
25730
25815
|
function getCellWithCoordByIndexCore(row, column, rowHeightAccumulation, columnWidthAccumulation, mergeDataInfo, gapSizeGetter) {
|
|
25731
|
-
var _gapSizeGetter$row, _gapSizeGetter$col;
|
|
25732
25816
|
row = Tools.clamp(row, 0, rowHeightAccumulation.length - 1);
|
|
25733
25817
|
column = Tools.clamp(column, 0, columnWidthAccumulation.length - 1);
|
|
25734
|
-
let { startY, endY, startX, endX } = getCellCoordByIndexSimple(row, column, rowHeightAccumulation, columnWidthAccumulation, (
|
|
25818
|
+
let { startY, endY, startX, endX } = getCellCoordByIndexSimple(row, column, rowHeightAccumulation, columnWidthAccumulation, (gapSizeGetter === null || gapSizeGetter === void 0 ? void 0 : gapSizeGetter.row(row)) ?? 0, (gapSizeGetter === null || gapSizeGetter === void 0 ? void 0 : gapSizeGetter.col(column)) ?? 0);
|
|
25735
25819
|
if (!mergeDataInfo) return {
|
|
25736
25820
|
startY,
|
|
25737
25821
|
endY,
|
|
@@ -25766,9 +25850,8 @@ function getCellWithCoordByIndexCore(row, column, rowHeightAccumulation, columnW
|
|
|
25766
25850
|
const rowAccumulationCount = rowHeightAccumulation.length - 1;
|
|
25767
25851
|
const columnAccumulationCount = columnWidthAccumulation.length - 1;
|
|
25768
25852
|
if (isMerged && startRow !== -1 && startColumn !== -1) {
|
|
25769
|
-
|
|
25770
|
-
const
|
|
25771
|
-
const mergeColGapSize = (_gapSizeGetter$col2 = gapSizeGetter === null || gapSizeGetter === void 0 ? void 0 : gapSizeGetter.col(startColumn)) !== null && _gapSizeGetter$col2 !== void 0 ? _gapSizeGetter$col2 : 0;
|
|
25853
|
+
const mergeRowGapSize = (gapSizeGetter === null || gapSizeGetter === void 0 ? void 0 : gapSizeGetter.row(startRow)) ?? 0;
|
|
25854
|
+
const mergeColGapSize = (gapSizeGetter === null || gapSizeGetter === void 0 ? void 0 : gapSizeGetter.col(startColumn)) ?? 0;
|
|
25772
25855
|
const mergeStartY = (rowHeightAccumulation[startRow - 1] || 0) + mergeRowGapSize;
|
|
25773
25856
|
const mergeEndY = rowHeightAccumulation[endRow] || rowHeightAccumulation[rowAccumulationCount];
|
|
25774
25857
|
const mergeStartX = (columnWidthAccumulation[startColumn - 1] || 0) + mergeColGapSize;
|
|
@@ -26223,13 +26306,12 @@ var Univer = class {
|
|
|
26223
26306
|
this._univerInstanceService.registerCtorForType(UniverInstanceType.UNIVER_SLIDE, SlideDataModel);
|
|
26224
26307
|
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
26225
26308
|
univerInstanceService.__setCreateHandler((type, data, ctor, options) => {
|
|
26226
|
-
var _univerInstanceServic;
|
|
26227
26309
|
const isFirstTime = !this._startedTypes.has(type);
|
|
26228
26310
|
if (isFirstTime) {
|
|
26229
26311
|
this._pluginService.startPluginsForType(type);
|
|
26230
26312
|
this._startedTypes.add(type);
|
|
26231
26313
|
}
|
|
26232
|
-
const actualCtor =
|
|
26314
|
+
const actualCtor = univerInstanceService.__getCtorByType(type) ?? ctor;
|
|
26233
26315
|
if (!actualCtor) throw new Error(`[Univer]: No constructor registered for unit type ${type}.`);
|
|
26234
26316
|
const model = injector.createInstance(actualCtor, data);
|
|
26235
26317
|
univerInstanceService.__addUnit(model, options);
|
|
@@ -26316,4 +26398,4 @@ function createUniverInjector(parentInjector, override) {
|
|
|
26316
26398
|
installShims();
|
|
26317
26399
|
|
|
26318
26400
|
//#endregion
|
|
26319
|
-
export { ABCToNumber, AUTO_HEIGHT_FOR_MERGED_CELLS, AbsoluteRefType, ActionIterator, AlignTypeH, AlignTypeV, ArrangeTypeEnum, AsyncInterceptorManager, AsyncLock, AuthzIoLocalService, AutoFillSeries, BORDER_KEYS, BORDER_STYLE_KEYS, BaseDataModel, BaseFieldType, BaseFilterConjunction, BaseFilterOperator, 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, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, EDITOR_ACTIVATED, 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, ObjectMatrix, 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, TableAlignmentType, TableLayoutType, TableRowHeightRule, TableSizeType, TableTextWrapType, TestConfirmService, TextDecoration, TextDecorationBuilder, TextDirection, TextDirectionType, TextStyleBuilder, TextStyleValue, TextX, TextXActionType, ThemeColorType, ThemeColors, ThemeService, Tools, UndoCommand, UndoCommandId, UnitModel, Univer, UniverInstanceService, UniverInstanceType, UpdateDocsAttributeType, UserManagerService, VerticalAlign, VerticalAlignmentType, WithNew, Workbook, Worksheet, WrapStrategy, WrapTextType, addLinkToDocumentModel, afterInitApply, afterTime, awaitTime, binSearchFirstGreaterThanTarget, binarySearchArray, bufferDebounceTime, cellToRange, characterSpacingControlType, checkForSubstrings, checkIfMove, checkParagraphHasBullet, checkParagraphHasIndent, checkParagraphHasIndentByStyle, cloneBodyWithFreshParagraphIds, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneParagraphWithId, cloneSectionBreakWithId, cloneValue, cloneWorksheetData, codeToBlob, columnLabelToNumber, composeBody, composeInterceptors, composeStyles, concatMatrixArray, containsInteriorInsertionOffset, containsStreamIndex, convertCellToRange, convertObservableToBehaviorSubject, covertCellValue, covertCellValues, createAsyncInterceptorKey, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCustomBlockIdsInSelections, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, 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, 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, isValidRange, isValueDependencyItem, isWhiteColor, makeArray, makeCellRangeToRangeData, mapObjectMatrix, merge, mergeIntervals, mergeLocales, mergeOverrideWithDependencies, mergeSets, mergeWith, mergeWorksheetSnapshotWithDefault, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBody, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, numberToABC, numberToListABC, api_exports as numfmt, queryObjectMatrix, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };
|
|
26401
|
+
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, DeleteDirection, DependentOn, DesktopLogService, DeveloperMetadataVisibility, Dimension, Direction, Disposable, DisposableCollection, DocStyleType, DocumentBlockRangeType, DocumentBlockType, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, EDITOR_ACTIVATED, 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, ObjectMatrix, 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, 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, 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, createBaseRecordIdField, createDefaultBaseTableSnapshot, createDefaultUser, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createRandomId, createRowColIter, createSectionId, createSheetGapTestConfig, currencySymbols, customNameCharacterCheck, dateKit, debounce, dedupe, dedupeBy, deepCompare, delayAnimationFrame, deleteContent, extractPureTextFromCell, forwardRef, fromCallback, fromEventSubject, generateIntervalsByPoints, generateRandomId, get, getArrayLength, getEmptySnapshot as getBasesEmptySnapshot, getBlockRangeInterval, getBodySlice, getBodySliceForSplitTextXAction, getBodySliceForTextXAction, getBorderStyleType, getCellCoordByIndexSimple, getCellValueType, getCellWithCoordByIndexCore, getColorStyle, getColumnGroupRangeInterval, getCustomBlockIdsInSelections, getCustomBlockInterval, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeInterval, getCustomRangeSlice, getDisplayValueFromCell, getEmptySnapshot$1 as getDocsEmptySnapshot, getDocsUpdateBody, getEmptyCell, getExclusiveRangeInterval, getInclusiveRangeInterval, getIntersectRange, 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, mixinClass, moveMatrixArray, moveRangeByOffset, nameCharacterCheck, noop, normalizeBody, normalizeInsertedSectionIdsForDocument, normalizeTextRuns, normalizeUrl, numberToABC, numberToListABC, api_exports as numfmt, queryObjectMatrix, regexp, registerDependencies, remove, repeatStringNumTimes, replaceInDocumentBody, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, resolveWithBasePath, rotate, searchArray, searchInOrderedArray, selectionToArray, sequence, sequenceAsync, sequenceExecute, sequenceExecuteAsync, set, setDependencies, shallowEqual, shiftExclusiveRangeOnDelete, shiftExclusiveRangeOnInsert, shiftInclusiveRangeOnDelete, shiftInclusiveRangeOnInsert, skipParseTagNames, sliceMatrixArray, sortRules, sortRulesByDesc, sortRulesFactory, spliceArray, splitIntoGrid, takeAfter, throttle, toDisposable, touchDependencies, updateAttributeByDelete, updateAttributeByInsert, validateDocBodyStructure, validateDocumentStructure, willLoseNumericPrecision };
|