@univerjs/core 0.4.0-alpha.1 → 0.4.0-experimental.20241017-da434a2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +4 -4
- package/lib/es/index.js +301 -80
- package/lib/types/docs/data-model/text-x/apply-utils/update-apply.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +8 -0
- package/lib/types/docs/data-model/text-x/build-utils/paragraph.d.ts +31 -0
- package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +1 -1
- package/lib/types/index.d.ts +2 -2
- package/lib/types/shared/rxjs.d.ts +2 -1
- package/lib/umd/index.js +4 -4
- package/package.json +3 -3
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -2,8 +2,8 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { BehaviorSubject, Subject, Observable, filter, merge as merge$1, timer,
|
|
6
|
-
import { filter as filter$1, debounceTime, first, map as map$1 } from "rxjs/operators";
|
|
5
|
+
import { BehaviorSubject, Subject, Observable, filter, tap, debounceTime, map, merge as merge$1, timer, distinctUntilChanged, skip, of, combineLatest } from "rxjs";
|
|
6
|
+
import { filter as filter$1, debounceTime as debounceTime$1, first, map as map$1 } from "rxjs/operators";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import React__default, { useState, useEffect, useRef, useMemo, createContext, useCallback, useContext } from "react";
|
|
9
9
|
function _mergeNamespaces(n, m) {
|
|
@@ -2649,11 +2649,23 @@ function takeAfter(callback) {
|
|
|
2649
2649
|
}, "complateAfter");
|
|
2650
2650
|
}
|
|
2651
2651
|
__name(takeAfter, "takeAfter");
|
|
2652
|
+
function bufferDebounceTime(time = 0) {
|
|
2653
|
+
return (source) => {
|
|
2654
|
+
let bufferedValues = [];
|
|
2655
|
+
return source.pipe(
|
|
2656
|
+
tap((value) => bufferedValues.push(value)),
|
|
2657
|
+
debounceTime(time),
|
|
2658
|
+
map(() => bufferedValues),
|
|
2659
|
+
tap(() => bufferedValues = [])
|
|
2660
|
+
);
|
|
2661
|
+
};
|
|
2662
|
+
}
|
|
2663
|
+
__name(bufferDebounceTime, "bufferDebounceTime");
|
|
2652
2664
|
const afterInitApply = /* @__PURE__ */ __name((commandService) => new Promise((res) => {
|
|
2653
2665
|
merge$1(
|
|
2654
2666
|
fromCallback(commandService.onCommandExecuted.bind(commandService)).pipe(filter$1(([info]) => info.type === CommandType.MUTATION)),
|
|
2655
2667
|
timer(300)
|
|
2656
|
-
).pipe(debounceTime(16), first()).subscribe(() => {
|
|
2668
|
+
).pipe(debounceTime$1(16), first()).subscribe(() => {
|
|
2657
2669
|
res();
|
|
2658
2670
|
});
|
|
2659
2671
|
}), "afterInitApply");
|
|
@@ -5048,7 +5060,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5048
5060
|
return { pattern: e2, partitions: t2, locale: n2 };
|
|
5049
5061
|
}
|
|
5050
5062
|
__name(D, "D");
|
|
5051
|
-
const
|
|
5063
|
+
const S2 = Math.floor;
|
|
5052
5064
|
function C(e2) {
|
|
5053
5065
|
if ((!(arguments.length > 1 && arguments[1] !== void 0) || arguments[1]) && e2 >= 0) {
|
|
5054
5066
|
if (e2 === 0) return [1900, 1, 0];
|
|
@@ -5056,12 +5068,12 @@ var numfmt$2 = { exports: {} };
|
|
|
5056
5068
|
if (e2 < 60) return [1900, e2 < 32 ? 1 : 2, (e2 - 1) % 31 + 1];
|
|
5057
5069
|
}
|
|
5058
5070
|
let n2 = e2 + 68569 + 2415019;
|
|
5059
|
-
const a2 =
|
|
5060
|
-
n2 -=
|
|
5061
|
-
const r2 =
|
|
5062
|
-
n2 = n2 -
|
|
5063
|
-
const i2 =
|
|
5064
|
-
n2 =
|
|
5071
|
+
const a2 = S2(4 * n2 / 146097);
|
|
5072
|
+
n2 -= S2((146097 * a2 + 3) / 4);
|
|
5073
|
+
const r2 = S2(4e3 * (n2 + 1) / 1461001);
|
|
5074
|
+
n2 = n2 - S2(1461 * r2 / 4) + 31;
|
|
5075
|
+
const i2 = S2(80 * n2 / 2447), s2 = n2 - S2(2447 * i2 / 80);
|
|
5076
|
+
n2 = S2(i2 / 11);
|
|
5065
5077
|
const o2 = i2 + 2 - 12 * n2;
|
|
5066
5078
|
return [0 | 100 * (a2 - 49) + r2 + n2, 0 | o2, 0 | s2];
|
|
5067
5079
|
}
|
|
@@ -5076,21 +5088,21 @@ var numfmt$2 = { exports: {} };
|
|
|
5076
5088
|
if (e2 < 60) return [1317, e2 < 32 ? 9 : 10, 1 + (e2 - 2) % 30];
|
|
5077
5089
|
const t2 = 10631 / 30, n2 = 0.1335;
|
|
5078
5090
|
let a2 = e2 + 466935;
|
|
5079
|
-
const r2 =
|
|
5091
|
+
const r2 = S2(a2 / 10631);
|
|
5080
5092
|
a2 -= 10631 * r2;
|
|
5081
|
-
const i2 =
|
|
5082
|
-
a2 -=
|
|
5083
|
-
const s2 =
|
|
5084
|
-
return s2 === 13 ? [30 * r2 + i2, 12, 30] : [30 * r2 + i2, s2, a2 -
|
|
5093
|
+
const i2 = S2((a2 - n2) / t2);
|
|
5094
|
+
a2 -= S2(i2 * t2 + n2);
|
|
5095
|
+
const s2 = S2((a2 + 28.5001) / 29.5);
|
|
5096
|
+
return s2 === 13 ? [30 * r2 + i2, 12, 30] : [30 * r2 + i2, s2, a2 - S2(29.5001 * s2 - 29)];
|
|
5085
5097
|
}
|
|
5086
5098
|
__name(A, "A");
|
|
5087
5099
|
function Y(e2) {
|
|
5088
5100
|
let t2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n2 = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2];
|
|
5089
|
-
const a2 =
|
|
5101
|
+
const a2 = S2(e2);
|
|
5090
5102
|
return t2 === 6 ? A(a2) : t2 === -1 ? E(a2) : C(a2, n2);
|
|
5091
5103
|
}
|
|
5092
5104
|
__name(Y, "Y");
|
|
5093
|
-
const
|
|
5105
|
+
const T2 = Math.floor, N = 86400;
|
|
5094
5106
|
function P(e2, t2) {
|
|
5095
5107
|
let n2 = null;
|
|
5096
5108
|
if (Array.isArray(e2)) {
|
|
@@ -5107,19 +5119,19 @@ var numfmt$2 = { exports: {} };
|
|
|
5107
5119
|
return e2;
|
|
5108
5120
|
}
|
|
5109
5121
|
__name(P, "P");
|
|
5110
|
-
function
|
|
5122
|
+
function I(e2, t2) {
|
|
5111
5123
|
let n2 = 0 | e2;
|
|
5112
5124
|
const a2 = N * (e2 - n2);
|
|
5113
|
-
let r2 =
|
|
5125
|
+
let r2 = T2(a2);
|
|
5114
5126
|
a2 - r2 > 0.9999 && (r2 += 1, r2 === N && (r2 = 0, n2 += 1));
|
|
5115
|
-
const i2 = r2 < 0 ? N + r2 : r2, [s2, o2, l2] = Y(e2, 0, t2 && t2.leap1900), d2 =
|
|
5127
|
+
const i2 = r2 < 0 ? N + r2 : r2, [s2, o2, l2] = Y(e2, 0, t2 && t2.leap1900), d2 = T2(i2 / 60 / 60) % 60, m2 = T2(i2 / 60) % 60, u2 = T2(i2) % 60;
|
|
5116
5128
|
if (t2 && t2.nativeDate) {
|
|
5117
5129
|
const e3 = /* @__PURE__ */ new Date(0);
|
|
5118
5130
|
return e3.setUTCFullYear(s2, o2 - 1, l2), e3.setUTCHours(d2, m2, u2), e3;
|
|
5119
5131
|
}
|
|
5120
5132
|
return [s2, o2, l2, d2, m2, u2];
|
|
5121
5133
|
}
|
|
5122
|
-
__name(
|
|
5134
|
+
__name(I, "I");
|
|
5123
5135
|
function O(e2) {
|
|
5124
5136
|
return !!(e2[0] && e2[0].percent || e2[1] && e2[1].percent || e2[2] && e2[2].percent || e2[3] && e2[3].percent);
|
|
5125
5137
|
}
|
|
@@ -5133,7 +5145,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5133
5145
|
return !(t2 && !t2.generated || n2 && !n2.generated || a2 && !a2.generated || !r2 || !r2.text || r2.generated);
|
|
5134
5146
|
}
|
|
5135
5147
|
__name(L, "L");
|
|
5136
|
-
const U = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 },
|
|
5148
|
+
const U = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 }, R2 = [["DMY", 1], ["DM", 2], ["MY", 3], ["MDY", 4], ["MD", 5], ["hmsa", 6], ["hma", 7], ["hms", 8], ["hm", 9]], G = { total: 1, sign: 0, period: 0, int: 1, frac: 0 }, H = /* @__PURE__ */ __name((e2, t2) => e2.replace(/\./, t2.decimal), "H");
|
|
5137
5149
|
function B(e2, t2, n2, a2) {
|
|
5138
5150
|
const r2 = 0 | n2;
|
|
5139
5151
|
if (typeof n2 == "string") e2.push(n2);
|
|
@@ -5145,7 +5157,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5145
5157
|
const s2 = function(e3) {
|
|
5146
5158
|
let t4 = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
|
|
5147
5159
|
const n3 = Math.abs(e3);
|
|
5148
|
-
if (!n3) return
|
|
5160
|
+
if (!n3) return G;
|
|
5149
5161
|
const a3 = t4 && e3 < 0 ? 1 : 0, r4 = Math.floor(n3), i3 = Math.floor(Math.log10(n3) + 1);
|
|
5150
5162
|
let s3 = 0, o3 = 0;
|
|
5151
5163
|
if (r4 !== n3) {
|
|
@@ -5165,19 +5177,19 @@ var numfmt$2 = { exports: {} };
|
|
|
5165
5177
|
}(t3), o2 = /* @__PURE__ */ __name(() => {
|
|
5166
5178
|
const t4 = Math.abs(r3);
|
|
5167
5179
|
let n3;
|
|
5168
|
-
n3 = i2 === 1 ? i2 : c(i2, 5), e2.push(
|
|
5180
|
+
n3 = i2 === 1 ? i2 : c(i2, 5), e2.push(H(n3 + "", a2), a2.exponent, r3 < 0 ? a2.negative : a2.positive, t4 < 10 ? "0" : "", t4);
|
|
5169
5181
|
}, "o");
|
|
5170
5182
|
if (r3 >= -4 && r3 <= -1) {
|
|
5171
5183
|
const n3 = t3.toPrecision(10 + r3).replace(/\.?0+$/, "");
|
|
5172
|
-
e2.push(
|
|
5184
|
+
e2.push(H(n3, a2));
|
|
5173
5185
|
} else if (r3 === 10) {
|
|
5174
5186
|
const n3 = t3.toFixed(10).slice(0, 12).replace(/\.$/, "");
|
|
5175
|
-
e2.push(
|
|
5187
|
+
e2.push(H(n3, a2));
|
|
5176
5188
|
} else if (Math.abs(r3) <= 9) if (s2.total <= 11) {
|
|
5177
5189
|
const n3 = c(t3, 9).toFixed(s2.frac);
|
|
5178
|
-
e2.push(
|
|
5190
|
+
e2.push(H(n3, a2));
|
|
5179
5191
|
} else r3 === 9 ? e2.push(Math.floor(t3)) : r3 >= 0 && r3 < 9 ? e2.push(c(t3, 9 - r3)) : o2();
|
|
5180
|
-
else s2.total >= 12 ? o2() : Math.floor(t3) === t3 ? e2.push(Math.floor(t3)) : e2.push(
|
|
5192
|
+
else s2.total >= 12 ? o2() : Math.floor(t3) === t3 ? e2.push(Math.floor(t3)) : e2.push(H(c(t3, 9).toFixed(s2.frac), a2));
|
|
5181
5193
|
}
|
|
5182
5194
|
return e2;
|
|
5183
5195
|
}
|
|
@@ -5247,7 +5259,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5247
5259
|
r2 = t2.man_padding.length === 1 ? (d2 < 0 ? "-" : e3) + (r2 || t2.man_padding) : (d2 < 0 ? "-" : e3) + t2.man_padding.slice(0, t2.man_padding.length - r2.length) + r2;
|
|
5248
5260
|
}
|
|
5249
5261
|
const D2 = [];
|
|
5250
|
-
let
|
|
5262
|
+
let S3 = 0;
|
|
5251
5263
|
const C2 = { int: 0, frac: 0, man: 0, num: 0, den: 0 };
|
|
5252
5264
|
for (let d3 = 0, u2 = t2.tokens.length; d3 < u2; d3++) {
|
|
5253
5265
|
const u3 = t2.tokens[d3], c2 = u3.num ? u3.num.length : 0;
|
|
@@ -5262,8 +5274,8 @@ var numfmt$2 = { exports: {} };
|
|
|
5262
5274
|
else if (u3.type === "div") F2 ? D2.push("/") : t2.num_min > 0 || t2.den_min > 0 ? D2.push(y["?"]) : D2.push(y["#"]);
|
|
5263
5275
|
else if (u3.type === "int") if (t2.int_pattern.length === 1) D2.push(l2);
|
|
5264
5276
|
else {
|
|
5265
|
-
const e3 =
|
|
5266
|
-
D2.push(l2.substring(l2.length - e3, l2.length - n3)),
|
|
5277
|
+
const e3 = S3 ? t2.int_pattern.join("").length - C2.int : 1 / 0, n3 = S3 === t2.int_pattern.length - 1 ? 0 : t2.int_pattern.join("").length - (C2.int + u3.num.length);
|
|
5278
|
+
D2.push(l2.substring(l2.length - e3, l2.length - n3)), S3++, C2.int += u3.num.length;
|
|
5267
5279
|
}
|
|
5268
5280
|
else if (u3.type === "frac") {
|
|
5269
5281
|
const e3 = C2.frac;
|
|
@@ -5462,7 +5474,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5462
5474
|
const i2 = Date.UTC(e3, n2.month - 1, n2.day) / 864e5 + r2 + (n2.time || 0);
|
|
5463
5475
|
if (i2 >= 0 && i2 <= 2958465) {
|
|
5464
5476
|
const e4 = n2._mon[0] === "0" || n2.day[0] === "0" || n2._mon.length === 2 && n2.day.length === 2, a3 = n2.path.replace(/[jdlDnmMFyYx-]/g, (t3) => t3 === "j" || t3 === "d" ? e4 ? "dd" : "d" : t3 === "D" ? "ddd" : t3 === "l" ? "dddd" : t3 === "n" || t3 === "m" ? e4 ? "mm" : "m" : t3 === "M" ? "mmm" : t3 === "F" ? "mmmm" : t3 === "y" ? "yy" : t3 === "x" ? n2.tf || "" : t3 === "Y" ? "yyyy" : t3);
|
|
5465
|
-
return t2 && t2.nativeDate ? { v:
|
|
5477
|
+
return t2 && t2.nativeDate ? { v: I(i2, t2), z: a3 } : { v: i2, z: a3 };
|
|
5466
5478
|
}
|
|
5467
5479
|
}
|
|
5468
5480
|
return null;
|
|
@@ -5524,7 +5536,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5524
5536
|
const r5 = a4.type;
|
|
5525
5537
|
/^(b-)?year/.test(r5) ? (n4 += "Y", t4++) : r5.startsWith("month") ? (n4 += "M", t4++) : /^(week)?day/.test(r5) ? (n4 += "D", t4++) : r5 !== "hour" && r5 !== "min" && r5 !== "sec" && r5 !== "am" || (n4 += r5[0], e4++);
|
|
5526
5538
|
}), s3.type = "date", t4 && e4 ? s3.type = "datetime" : !t4 && e4 && (s3.type = "time");
|
|
5527
|
-
const r4 =
|
|
5539
|
+
const r4 = R2.find((e5) => n4.startsWith(e5[0]));
|
|
5528
5540
|
l2 = r4 ? "D" : "G", d2 = r4 ? r4[1] : "";
|
|
5529
5541
|
} else s3.isText ? (l2 = "G", s3.type = "text", d2 = "", s3.maxDecimals = 0) : a3.general ? (l2 = "G", s3.type = "general", d2 = "") : a3.fractions ? (l2 = "G", s3.type = "fraction", d2 = "") : a3.exponential ? (l2 = "S", s3.type = "scientific") : s3.isPercent ? (l2 = "P", s3.type = "percent") : a3.grouping ? (l2 = ",", s3.type = "grouped") : (a3.int_max || i3) && (l2 = "F", s3.type = "number");
|
|
5530
5542
|
return s3.code = l2 + d2 + u2 + m2, s3.level = U[s3.type], Object.freeze(s3);
|
|
@@ -5547,7 +5559,7 @@ var numfmt$2 = { exports: {} };
|
|
|
5547
5559
|
}
|
|
5548
5560
|
}(e2), n2.error || (me[e2] = n2)), ue(n2, t2);
|
|
5549
5561
|
}
|
|
5550
|
-
__name(ce, "ce"), ce.isDate = (e2) => ce(e2, { throws: !1 }).isDate(), ce.isPercent = (e2) => ce(e2, { throws: !1 }).isPercent(), ce.isText = (e2) => ce(e2, { throws: !1 }).isText(), ce.getInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).info, ce.getDateInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).dateInfo, ce.dateToSerial = P, ce.dateFromSerial =
|
|
5562
|
+
__name(ce, "ce"), ce.isDate = (e2) => ce(e2, { throws: !1 }).isDate(), ce.isPercent = (e2) => ce(e2, { throws: !1 }).isPercent(), ce.isText = (e2) => ce(e2, { throws: !1 }).isText(), ce.getInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).info, ce.getDateInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).dateInfo, ce.dateToSerial = P, ce.dateFromSerial = I, ce.options = h, ce.dec2frac = p, ce.round = c, ce.codeToLocale = n, ce.parseLocale = s, ce.getLocale = l, ce.addLocale = (e2, t2) => {
|
|
5551
5563
|
const n2 = s(t2);
|
|
5552
5564
|
return delete me[n2.lang], delete me[n2.language], m(e2, n2);
|
|
5553
5565
|
}, ce.format = function(e2, t2, n2) {
|
|
@@ -7125,7 +7137,7 @@ function sortRulesFactory(key = "index", ruler = 1) {
|
|
|
7125
7137
|
return (oa, ob) => oa[key] > ob[key] ? ruler : oa[key] === ob[key] ? 0 : -ruler;
|
|
7126
7138
|
}
|
|
7127
7139
|
__name(sortRulesFactory, "sortRulesFactory");
|
|
7128
|
-
var
|
|
7140
|
+
var R = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(R || {}), S = /* @__PURE__ */ ((E) => (E[E.Reader = 0] = "Reader", E[E.Editor = 1] = "Editor", E[E.Owner = 2] = "Owner", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(S || {}), T = /* @__PURE__ */ ((E) => (E[E.SomeCollaborator = 0] = "SomeCollaborator", E[E.AllCollaborator = 1] = "AllCollaborator", E[E.OneSelf = 2] = "OneSelf", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(T || {});
|
|
7129
7141
|
const _UnitModel = class _UnitModel extends Disposable {
|
|
7130
7142
|
};
|
|
7131
7143
|
__name(_UnitModel, "UnitModel");
|
|
@@ -9424,7 +9436,7 @@ function updateSectionBreaks(body, updateBody, textLength, currentIndex, coverTy
|
|
|
9424
9436
|
}
|
|
9425
9437
|
updateBody.sectionBreaks = newUpdateSectionBreaks;
|
|
9426
9438
|
}
|
|
9427
|
-
return
|
|
9439
|
+
return insertSectionBreaks(body, updateBody, textLength, currentIndex), removeSectionBreaks;
|
|
9428
9440
|
}
|
|
9429
9441
|
__name(updateSectionBreaks, "updateSectionBreaks");
|
|
9430
9442
|
function updateCustomBlocks(body, updateBody, textLength, currentIndex, coverType) {
|
|
@@ -9544,7 +9556,7 @@ function getBodySlice(body, startOffset, endOffset, returnEmptyTextRun = !1, typ
|
|
|
9544
9556
|
const newParagraphs = [];
|
|
9545
9557
|
for (const paragraph of paragraphs) {
|
|
9546
9558
|
const { startIndex } = paragraph;
|
|
9547
|
-
startIndex >= startOffset && startIndex
|
|
9559
|
+
startIndex >= startOffset && startIndex < endOffset && newParagraphs.push(Tools.deepClone(paragraph));
|
|
9548
9560
|
}
|
|
9549
9561
|
newParagraphs.length && (docBody.paragraphs = newParagraphs.map((p) => ({
|
|
9550
9562
|
...p,
|
|
@@ -10184,7 +10196,7 @@ const DEFAULT_DOC = {
|
|
|
10184
10196
|
constructor(snapshot) {
|
|
10185
10197
|
var _a11;
|
|
10186
10198
|
super();
|
|
10187
|
-
__publicField(this, "type",
|
|
10199
|
+
__publicField(this, "type", R.UNIVER_DOC);
|
|
10188
10200
|
__publicField(this, "_name$", new BehaviorSubject(""));
|
|
10189
10201
|
__publicField(this, "name$", this._name$.asObservable());
|
|
10190
10202
|
__publicField(this, "snapshot");
|
|
@@ -10409,6 +10421,184 @@ function excludePointsFromRange(range, points) {
|
|
|
10409
10421
|
return start <= range[1] && newRanges.push([start, range[1]]), newRanges;
|
|
10410
10422
|
}
|
|
10411
10423
|
__name(excludePointsFromRange, "excludePointsFromRange");
|
|
10424
|
+
const switchParagraphBullet = /* @__PURE__ */ __name((params) => {
|
|
10425
|
+
var _a11, _b2, _c;
|
|
10426
|
+
const { paragraphs: currentParagraphs, segmentId, document: docDataModel } = params;
|
|
10427
|
+
let listType = params.listType;
|
|
10428
|
+
const paragraphs = (_b2 = (_a11 = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) == null ? void 0 : _a11.paragraphs) != null ? _b2 : [], isAlreadyList = currentParagraphs.every((paragraph) => {
|
|
10429
|
+
var _a12;
|
|
10430
|
+
return ((_a12 = paragraph.bullet) == null ? void 0 : _a12.listType.indexOf(listType)) === 0;
|
|
10431
|
+
});
|
|
10432
|
+
let listId = Tools.generateRandomId(6);
|
|
10433
|
+
if (currentParagraphs.length === 1) {
|
|
10434
|
+
const curIndex = paragraphs.indexOf(currentParagraphs[0]), prevParagraph = paragraphs[curIndex - 1], nextParagraph = paragraphs[curIndex + 1];
|
|
10435
|
+
prevParagraph && prevParagraph.bullet && prevParagraph.bullet.listType.indexOf(listType) === 0 ? (listId = prevParagraph.bullet.listId, listType !== PresetListType.CHECK_LIST && (listType = prevParagraph.bullet.listType)) : nextParagraph && nextParagraph.bullet && nextParagraph.bullet.listType.indexOf(listType) === 0 && (listId = nextParagraph.bullet.listId, listType !== PresetListType.CHECK_LIST && (listType = nextParagraph.bullet.listType));
|
|
10436
|
+
}
|
|
10437
|
+
const memoryCursor = new MemoryCursor();
|
|
10438
|
+
memoryCursor.reset();
|
|
10439
|
+
const textX = new TextX();
|
|
10440
|
+
for (const paragraph of currentParagraphs) {
|
|
10441
|
+
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
10442
|
+
textX.push({
|
|
10443
|
+
t: TextXActionType.RETAIN,
|
|
10444
|
+
len: startIndex - memoryCursor.cursor,
|
|
10445
|
+
segmentId
|
|
10446
|
+
}), textX.push({
|
|
10447
|
+
t: TextXActionType.RETAIN,
|
|
10448
|
+
len: 1,
|
|
10449
|
+
body: {
|
|
10450
|
+
dataStream: "",
|
|
10451
|
+
paragraphs: [
|
|
10452
|
+
isAlreadyList ? {
|
|
10453
|
+
paragraphStyle,
|
|
10454
|
+
startIndex: 0
|
|
10455
|
+
} : {
|
|
10456
|
+
startIndex: 0,
|
|
10457
|
+
paragraphStyle: {
|
|
10458
|
+
...paragraphStyle
|
|
10459
|
+
},
|
|
10460
|
+
bullet: {
|
|
10461
|
+
nestingLevel: (_c = bullet == null ? void 0 : bullet.nestingLevel) != null ? _c : 0,
|
|
10462
|
+
textStyle: {
|
|
10463
|
+
fs: 20
|
|
10464
|
+
},
|
|
10465
|
+
listType,
|
|
10466
|
+
listId
|
|
10467
|
+
}
|
|
10468
|
+
}
|
|
10469
|
+
]
|
|
10470
|
+
},
|
|
10471
|
+
segmentId,
|
|
10472
|
+
coverType: UpdateDocsAttributeType.REPLACE
|
|
10473
|
+
}), memoryCursor.moveCursorTo(startIndex + 1);
|
|
10474
|
+
}
|
|
10475
|
+
return textX;
|
|
10476
|
+
}, "switchParagraphBullet"), toggleChecklistParagraph = /* @__PURE__ */ __name((params) => {
|
|
10477
|
+
var _a11;
|
|
10478
|
+
const { paragraphIndex, segmentId, document: docDataModel } = params, paragraphs = (_a11 = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) == null ? void 0 : _a11.paragraphs;
|
|
10479
|
+
if (paragraphs == null)
|
|
10480
|
+
return !1;
|
|
10481
|
+
const currentParagraph = paragraphs.find((p) => p.startIndex === paragraphIndex);
|
|
10482
|
+
if (!(currentParagraph != null && currentParagraph.bullet) || currentParagraph.bullet.listType.indexOf(PresetListType.CHECK_LIST) === -1)
|
|
10483
|
+
return !1;
|
|
10484
|
+
const memoryCursor = new MemoryCursor();
|
|
10485
|
+
memoryCursor.reset();
|
|
10486
|
+
const textX = new TextX(), { startIndex, paragraphStyle = {} } = currentParagraph, listType = currentParagraph.bullet.listType === PresetListType.CHECK_LIST ? PresetListType.CHECK_LIST_CHECKED : PresetListType.CHECK_LIST;
|
|
10487
|
+
return textX.push({
|
|
10488
|
+
t: TextXActionType.RETAIN,
|
|
10489
|
+
len: startIndex - memoryCursor.cursor,
|
|
10490
|
+
segmentId
|
|
10491
|
+
}), textX.push({
|
|
10492
|
+
t: TextXActionType.RETAIN,
|
|
10493
|
+
len: 1,
|
|
10494
|
+
body: {
|
|
10495
|
+
dataStream: "",
|
|
10496
|
+
paragraphs: [
|
|
10497
|
+
{
|
|
10498
|
+
...currentParagraph,
|
|
10499
|
+
paragraphStyle,
|
|
10500
|
+
startIndex: 0,
|
|
10501
|
+
bullet: {
|
|
10502
|
+
...currentParagraph.bullet,
|
|
10503
|
+
listType
|
|
10504
|
+
}
|
|
10505
|
+
}
|
|
10506
|
+
]
|
|
10507
|
+
},
|
|
10508
|
+
coverType: UpdateDocsAttributeType.REPLACE,
|
|
10509
|
+
segmentId
|
|
10510
|
+
}), memoryCursor.moveCursorTo(startIndex + 1), textX;
|
|
10511
|
+
}, "toggleChecklistParagraph"), setParagraphBullet = /* @__PURE__ */ __name((params) => {
|
|
10512
|
+
var _a11, _b2;
|
|
10513
|
+
const { paragraphs: currentParagraphs, listType, segmentId, document: docDataModel } = params;
|
|
10514
|
+
if (((_a11 = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) == null ? void 0 : _a11.paragraphs) == null)
|
|
10515
|
+
return !1;
|
|
10516
|
+
const listId = Tools.generateRandomId(6), memoryCursor = new MemoryCursor();
|
|
10517
|
+
memoryCursor.reset();
|
|
10518
|
+
const textX = new TextX();
|
|
10519
|
+
for (const paragraph of currentParagraphs) {
|
|
10520
|
+
const { startIndex, paragraphStyle = {}, bullet } = paragraph;
|
|
10521
|
+
textX.push({
|
|
10522
|
+
t: TextXActionType.RETAIN,
|
|
10523
|
+
len: startIndex - memoryCursor.cursor,
|
|
10524
|
+
segmentId
|
|
10525
|
+
}), textX.push({
|
|
10526
|
+
t: TextXActionType.RETAIN,
|
|
10527
|
+
len: 1,
|
|
10528
|
+
body: {
|
|
10529
|
+
dataStream: "",
|
|
10530
|
+
paragraphs: [
|
|
10531
|
+
{
|
|
10532
|
+
startIndex: 0,
|
|
10533
|
+
paragraphStyle,
|
|
10534
|
+
bullet: {
|
|
10535
|
+
nestingLevel: (_b2 = bullet == null ? void 0 : bullet.nestingLevel) != null ? _b2 : 0,
|
|
10536
|
+
textStyle: (bullet == null ? void 0 : bullet.listType) === listType ? bullet.textStyle : {
|
|
10537
|
+
fs: 20
|
|
10538
|
+
},
|
|
10539
|
+
listType,
|
|
10540
|
+
listId
|
|
10541
|
+
}
|
|
10542
|
+
}
|
|
10543
|
+
]
|
|
10544
|
+
},
|
|
10545
|
+
segmentId,
|
|
10546
|
+
coverType: UpdateDocsAttributeType.REPLACE
|
|
10547
|
+
}), memoryCursor.moveCursorTo(startIndex + 1);
|
|
10548
|
+
}
|
|
10549
|
+
return textX;
|
|
10550
|
+
}, "setParagraphBullet");
|
|
10551
|
+
function hasParagraphInTable(paragraph, tables) {
|
|
10552
|
+
return tables.some((table) => paragraph.startIndex > table.startIndex && paragraph.startIndex < table.endIndex);
|
|
10553
|
+
}
|
|
10554
|
+
__name(hasParagraphInTable, "hasParagraphInTable");
|
|
10555
|
+
const changeParagraphBulletNestLevel = /* @__PURE__ */ __name((params) => {
|
|
10556
|
+
var _a11, _b2, _c;
|
|
10557
|
+
const { paragraphs: currentParagraphs, segmentId, document: docDataModel, type: type2 } = params, memoryCursor = new MemoryCursor();
|
|
10558
|
+
memoryCursor.reset();
|
|
10559
|
+
const textX = new TextX(), customLists = (_a11 = docDataModel.getSnapshot().lists) != null ? _a11 : {}, tables = (_c = (_b2 = docDataModel.getBody()) == null ? void 0 : _b2.tables) != null ? _c : [], lists = {
|
|
10560
|
+
...PRESET_LIST_TYPE,
|
|
10561
|
+
...customLists
|
|
10562
|
+
};
|
|
10563
|
+
for (const paragraph of currentParagraphs) {
|
|
10564
|
+
const { startIndex, paragraphStyle = {}, bullet } = paragraph, isInTable = hasParagraphInTable(paragraph, tables);
|
|
10565
|
+
if (textX.push({
|
|
10566
|
+
t: TextXActionType.RETAIN,
|
|
10567
|
+
len: startIndex - memoryCursor.cursor,
|
|
10568
|
+
segmentId
|
|
10569
|
+
}), bullet) {
|
|
10570
|
+
const listType = bullet.listType;
|
|
10571
|
+
let maxLevel = lists[listType].nestingLevel.length - 1;
|
|
10572
|
+
isInTable && (maxLevel = Math.min(maxLevel, 2)), textX.push({
|
|
10573
|
+
t: TextXActionType.RETAIN,
|
|
10574
|
+
len: 1,
|
|
10575
|
+
body: {
|
|
10576
|
+
dataStream: "",
|
|
10577
|
+
paragraphs: [
|
|
10578
|
+
{
|
|
10579
|
+
startIndex: 0,
|
|
10580
|
+
paragraphStyle: {
|
|
10581
|
+
...paragraphStyle
|
|
10582
|
+
},
|
|
10583
|
+
bullet: {
|
|
10584
|
+
...bullet,
|
|
10585
|
+
nestingLevel: Math.max(Math.min(bullet.nestingLevel + type2, maxLevel), 0)
|
|
10586
|
+
}
|
|
10587
|
+
}
|
|
10588
|
+
]
|
|
10589
|
+
},
|
|
10590
|
+
segmentId,
|
|
10591
|
+
coverType: UpdateDocsAttributeType.REPLACE
|
|
10592
|
+
});
|
|
10593
|
+
} else
|
|
10594
|
+
textX.push({
|
|
10595
|
+
t: TextXActionType.RETAIN,
|
|
10596
|
+
len: 1
|
|
10597
|
+
});
|
|
10598
|
+
memoryCursor.moveCursorTo(startIndex + 1);
|
|
10599
|
+
}
|
|
10600
|
+
return textX;
|
|
10601
|
+
}, "changeParagraphBulletNestLevel");
|
|
10412
10602
|
var PageType = /* @__PURE__ */ ((PageType2) => (PageType2[PageType2.SLIDE = 0] = "SLIDE", PageType2[PageType2.MASTER = 1] = "MASTER", PageType2[PageType2.LAYOUT = 2] = "LAYOUT", PageType2[PageType2.HANDOUT_MASTER = 3] = "HANDOUT_MASTER", PageType2[PageType2.NOTES_MASTER = 4] = "NOTES_MASTER", PageType2))(PageType || {}), PageElementType = /* @__PURE__ */ ((PageElementType2) => (PageElementType2[PageElementType2.SHAPE = 0] = "SHAPE", PageElementType2[PageElementType2.IMAGE = 1] = "IMAGE", PageElementType2[PageElementType2.TEXT = 2] = "TEXT", PageElementType2[PageElementType2.SPREADSHEET = 3] = "SPREADSHEET", PageElementType2[PageElementType2.DOCUMENT = 4] = "DOCUMENT", PageElementType2[PageElementType2.SLIDE = 5] = "SLIDE", PageElementType2))(PageElementType || {}), RelativeSlideLink = /* @__PURE__ */ ((RelativeSlideLink2) => (RelativeSlideLink2[RelativeSlideLink2.RELATIVE_SLIDE_LINK_UNSPECIFIED = 0] = "RELATIVE_SLIDE_LINK_UNSPECIFIED", RelativeSlideLink2[RelativeSlideLink2.NEXT_SLIDE = 1] = "NEXT_SLIDE", RelativeSlideLink2[RelativeSlideLink2.PREVIOUS_SLIDE = 2] = "PREVIOUS_SLIDE", RelativeSlideLink2[RelativeSlideLink2.FIRST_SLIDE = 3] = "FIRST_SLIDE", RelativeSlideLink2[RelativeSlideLink2.LAST_SLIDE = 4] = "LAST_SLIDE", RelativeSlideLink2))(RelativeSlideLink || {});
|
|
10413
10603
|
const tags = [
|
|
10414
10604
|
// DataStreamTreeTokenType.PARAGRAPH, // 段落
|
|
@@ -10752,7 +10942,7 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
|
|
|
10752
10942
|
}
|
|
10753
10943
|
const sortedRetains = [...retainPoints].sort((pre, aft) => pre - aft);
|
|
10754
10944
|
let cursor2 = textStart;
|
|
10755
|
-
|
|
10945
|
+
if (sortedRetains.forEach((pos) => {
|
|
10756
10946
|
const len = pos - cursor2;
|
|
10757
10947
|
len > 0 && dos.push({
|
|
10758
10948
|
t: TextXActionType.DELETE,
|
|
@@ -10764,12 +10954,35 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
|
|
|
10764
10954
|
len: 1,
|
|
10765
10955
|
segmentId
|
|
10766
10956
|
}), cursor2 = pos + 1;
|
|
10767
|
-
}), cursor2 < textEnd && dos.push({
|
|
10957
|
+
}), cursor2 < textEnd && (dos.push({
|
|
10768
10958
|
t: TextXActionType.DELETE,
|
|
10769
10959
|
len: textEnd - cursor2,
|
|
10770
10960
|
line: 0,
|
|
10771
10961
|
segmentId
|
|
10772
|
-
}),
|
|
10962
|
+
}), cursor2 = textEnd), !preserveLineBreak) {
|
|
10963
|
+
const nextParagraph = paragraphs.find((p) => p.startIndex - memoryCursor >= textEnd);
|
|
10964
|
+
nextParagraph && (nextParagraph.startIndex > cursor2 && (dos.push({
|
|
10965
|
+
t: TextXActionType.RETAIN,
|
|
10966
|
+
len: nextParagraph.startIndex - cursor2,
|
|
10967
|
+
segmentId
|
|
10968
|
+
}), cursor2 = nextParagraph.startIndex), dos.push({
|
|
10969
|
+
t: TextXActionType.RETAIN,
|
|
10970
|
+
len: 1,
|
|
10971
|
+
segmentId,
|
|
10972
|
+
body: {
|
|
10973
|
+
dataStream: "",
|
|
10974
|
+
paragraphs: [
|
|
10975
|
+
{
|
|
10976
|
+
...nextParagraph,
|
|
10977
|
+
startIndex: 0,
|
|
10978
|
+
bullet: paragraphInRange == null ? void 0 : paragraphInRange.bullet
|
|
10979
|
+
}
|
|
10980
|
+
]
|
|
10981
|
+
},
|
|
10982
|
+
coverType: UpdateDocsAttributeType.REPLACE
|
|
10983
|
+
}));
|
|
10984
|
+
}
|
|
10985
|
+
return dos;
|
|
10773
10986
|
}
|
|
10774
10987
|
__name(getRetainAndDeleteAndExcludeLineBreak, "getRetainAndDeleteAndExcludeLineBreak");
|
|
10775
10988
|
const replaceSelectionTextX = /* @__PURE__ */ __name((params) => {
|
|
@@ -10807,6 +11020,13 @@ __name(_BuildTextUtils, "BuildTextUtils"), __publicField(_BuildTextUtils, "custo
|
|
|
10807
11020
|
getPlainText,
|
|
10808
11021
|
fromPlainText,
|
|
10809
11022
|
isEmptyDocument
|
|
11023
|
+
}), __publicField(_BuildTextUtils, "paragraph", {
|
|
11024
|
+
bullet: {
|
|
11025
|
+
set: setParagraphBullet,
|
|
11026
|
+
switch: switchParagraphBullet,
|
|
11027
|
+
toggleChecklist: toggleChecklistParagraph,
|
|
11028
|
+
changeNestLevel: changeParagraphBulletNestLevel
|
|
11029
|
+
}
|
|
10810
11030
|
});
|
|
10811
11031
|
let BuildTextUtils = _BuildTextUtils;
|
|
10812
11032
|
function replaceInDocumentBody(body, query, target) {
|
|
@@ -10924,10 +11144,10 @@ function fromEventSubject(subject$) {
|
|
|
10924
11144
|
}
|
|
10925
11145
|
__name(fromEventSubject, "fromEventSubject");
|
|
10926
11146
|
const IResourceManagerService = createIdentifier("core.resource-manager.service"), nameMap = {
|
|
10927
|
-
[
|
|
10928
|
-
[
|
|
10929
|
-
[
|
|
10930
|
-
[
|
|
11147
|
+
[S.Editor]: "Editor",
|
|
11148
|
+
[S.Owner]: "Owner",
|
|
11149
|
+
[S.Reader]: "Reader",
|
|
11150
|
+
[S.UNRECOGNIZED]: "UNRECOGNIZED"
|
|
10931
11151
|
}, createDefaultUser = /* @__PURE__ */ __name((type2) => type2 ? {
|
|
10932
11152
|
userID: `${nameMap[type2]}_${Tools.generateRandomId(8)}`,
|
|
10933
11153
|
name: nameMap[type2],
|
|
@@ -10991,7 +11211,7 @@ let AuthzIoLocalService = (_a3 = class {
|
|
|
10991
11211
|
}
|
|
10992
11212
|
_initDefaultUser() {
|
|
10993
11213
|
const currentUser = this._userManagerService.getCurrentUser();
|
|
10994
|
-
currentUser && currentUser.userID || this._userManagerService.setCurrentUser(createDefaultUser(
|
|
11214
|
+
currentUser && currentUser.userID || this._userManagerService.setCurrentUser(createDefaultUser(S.Owner));
|
|
10995
11215
|
}
|
|
10996
11216
|
_getRole(type2) {
|
|
10997
11217
|
const user = this._userManagerService.getCurrentUser();
|
|
@@ -11008,7 +11228,7 @@ let AuthzIoLocalService = (_a3 = class {
|
|
|
11008
11228
|
}, "toJson"),
|
|
11009
11229
|
parseJson: /* @__PURE__ */ __name((json) => JSON.parse(json), "parseJson"),
|
|
11010
11230
|
pluginName: "SHEET_AuthzIoMockService_PLUGIN",
|
|
11011
|
-
businesses: [
|
|
11231
|
+
businesses: [R.UNIVER_SHEET, R.UNIVER_DOC, R.UNIVER_SLIDE],
|
|
11012
11232
|
onLoad: /* @__PURE__ */ __name((_unitId, resource) => {
|
|
11013
11233
|
for (const key in resource)
|
|
11014
11234
|
this._permissionMap.set(key, resource[key]);
|
|
@@ -11039,13 +11259,13 @@ let AuthzIoLocalService = (_a3 = class {
|
|
|
11039
11259
|
objectType: rule.objectType,
|
|
11040
11260
|
name: rule.name,
|
|
11041
11261
|
shareOn: !1,
|
|
11042
|
-
shareRole:
|
|
11262
|
+
shareRole: S.Owner,
|
|
11043
11263
|
shareScope: -1,
|
|
11044
11264
|
scope: {
|
|
11045
|
-
read:
|
|
11046
|
-
edit:
|
|
11265
|
+
read: T.AllCollaborator,
|
|
11266
|
+
edit: T.AllCollaborator
|
|
11047
11267
|
},
|
|
11048
|
-
creator: createDefaultUser(
|
|
11268
|
+
creator: createDefaultUser(S.Owner),
|
|
11049
11269
|
strategies: [
|
|
11050
11270
|
{
|
|
11051
11271
|
action: 6,
|
|
@@ -11100,7 +11320,7 @@ let AuthzIoLocalService = (_a3 = class {
|
|
|
11100
11320
|
role: 1
|
|
11101
11321
|
}
|
|
11102
11322
|
],
|
|
11103
|
-
actions: config.actions.map((a) => ({ action: a, allowed: this._getRole(
|
|
11323
|
+
actions: config.actions.map((a) => ({ action: a, allowed: this._getRole(S.Owner) || this._getRole(S.Editor) }))
|
|
11104
11324
|
};
|
|
11105
11325
|
result.push(item);
|
|
11106
11326
|
}
|
|
@@ -11167,7 +11387,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
|
|
|
11167
11387
|
};
|
|
11168
11388
|
__name(_ErrorService, "ErrorService");
|
|
11169
11389
|
let ErrorService = _ErrorService;
|
|
11170
|
-
const version = "0.4.0-
|
|
11390
|
+
const version = "0.4.0-experimental.20241017-da434a2";
|
|
11171
11391
|
function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
|
|
11172
11392
|
return {
|
|
11173
11393
|
id: unitID,
|
|
@@ -12317,7 +12537,7 @@ var _a4;
|
|
|
12317
12537
|
let Workbook = (_a4 = class extends UnitModel {
|
|
12318
12538
|
constructor(workbookData = {}, _logService) {
|
|
12319
12539
|
super();
|
|
12320
|
-
__publicField(this, "type",
|
|
12540
|
+
__publicField(this, "type", R.UNIVER_SHEET);
|
|
12321
12541
|
__publicField(this, "_sheetCreated$", new Subject());
|
|
12322
12542
|
__publicField(this, "sheetCreated$", this._sheetCreated$.asObservable());
|
|
12323
12543
|
__publicField(this, "_sheetDisposed$", new Subject());
|
|
@@ -12562,7 +12782,7 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
|
|
|
12562
12782
|
constructor(snapshot) {
|
|
12563
12783
|
var _a11;
|
|
12564
12784
|
super();
|
|
12565
|
-
__publicField(this, "type",
|
|
12785
|
+
__publicField(this, "type", R.UNIVER_SLIDE);
|
|
12566
12786
|
__publicField(this, "_activePage$", new BehaviorSubject(null));
|
|
12567
12787
|
__publicField(this, "activePage$", this._activePage$.asObservable());
|
|
12568
12788
|
__publicField(this, "_name$");
|
|
@@ -12735,20 +12955,20 @@ let UniverInstanceService = (_a5 = class extends Disposable {
|
|
|
12735
12955
|
return type2 && (unit == null ? void 0 : unit.type) !== type2 ? null : unit;
|
|
12736
12956
|
}
|
|
12737
12957
|
getCurrentUniverDocInstance() {
|
|
12738
|
-
return this.getCurrentUnitForType(
|
|
12958
|
+
return this.getCurrentUnitForType(R.UNIVER_DOC);
|
|
12739
12959
|
}
|
|
12740
12960
|
getUniverDocInstance(unitId) {
|
|
12741
|
-
return this.getUnit(unitId,
|
|
12961
|
+
return this.getUnit(unitId, R.UNIVER_DOC);
|
|
12742
12962
|
}
|
|
12743
12963
|
getUniverSheetInstance(unitId) {
|
|
12744
|
-
return this.getUnit(unitId,
|
|
12964
|
+
return this.getUnit(unitId, R.UNIVER_SHEET);
|
|
12745
12965
|
}
|
|
12746
12966
|
getAllUnitsForType(type2) {
|
|
12747
12967
|
var _a11;
|
|
12748
12968
|
return (_a11 = this._unitsByType.get(type2)) != null ? _a11 : [];
|
|
12749
12969
|
}
|
|
12750
12970
|
changeDoc(unitId, doc) {
|
|
12751
|
-
const allDocs = this.getAllUnitsForType(
|
|
12971
|
+
const allDocs = this.getAllUnitsForType(R.UNIVER_DOC), oldDoc = allDocs.find((doc2) => doc2.getUnitId() === unitId);
|
|
12752
12972
|
if (oldDoc != null) {
|
|
12753
12973
|
const index2 = allDocs.indexOf(oldDoc);
|
|
12754
12974
|
allDocs.splice(index2, 1);
|
|
@@ -12768,7 +12988,7 @@ let UniverInstanceService = (_a5 = class extends Disposable {
|
|
|
12768
12988
|
}
|
|
12769
12989
|
getUnitType(unitId) {
|
|
12770
12990
|
const result = this._getUnitById(unitId);
|
|
12771
|
-
return result ? result[1] :
|
|
12991
|
+
return result ? result[1] : R.UNRECOGNIZED;
|
|
12772
12992
|
}
|
|
12773
12993
|
disposeUnit(unitId) {
|
|
12774
12994
|
const result = this._getUnitById(unitId);
|
|
@@ -13025,7 +13245,7 @@ const DependentOnSymbol = Symbol("DependentOn"), _Plugin = class _Plugin extends
|
|
|
13025
13245
|
return this.constructor.pluginName;
|
|
13026
13246
|
}
|
|
13027
13247
|
};
|
|
13028
|
-
__name(_Plugin, "Plugin"), __publicField(_Plugin, "pluginName"), __publicField(_Plugin, "type",
|
|
13248
|
+
__name(_Plugin, "Plugin"), __publicField(_Plugin, "pluginName"), __publicField(_Plugin, "type", R.UNIVER_UNKNOWN);
|
|
13029
13249
|
let Plugin = _Plugin;
|
|
13030
13250
|
const _PluginStore = class _PluginStore {
|
|
13031
13251
|
constructor() {
|
|
@@ -13084,7 +13304,7 @@ let PluginService = (_a7 = class {
|
|
|
13084
13304
|
PluginHolder,
|
|
13085
13305
|
this._checkPluginSeen.bind(this),
|
|
13086
13306
|
this._immediateInitPlugin.bind(this)
|
|
13087
|
-
), this._pluginHoldersForTypes.set(
|
|
13307
|
+
), this._pluginHoldersForTypes.set(R.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
|
|
13088
13308
|
}
|
|
13089
13309
|
dispose() {
|
|
13090
13310
|
this._clearFlushTimer();
|
|
@@ -13096,7 +13316,7 @@ let PluginService = (_a7 = class {
|
|
|
13096
13316
|
registerPlugin(ctor, config) {
|
|
13097
13317
|
this._assertPluginValid(ctor), this._scheduleInitPlugin();
|
|
13098
13318
|
const { type: type2 } = ctor;
|
|
13099
|
-
type2 ===
|
|
13319
|
+
type2 === R.UNIVER_UNKNOWN ? (this._pluginHolderForUniver.register(ctor, config), this._pluginHolderForUniver.flush()) : this._ensurePluginHolderForType(type2).register(ctor, config);
|
|
13100
13320
|
}
|
|
13101
13321
|
startPluginForType(type2) {
|
|
13102
13322
|
this._ensurePluginHolderForType(type2).start();
|
|
@@ -13120,7 +13340,7 @@ let PluginService = (_a7 = class {
|
|
|
13120
13340
|
}
|
|
13121
13341
|
_assertPluginValid(ctor) {
|
|
13122
13342
|
const { type: type2, pluginName } = ctor;
|
|
13123
|
-
if (type2 ===
|
|
13343
|
+
if (type2 === R.UNRECOGNIZED)
|
|
13124
13344
|
throw new Error(`[PluginService]: invalid plugin type for ${ctor.name}. Please assign a "type" to your plugin.`);
|
|
13125
13345
|
if (!pluginName)
|
|
13126
13346
|
throw new Error(`[PluginService]: no plugin name for ${ctor.name}. Please assign a "pluginName" to your plugin.`);
|
|
@@ -13895,11 +14115,11 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
|
|
|
13895
14115
|
const handleHookAdd = /* @__PURE__ */ __name((hook) => {
|
|
13896
14116
|
hook.businesses.forEach((business) => {
|
|
13897
14117
|
switch (business) {
|
|
13898
|
-
case
|
|
13899
|
-
case
|
|
13900
|
-
case
|
|
13901
|
-
case
|
|
13902
|
-
this._univerInstanceService.getAllUnitsForType(
|
|
14118
|
+
case R.UNRECOGNIZED:
|
|
14119
|
+
case R.UNIVER_UNKNOWN:
|
|
14120
|
+
case R.UNIVER_SLIDE:
|
|
14121
|
+
case R.UNIVER_DOC: {
|
|
14122
|
+
this._univerInstanceService.getAllUnitsForType(R.UNIVER_DOC).forEach((doc) => {
|
|
13903
14123
|
const plugin = (doc.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
|
|
13904
14124
|
if (plugin)
|
|
13905
14125
|
try {
|
|
@@ -13911,8 +14131,8 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
|
|
|
13911
14131
|
});
|
|
13912
14132
|
break;
|
|
13913
14133
|
}
|
|
13914
|
-
case
|
|
13915
|
-
this._univerInstanceService.getAllUnitsForType(
|
|
14134
|
+
case R.UNIVER_SHEET:
|
|
14135
|
+
this._univerInstanceService.getAllUnitsForType(R.UNIVER_SHEET).forEach((workbook) => {
|
|
13916
14136
|
const plugin = (workbook.getSnapshot().resources || []).find((r) => r.name === hook.pluginName);
|
|
13917
14137
|
if (plugin)
|
|
13918
14138
|
try {
|
|
@@ -13926,20 +14146,20 @@ let ResourceLoaderService = (_a10 = class extends Disposable {
|
|
|
13926
14146
|
});
|
|
13927
14147
|
}, "handleHookAdd");
|
|
13928
14148
|
this._resourceManagerService.getAllResourceHooks().forEach((hook) => handleHookAdd(hook)), this.disposeWithMe(this._resourceManagerService.register$.subscribe((hook) => handleHookAdd(hook))), this.disposeWithMe(
|
|
13929
|
-
this._univerInstanceService.getTypeOfUnitAdded$(
|
|
14149
|
+
this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_SHEET).subscribe((workbook) => {
|
|
13930
14150
|
this._resourceManagerService.loadResources(workbook.getUnitId(), workbook.getSnapshot().resources);
|
|
13931
14151
|
})
|
|
13932
14152
|
), this.disposeWithMe(
|
|
13933
|
-
this._univerInstanceService.getTypeOfUnitAdded$(
|
|
14153
|
+
this._univerInstanceService.getTypeOfUnitAdded$(R.UNIVER_DOC).subscribe((doc) => {
|
|
13934
14154
|
const unitId = doc.getUnitId();
|
|
13935
14155
|
isInternalEditorID(unitId) || this._resourceManagerService.loadResources(doc.getUnitId(), doc.getSnapshot().resources);
|
|
13936
14156
|
})
|
|
13937
14157
|
), this.disposeWithMe(
|
|
13938
|
-
this._univerInstanceService.getTypeOfUnitDisposed$(
|
|
14158
|
+
this._univerInstanceService.getTypeOfUnitDisposed$(R.UNIVER_SHEET).subscribe((workbook) => {
|
|
13939
14159
|
this._resourceManagerService.unloadResources(workbook.getUnitId());
|
|
13940
14160
|
})
|
|
13941
14161
|
), this.disposeWithMe(
|
|
13942
|
-
this._univerInstanceService.getTypeOfUnitDisposed$(
|
|
14162
|
+
this._univerInstanceService.getTypeOfUnitDisposed$(R.UNIVER_DOC).subscribe((doc) => {
|
|
13943
14163
|
this._resourceManagerService.unloadResources(doc.getUnitId());
|
|
13944
14164
|
})
|
|
13945
14165
|
);
|
|
@@ -13992,22 +14212,22 @@ const _Univer = class _Univer {
|
|
|
13992
14212
|
* @deprecated use `createUnit` instead
|
|
13993
14213
|
*/
|
|
13994
14214
|
createUniverSheet(data) {
|
|
13995
|
-
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(
|
|
14215
|
+
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(R.UNIVER_SHEET, data);
|
|
13996
14216
|
}
|
|
13997
14217
|
/**
|
|
13998
14218
|
* @deprecated use `createUnit` instead
|
|
13999
14219
|
*/
|
|
14000
14220
|
createUniverDoc(data) {
|
|
14001
|
-
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(
|
|
14221
|
+
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(R.UNIVER_DOC, data);
|
|
14002
14222
|
}
|
|
14003
14223
|
/**
|
|
14004
14224
|
* @deprecated use `createUnit` instead
|
|
14005
14225
|
*/
|
|
14006
14226
|
createUniverSlide(data) {
|
|
14007
|
-
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(
|
|
14227
|
+
return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(R.UNIVER_SLIDE, data);
|
|
14008
14228
|
}
|
|
14009
14229
|
_init(injector) {
|
|
14010
|
-
this._univerInstanceService.registerCtorForType(
|
|
14230
|
+
this._univerInstanceService.registerCtorForType(R.UNIVER_SHEET, Workbook), this._univerInstanceService.registerCtorForType(R.UNIVER_DOC, DocumentDataModel), this._univerInstanceService.registerCtorForType(R.UNIVER_SLIDE, SlideDataModel);
|
|
14011
14231
|
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
14012
14232
|
univerInstanceService.__setCreateHandler(
|
|
14013
14233
|
(type2, data, ctor, options) => {
|
|
@@ -14272,7 +14492,7 @@ export {
|
|
|
14272
14492
|
UnitModel,
|
|
14273
14493
|
Univer,
|
|
14274
14494
|
UniverInstanceService,
|
|
14275
|
-
|
|
14495
|
+
R as UniverInstanceType,
|
|
14276
14496
|
UpdateDocsAttributeType,
|
|
14277
14497
|
UserManagerService,
|
|
14278
14498
|
VerticalAlign,
|
|
@@ -14286,6 +14506,7 @@ export {
|
|
|
14286
14506
|
afterInitApply,
|
|
14287
14507
|
awaitTime,
|
|
14288
14508
|
binarySearchArray,
|
|
14509
|
+
bufferDebounceTime,
|
|
14289
14510
|
cellToRange,
|
|
14290
14511
|
characterSpacingControlType,
|
|
14291
14512
|
checkForSubstrings,
|