@uva-glass/component-library 3.0.12 → 3.0.14
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/dist/{Lexical.prod-pVkgOp1j.js → Lexical.prod-LIa6Q94i.js} +2 -2
- package/dist/{Lexical.prod-pVkgOp1j.js.map → Lexical.prod-LIa6Q94i.js.map} +1 -1
- package/dist/{LexicalClipboard.prod-DIvwPtmL.js → LexicalClipboard.prod-LIoPcoQF.js} +4 -4
- package/dist/{LexicalClipboard.prod-DIvwPtmL.js.map → LexicalClipboard.prod-LIoPcoQF.js.map} +1 -1
- package/dist/{LexicalLink.prod-NMeHB9CR.js → LexicalLink.prod-N0i4wDOR.js} +3 -3
- package/dist/{LexicalLink.prod-NMeHB9CR.js.map → LexicalLink.prod-N0i4wDOR.js.map} +1 -1
- package/dist/{LexicalList.prod-CicvwkCx.js → LexicalList.prod-BKa7Tljk.js} +3 -3
- package/dist/{LexicalList.prod-CicvwkCx.js.map → LexicalList.prod-BKa7Tljk.js.map} +1 -1
- package/dist/{LexicalSelection.prod-mQvH0_ap.js → LexicalSelection.prod-Cid08b3Z.js} +2 -2
- package/dist/{LexicalSelection.prod-mQvH0_ap.js.map → LexicalSelection.prod-Cid08b3Z.js.map} +1 -1
- package/dist/{LexicalTable.prod-Bb6g8CAC.js → LexicalTable.prod-B1mw85mv.js} +512 -509
- package/dist/LexicalTable.prod-B1mw85mv.js.map +1 -0
- package/dist/{LexicalUtils.prod-C_aSRWfh.js → LexicalUtils.prod-DstvN5hc.js} +2 -2
- package/dist/{LexicalUtils.prod-C_aSRWfh.js.map → LexicalUtils.prod-DstvN5hc.js.map} +1 -1
- package/dist/{TablePlugin-o1MveXq2.js → TablePlugin-DlTujN8R.js} +4 -4
- package/dist/{TablePlugin-o1MveXq2.js.map → TablePlugin-DlTujN8R.js.map} +1 -1
- package/dist/TimelineItem-ClDZJkaZ.js +60 -0
- package/dist/TimelineItem-ClDZJkaZ.js.map +1 -0
- package/dist/assets/TimelineItem.css +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/FormInput/FormInput.js +1 -1
- package/dist/components/InputField/InputField.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/OverlayStepBar/OverlayStepBar.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +1 -1
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +6 -6
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/index.js +1 -1
- package/dist/components/RteEditor/RteEditor.js +9 -9
- package/dist/components/RteEditor/helpers.js +4 -4
- package/dist/components/Timeline/Timeline.d.ts +1 -6
- package/dist/components/Timeline/Timeline.js +8 -8
- package/dist/components/Timeline/Timeline.js.map +1 -1
- package/dist/components/Timeline/Timeline.test.js +1 -1
- package/dist/components/Timeline/TimelineItem.d.ts +1 -1
- package/dist/components/Timeline/TimelineItem.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-CtrLGKFA.js → helpers-BFkCPTTp.js} +4 -4
- package/dist/{helpers-CtrLGKFA.js.map → helpers-BFkCPTTp.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +30 -30
- package/dist/LexicalTable.prod-Bb6g8CAC.js.map +0 -1
- package/dist/TimelineItem-DmrymETS.js +0 -52
- package/dist/TimelineItem-DmrymETS.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { h as N, e as X, T as
|
|
2
|
-
import { f as Pe, e as we, U as Be, d as P, T as j, O as Bt, X as
|
|
3
|
-
import { _ as
|
|
1
|
+
import { h as N, e as X, T as Ct, n as ie, $ as Mt, A as zt, P as _t, w as Lt, E as Pt } from "./LexicalUtils.prod-DstvN5hc.js";
|
|
2
|
+
import { f as Pe, e as we, U as Be, d as P, T as j, O as Bt, X as de, Q as He, _ as Ht, h as St, r as V, i as Wt, N as Ke, j as wt, l as z, o as Dt, n as ue, a as L, k as ye, m as It, p as Jt, q as Xt, u as Yt, F as Ae, L as qt, v as Ut, x as yt, y as jt, z as I, A as Vt, B as Qt, G as Gt, I as Zt, J as en, K as tn, M as nn, P as on, S as oe, V as Ze, g as q, W as xe, Y as rn, b as bt, Z as ln, w as Nt, a0 as sn, $ as an, a1 as be, a2 as cn, a3 as un, a4 as et, a5 as hn, a6 as tt, D as dn, a7 as nt, s as ot, c as pe, a8 as fn, C as gn, a9 as mn, aa as pn } from "./Lexical.prod-LIa6Q94i.js";
|
|
3
|
+
import { _ as Cn, M as _n } from "./LexicalClipboard.prod-LIoPcoQF.js";
|
|
4
4
|
const We = /^(\d+(?:\.\d+)?)px$/, D = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
|
|
5
|
-
class
|
|
5
|
+
class ee extends Pe {
|
|
6
6
|
static getType() {
|
|
7
7
|
return "tablecell";
|
|
8
8
|
}
|
|
9
9
|
static clone(e) {
|
|
10
|
-
return new
|
|
10
|
+
return new ee(e.__headerState, e.__colSpan, e.__width, e.__key);
|
|
11
11
|
}
|
|
12
12
|
afterCloneFrom(e) {
|
|
13
13
|
super.afterCloneFrom(e), this.__rowSpan = e.__rowSpan, this.__backgroundColor = e.__backgroundColor, this.__verticalAlign = e.__verticalAlign;
|
|
@@ -16,13 +16,13 @@ class Z extends Pe {
|
|
|
16
16
|
return { td: (e) => ({ conversion: rt, priority: 0 }), th: (e) => ({ conversion: rt, priority: 0 }) };
|
|
17
17
|
}
|
|
18
18
|
static importJSON(e) {
|
|
19
|
-
return
|
|
19
|
+
return fe().updateFromJSON(e);
|
|
20
20
|
}
|
|
21
21
|
updateFromJSON(e) {
|
|
22
22
|
return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan || 1).setRowSpan(e.rowSpan || 1).setWidth(e.width || void 0).setBackgroundColor(e.backgroundColor || null).setVerticalAlign(e.verticalAlign || void 0);
|
|
23
23
|
}
|
|
24
|
-
constructor(e = D.NO_STATUS, t = 1, o,
|
|
25
|
-
super(
|
|
24
|
+
constructor(e = D.NO_STATUS, t = 1, o, l) {
|
|
25
|
+
super(l), this.__colSpan = t, this.__rowSpan = 1, this.__headerState = e, this.__width = o, this.__backgroundColor = null, this.__verticalAlign = void 0;
|
|
26
26
|
}
|
|
27
27
|
createDOM(e) {
|
|
28
28
|
const t = document.createElement(this.getTag());
|
|
@@ -117,41 +117,41 @@ function rt(n) {
|
|
|
117
117
|
const e = n, t = n.nodeName.toLowerCase();
|
|
118
118
|
let o;
|
|
119
119
|
We.test(e.style.width) && (o = parseFloat(e.style.width));
|
|
120
|
-
const
|
|
121
|
-
|
|
120
|
+
const l = fe(t === "th" ? D.ROW : D.NO_STATUS, e.colSpan, o);
|
|
121
|
+
l.__rowSpan = e.rowSpan;
|
|
122
122
|
const s = e.style.backgroundColor;
|
|
123
|
-
s !== "" && (
|
|
124
|
-
const
|
|
125
|
-
ke(
|
|
126
|
-
const a = e.style, c = (a && a.textDecoration || "").split(" "), f = a.fontWeight === "700" || a.fontWeight === "bold", h = c.includes("line-through"),
|
|
123
|
+
s !== "" && (l.__backgroundColor = s);
|
|
124
|
+
const r = e.style.verticalAlign;
|
|
125
|
+
ke(r) && (l.__verticalAlign = r);
|
|
126
|
+
const a = e.style, c = (a && a.textDecoration || "").split(" "), f = a.fontWeight === "700" || a.fontWeight === "bold", h = c.includes("line-through"), p = a.fontStyle === "italic", C = c.includes("underline");
|
|
127
127
|
return { after: (i) => (i.length === 0 && i.push(j()), i), forChild: (i, u) => {
|
|
128
128
|
if (S(u) && !P(i)) {
|
|
129
129
|
const g = j();
|
|
130
130
|
return Bt(i) && i.getTextContent() === `
|
|
131
|
-
` ? null : (
|
|
131
|
+
` ? null : (de(i) && (f && i.toggleFormat("bold"), h && i.toggleFormat("strikethrough"), p && i.toggleFormat("italic"), C && i.toggleFormat("underline")), g.append(i), g);
|
|
132
132
|
}
|
|
133
133
|
return i;
|
|
134
|
-
}, node:
|
|
134
|
+
}, node: l };
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
return Be(new
|
|
136
|
+
function fe(n = D.NO_STATUS, e = 1, t) {
|
|
137
|
+
return Be(new ee(n, e, t));
|
|
138
138
|
}
|
|
139
139
|
function S(n) {
|
|
140
|
-
return n instanceof
|
|
140
|
+
return n instanceof ee;
|
|
141
141
|
}
|
|
142
142
|
const Sn = Dt();
|
|
143
143
|
function w(n, ...e) {
|
|
144
144
|
const t = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
|
|
145
145
|
o.append("code", n);
|
|
146
|
-
for (const
|
|
146
|
+
for (const l of e) o.append("v", l);
|
|
147
147
|
throw t.search = o.toString(), Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
148
148
|
}
|
|
149
|
-
class
|
|
149
|
+
class ge extends Pe {
|
|
150
150
|
static getType() {
|
|
151
151
|
return "tablerow";
|
|
152
152
|
}
|
|
153
153
|
static clone(e) {
|
|
154
|
-
return new
|
|
154
|
+
return new ge(e.__height, e.__key);
|
|
155
155
|
}
|
|
156
156
|
static importDOM() {
|
|
157
157
|
return { tr: (e) => ({ conversion: wn, priority: 0 }) };
|
|
@@ -199,23 +199,23 @@ class fe extends Pe {
|
|
|
199
199
|
function wn(n) {
|
|
200
200
|
const e = n;
|
|
201
201
|
let t;
|
|
202
|
-
return We.test(e.style.height) && (t = parseFloat(e.style.height)), { after: (o) =>
|
|
202
|
+
return We.test(e.style.height) && (t = parseFloat(e.style.height)), { after: (o) => Ct(o, S), node: De(t) };
|
|
203
203
|
}
|
|
204
204
|
function De(n) {
|
|
205
|
-
return Be(new
|
|
205
|
+
return Be(new ge(n));
|
|
206
206
|
}
|
|
207
207
|
function k(n) {
|
|
208
|
-
return n instanceof
|
|
208
|
+
return n instanceof ge;
|
|
209
209
|
}
|
|
210
|
-
const Ie = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0,
|
|
211
|
-
function
|
|
210
|
+
const Ie = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, yn = Ie && "documentMode" in document ? document.documentMode : null, lt = Ie && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
211
|
+
function bn(n, e, t = !0) {
|
|
212
212
|
const o = qe();
|
|
213
|
-
for (let
|
|
213
|
+
for (let l = 0; l < n; l++) {
|
|
214
214
|
const s = De();
|
|
215
|
-
for (let
|
|
215
|
+
for (let r = 0; r < e; r++) {
|
|
216
216
|
let a = D.NO_STATUS;
|
|
217
|
-
typeof t == "object" ? (
|
|
218
|
-
const c =
|
|
217
|
+
typeof t == "object" ? (l === 0 && t.rows && (a |= D.ROW), r === 0 && t.columns && (a |= D.COLUMN)) : t && (l === 0 && (a |= D.ROW), r === 0 && (a |= D.COLUMN));
|
|
218
|
+
const c = fe(a), f = j();
|
|
219
219
|
f.append(He()), c.append(f), s.append(c);
|
|
220
220
|
}
|
|
221
221
|
o.append(s);
|
|
@@ -232,8 +232,8 @@ function xt(n) {
|
|
|
232
232
|
throw new Error("Expected table cell to be inside of table row.");
|
|
233
233
|
}
|
|
234
234
|
function Nn(n) {
|
|
235
|
-
const e = N(n, (t) =>
|
|
236
|
-
if (
|
|
235
|
+
const e = N(n, (t) => A(t));
|
|
236
|
+
if (A(e)) return e;
|
|
237
237
|
throw new Error("Expected table cell to be inside of table.");
|
|
238
238
|
}
|
|
239
239
|
function Yn(n) {
|
|
@@ -243,13 +243,13 @@ function Yn(n) {
|
|
|
243
243
|
function qn(n) {
|
|
244
244
|
return xt(n).getChildren().findIndex((e) => e.is(n));
|
|
245
245
|
}
|
|
246
|
-
Ie && "InputEvent" in window && !
|
|
246
|
+
Ie && "InputEvent" in window && !yn && new window.InputEvent("input");
|
|
247
247
|
function Un(n, e) {
|
|
248
248
|
const t = n.getChildren();
|
|
249
249
|
for (let o = 0; o < t.length; o++) {
|
|
250
|
-
const
|
|
251
|
-
if (k(
|
|
252
|
-
const s =
|
|
250
|
+
const l = t[o];
|
|
251
|
+
if (k(l)) {
|
|
252
|
+
const s = l.getChildren();
|
|
253
253
|
if (e >= s.length || e < 0) throw new Error("Table column target index out of range");
|
|
254
254
|
s[e].remove();
|
|
255
255
|
}
|
|
@@ -257,13 +257,13 @@ function Un(n, e) {
|
|
|
257
257
|
return n;
|
|
258
258
|
}
|
|
259
259
|
function U(n, e, t) {
|
|
260
|
-
const [o,
|
|
261
|
-
return
|
|
260
|
+
const [o, l, s] = Je(n, e, t);
|
|
261
|
+
return l === null && w(207), s === null && w(208), [o, l, s];
|
|
262
262
|
}
|
|
263
263
|
function Je(n, e, t) {
|
|
264
264
|
const o = [];
|
|
265
|
-
let
|
|
266
|
-
function
|
|
265
|
+
let l = null, s = null;
|
|
266
|
+
function r(c) {
|
|
267
267
|
let f = o[c];
|
|
268
268
|
return f === void 0 && (o[c] = f = []), f;
|
|
269
269
|
}
|
|
@@ -271,76 +271,76 @@ function Je(n, e, t) {
|
|
|
271
271
|
for (let c = 0; c < a.length; c++) {
|
|
272
272
|
const f = a[c];
|
|
273
273
|
k(f) || w(209);
|
|
274
|
-
const h =
|
|
275
|
-
for (let
|
|
276
|
-
for (S(
|
|
277
|
-
const i = { cell:
|
|
274
|
+
const h = r(c);
|
|
275
|
+
for (let p = f.getFirstChild(), C = 0; p != null; p = p.getNextSibling()) {
|
|
276
|
+
for (S(p) || w(147); h[C] !== void 0; ) C++;
|
|
277
|
+
const i = { cell: p, startColumn: C, startRow: c }, { __rowSpan: u, __colSpan: g } = p;
|
|
278
278
|
for (let d = 0; d < u && !(c + d >= a.length); d++) {
|
|
279
|
-
const m =
|
|
280
|
-
for (let _ = 0; _ < g; _++) m[
|
|
279
|
+
const m = r(c + d);
|
|
280
|
+
for (let _ = 0; _ < g; _++) m[C + _] = i;
|
|
281
281
|
}
|
|
282
|
-
e !== null &&
|
|
282
|
+
e !== null && l === null && e.is(p) && (l = i), t !== null && s === null && t.is(p) && (s = i);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
return [o,
|
|
285
|
+
return [o, l, s];
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function re(n) {
|
|
288
288
|
let e;
|
|
289
|
-
if (n instanceof
|
|
289
|
+
if (n instanceof ee) e = n;
|
|
290
290
|
else if ("__type" in n) {
|
|
291
|
-
const
|
|
292
|
-
S(
|
|
291
|
+
const l = N(n, S);
|
|
292
|
+
S(l) || w(148), e = l;
|
|
293
293
|
} else {
|
|
294
|
-
const
|
|
295
|
-
S(
|
|
294
|
+
const l = N(n.getNode(), S);
|
|
295
|
+
S(l) || w(148), e = l;
|
|
296
296
|
}
|
|
297
297
|
const t = e.getParent();
|
|
298
298
|
k(t) || w(149);
|
|
299
299
|
const o = t.getParent();
|
|
300
|
-
return
|
|
300
|
+
return A(o) || w(210), [e, t, o];
|
|
301
301
|
}
|
|
302
302
|
function $e(n, e, t) {
|
|
303
|
-
let o,
|
|
303
|
+
let o, l = Math.min(e.startColumn, t.startColumn), s = Math.min(e.startRow, t.startRow), r = Math.max(e.startColumn + e.cell.__colSpan - 1, t.startColumn + t.cell.__colSpan - 1), a = Math.max(e.startRow + e.cell.__rowSpan - 1, t.startRow + t.cell.__rowSpan - 1);
|
|
304
304
|
do {
|
|
305
305
|
o = !1;
|
|
306
306
|
for (let c = 0; c < n.length; c++) for (let f = 0; f < n[0].length; f++) {
|
|
307
307
|
const h = n[c][f];
|
|
308
308
|
if (!h) continue;
|
|
309
|
-
const
|
|
309
|
+
const p = h.startColumn + h.cell.__colSpan - 1, C = h.startRow + h.cell.__rowSpan - 1, i = h.startColumn <= r && p >= l, u = h.startRow <= a && C >= s;
|
|
310
310
|
if (i && u) {
|
|
311
|
-
const g = Math.min(
|
|
312
|
-
g ===
|
|
311
|
+
const g = Math.min(l, h.startColumn), d = Math.max(r, p), m = Math.min(s, h.startRow), _ = Math.max(a, C);
|
|
312
|
+
g === l && d === r && m === s && _ === a || (l = g, r = d, s = m, a = _, o = !0);
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
} while (o);
|
|
316
|
-
return { maxColumn:
|
|
316
|
+
return { maxColumn: r, maxRow: a, minColumn: l, minRow: s };
|
|
317
317
|
}
|
|
318
318
|
function st(n) {
|
|
319
|
-
const [e, , t] =
|
|
320
|
-
for (let a = 0; a <
|
|
321
|
-
for (let a = 0; a <
|
|
319
|
+
const [e, , t] = re(n), o = t.getChildren(), l = o.length, s = o[0].getChildren().length, r = new Array(l);
|
|
320
|
+
for (let a = 0; a < l; a++) r[a] = new Array(s);
|
|
321
|
+
for (let a = 0; a < l; a++) {
|
|
322
322
|
const c = o[a].getChildren();
|
|
323
323
|
let f = 0;
|
|
324
324
|
for (let h = 0; h < c.length; h++) {
|
|
325
|
-
for (;
|
|
326
|
-
const
|
|
327
|
-
for (let u = 0; u <
|
|
328
|
-
if (e ===
|
|
325
|
+
for (; r[a][f]; ) f++;
|
|
326
|
+
const p = c[h], C = p.__rowSpan || 1, i = p.__colSpan || 1;
|
|
327
|
+
for (let u = 0; u < C; u++) for (let g = 0; g < i; g++) r[a + u][f + g] = p;
|
|
328
|
+
if (e === p) return { colSpan: i, columnIndex: f, rowIndex: a, rowSpan: C };
|
|
329
329
|
f += i;
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
return null;
|
|
333
333
|
}
|
|
334
334
|
function it(n) {
|
|
335
|
-
const [[e, t, o,
|
|
336
|
-
const h = n[f].getNode(),
|
|
337
|
-
S(
|
|
338
|
-
const
|
|
339
|
-
k(
|
|
340
|
-
const i =
|
|
341
|
-
return
|
|
335
|
+
const [[e, t, o, l], [s, r, a, c]] = ["anchor", "focus"].map((f) => {
|
|
336
|
+
const h = n[f].getNode(), p = N(h, S);
|
|
337
|
+
S(p) || w(238, f, h.getKey(), h.getType());
|
|
338
|
+
const C = p.getParent();
|
|
339
|
+
k(C) || w(239, f);
|
|
340
|
+
const i = C.getParent();
|
|
341
|
+
return A(i) || w(240, f), [h, p, C, i];
|
|
342
342
|
});
|
|
343
|
-
return
|
|
343
|
+
return l.is(c) || w(241), { anchorCell: t, anchorNode: e, anchorRow: o, anchorTable: l, focusCell: r, focusNode: s, focusRow: a, focusTable: c };
|
|
344
344
|
}
|
|
345
345
|
class Te {
|
|
346
346
|
constructor(e, t, o) {
|
|
@@ -362,13 +362,13 @@ class Te {
|
|
|
362
362
|
this._cachedNodes = e;
|
|
363
363
|
}
|
|
364
364
|
is(e) {
|
|
365
|
-
return
|
|
365
|
+
return R(e) && this.tableKey === e.tableKey && this.anchor.is(e.anchor) && this.focus.is(e.focus);
|
|
366
366
|
}
|
|
367
367
|
set(e, t, o) {
|
|
368
368
|
this.dirty = this.dirty || e !== this.tableKey || t !== this.anchor.key || o !== this.focus.key, this.tableKey = e, this.anchor.key = t, this.focus.key = o, this._cachedNodes = null;
|
|
369
369
|
}
|
|
370
370
|
clone() {
|
|
371
|
-
return new Te(this.tableKey,
|
|
371
|
+
return new Te(this.tableKey, be(this.anchor.key, this.anchor.offset, this.anchor.type), be(this.focus.key, this.focus.offset, this.focus.type));
|
|
372
372
|
}
|
|
373
373
|
isCollapsed() {
|
|
374
374
|
return !1;
|
|
@@ -382,11 +382,11 @@ class Te {
|
|
|
382
382
|
}
|
|
383
383
|
hasFormat(e) {
|
|
384
384
|
let t = 0;
|
|
385
|
-
this.getNodes().filter(S).forEach((
|
|
386
|
-
const s =
|
|
385
|
+
this.getNodes().filter(S).forEach((l) => {
|
|
386
|
+
const s = l.getFirstChild();
|
|
387
387
|
Nt(s) && (t |= s.getTextFormat());
|
|
388
388
|
});
|
|
389
|
-
const o =
|
|
389
|
+
const o = pn[e];
|
|
390
390
|
return !!(t & o);
|
|
391
391
|
}
|
|
392
392
|
insertNodes(e) {
|
|
@@ -396,32 +396,32 @@ class Te {
|
|
|
396
396
|
getShape() {
|
|
397
397
|
const { anchorCell: e, focusCell: t } = it(this), o = st(e);
|
|
398
398
|
o === null && w(153);
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
const s = Math.min(o.columnIndex,
|
|
402
|
-
return { fromX: Math.min(s,
|
|
399
|
+
const l = st(t);
|
|
400
|
+
l === null && w(155);
|
|
401
|
+
const s = Math.min(o.columnIndex, l.columnIndex), r = Math.max(o.columnIndex + o.colSpan - 1, l.columnIndex + l.colSpan - 1), a = Math.min(o.rowIndex, l.rowIndex), c = Math.max(o.rowIndex + o.rowSpan - 1, l.rowIndex + l.rowSpan - 1);
|
|
402
|
+
return { fromX: Math.min(s, r), fromY: Math.min(a, c), toX: Math.max(s, r), toY: Math.max(a, c) };
|
|
403
403
|
}
|
|
404
404
|
getNodes() {
|
|
405
405
|
if (!this.isValid()) return [];
|
|
406
406
|
const e = this._cachedNodes;
|
|
407
407
|
if (e !== null) return e;
|
|
408
|
-
const { anchorTable: t, anchorCell: o, focusCell:
|
|
408
|
+
const { anchorTable: t, anchorCell: o, focusCell: l } = it(this), s = l.getParents()[1];
|
|
409
409
|
if (s !== t) {
|
|
410
|
-
if (t.isParentOf(
|
|
410
|
+
if (t.isParentOf(l)) {
|
|
411
411
|
const d = s.getParent();
|
|
412
|
-
d == null && w(159), this.set(this.tableKey,
|
|
412
|
+
d == null && w(159), this.set(this.tableKey, l.getKey(), d.getKey());
|
|
413
413
|
} else {
|
|
414
414
|
const d = t.getParent();
|
|
415
|
-
d == null && w(158), this.set(this.tableKey, d.getKey(),
|
|
415
|
+
d == null && w(158), this.set(this.tableKey, d.getKey(), l.getKey());
|
|
416
416
|
}
|
|
417
417
|
return this.getNodes();
|
|
418
418
|
}
|
|
419
|
-
const [
|
|
419
|
+
const [r, a, c] = U(t, o, l), { minColumn: f, maxColumn: h, minRow: p, maxRow: C } = $e(r, a, c), i = /* @__PURE__ */ new Map([[t.getKey(), t]]);
|
|
420
420
|
let u = null;
|
|
421
|
-
for (let d =
|
|
422
|
-
const { cell: _ } =
|
|
423
|
-
k(
|
|
424
|
-
i.set(
|
|
421
|
+
for (let d = p; d <= C; d++) for (let m = f; m <= h; m++) {
|
|
422
|
+
const { cell: _ } = r[d][m], y = _.getParent();
|
|
423
|
+
k(y) || w(160), y !== u && (i.set(y.getKey(), y), u = y), i.has(_.getKey()) || Tn(_, (b) => {
|
|
424
|
+
i.set(b.getKey(), b);
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
427
|
const g = Array.from(i.values());
|
|
@@ -431,41 +431,41 @@ class Te {
|
|
|
431
431
|
const e = this.getNodes().filter((o) => S(o));
|
|
432
432
|
let t = "";
|
|
433
433
|
for (let o = 0; o < e.length; o++) {
|
|
434
|
-
const
|
|
435
|
-
t +=
|
|
434
|
+
const l = e[o], s = l.__parent, r = (e[o + 1] || {}).__parent;
|
|
435
|
+
t += l.getTextContent() + (r !== s ? `
|
|
436
436
|
` : " ");
|
|
437
437
|
}
|
|
438
438
|
return t;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function R(n) {
|
|
442
442
|
return n instanceof Te;
|
|
443
443
|
}
|
|
444
444
|
function Tt() {
|
|
445
|
-
const n =
|
|
445
|
+
const n = be("root", 0, "element"), e = be("root", 0, "element");
|
|
446
446
|
return new Te("root", n, e);
|
|
447
447
|
}
|
|
448
448
|
function xn(n, e, t) {
|
|
449
449
|
n.getKey(), e.getKey(), t.getKey();
|
|
450
|
-
const o = L(),
|
|
451
|
-
return
|
|
450
|
+
const o = L(), l = R(o) ? o.clone() : Tt();
|
|
451
|
+
return l.set(n.getKey(), e.getKey(), t.getKey()), l;
|
|
452
452
|
}
|
|
453
453
|
function Tn(n, e) {
|
|
454
454
|
const t = [[n]];
|
|
455
455
|
for (let o = t.at(-1); o !== void 0 && t.length > 0; o = t.at(-1)) {
|
|
456
|
-
const
|
|
457
|
-
|
|
456
|
+
const l = o.pop();
|
|
457
|
+
l === void 0 ? t.pop() : e(l) !== !1 && P(l) && t.push(l.getChildren());
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
function Ft(n, e = St()) {
|
|
461
|
-
const t =
|
|
462
|
-
|
|
463
|
-
const o =
|
|
461
|
+
const t = ye(n);
|
|
462
|
+
A(t) || w(231, n);
|
|
463
|
+
const o = G(t, e.getElementByKey(n));
|
|
464
464
|
return o === null && w(232, n), { tableElement: o, tableNode: t };
|
|
465
465
|
}
|
|
466
466
|
class Fn {
|
|
467
467
|
constructor(e, t) {
|
|
468
|
-
this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.listenersToRemove = /* @__PURE__ */ new Set(), this.tableNodeKey = t, this.editor = e, this.table = { columns: 0, domRows: [], rows: 0 }, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.isSelecting = !1, this.shouldCheckSelection = !1, this.abortController = new AbortController(), this.listenerOptions = { signal: this.abortController.signal }, this.nextFocus = null, this.trackTable();
|
|
468
|
+
this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.listenersToRemove = /* @__PURE__ */ new Set(), this.tableNodeKey = t, this.editor = e, this.table = { columns: 0, domRows: [], rows: 0 }, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.isSelecting = !1, this.pointerType = null, this.shouldCheckSelection = !1, this.abortController = new AbortController(), this.listenerOptions = { signal: this.abortController.signal }, this.nextFocus = null, this.trackTable();
|
|
469
469
|
}
|
|
470
470
|
getTable() {
|
|
471
471
|
return this.table;
|
|
@@ -480,32 +480,32 @@ class Fn {
|
|
|
480
480
|
const e = new MutationObserver((t) => {
|
|
481
481
|
this.editor.getEditorState().read(() => {
|
|
482
482
|
let o = !1;
|
|
483
|
-
for (let
|
|
484
|
-
const a = t[
|
|
483
|
+
for (let r = 0; r < t.length; r++) {
|
|
484
|
+
const a = t[r].target.nodeName;
|
|
485
485
|
if (a === "TABLE" || a === "TBODY" || a === "THEAD" || a === "TR") {
|
|
486
486
|
o = !0;
|
|
487
487
|
break;
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
if (!o) return;
|
|
491
|
-
const { tableNode:
|
|
492
|
-
this.table =
|
|
491
|
+
const { tableNode: l, tableElement: s } = this.$lookup();
|
|
492
|
+
this.table = le(l, s);
|
|
493
493
|
}, { editor: this.editor });
|
|
494
494
|
});
|
|
495
495
|
this.editor.getEditorState().read(() => {
|
|
496
496
|
const { tableNode: t, tableElement: o } = this.$lookup();
|
|
497
|
-
this.table =
|
|
497
|
+
this.table = le(t, o), e.observe(o, { attributes: !0, childList: !0, subtree: !0 });
|
|
498
498
|
}, { editor: this.editor });
|
|
499
499
|
}
|
|
500
500
|
$clearHighlight() {
|
|
501
501
|
const e = this.editor;
|
|
502
502
|
this.isHighlightingCells = !1, this.anchorX = -1, this.anchorY = -1, this.focusX = -1, this.focusY = -1, this.tableSelection = null, this.anchorCellNodeKey = null, this.focusCellNodeKey = null, this.anchorCell = null, this.focusCell = null, this.hasHijackedSelectionStyles = !1, this.$enableHighlightStyle();
|
|
503
503
|
const { tableNode: t, tableElement: o } = this.$lookup();
|
|
504
|
-
Ce(e,
|
|
504
|
+
Ce(e, le(t, o), null), L() !== null && (q(null), e.dispatchCommand(oe, void 0));
|
|
505
505
|
}
|
|
506
506
|
$enableHighlightStyle() {
|
|
507
507
|
const e = this.editor, { tableElement: t } = this.$lookup();
|
|
508
|
-
|
|
508
|
+
ie(t, e._config.theme.tableSelection), t.classList.remove("disable-selection"), this.hasHijackedSelectionStyles = !1;
|
|
509
509
|
}
|
|
510
510
|
$disableHighlightStyle() {
|
|
511
511
|
const { tableElement: e } = this.$lookup();
|
|
@@ -538,25 +538,25 @@ class Fn {
|
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
$setFocusCellForSelection(e, t = !1) {
|
|
541
|
-
const o = this.editor, { tableNode:
|
|
542
|
-
if (this.focusCell = e, this.isHighlightingCells || this.anchorX === s && this.anchorY ===
|
|
543
|
-
if (s === this.focusX &&
|
|
541
|
+
const o = this.editor, { tableNode: l } = this.$lookup(), s = e.x, r = e.y;
|
|
542
|
+
if (this.focusCell = e, this.isHighlightingCells || this.anchorX === s && this.anchorY === r && !t) {
|
|
543
|
+
if (s === this.focusX && r === this.focusY) return !1;
|
|
544
544
|
} else this.isHighlightingCells = !0, this.$disableHighlightStyle();
|
|
545
|
-
if (this.focusX = s, this.focusY =
|
|
546
|
-
const a = ze(
|
|
547
|
-
if (this.tableSelection != null && this.anchorCellNodeKey != null && a !== null) return this.focusCellNodeKey = a.getKey(), this.tableSelection = xn(
|
|
545
|
+
if (this.focusX = s, this.focusY = r, this.isHighlightingCells) {
|
|
546
|
+
const a = ze(l, e.elem);
|
|
547
|
+
if (this.tableSelection != null && this.anchorCellNodeKey != null && a !== null) return this.focusCellNodeKey = a.getKey(), this.tableSelection = xn(l, this.$getAnchorTableCellOrThrow(), a), q(this.tableSelection), o.dispatchCommand(oe, void 0), Ce(o, this.table, this.tableSelection), !0;
|
|
548
548
|
}
|
|
549
549
|
return !1;
|
|
550
550
|
}
|
|
551
551
|
$getAnchorTableCell() {
|
|
552
|
-
return this.anchorCellNodeKey ?
|
|
552
|
+
return this.anchorCellNodeKey ? ye(this.anchorCellNodeKey) : null;
|
|
553
553
|
}
|
|
554
554
|
$getAnchorTableCellOrThrow() {
|
|
555
555
|
const e = this.$getAnchorTableCell();
|
|
556
556
|
return e === null && w(234), e;
|
|
557
557
|
}
|
|
558
558
|
$getFocusTableCell() {
|
|
559
|
-
return this.focusCellNodeKey ?
|
|
559
|
+
return this.focusCellNodeKey ? ye(this.focusCellNodeKey) : null;
|
|
560
560
|
}
|
|
561
561
|
$getFocusTableCellOrThrow() {
|
|
562
562
|
const e = this.$getFocusTableCell();
|
|
@@ -566,43 +566,43 @@ class Fn {
|
|
|
566
566
|
this.isHighlightingCells = !1, this.anchorCell = e, this.anchorX = e.x, this.anchorY = e.y;
|
|
567
567
|
const { tableNode: t } = this.$lookup(), o = ze(t, e.elem);
|
|
568
568
|
if (o !== null) {
|
|
569
|
-
const
|
|
570
|
-
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : Tt(), this.anchorCellNodeKey =
|
|
569
|
+
const l = o.getKey();
|
|
570
|
+
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : Tt(), this.anchorCellNodeKey = l;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
$formatCells(e) {
|
|
574
574
|
const t = L();
|
|
575
|
-
|
|
576
|
-
const o = ln(),
|
|
577
|
-
|
|
578
|
-
const a =
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}), q(t), this.editor.dispatchCommand(
|
|
575
|
+
R(t) || w(236);
|
|
576
|
+
const o = ln(), l = o.anchor, s = o.focus, r = t.getNodes().filter(S);
|
|
577
|
+
r.length > 0 || w(237);
|
|
578
|
+
const a = r[0].getFirstChild(), c = Nt(a) ? a.getFormatFlags(e, null) : null;
|
|
579
|
+
r.forEach((f) => {
|
|
580
|
+
l.set(f.getKey(), 0, "element"), s.set(f.getKey(), f.getChildrenSize(), "element"), o.formatText(e, c);
|
|
581
|
+
}), q(t), this.editor.dispatchCommand(oe, void 0);
|
|
582
582
|
}
|
|
583
583
|
$clearText() {
|
|
584
|
-
const { editor: e } = this, t =
|
|
585
|
-
if (!
|
|
584
|
+
const { editor: e } = this, t = ye(this.tableNodeKey);
|
|
585
|
+
if (!A(t)) throw new Error("Expected TableNode.");
|
|
586
586
|
const o = L();
|
|
587
|
-
|
|
588
|
-
const
|
|
589
|
-
if (
|
|
587
|
+
R(o) || w(253);
|
|
588
|
+
const l = o.getNodes().filter(S);
|
|
589
|
+
if (l.length === this.table.columns * this.table.rows) {
|
|
590
590
|
t.selectPrevious();
|
|
591
591
|
const s = t.getParent();
|
|
592
|
-
return t.remove(), void (sn(s) && s.isEmpty() && e.dispatchCommand(
|
|
592
|
+
return t.remove(), void (sn(s) && s.isEmpty() && e.dispatchCommand(bt, void 0));
|
|
593
593
|
}
|
|
594
|
-
|
|
594
|
+
l.forEach((s) => {
|
|
595
595
|
if (P(s)) {
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
c !==
|
|
596
|
+
const r = j(), a = He();
|
|
597
|
+
r.append(a), s.append(r), s.getChildren().forEach((c) => {
|
|
598
|
+
c !== r && c.remove();
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
|
-
}), Ce(e, this.table, null), q(null), e.dispatchCommand(
|
|
601
|
+
}), Ce(e, this.table, null), q(null), e.dispatchCommand(oe, void 0);
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
604
|
const Me = "__lexicalTableSelection", vn = (n) => !(1 & ~n.buttons);
|
|
605
|
-
function
|
|
605
|
+
function G(n, e) {
|
|
606
606
|
if (!e) return e;
|
|
607
607
|
const t = e.nodeName === "TABLE" ? e : n.getDOMSlot(e).element;
|
|
608
608
|
return t.nodeName !== "TABLE" && w(245, e.nodeName), t;
|
|
@@ -610,151 +610,151 @@ function Q(n, e) {
|
|
|
610
610
|
function Xe(n) {
|
|
611
611
|
return n._window;
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function he(n, e) {
|
|
614
614
|
for (let t = e, o = null; t !== null; t = t.getParent()) {
|
|
615
615
|
if (n.is(t)) return o;
|
|
616
616
|
S(t) && (o = t);
|
|
617
617
|
}
|
|
618
618
|
return null;
|
|
619
619
|
}
|
|
620
|
-
const Rn = [[It, "down"], [Jt, "up"], [Xt, "backward"], [Yt, "forward"]], Kn = [Ut,
|
|
620
|
+
const Rn = [[It, "down"], [Jt, "up"], [Xt, "backward"], [Yt, "forward"]], Kn = [Ut, yt, jt], An = [Vt, Qt];
|
|
621
621
|
function On(n, e, t, o) {
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
const
|
|
622
|
+
const l = t.getRootElement(), s = Xe(t);
|
|
623
|
+
l !== null && s !== null || w(246);
|
|
624
|
+
const r = new Fn(t, n.getKey()), a = G(n, e);
|
|
625
625
|
(function(i, u) {
|
|
626
626
|
at(i) !== null && w(205), i[Me] = u;
|
|
627
|
-
})(a,
|
|
627
|
+
})(a, r), r.listenersToRemove.add(() => function(i, u) {
|
|
628
628
|
at(i) === u && delete i[Me];
|
|
629
|
-
}(a,
|
|
629
|
+
}(a, r));
|
|
630
630
|
const c = (i) => {
|
|
631
|
-
if (i.button !== 0 || !
|
|
631
|
+
if (r.pointerType = i.pointerType, i.button !== 0 || !ue(i.target) || !s) return;
|
|
632
632
|
const u = Ne(i.target);
|
|
633
633
|
u !== null && t.update(() => {
|
|
634
634
|
const g = Ze();
|
|
635
|
-
if (lt && i.shiftKey && J(g, n) && (z(g) ||
|
|
636
|
-
const d = g.anchor.getNode(), m =
|
|
637
|
-
m ? (
|
|
638
|
-
} else
|
|
635
|
+
if (lt && i.shiftKey && J(g, n) && (z(g) || R(g))) {
|
|
636
|
+
const d = g.anchor.getNode(), m = he(n, g.anchor.getNode());
|
|
637
|
+
m ? (r.$setAnchorCellForSelection(Q(r, m)), r.$setFocusCellForSelection(u), Y(i)) : (n.isBefore(d) ? n.selectStart() : n.selectEnd()).anchor.set(g.anchor.key, g.anchor.offset, g.anchor.type);
|
|
638
|
+
} else r.$setAnchorCellForSelection(u);
|
|
639
639
|
}), (() => {
|
|
640
|
-
if (
|
|
640
|
+
if (r.isSelecting) return;
|
|
641
641
|
const g = () => {
|
|
642
|
-
|
|
642
|
+
r.isSelecting = !1, s.removeEventListener("pointerup", g), s.removeEventListener("pointermove", d);
|
|
643
643
|
}, d = (m) => {
|
|
644
|
-
if (!vn(m) &&
|
|
645
|
-
if (!
|
|
644
|
+
if (!vn(m) && r.isSelecting) return r.isSelecting = !1, s.removeEventListener("pointerup", g), void s.removeEventListener("pointermove", d);
|
|
645
|
+
if (!ue(m.target)) return;
|
|
646
646
|
let _ = null;
|
|
647
|
-
const
|
|
648
|
-
if (
|
|
649
|
-
else for (const
|
|
650
|
-
!_ ||
|
|
647
|
+
const y = !(lt || a.contains(m.target));
|
|
648
|
+
if (y) _ = ct(a, m.target);
|
|
649
|
+
else for (const b of document.elementsFromPoint(m.clientX, m.clientY)) if (_ = ct(a, b), _) break;
|
|
650
|
+
!_ || r.focusCell !== null && _.elem === r.focusCell.elem || (r.setNextFocus({ focusCell: _, override: y }), t.dispatchCommand(oe, void 0));
|
|
651
651
|
};
|
|
652
|
-
|
|
652
|
+
r.isSelecting = !0, s.addEventListener("pointerup", g, r.listenerOptions), s.addEventListener("pointermove", d, r.listenerOptions);
|
|
653
653
|
})();
|
|
654
654
|
};
|
|
655
|
-
a.addEventListener("
|
|
656
|
-
a.removeEventListener("
|
|
655
|
+
a.addEventListener("pointerdown", c, r.listenerOptions), r.listenersToRemove.add(() => {
|
|
656
|
+
a.removeEventListener("pointerdown", c);
|
|
657
657
|
});
|
|
658
658
|
const f = (i) => {
|
|
659
|
-
i.detail >= 3 &&
|
|
659
|
+
i.detail >= 3 && ue(i.target) && Ne(i.target) !== null && i.preventDefault();
|
|
660
660
|
};
|
|
661
|
-
a.addEventListener("mousedown", f,
|
|
661
|
+
a.addEventListener("mousedown", f, r.listenerOptions), r.listenersToRemove.add(() => {
|
|
662
662
|
a.removeEventListener("mousedown", f);
|
|
663
663
|
});
|
|
664
664
|
const h = (i) => {
|
|
665
665
|
const u = i.target;
|
|
666
|
-
i.button === 0 &&
|
|
666
|
+
i.button === 0 && ue(u) && t.update(() => {
|
|
667
667
|
const g = L();
|
|
668
|
-
|
|
668
|
+
R(g) && g.tableKey === r.tableNodeKey && l.contains(u) && r.$clearHighlight();
|
|
669
669
|
});
|
|
670
670
|
};
|
|
671
|
-
s.addEventListener("
|
|
672
|
-
s.removeEventListener("
|
|
671
|
+
s.addEventListener("pointerdown", h, r.listenerOptions), r.listenersToRemove.add(() => {
|
|
672
|
+
s.removeEventListener("pointerdown", h);
|
|
673
673
|
});
|
|
674
|
-
for (const [i, u] of Rn)
|
|
675
|
-
|
|
674
|
+
for (const [i, u] of Rn) r.listenersToRemove.add(t.registerCommand(i, (g) => Kt(t, g, u, n, r), Ae));
|
|
675
|
+
r.listenersToRemove.add(t.registerCommand(qt, (i) => {
|
|
676
676
|
const u = L();
|
|
677
|
-
if (
|
|
678
|
-
const g =
|
|
677
|
+
if (R(u)) {
|
|
678
|
+
const g = he(n, u.focus.getNode());
|
|
679
679
|
if (g !== null) return Y(i), g.selectEnd(), !0;
|
|
680
680
|
}
|
|
681
681
|
return !1;
|
|
682
682
|
}, Ae));
|
|
683
|
-
const
|
|
683
|
+
const p = (i) => () => {
|
|
684
684
|
const u = L();
|
|
685
685
|
if (!J(u, n)) return !1;
|
|
686
|
-
if (
|
|
686
|
+
if (R(u)) return r.$clearText(), !0;
|
|
687
687
|
if (z(u)) {
|
|
688
|
-
if (!S(
|
|
688
|
+
if (!S(he(n, u.anchor.getNode()))) return !1;
|
|
689
689
|
const g = u.anchor.getNode(), d = u.focus.getNode(), m = n.isParentOf(g), _ = n.isParentOf(d);
|
|
690
|
-
if (m && !_ || _ && !m) return
|
|
691
|
-
const
|
|
692
|
-
if (!P(
|
|
693
|
-
if (i ===
|
|
690
|
+
if (m && !_ || _ && !m) return r.$clearText(), !0;
|
|
691
|
+
const y = N(u.anchor.getNode(), (x) => P(x)), b = y && N(y, (x) => P(x) && S(x.getParent()));
|
|
692
|
+
if (!P(b) || !P(y)) return !1;
|
|
693
|
+
if (i === yt && b.getPreviousSibling() === null) return !0;
|
|
694
694
|
}
|
|
695
695
|
return !1;
|
|
696
696
|
};
|
|
697
|
-
for (const i of Kn)
|
|
698
|
-
const
|
|
697
|
+
for (const i of Kn) r.listenersToRemove.add(t.registerCommand(i, p(i), I));
|
|
698
|
+
const C = (i) => {
|
|
699
699
|
const u = L();
|
|
700
|
-
if (!
|
|
700
|
+
if (!R(u) && !z(u)) return !1;
|
|
701
701
|
const g = n.isParentOf(u.anchor.getNode());
|
|
702
702
|
if (g !== n.isParentOf(u.focus.getNode())) {
|
|
703
|
-
const d = g ? "anchor" : "focus", m = g ? "focus" : "anchor", { key: _, offset:
|
|
704
|
-
return n[u[d].isBefore(u[m]) ? "selectPrevious" : "selectNext"]()[m].set(_,
|
|
703
|
+
const d = g ? "anchor" : "focus", m = g ? "focus" : "anchor", { key: _, offset: y, type: b } = u[m];
|
|
704
|
+
return n[u[d].isBefore(u[m]) ? "selectPrevious" : "selectNext"]()[m].set(_, y, b), !1;
|
|
705
705
|
}
|
|
706
|
-
return !!J(u, n) && !!
|
|
706
|
+
return !!J(u, n) && !!R(u) && (i && (i.preventDefault(), i.stopPropagation()), r.$clearText(), !0);
|
|
707
707
|
};
|
|
708
|
-
for (const i of An)
|
|
709
|
-
return
|
|
708
|
+
for (const i of An) r.listenersToRemove.add(t.registerCommand(i, C, I));
|
|
709
|
+
return r.listenersToRemove.add(t.registerCommand(Gt, (i) => {
|
|
710
710
|
const u = L();
|
|
711
711
|
if (u) {
|
|
712
|
-
if (!
|
|
713
|
-
|
|
714
|
-
const g =
|
|
712
|
+
if (!R(u) && !z(u)) return !1;
|
|
713
|
+
Cn(t, Pt(i, ClipboardEvent) ? i : null, _n(u));
|
|
714
|
+
const g = C(i);
|
|
715
715
|
return z(u) ? (u.removeText(), !0) : g;
|
|
716
716
|
}
|
|
717
717
|
return !1;
|
|
718
|
-
}, I)),
|
|
718
|
+
}, I)), r.listenersToRemove.add(t.registerCommand(Zt, (i) => {
|
|
719
719
|
const u = L();
|
|
720
720
|
if (!J(u, n)) return !1;
|
|
721
|
-
if (
|
|
721
|
+
if (R(u)) return r.$formatCells(i), !0;
|
|
722
722
|
if (z(u)) {
|
|
723
723
|
const g = N(u.anchor.getNode(), (d) => S(d));
|
|
724
724
|
if (!S(g)) return !1;
|
|
725
725
|
}
|
|
726
726
|
return !1;
|
|
727
|
-
}, I)),
|
|
727
|
+
}, I)), r.listenersToRemove.add(t.registerCommand(en, (i) => {
|
|
728
728
|
const u = L();
|
|
729
|
-
if (!
|
|
729
|
+
if (!R(u) || !J(u, n)) return !1;
|
|
730
730
|
const g = u.anchor.getNode(), d = u.focus.getNode();
|
|
731
731
|
if (!S(g) || !S(d)) return !1;
|
|
732
|
-
if (function(
|
|
733
|
-
if (
|
|
734
|
-
const
|
|
735
|
-
if (O &&
|
|
736
|
-
const [M] = U(O,
|
|
737
|
-
return
|
|
732
|
+
if (function(T, O) {
|
|
733
|
+
if (R(T)) {
|
|
734
|
+
const F = T.anchor.getNode(), K = T.focus.getNode();
|
|
735
|
+
if (O && F && K) {
|
|
736
|
+
const [M] = U(O, F, K);
|
|
737
|
+
return F.getKey() === M[0][0].cell.getKey() && K.getKey() === M[M.length - 1].at(-1).cell.getKey();
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
740
|
return !1;
|
|
741
741
|
}(u, n)) return n.setFormat(i), !0;
|
|
742
|
-
const [m, _,
|
|
743
|
-
for (let
|
|
744
|
-
const
|
|
745
|
-
if (E.has(
|
|
746
|
-
E.add(
|
|
747
|
-
const
|
|
748
|
-
for (let M = 0; M <
|
|
749
|
-
const B =
|
|
742
|
+
const [m, _, y] = U(n, g, d), b = Math.max(_.startRow + _.cell.__rowSpan - 1, y.startRow + y.cell.__rowSpan - 1), x = Math.max(_.startColumn + _.cell.__colSpan - 1, y.startColumn + y.cell.__colSpan - 1), v = Math.min(_.startRow, y.startRow), $ = Math.min(_.startColumn, y.startColumn), E = /* @__PURE__ */ new Set();
|
|
743
|
+
for (let T = v; T <= b; T++) for (let O = $; O <= x; O++) {
|
|
744
|
+
const F = m[T][O].cell;
|
|
745
|
+
if (E.has(F)) continue;
|
|
746
|
+
E.add(F), F.setFormat(i);
|
|
747
|
+
const K = F.getChildren();
|
|
748
|
+
for (let M = 0; M < K.length; M++) {
|
|
749
|
+
const B = K[M];
|
|
750
750
|
P(B) && !B.isInline() && B.setFormat(i);
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
753
|
return !0;
|
|
754
|
-
}, I)),
|
|
754
|
+
}, I)), r.listenersToRemove.add(t.registerCommand(tn, (i) => {
|
|
755
755
|
const u = L();
|
|
756
756
|
if (!J(u, n)) return !1;
|
|
757
|
-
if (
|
|
757
|
+
if (R(u)) return r.$clearHighlight(), !1;
|
|
758
758
|
if (z(u)) {
|
|
759
759
|
const g = N(u.anchor.getNode(), (d) => S(d));
|
|
760
760
|
if (!S(g)) return !1;
|
|
@@ -764,98 +764,101 @@ function On(n, e, t, o) {
|
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
766
|
return !1;
|
|
767
|
-
}, I)), o &&
|
|
767
|
+
}, I)), o && r.listenersToRemove.add(t.registerCommand(nn, (i) => {
|
|
768
768
|
const u = L();
|
|
769
769
|
if (!z(u) || !u.isCollapsed() || !J(u, n)) return !1;
|
|
770
|
-
const g =
|
|
771
|
-
return !(g === null || !n.is(
|
|
772
|
-
const _ = m === "next" ? "getNextSibling" : "getPreviousSibling",
|
|
773
|
-
if (P(
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
for (let $ =
|
|
777
|
-
const E = $[
|
|
770
|
+
const g = ce(u.anchor.getNode());
|
|
771
|
+
return !(g === null || !n.is(se(g))) && (Y(i), function(d, m) {
|
|
772
|
+
const _ = m === "next" ? "getNextSibling" : "getPreviousSibling", y = m === "next" ? "getFirstChild" : "getLastChild", b = d[_]();
|
|
773
|
+
if (P(b)) return b.selectEnd();
|
|
774
|
+
const x = N(d, k);
|
|
775
|
+
x === null && w(247);
|
|
776
|
+
for (let $ = x[_](); k($); $ = $[_]()) {
|
|
777
|
+
const E = $[y]();
|
|
778
778
|
if (P(E)) return E.selectEnd();
|
|
779
779
|
}
|
|
780
|
-
const
|
|
781
|
-
|
|
780
|
+
const v = N(x, A);
|
|
781
|
+
v === null && w(248), m === "next" ? v.selectNext() : v.selectPrevious();
|
|
782
782
|
}(g, i.shiftKey ? "previous" : "next"), !0);
|
|
783
|
-
}, I)),
|
|
784
|
-
const { nodes: u, selection: g } = i, d = g.getStartEndPoints(), m =
|
|
785
|
-
if (u.length !== 1 || !
|
|
786
|
-
const [
|
|
787
|
-
if (!S(E) || !k(
|
|
788
|
-
const
|
|
783
|
+
}, I)), r.listenersToRemove.add(t.registerCommand(on, (i) => n.isSelected(), Ae)), r.listenersToRemove.add(t.registerCommand(wt, (i) => {
|
|
784
|
+
const { nodes: u, selection: g } = i, d = g.getStartEndPoints(), m = R(g), _ = z(g) && N(g.anchor.getNode(), (H) => S(H)) !== null && N(g.focus.getNode(), (H) => S(H)) !== null || m;
|
|
785
|
+
if (u.length !== 1 || !A(u[0]) || !_ || d === null) return !1;
|
|
786
|
+
const [y] = d, b = u[0], x = b.getChildren(), v = b.getFirstChildOrThrow().getChildrenSize(), $ = b.getChildrenSize(), E = N(y.getNode(), (H) => S(H)), T = E && N(E, (H) => k(H)), O = T && N(T, (H) => A(H));
|
|
787
|
+
if (!S(E) || !k(T) || !A(O)) return !1;
|
|
788
|
+
const F = T.getIndexWithinParent(), K = Math.min(O.getChildrenSize() - 1, F + $ - 1), M = E.getIndexWithinParent(), B = Math.min(T.getChildrenSize() - 1, M + v - 1), ae = Math.min(M, B), Fe = Math.min(F, K), ve = Math.max(M, B), W = Math.max(F, K), Ot = O.getChildren();
|
|
789
789
|
let Ue = 0;
|
|
790
790
|
for (let H = Fe; H <= W; H++) {
|
|
791
791
|
const je = Ot[H];
|
|
792
792
|
if (!k(je)) return !1;
|
|
793
|
-
const Ve =
|
|
793
|
+
const Ve = x[Ue];
|
|
794
794
|
if (!k(Ve)) return !1;
|
|
795
795
|
const Et = je.getChildren(), kt = Ve.getChildren();
|
|
796
796
|
let Qe = 0;
|
|
797
|
-
for (let Re =
|
|
798
|
-
const
|
|
799
|
-
if (!S(
|
|
797
|
+
for (let Re = ae; Re <= ve; Re++) {
|
|
798
|
+
const me = Et[Re];
|
|
799
|
+
if (!S(me)) return !1;
|
|
800
800
|
const Ge = kt[Qe];
|
|
801
801
|
if (!S(Ge)) return !1;
|
|
802
|
-
const $t =
|
|
803
|
-
Ge.getChildren().forEach((
|
|
804
|
-
|
|
805
|
-
}), $t.forEach((
|
|
802
|
+
const $t = me.getChildren();
|
|
803
|
+
Ge.getChildren().forEach((te) => {
|
|
804
|
+
de(te) && j().append(te), me.append(te);
|
|
805
|
+
}), $t.forEach((te) => te.remove()), Qe++;
|
|
806
806
|
}
|
|
807
807
|
Ue++;
|
|
808
808
|
}
|
|
809
809
|
return !0;
|
|
810
|
-
}, I)),
|
|
811
|
-
const i = L(), u = Ze(), g =
|
|
810
|
+
}, I)), r.listenersToRemove.add(t.registerCommand(oe, () => {
|
|
811
|
+
const i = L(), u = Ze(), g = r.getAndClearNextFocus();
|
|
812
812
|
if (g !== null) {
|
|
813
813
|
const { focusCell: d } = g;
|
|
814
|
-
if (
|
|
815
|
-
if (d !==
|
|
814
|
+
if (R(i) && i.tableKey === r.tableNodeKey) return (d.x !== r.focusX || d.y !== r.focusY) && (r.$setFocusCellForSelection(d), !0);
|
|
815
|
+
if (d !== r.anchorCell && J(i, n)) return r.$setFocusCellForSelection(d), !0;
|
|
816
816
|
}
|
|
817
|
-
if (
|
|
818
|
-
const d = i.anchor.getNode(), m = n.getFirstChild(), _ =
|
|
817
|
+
if (r.getAndClearShouldCheckSelection() && z(u) && z(i) && i.isCollapsed()) {
|
|
818
|
+
const d = i.anchor.getNode(), m = n.getFirstChild(), _ = ce(d);
|
|
819
819
|
if (_ !== null && k(m)) {
|
|
820
|
-
const
|
|
821
|
-
if (S(
|
|
820
|
+
const y = m.getFirstChild();
|
|
821
|
+
if (S(y) && n.is(N(_, (b) => b.is(n) || b.is(y)))) return y.selectStart(), !0;
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
824
|
if (z(i)) {
|
|
825
|
-
const { anchor: d, focus: m } = i, _ = d.getNode(),
|
|
825
|
+
const { anchor: d, focus: m } = i, _ = d.getNode(), y = m.getNode(), b = ce(_), x = ce(y), v = !(!b || !n.is(se(b))), $ = !(!x || !n.is(se(x))), E = v !== $, T = v && $, O = i.isBackward();
|
|
826
826
|
if (E) {
|
|
827
|
-
const
|
|
827
|
+
const F = i.clone();
|
|
828
828
|
if ($) {
|
|
829
|
-
const [
|
|
830
|
-
|
|
831
|
-
} else if (
|
|
832
|
-
const [
|
|
833
|
-
|
|
829
|
+
const [K] = U(n, x, x), M = K[0][0].cell, B = K[K.length - 1].at(-1).cell;
|
|
830
|
+
F.focus.set(O ? M.getKey() : B.getKey(), O ? M.getChildrenSize() : B.getChildrenSize(), "element");
|
|
831
|
+
} else if (v) {
|
|
832
|
+
const [K] = U(n, b, b), M = K[0][0].cell, B = K[K.length - 1].at(-1).cell;
|
|
833
|
+
F.anchor.set(O ? B.getKey() : M.getKey(), O ? B.getChildrenSize() : 0, "element");
|
|
834
834
|
}
|
|
835
|
-
q(
|
|
836
|
-
} else
|
|
837
|
-
|
|
835
|
+
q(F), ut(t, r);
|
|
836
|
+
} else if (T && (b.is(x) || (r.$setAnchorCellForSelection(Q(r, b)), r.$setFocusCellForSelection(Q(r, x), !0)), r.pointerType === "touch" && i.isCollapsed() && z(u) && u.isCollapsed())) {
|
|
837
|
+
const F = ce(u.anchor.getNode());
|
|
838
|
+
F && !F.is(x) && (r.$setAnchorCellForSelection(Q(r, F)), r.$setFocusCellForSelection(Q(r, x), !0), r.pointerType = null);
|
|
839
|
+
}
|
|
840
|
+
} else if (i && R(i) && i.is(u) && i.tableKey === n.getKey()) {
|
|
838
841
|
const d = xe(s);
|
|
839
842
|
if (d && d.anchorNode && d.focusNode) {
|
|
840
|
-
const m = V(d.focusNode), _ = m && !n.isParentOf(m),
|
|
841
|
-
if (_ &&
|
|
842
|
-
const
|
|
843
|
-
|
|
843
|
+
const m = V(d.focusNode), _ = m && !n.isParentOf(m), y = V(d.anchorNode), b = y && n.isParentOf(y);
|
|
844
|
+
if (_ && b && d.rangeCount > 0) {
|
|
845
|
+
const x = rn(d, t);
|
|
846
|
+
x && (x.anchor.set(n.getKey(), i.isBackward() ? n.getChildrenSize() : 0, "element"), d.removeAllRanges(), q(x));
|
|
844
847
|
}
|
|
845
848
|
}
|
|
846
849
|
}
|
|
847
|
-
return i && !i.is(u) && (
|
|
850
|
+
return i && !i.is(u) && (R(i) || R(u)) && r.tableSelection && !r.tableSelection.is(u) ? (R(i) && i.tableKey === r.tableNodeKey ? r.$updateTableTableSelection(i) : !R(i) && R(u) && u.tableKey === r.tableNodeKey && r.$updateTableTableSelection(null), !1) : (r.hasHijackedSelectionStyles && !n.isSelected() ? function(d, m) {
|
|
848
851
|
m.$enableHighlightStyle(), Ye(m.table, (_) => {
|
|
849
|
-
const
|
|
850
|
-
_.highlighted = !1, Rt(d, _),
|
|
852
|
+
const y = _.elem;
|
|
853
|
+
_.highlighted = !1, Rt(d, _), y.getAttribute("style") || y.removeAttribute("style");
|
|
851
854
|
});
|
|
852
|
-
}(t,
|
|
853
|
-
}, I)),
|
|
855
|
+
}(t, r) : !r.hasHijackedSelectionStyles && n.isSelected() && ut(t, r), !1);
|
|
856
|
+
}, I)), r.listenersToRemove.add(t.registerCommand(bt, () => {
|
|
854
857
|
const i = L();
|
|
855
858
|
if (!z(i) || !i.isCollapsed() || !J(i, n)) return !1;
|
|
856
859
|
const u = dt(t, i, n);
|
|
857
860
|
return !!u && (ht(u, n), !0);
|
|
858
|
-
}, I)),
|
|
861
|
+
}, I)), r;
|
|
859
862
|
}
|
|
860
863
|
function at(n) {
|
|
861
864
|
return n[Me] || null;
|
|
@@ -877,58 +880,58 @@ function ct(n, e) {
|
|
|
877
880
|
let t = null;
|
|
878
881
|
for (let o = e; o != null; o = o.parentNode) {
|
|
879
882
|
if (o === n) return t;
|
|
880
|
-
const
|
|
881
|
-
|
|
883
|
+
const l = o.nodeName;
|
|
884
|
+
l !== "TD" && l !== "TH" || (t = o._cell || null);
|
|
882
885
|
}
|
|
883
886
|
return null;
|
|
884
887
|
}
|
|
885
|
-
function
|
|
888
|
+
function le(n, e) {
|
|
886
889
|
const t = [], o = { columns: 0, domRows: t, rows: 0 };
|
|
887
|
-
let
|
|
888
|
-
for (t.length = 0;
|
|
889
|
-
const a =
|
|
890
|
+
let l = G(n, e).querySelector("tr"), s = 0, r = 0;
|
|
891
|
+
for (t.length = 0; l != null; ) {
|
|
892
|
+
const a = l.nodeName;
|
|
890
893
|
if (a === "TD" || a === "TH") {
|
|
891
|
-
const h = { elem:
|
|
892
|
-
|
|
893
|
-
let
|
|
894
|
-
|
|
894
|
+
const h = { elem: l, hasBackgroundColor: l.style.backgroundColor !== "", highlighted: !1, x: s, y: r };
|
|
895
|
+
l._cell = h;
|
|
896
|
+
let p = t[r];
|
|
897
|
+
p === void 0 && (p = t[r] = []), p[s] = h;
|
|
895
898
|
} else {
|
|
896
|
-
const h =
|
|
899
|
+
const h = l.firstChild;
|
|
897
900
|
if (h != null) {
|
|
898
|
-
|
|
901
|
+
l = h;
|
|
899
902
|
continue;
|
|
900
903
|
}
|
|
901
904
|
}
|
|
902
|
-
const c =
|
|
905
|
+
const c = l.nextSibling;
|
|
903
906
|
if (c != null) {
|
|
904
|
-
s++,
|
|
907
|
+
s++, l = c;
|
|
905
908
|
continue;
|
|
906
909
|
}
|
|
907
|
-
const f =
|
|
910
|
+
const f = l.parentNode;
|
|
908
911
|
if (f != null) {
|
|
909
912
|
const h = f.nextSibling;
|
|
910
913
|
if (h == null) break;
|
|
911
|
-
|
|
914
|
+
r++, s = 0, l = h;
|
|
912
915
|
}
|
|
913
916
|
}
|
|
914
|
-
return o.columns = s + 1, o.rows =
|
|
917
|
+
return o.columns = s + 1, o.rows = r + 1, o;
|
|
915
918
|
}
|
|
916
919
|
function Ce(n, e, t) {
|
|
917
920
|
const o = new Set(t ? t.getNodes() : []);
|
|
918
|
-
Ye(e, (
|
|
919
|
-
const
|
|
920
|
-
o.has(s) ? (
|
|
921
|
+
Ye(e, (l, s) => {
|
|
922
|
+
const r = l.elem;
|
|
923
|
+
o.has(s) ? (l.highlighted = !0, vt(n, l)) : (l.highlighted = !1, Rt(n, l), r.getAttribute("style") || r.removeAttribute("style"));
|
|
921
924
|
});
|
|
922
925
|
}
|
|
923
926
|
function Ye(n, e) {
|
|
924
927
|
const { domRows: t } = n;
|
|
925
928
|
for (let o = 0; o < t.length; o++) {
|
|
926
|
-
const
|
|
927
|
-
if (
|
|
928
|
-
const
|
|
929
|
-
if (!
|
|
930
|
-
const a = V(
|
|
931
|
-
a !== null && e(
|
|
929
|
+
const l = t[o];
|
|
930
|
+
if (l) for (let s = 0; s < l.length; s++) {
|
|
931
|
+
const r = l[s];
|
|
932
|
+
if (!r) continue;
|
|
933
|
+
const a = V(r.elem);
|
|
934
|
+
a !== null && e(r, a, { x: s, y: o });
|
|
932
935
|
}
|
|
933
936
|
}
|
|
934
937
|
}
|
|
@@ -937,16 +940,16 @@ function ut(n, e) {
|
|
|
937
940
|
t.highlighted = !0, vt(n, t);
|
|
938
941
|
});
|
|
939
942
|
}
|
|
940
|
-
const En = (n, e, t, o,
|
|
941
|
-
const s =
|
|
942
|
-
switch (
|
|
943
|
+
const En = (n, e, t, o, l) => {
|
|
944
|
+
const s = l === "forward";
|
|
945
|
+
switch (l) {
|
|
943
946
|
case "backward":
|
|
944
947
|
case "forward":
|
|
945
|
-
return t !== (s ? n.table.columns - 1 : 0) ?
|
|
948
|
+
return t !== (s ? n.table.columns - 1 : 0) ? Se(e.getCellNodeFromCordsOrThrow(t + (s ? 1 : -1), o, n.table), s) : o !== (s ? n.table.rows - 1 : 0) ? Se(e.getCellNodeFromCordsOrThrow(s ? 0 : n.table.columns - 1, o + (s ? 1 : -1), n.table), s) : s ? e.selectNext() : e.selectPrevious(), !0;
|
|
946
949
|
case "up":
|
|
947
|
-
return o !== 0 ?
|
|
950
|
+
return o !== 0 ? Se(e.getCellNodeFromCordsOrThrow(t, o - 1, n.table), !1) : e.selectPrevious(), !0;
|
|
948
951
|
case "down":
|
|
949
|
-
return o !== n.table.rows - 1 ?
|
|
952
|
+
return o !== n.table.rows - 1 ? Se(e.getCellNodeFromCordsOrThrow(t, o + 1, n.table), !0) : e.selectNext(), !0;
|
|
950
953
|
default:
|
|
951
954
|
return !1;
|
|
952
955
|
}
|
|
@@ -965,51 +968,51 @@ function Oe(n, e) {
|
|
|
965
968
|
}
|
|
966
969
|
return [t, o];
|
|
967
970
|
}
|
|
968
|
-
function
|
|
971
|
+
function _e([n, e]) {
|
|
969
972
|
return [n === "minColumn" ? "maxColumn" : "minColumn", e === "minRow" ? "maxRow" : "minRow"];
|
|
970
973
|
}
|
|
971
|
-
function
|
|
972
|
-
const
|
|
973
|
-
s === void 0 && w(250, o, String(
|
|
974
|
-
const
|
|
975
|
-
return a === void 0 && w(250, t, String(
|
|
976
|
-
}
|
|
977
|
-
function kn(n, e, t, o,
|
|
978
|
-
const s = $e(e, t, o),
|
|
979
|
-
const { minColumn: E, maxColumn:
|
|
980
|
-
let
|
|
981
|
-
const Fe =
|
|
982
|
-
for (let W = E; W <=
|
|
983
|
-
for (let W = O; W <=
|
|
984
|
-
return { bottomSpan:
|
|
985
|
-
}(e, s), { topSpan: a, leftSpan: c, bottomSpan: f, rightSpan: h } =
|
|
986
|
-
const E = Oe(
|
|
974
|
+
function ne(n, e, [t, o]) {
|
|
975
|
+
const l = e[o], s = n[l];
|
|
976
|
+
s === void 0 && w(250, o, String(l));
|
|
977
|
+
const r = e[t], a = s[r];
|
|
978
|
+
return a === void 0 && w(250, t, String(r)), a;
|
|
979
|
+
}
|
|
980
|
+
function kn(n, e, t, o, l) {
|
|
981
|
+
const s = $e(e, t, o), r = function(v, $) {
|
|
982
|
+
const { minColumn: E, maxColumn: T, minRow: O, maxRow: F } = $;
|
|
983
|
+
let K = 1, M = 1, B = 1, ae = 1;
|
|
984
|
+
const Fe = v[O], ve = v[F];
|
|
985
|
+
for (let W = E; W <= T; W++) K = Math.max(K, Fe[W].cell.__rowSpan), ae = Math.max(ae, ve[W].cell.__rowSpan);
|
|
986
|
+
for (let W = O; W <= F; W++) M = Math.max(M, v[W][E].cell.__colSpan), B = Math.max(B, v[W][T].cell.__colSpan);
|
|
987
|
+
return { bottomSpan: ae, leftSpan: M, rightSpan: B, topSpan: K };
|
|
988
|
+
}(e, s), { topSpan: a, leftSpan: c, bottomSpan: f, rightSpan: h } = r, p = function(v, $) {
|
|
989
|
+
const E = Oe(v, $);
|
|
987
990
|
return E === null && w(249, $.cell.getKey()), E;
|
|
988
|
-
}(s, t), [
|
|
989
|
-
let u = s[
|
|
990
|
-
|
|
991
|
+
}(s, t), [C, i] = _e(p);
|
|
992
|
+
let u = s[C], g = s[i];
|
|
993
|
+
l === "forward" ? u += C === "maxColumn" ? 1 : c : l === "backward" ? u -= C === "minColumn" ? 1 : h : l === "down" ? g += i === "maxRow" ? 1 : a : l === "up" && (g -= i === "minRow" ? 1 : f);
|
|
991
994
|
const d = e[g];
|
|
992
995
|
if (d === void 0) return !1;
|
|
993
996
|
const m = d[u];
|
|
994
997
|
if (m === void 0) return !1;
|
|
995
|
-
const [_,
|
|
996
|
-
const
|
|
997
|
-
if (O) return [
|
|
998
|
-
const
|
|
999
|
-
if (
|
|
1000
|
-
const
|
|
1001
|
-
return [
|
|
1002
|
-
}(e, t, m),
|
|
1003
|
-
return n.$setAnchorCellForSelection(
|
|
998
|
+
const [_, y] = function(v, $, E) {
|
|
999
|
+
const T = $e(v, $, E), O = Oe(T, $);
|
|
1000
|
+
if (O) return [ne(v, T, O), ne(v, T, _e(O))];
|
|
1001
|
+
const F = Oe(T, E);
|
|
1002
|
+
if (F) return [ne(v, T, _e(F)), ne(v, T, F)];
|
|
1003
|
+
const K = ["minColumn", "minRow"];
|
|
1004
|
+
return [ne(v, T, K), ne(v, T, _e(K))];
|
|
1005
|
+
}(e, t, m), b = Q(n, _.cell), x = Q(n, y.cell);
|
|
1006
|
+
return n.$setAnchorCellForSelection(b), n.$setFocusCellForSelection(x, !0), !0;
|
|
1004
1007
|
}
|
|
1005
1008
|
function J(n, e) {
|
|
1006
|
-
if (z(n) ||
|
|
1009
|
+
if (z(n) || R(n)) {
|
|
1007
1010
|
const t = e.isParentOf(n.anchor.getNode()), o = e.isParentOf(n.focus.getNode());
|
|
1008
1011
|
return t && o;
|
|
1009
1012
|
}
|
|
1010
1013
|
return !1;
|
|
1011
1014
|
}
|
|
1012
|
-
function
|
|
1015
|
+
function Se(n, e) {
|
|
1013
1016
|
e ? n.selectStart() : n.selectEnd();
|
|
1014
1017
|
}
|
|
1015
1018
|
function vt(n, e) {
|
|
@@ -1020,18 +1023,18 @@ function Rt(n, e) {
|
|
|
1020
1023
|
const t = e.elem;
|
|
1021
1024
|
S(V(t)) || w(131);
|
|
1022
1025
|
const o = n._config.theme;
|
|
1023
|
-
|
|
1026
|
+
ie(t, o.tableCellSelected);
|
|
1024
1027
|
}
|
|
1025
|
-
function
|
|
1028
|
+
function ce(n) {
|
|
1026
1029
|
const e = N(n, S);
|
|
1027
1030
|
return S(e) ? e : null;
|
|
1028
1031
|
}
|
|
1029
|
-
function
|
|
1030
|
-
const e = N(n,
|
|
1031
|
-
return
|
|
1032
|
+
function se(n) {
|
|
1033
|
+
const e = N(n, A);
|
|
1034
|
+
return A(e) ? e : null;
|
|
1032
1035
|
}
|
|
1033
|
-
function $n(n, e, t, o,
|
|
1034
|
-
const a = cn(t.focus,
|
|
1036
|
+
function $n(n, e, t, o, l, s, r) {
|
|
1037
|
+
const a = cn(t.focus, l ? "previous" : "next");
|
|
1035
1038
|
if (un(a)) return !1;
|
|
1036
1039
|
let c = a;
|
|
1037
1040
|
for (const d of et(a).iterNodeCarets("shadowRoot")) {
|
|
@@ -1040,7 +1043,7 @@ function $n(n, e, t, o, r, s, l) {
|
|
|
1040
1043
|
}
|
|
1041
1044
|
const f = c.getParentAtCaret();
|
|
1042
1045
|
if (!S(f)) return !1;
|
|
1043
|
-
const h = f,
|
|
1046
|
+
const h = f, p = function(d) {
|
|
1044
1047
|
for (const m of et(d).iterNodeCarets("root")) {
|
|
1045
1048
|
const { origin: _ } = m;
|
|
1046
1049
|
if (S(_)) {
|
|
@@ -1048,32 +1051,32 @@ function $n(n, e, t, o, r, s, l) {
|
|
|
1048
1051
|
} else if (!k(_)) break;
|
|
1049
1052
|
}
|
|
1050
1053
|
return null;
|
|
1051
|
-
}(nt(h, c.direction)),
|
|
1052
|
-
if (!
|
|
1054
|
+
}(nt(h, c.direction)), C = N(h, A);
|
|
1055
|
+
if (!C || !C.is(s)) return !1;
|
|
1053
1056
|
const i = n.getElementByKey(h.getKey()), u = Ne(i);
|
|
1054
1057
|
if (!i || !u) return !1;
|
|
1055
|
-
const g = Mn(n,
|
|
1056
|
-
if (
|
|
1057
|
-
const d = Ne(n.getElementByKey(
|
|
1058
|
+
const g = Mn(n, C);
|
|
1059
|
+
if (r.table = g, p) if (o === "extend") {
|
|
1060
|
+
const d = Ne(n.getElementByKey(p.origin.getKey()));
|
|
1058
1061
|
if (!d) return !1;
|
|
1059
|
-
|
|
1062
|
+
r.$setAnchorCellForSelection(u), r.$setFocusCellForSelection(d, !0);
|
|
1060
1063
|
} else {
|
|
1061
|
-
const d = ot(
|
|
1062
|
-
|
|
1064
|
+
const d = ot(p);
|
|
1065
|
+
pe(t.anchor, d), pe(t.focus, d);
|
|
1063
1066
|
}
|
|
1064
|
-
else if (o === "extend")
|
|
1067
|
+
else if (o === "extend") r.$setAnchorCellForSelection(u), r.$setFocusCellForSelection(u, !0);
|
|
1065
1068
|
else {
|
|
1066
1069
|
const d = function(m) {
|
|
1067
1070
|
const _ = fn(m);
|
|
1068
1071
|
return tt(_) ? ot(_) : m;
|
|
1069
|
-
}(nt(
|
|
1070
|
-
|
|
1072
|
+
}(nt(C, a.direction));
|
|
1073
|
+
pe(t.anchor, d), pe(t.focus, d);
|
|
1071
1074
|
}
|
|
1072
1075
|
return Y(e), !0;
|
|
1073
1076
|
}
|
|
1074
|
-
function Kt(n, e, t, o,
|
|
1075
|
-
if ((t === "up" || t === "down") && function(
|
|
1076
|
-
const a =
|
|
1077
|
+
function Kt(n, e, t, o, l) {
|
|
1078
|
+
if ((t === "up" || t === "down") && function(r) {
|
|
1079
|
+
const a = r.getRootElement();
|
|
1077
1080
|
return a ? a.hasAttribute("aria-controls") && a.getAttribute("aria-controls") === "typeahead-menu" : !1;
|
|
1078
1081
|
}(n)) return !1;
|
|
1079
1082
|
const s = L();
|
|
@@ -1081,71 +1084,71 @@ function Kt(n, e, t, o, r) {
|
|
|
1081
1084
|
if (z(s)) {
|
|
1082
1085
|
if (t === "backward") {
|
|
1083
1086
|
if (s.focus.offset > 0) return !1;
|
|
1084
|
-
const
|
|
1087
|
+
const r = function(c) {
|
|
1085
1088
|
for (let f = c, h = c; h !== null; f = h, h = h.getParent()) if (P(h)) {
|
|
1086
1089
|
if (h !== f && h.getFirstChild() !== f) return null;
|
|
1087
1090
|
if (!h.isInline()) return h;
|
|
1088
1091
|
}
|
|
1089
1092
|
return null;
|
|
1090
1093
|
}(s.focus.getNode());
|
|
1091
|
-
if (!
|
|
1092
|
-
const a =
|
|
1093
|
-
return !!
|
|
1094
|
+
if (!r) return !1;
|
|
1095
|
+
const a = r.getPreviousSibling();
|
|
1096
|
+
return !!A(a) && (Y(e), e.shiftKey ? s.focus.set(a.getParentOrThrow().getKey(), a.getIndexWithinParent(), "element") : a.selectEnd(), !0);
|
|
1094
1097
|
}
|
|
1095
1098
|
if (e.shiftKey && (t === "up" || t === "down")) {
|
|
1096
|
-
const
|
|
1099
|
+
const r = s.focus.getNode();
|
|
1097
1100
|
if (!s.isCollapsed() && (t === "up" && !s.isBackward() || t === "down" && s.isBackward())) {
|
|
1098
|
-
let a = N(
|
|
1099
|
-
if (S(a) && (a = N(a,
|
|
1101
|
+
let a = N(r, (C) => A(C));
|
|
1102
|
+
if (S(a) && (a = N(a, A)), a !== o || !a) return !1;
|
|
1100
1103
|
const c = t === "down" ? a.getNextSibling() : a.getPreviousSibling();
|
|
1101
1104
|
if (!c) return !1;
|
|
1102
1105
|
let f = 0;
|
|
1103
1106
|
t === "up" && P(c) && (f = c.getChildrenSize());
|
|
1104
1107
|
let h = c;
|
|
1105
|
-
t === "up" && P(c) && (h = c.getLastChild() || c, f =
|
|
1106
|
-
const
|
|
1107
|
-
return
|
|
1108
|
+
t === "up" && P(c) && (h = c.getLastChild() || c, f = de(h) ? h.getTextContentSize() : 0);
|
|
1109
|
+
const p = s.clone();
|
|
1110
|
+
return p.focus.set(h.getKey(), f, de(h) ? "text" : "element"), q(p), Y(e), !0;
|
|
1108
1111
|
}
|
|
1109
|
-
if (an(
|
|
1112
|
+
if (an(r)) {
|
|
1110
1113
|
const a = t === "up" ? s.getNodes()[s.getNodes().length - 1] : s.getNodes()[0];
|
|
1111
|
-
if (a &&
|
|
1114
|
+
if (a && he(o, a) !== null) {
|
|
1112
1115
|
const c = o.getFirstDescendant(), f = o.getLastDescendant();
|
|
1113
1116
|
if (!c || !f) return !1;
|
|
1114
|
-
const [h] =
|
|
1115
|
-
return
|
|
1117
|
+
const [h] = re(c), [p] = re(f), C = o.getCordsFromCellNode(h, l.table), i = o.getCordsFromCellNode(p, l.table), u = o.getDOMCellFromCordsOrThrow(C.x, C.y, l.table), g = o.getDOMCellFromCordsOrThrow(i.x, i.y, l.table);
|
|
1118
|
+
return l.$setAnchorCellForSelection(u), l.$setFocusCellForSelection(g, !0), !0;
|
|
1116
1119
|
}
|
|
1117
1120
|
return !1;
|
|
1118
1121
|
}
|
|
1119
1122
|
{
|
|
1120
|
-
let a = N(
|
|
1121
|
-
if (S(a) && (a = N(a,
|
|
1123
|
+
let a = N(r, (f) => P(f) && !f.isInline());
|
|
1124
|
+
if (S(a) && (a = N(a, A)), !a) return !1;
|
|
1122
1125
|
const c = t === "down" ? a.getNextSibling() : a.getPreviousSibling();
|
|
1123
|
-
if (
|
|
1126
|
+
if (A(c) && l.tableNodeKey === c.getKey()) {
|
|
1124
1127
|
const f = c.getFirstDescendant(), h = c.getLastDescendant();
|
|
1125
1128
|
if (!f || !h) return !1;
|
|
1126
|
-
const [
|
|
1127
|
-
return i.focus.set((t === "up" ?
|
|
1129
|
+
const [p] = re(f), [C] = re(h), i = s.clone();
|
|
1130
|
+
return i.focus.set((t === "up" ? p : C).getKey(), t === "up" ? 0 : C.getChildrenSize(), "element"), Y(e), q(i), !0;
|
|
1128
1131
|
}
|
|
1129
1132
|
}
|
|
1130
1133
|
}
|
|
1131
1134
|
}
|
|
1132
|
-
return t === "down" && At(n) &&
|
|
1135
|
+
return t === "down" && At(n) && l.setShouldCheckSelection(), !1;
|
|
1133
1136
|
}
|
|
1134
1137
|
if (z(s)) {
|
|
1135
1138
|
if (t === "backward" || t === "forward")
|
|
1136
|
-
return $n(n, e, s, e.shiftKey ? "extend" : "move", t === "backward", o,
|
|
1139
|
+
return $n(n, e, s, e.shiftKey ? "extend" : "move", t === "backward", o, l);
|
|
1137
1140
|
if (s.isCollapsed()) {
|
|
1138
|
-
const { anchor:
|
|
1141
|
+
const { anchor: r, focus: a } = s, c = N(r.getNode(), S), f = N(a.getNode(), S);
|
|
1139
1142
|
if (!S(c) || !c.is(f)) return !1;
|
|
1140
|
-
const h =
|
|
1143
|
+
const h = se(c);
|
|
1141
1144
|
if (h !== o && h != null) {
|
|
1142
|
-
const m =
|
|
1143
|
-
if (m != null) return
|
|
1145
|
+
const m = G(h, n.getElementByKey(h.getKey()));
|
|
1146
|
+
if (m != null) return l.table = le(h, m), Kt(n, e, t, h, l);
|
|
1144
1147
|
}
|
|
1145
|
-
const
|
|
1146
|
-
if (
|
|
1148
|
+
const p = n.getElementByKey(c.__key), C = n.getElementByKey(r.key);
|
|
1149
|
+
if (C == null || p == null) return !1;
|
|
1147
1150
|
let i;
|
|
1148
|
-
if (
|
|
1151
|
+
if (r.type === "element") i = C.getBoundingClientRect();
|
|
1149
1152
|
else {
|
|
1150
1153
|
const m = xe(Xe(n));
|
|
1151
1154
|
if (m === null || m.rangeCount === 0) return !1;
|
|
@@ -1158,25 +1161,25 @@ function Kt(n, e, t, o, r) {
|
|
|
1158
1161
|
const d = g.getBoundingClientRect();
|
|
1159
1162
|
if (t === "up" ? d.top > i.top - i.height : i.bottom + i.height > d.bottom) {
|
|
1160
1163
|
Y(e);
|
|
1161
|
-
const m = o.getCordsFromCellNode(c,
|
|
1162
|
-
if (!e.shiftKey) return En(
|
|
1164
|
+
const m = o.getCordsFromCellNode(c, l.table);
|
|
1165
|
+
if (!e.shiftKey) return En(l, o, m.x, m.y, t);
|
|
1163
1166
|
{
|
|
1164
|
-
const _ = o.getDOMCellFromCordsOrThrow(m.x, m.y,
|
|
1165
|
-
|
|
1167
|
+
const _ = o.getDOMCellFromCordsOrThrow(m.x, m.y, l.table);
|
|
1168
|
+
l.$setAnchorCellForSelection(_), l.$setFocusCellForSelection(_, !0);
|
|
1166
1169
|
}
|
|
1167
1170
|
return !0;
|
|
1168
1171
|
}
|
|
1169
1172
|
}
|
|
1170
|
-
} else if (
|
|
1171
|
-
const { anchor:
|
|
1172
|
-
|
|
1173
|
-
const
|
|
1174
|
-
if (!S(c) || !S(f) || !
|
|
1175
|
-
|
|
1176
|
-
const
|
|
1177
|
-
if (
|
|
1173
|
+
} else if (R(s)) {
|
|
1174
|
+
const { anchor: r, focus: a } = s, c = N(r.getNode(), S), f = N(a.getNode(), S), [h] = s.getNodes();
|
|
1175
|
+
A(h) || w(251);
|
|
1176
|
+
const p = G(h, n.getElementByKey(h.getKey()));
|
|
1177
|
+
if (!S(c) || !S(f) || !A(h) || p == null) return !1;
|
|
1178
|
+
l.$updateTableTableSelection(s);
|
|
1179
|
+
const C = le(h, p), i = o.getCordsFromCellNode(c, C), u = o.getDOMCellFromCordsOrThrow(i.x, i.y, C);
|
|
1180
|
+
if (l.$setAnchorCellForSelection(u), Y(e), e.shiftKey) {
|
|
1178
1181
|
const [g, d, m] = U(o, c, f);
|
|
1179
|
-
return kn(
|
|
1182
|
+
return kn(l, g, d, m, t);
|
|
1180
1183
|
}
|
|
1181
1184
|
return f.selectEnd(), !0;
|
|
1182
1185
|
}
|
|
@@ -1192,51 +1195,51 @@ function ht(n, e, t) {
|
|
|
1192
1195
|
function dt(n, e, t) {
|
|
1193
1196
|
const o = t.getParent();
|
|
1194
1197
|
if (!o) return;
|
|
1195
|
-
const
|
|
1196
|
-
if (!
|
|
1197
|
-
const s =
|
|
1198
|
-
if (!s || !
|
|
1198
|
+
const l = xe(Xe(n));
|
|
1199
|
+
if (!l) return;
|
|
1200
|
+
const s = l.anchorNode, r = n.getElementByKey(o.getKey()), a = G(t, n.getElementByKey(t.getKey()));
|
|
1201
|
+
if (!s || !r || !a || !r.contains(s) || a.contains(s)) return;
|
|
1199
1202
|
const c = N(e.anchor.getNode(), (_) => S(_));
|
|
1200
1203
|
if (!c) return;
|
|
1201
|
-
const f = N(c, (_) =>
|
|
1202
|
-
if (!
|
|
1203
|
-
const [h,
|
|
1204
|
+
const f = N(c, (_) => A(_));
|
|
1205
|
+
if (!A(f) || !f.is(t)) return;
|
|
1206
|
+
const [h, p] = U(t, c, c), C = h[0][0], i = h[h.length - 1][h[0].length - 1], { startRow: u, startColumn: g } = p, d = u === C.startRow && g === C.startColumn, m = u === i.startRow && g === i.startColumn;
|
|
1204
1207
|
return d ? "first" : m ? "last" : void 0;
|
|
1205
1208
|
}
|
|
1206
|
-
function
|
|
1209
|
+
function Q(n, e) {
|
|
1207
1210
|
const { tableNode: t } = n.$lookup(), o = t.getCordsFromCellNode(e, n.table);
|
|
1208
1211
|
return t.getDOMCellFromCordsOrThrow(o.x, o.y, n.table);
|
|
1209
1212
|
}
|
|
1210
1213
|
function ze(n, e, t) {
|
|
1211
|
-
return
|
|
1214
|
+
return he(n, V(e, t));
|
|
1212
1215
|
}
|
|
1213
1216
|
function ft(n, e, t, o) {
|
|
1214
|
-
const
|
|
1215
|
-
if (!
|
|
1217
|
+
const l = n.querySelector("colgroup");
|
|
1218
|
+
if (!l) return;
|
|
1216
1219
|
const s = [];
|
|
1217
|
-
for (let
|
|
1218
|
-
const a = document.createElement("col"), c = o && o[
|
|
1220
|
+
for (let r = 0; r < t; r++) {
|
|
1221
|
+
const a = document.createElement("col"), c = o && o[r];
|
|
1219
1222
|
c && (a.style.width = `${c}px`), s.push(a);
|
|
1220
1223
|
}
|
|
1221
|
-
|
|
1224
|
+
l.replaceChildren(...s);
|
|
1222
1225
|
}
|
|
1223
1226
|
function gt(n, e, t) {
|
|
1224
|
-
t ? (X(n, e.theme.tableRowStriping), n.setAttribute("data-lexical-row-striping", "true")) : (
|
|
1227
|
+
t ? (X(n, e.theme.tableRowStriping), n.setAttribute("data-lexical-row-striping", "true")) : (ie(n, e.theme.tableRowStriping), n.removeAttribute("data-lexical-row-striping"));
|
|
1225
1228
|
}
|
|
1226
1229
|
function mt(n, e, t) {
|
|
1227
|
-
t > 0 ? (X(n, e.theme.tableFrozenColumn), n.setAttribute("data-lexical-frozen-column", "true")) : (
|
|
1230
|
+
t > 0 ? (X(n, e.theme.tableFrozenColumn), n.setAttribute("data-lexical-frozen-column", "true")) : (ie(n, e.theme.tableFrozenColumn), n.removeAttribute("data-lexical-frozen-column"));
|
|
1228
1231
|
}
|
|
1229
|
-
function
|
|
1230
|
-
t > 0 ? (X(n, e.theme.tableFrozenRow), n.setAttribute("data-lexical-frozen-row", "true")) : (
|
|
1232
|
+
function pt(n, e, t) {
|
|
1233
|
+
t > 0 ? (X(n, e.theme.tableFrozenRow), n.setAttribute("data-lexical-frozen-row", "true")) : (ie(n, e.theme.tableFrozenRow), n.removeAttribute("data-lexical-frozen-row"));
|
|
1231
1234
|
}
|
|
1232
1235
|
function Ee(n, e, t) {
|
|
1233
1236
|
if (!e.theme.tableAlignment) return;
|
|
1234
|
-
const o = [],
|
|
1237
|
+
const o = [], l = [];
|
|
1235
1238
|
for (const s of ["center", "right"]) {
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1239
|
+
const r = e.theme.tableAlignment[s];
|
|
1240
|
+
r && (s === t ? l : o).push(r);
|
|
1238
1241
|
}
|
|
1239
|
-
|
|
1242
|
+
ie(n, ...o), X(n, ...l);
|
|
1240
1243
|
}
|
|
1241
1244
|
const Le = /* @__PURE__ */ new WeakSet();
|
|
1242
1245
|
function At(n = St()) {
|
|
@@ -1245,7 +1248,7 @@ function At(n = St()) {
|
|
|
1245
1248
|
function jn(n, e) {
|
|
1246
1249
|
e ? Le.add(n) : Le.delete(n);
|
|
1247
1250
|
}
|
|
1248
|
-
class
|
|
1251
|
+
class Z extends Pe {
|
|
1249
1252
|
static getType() {
|
|
1250
1253
|
return "table";
|
|
1251
1254
|
}
|
|
@@ -1257,7 +1260,7 @@ class G extends Pe {
|
|
|
1257
1260
|
return t.__colWidths = e, t;
|
|
1258
1261
|
}
|
|
1259
1262
|
static clone(e) {
|
|
1260
|
-
return new
|
|
1263
|
+
return new Z(e.__key);
|
|
1261
1264
|
}
|
|
1262
1265
|
afterCloneFrom(e) {
|
|
1263
1266
|
super.afterCloneFrom(e), this.__colWidths = e.__colWidths, this.__rowStriping = e.__rowStriping, this.__frozenColumnCount = e.__frozenColumnCount, this.__frozenRowCount = e.__frozenRowCount;
|
|
@@ -1287,50 +1290,50 @@ class G extends Pe {
|
|
|
1287
1290
|
createDOM(e, t) {
|
|
1288
1291
|
const o = document.createElement("table");
|
|
1289
1292
|
this.__style && (o.style.cssText = this.__style);
|
|
1290
|
-
const
|
|
1291
|
-
if (o.appendChild(
|
|
1292
|
-
const s = document.createElement("div"),
|
|
1293
|
-
return
|
|
1293
|
+
const l = document.createElement("colgroup");
|
|
1294
|
+
if (o.appendChild(l), ft(o, 0, this.getColumnCount(), this.getColWidths()), Ht(l), X(o, e.theme.table), Ee(o, e, this.getFormatType()), this.__frozenColumnCount && mt(o, e, this.__frozenColumnCount), this.__frozenRowCount && pt(o, e, this.__frozenRowCount), this.__rowStriping && gt(o, e, !0), At(t)) {
|
|
1295
|
+
const s = document.createElement("div"), r = e.theme.tableScrollableWrapper;
|
|
1296
|
+
return r ? X(s, r) : s.style.cssText = "overflow-x: auto;", s.appendChild(o), s;
|
|
1294
1297
|
}
|
|
1295
1298
|
return o;
|
|
1296
1299
|
}
|
|
1297
1300
|
updateDOM(e, t, o) {
|
|
1298
|
-
e.__rowStriping !== this.__rowStriping && gt(t, o, this.__rowStriping), e.__frozenColumnCount !== this.__frozenColumnCount && mt(t, o, this.__frozenColumnCount), e.__frozenRowCount !== this.__frozenRowCount &&
|
|
1299
|
-
const
|
|
1300
|
-
return e.__style !== this.__style && (
|
|
1301
|
+
e.__rowStriping !== this.__rowStriping && gt(t, o, this.__rowStriping), e.__frozenColumnCount !== this.__frozenColumnCount && mt(t, o, this.__frozenColumnCount), e.__frozenRowCount !== this.__frozenRowCount && pt(t, o, this.__frozenRowCount), ft(t, 0, this.getColumnCount(), this.getColWidths());
|
|
1302
|
+
const l = this.getDOMSlot(t).element;
|
|
1303
|
+
return e.__style !== this.__style && (l.style.cssText = this.__style), Ee(l, o, this.getFormatType()), !1;
|
|
1301
1304
|
}
|
|
1302
1305
|
exportDOM(e) {
|
|
1303
1306
|
const t = super.exportDOM(e), { element: o } = t;
|
|
1304
|
-
return { after: (
|
|
1305
|
-
if (t.after && (
|
|
1306
|
-
const [s] = Je(this, null, null),
|
|
1307
|
-
for (const h of s) for (const
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1307
|
+
return { after: (l) => {
|
|
1308
|
+
if (t.after && (l = t.after(l), this.__format && Ee(l, e._config, this.getFormatType())), we(l) && l.nodeName !== "TABLE" && (l = l.querySelector("table")), !we(l)) return null;
|
|
1309
|
+
const [s] = Je(this, null, null), r = /* @__PURE__ */ new Map();
|
|
1310
|
+
for (const h of s) for (const p of h) {
|
|
1311
|
+
const C = p.cell.getKey();
|
|
1312
|
+
r.has(C) || r.set(C, { colSpan: p.cell.getColSpan(), startColumn: p.startColumn });
|
|
1310
1313
|
}
|
|
1311
1314
|
const a = /* @__PURE__ */ new Set();
|
|
1312
|
-
for (const h of
|
|
1313
|
-
const
|
|
1314
|
-
if (
|
|
1315
|
-
const
|
|
1316
|
-
if (h.removeAttribute("data-temporary-table-cell-lexical-key"),
|
|
1317
|
-
|
|
1318
|
-
for (let i = 0; i <
|
|
1315
|
+
for (const h of l.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")) {
|
|
1316
|
+
const p = h.getAttribute("data-temporary-table-cell-lexical-key");
|
|
1317
|
+
if (p) {
|
|
1318
|
+
const C = r.get(p);
|
|
1319
|
+
if (h.removeAttribute("data-temporary-table-cell-lexical-key"), C) {
|
|
1320
|
+
r.delete(p);
|
|
1321
|
+
for (let i = 0; i < C.colSpan; i++) a.add(i + C.startColumn);
|
|
1319
1322
|
}
|
|
1320
1323
|
}
|
|
1321
1324
|
}
|
|
1322
|
-
const c =
|
|
1325
|
+
const c = l.querySelector(":scope > colgroup");
|
|
1323
1326
|
if (c) {
|
|
1324
|
-
const h = Array.from(
|
|
1327
|
+
const h = Array.from(l.querySelectorAll(":scope > colgroup > col")).filter((p, C) => a.has(C));
|
|
1325
1328
|
c.replaceChildren(...h);
|
|
1326
1329
|
}
|
|
1327
|
-
const f =
|
|
1330
|
+
const f = l.querySelectorAll(":scope > tr");
|
|
1328
1331
|
if (f.length > 0) {
|
|
1329
1332
|
const h = document.createElement("tbody");
|
|
1330
|
-
for (const
|
|
1331
|
-
|
|
1333
|
+
for (const p of f) h.appendChild(p);
|
|
1334
|
+
l.append(h);
|
|
1332
1335
|
}
|
|
1333
|
-
return
|
|
1336
|
+
return l;
|
|
1334
1337
|
}, element: we(o) && o.nodeName !== "TABLE" ? o.querySelector("table") : o };
|
|
1335
1338
|
}
|
|
1336
1339
|
canBeEmpty() {
|
|
@@ -1340,11 +1343,11 @@ class G extends Pe {
|
|
|
1340
1343
|
return !0;
|
|
1341
1344
|
}
|
|
1342
1345
|
getCordsFromCellNode(e, t) {
|
|
1343
|
-
const { rows: o, domRows:
|
|
1346
|
+
const { rows: o, domRows: l } = t;
|
|
1344
1347
|
for (let s = 0; s < o; s++) {
|
|
1345
|
-
const
|
|
1346
|
-
if (
|
|
1347
|
-
const c =
|
|
1348
|
+
const r = l[s];
|
|
1349
|
+
if (r != null) for (let a = 0; a < r.length; a++) {
|
|
1350
|
+
const c = r[a];
|
|
1348
1351
|
if (c == null) continue;
|
|
1349
1352
|
const { elem: f } = c, h = ze(this, f);
|
|
1350
1353
|
if (h !== null && e.is(h)) return { x: a, y: s };
|
|
@@ -1353,26 +1356,26 @@ class G extends Pe {
|
|
|
1353
1356
|
throw new Error("Cell not found in table.");
|
|
1354
1357
|
}
|
|
1355
1358
|
getDOMCellFromCords(e, t, o) {
|
|
1356
|
-
const { domRows:
|
|
1359
|
+
const { domRows: l } = o, s = l[t];
|
|
1357
1360
|
if (s == null) return null;
|
|
1358
|
-
const
|
|
1359
|
-
return
|
|
1361
|
+
const r = s[e < s.length ? e : s.length - 1];
|
|
1362
|
+
return r ?? null;
|
|
1360
1363
|
}
|
|
1361
1364
|
getDOMCellFromCordsOrThrow(e, t, o) {
|
|
1362
|
-
const
|
|
1363
|
-
if (!
|
|
1364
|
-
return
|
|
1365
|
+
const l = this.getDOMCellFromCords(e, t, o);
|
|
1366
|
+
if (!l) throw new Error("Cell not found at cords.");
|
|
1367
|
+
return l;
|
|
1365
1368
|
}
|
|
1366
1369
|
getCellNodeFromCords(e, t, o) {
|
|
1367
|
-
const
|
|
1368
|
-
if (
|
|
1369
|
-
const s = V(
|
|
1370
|
+
const l = this.getDOMCellFromCords(e, t, o);
|
|
1371
|
+
if (l == null) return null;
|
|
1372
|
+
const s = V(l.elem);
|
|
1370
1373
|
return S(s) ? s : null;
|
|
1371
1374
|
}
|
|
1372
1375
|
getCellNodeFromCordsOrThrow(e, t, o) {
|
|
1373
|
-
const
|
|
1374
|
-
if (!
|
|
1375
|
-
return
|
|
1376
|
+
const l = this.getCellNodeFromCords(e, t, o);
|
|
1377
|
+
if (!l) throw new Error("Node at cords not TableCellNode.");
|
|
1378
|
+
return l;
|
|
1376
1379
|
}
|
|
1377
1380
|
getRowStriping() {
|
|
1378
1381
|
return !!this.getLatest().__rowStriping;
|
|
@@ -1412,7 +1415,7 @@ class G extends Pe {
|
|
|
1412
1415
|
}
|
|
1413
1416
|
function Mn(n, e) {
|
|
1414
1417
|
const t = n.getElementByKey(e.getKey());
|
|
1415
|
-
return t === null && w(230),
|
|
1418
|
+
return t === null && w(230), le(e, t);
|
|
1416
1419
|
}
|
|
1417
1420
|
function zn(n) {
|
|
1418
1421
|
const e = qe();
|
|
@@ -1420,9 +1423,9 @@ function zn(n) {
|
|
|
1420
1423
|
const t = n.querySelector(":scope > colgroup");
|
|
1421
1424
|
if (t) {
|
|
1422
1425
|
let o = [];
|
|
1423
|
-
for (const
|
|
1424
|
-
let s =
|
|
1425
|
-
if (!We.test(s) && (s =
|
|
1426
|
+
for (const l of t.querySelectorAll(":scope > col")) {
|
|
1427
|
+
let s = l.style.width || "";
|
|
1428
|
+
if (!We.test(s) && (s = l.getAttribute("width") || "", !/^\d+$/.test(s))) {
|
|
1426
1429
|
o = void 0;
|
|
1427
1430
|
break;
|
|
1428
1431
|
}
|
|
@@ -1430,66 +1433,66 @@ function zn(n) {
|
|
|
1430
1433
|
}
|
|
1431
1434
|
o && e.setColWidths(o);
|
|
1432
1435
|
}
|
|
1433
|
-
return { after: (o) =>
|
|
1436
|
+
return { after: (o) => Ct(o, k), node: e };
|
|
1434
1437
|
}
|
|
1435
1438
|
function qe() {
|
|
1436
|
-
return Be(new
|
|
1439
|
+
return Be(new Z());
|
|
1437
1440
|
}
|
|
1438
|
-
function
|
|
1439
|
-
return n instanceof
|
|
1441
|
+
function A(n) {
|
|
1442
|
+
return n instanceof Z;
|
|
1440
1443
|
}
|
|
1441
1444
|
function Ln({ rows: n, columns: e, includeHeaders: t }) {
|
|
1442
1445
|
const o = L();
|
|
1443
|
-
if (!o || !z(o) ||
|
|
1444
|
-
const
|
|
1445
|
-
Lt(
|
|
1446
|
-
const s =
|
|
1447
|
-
return
|
|
1446
|
+
if (!o || !z(o) || se(o.anchor.getNode())) return !1;
|
|
1447
|
+
const l = bn(Number(n), Number(e), t);
|
|
1448
|
+
Lt(l);
|
|
1449
|
+
const s = l.getFirstDescendant();
|
|
1450
|
+
return de(s) && s.select(), !0;
|
|
1448
1451
|
}
|
|
1449
1452
|
function Pn(n) {
|
|
1450
1453
|
k(n.getParent()) ? n.isEmpty() && n.append(j()) : n.remove();
|
|
1451
1454
|
}
|
|
1452
1455
|
function Bn(n) {
|
|
1453
|
-
|
|
1456
|
+
A(n.getParent()) ? _t(n, S) : n.remove();
|
|
1454
1457
|
}
|
|
1455
1458
|
function Hn(n) {
|
|
1456
1459
|
_t(n, k);
|
|
1457
|
-
const [e] = Je(n, null, null), t = e.reduce((
|
|
1458
|
-
for (let
|
|
1459
|
-
const s = o[
|
|
1460
|
+
const [e] = Je(n, null, null), t = e.reduce((l, s) => Math.max(l, s.length), 0), o = n.getChildren();
|
|
1461
|
+
for (let l = 0; l < e.length; ++l) {
|
|
1462
|
+
const s = o[l];
|
|
1460
1463
|
if (!s) continue;
|
|
1461
1464
|
k(s) || w(254, s.constructor.name, s.getType());
|
|
1462
|
-
const
|
|
1463
|
-
if (
|
|
1464
|
-
const c =
|
|
1465
|
+
const r = e[l].reduce((a, c) => c ? 1 + a : a, 0);
|
|
1466
|
+
if (r !== t) for (let a = r; a < t; ++a) {
|
|
1467
|
+
const c = fe();
|
|
1465
1468
|
c.append(j()), s.append(c);
|
|
1466
1469
|
}
|
|
1467
1470
|
}
|
|
1468
1471
|
}
|
|
1469
1472
|
function Wn(n) {
|
|
1470
|
-
if (n.detail < 3 || !
|
|
1473
|
+
if (n.detail < 3 || !ue(n.target)) return !1;
|
|
1471
1474
|
const e = V(n.target);
|
|
1472
1475
|
if (e === null) return !1;
|
|
1473
1476
|
const t = N(e, (o) => P(o) && !o.isInline());
|
|
1474
1477
|
return t === null ? !1 : !!S(t.getParent()) && (t.select(0), !0);
|
|
1475
1478
|
}
|
|
1476
1479
|
function Vn(n) {
|
|
1477
|
-
return n.registerNodeTransform(
|
|
1480
|
+
return n.registerNodeTransform(ee, (e) => {
|
|
1478
1481
|
if (e.getColSpan() > 1 || e.getRowSpan() > 1) {
|
|
1479
|
-
const [, , t] =
|
|
1480
|
-
let
|
|
1481
|
-
k(
|
|
1482
|
+
const [, , t] = re(e), [o] = U(t, e, e), l = o.length, s = o[0].length;
|
|
1483
|
+
let r = t.getFirstChild();
|
|
1484
|
+
k(r) || w(175);
|
|
1482
1485
|
const a = [];
|
|
1483
|
-
for (let c = 0; c <
|
|
1484
|
-
c !== 0 && (
|
|
1486
|
+
for (let c = 0; c < l; c++) {
|
|
1487
|
+
c !== 0 && (r = r.getNextSibling(), k(r) || w(175));
|
|
1485
1488
|
let f = null;
|
|
1486
1489
|
for (let h = 0; h < s; h++) {
|
|
1487
|
-
const
|
|
1488
|
-
if (
|
|
1489
|
-
else if (
|
|
1490
|
-
S(
|
|
1491
|
-
const i =
|
|
1492
|
-
f !== null ? f.insertAfter(i) : zt(
|
|
1490
|
+
const p = o[c][h], C = p.cell;
|
|
1491
|
+
if (p.startRow === c && p.startColumn === h) f = C, a.push(C);
|
|
1492
|
+
else if (C.getColSpan() > 1 || C.getRowSpan() > 1) {
|
|
1493
|
+
S(C) || w(176);
|
|
1494
|
+
const i = fe(C.__headerState);
|
|
1495
|
+
f !== null ? f.insertAfter(i) : zt(r, i);
|
|
1493
1496
|
}
|
|
1494
1497
|
}
|
|
1495
1498
|
}
|
|
@@ -1498,45 +1501,45 @@ function Vn(n) {
|
|
|
1498
1501
|
});
|
|
1499
1502
|
}
|
|
1500
1503
|
function Qn(n, e = !0) {
|
|
1501
|
-
const t = /* @__PURE__ */ new Map(), o = (s,
|
|
1502
|
-
const c =
|
|
1503
|
-
t.set(
|
|
1504
|
-
},
|
|
1504
|
+
const t = /* @__PURE__ */ new Map(), o = (s, r, a) => {
|
|
1505
|
+
const c = G(s, a), f = On(s, c, n, e);
|
|
1506
|
+
t.set(r, [f, c]);
|
|
1507
|
+
}, l = n.registerMutationListener(Z, (s) => {
|
|
1505
1508
|
n.getEditorState().read(() => {
|
|
1506
|
-
for (const [
|
|
1507
|
-
const c = t.get(
|
|
1509
|
+
for (const [r, a] of s) {
|
|
1510
|
+
const c = t.get(r);
|
|
1508
1511
|
if (a === "created" || a === "updated") {
|
|
1509
|
-
const { tableNode: f, tableElement: h } = Ft(
|
|
1510
|
-
c === void 0 ? o(f,
|
|
1511
|
-
} else a === "destroyed" && c !== void 0 && (c[0].removeListeners(), t.delete(
|
|
1512
|
+
const { tableNode: f, tableElement: h } = Ft(r);
|
|
1513
|
+
c === void 0 ? o(f, r, h) : h !== c[1] && (c[0].removeListeners(), t.delete(r), o(f, r, h));
|
|
1514
|
+
} else a === "destroyed" && c !== void 0 && (c[0].removeListeners(), t.delete(r));
|
|
1512
1515
|
}
|
|
1513
1516
|
}, { editor: n });
|
|
1514
1517
|
}, { skipInitialization: !1 });
|
|
1515
1518
|
return () => {
|
|
1516
|
-
|
|
1519
|
+
l();
|
|
1517
1520
|
for (const [, [s]] of t) s.removeListeners();
|
|
1518
1521
|
};
|
|
1519
1522
|
}
|
|
1520
1523
|
function Gn(n) {
|
|
1521
|
-
return n.hasNodes([
|
|
1524
|
+
return n.hasNodes([Z]) || w(255), Mt(n.registerCommand(Sn, Ln, Ke), n.registerCommand(wt, ({ nodes: e, selection: t }) => z(t) ? se(t.anchor.getNode()) !== null && e.some(A) : !1, Ke), n.registerCommand(Wt, Wn, Ke), n.registerNodeTransform(Z, Hn), n.registerNodeTransform(ge, Bn), n.registerNodeTransform(ee, Pn));
|
|
1522
1525
|
}
|
|
1523
1526
|
export {
|
|
1524
|
-
|
|
1525
|
-
De as A,
|
|
1527
|
+
bn as $,
|
|
1526
1528
|
qn as B,
|
|
1527
|
-
|
|
1529
|
+
ge as F,
|
|
1528
1530
|
Yn as H,
|
|
1529
1531
|
Xn as L,
|
|
1532
|
+
De as O,
|
|
1530
1533
|
Nn as W,
|
|
1531
1534
|
Un as X,
|
|
1532
|
-
|
|
1535
|
+
ee as b,
|
|
1533
1536
|
Vn as d,
|
|
1534
1537
|
jn as e,
|
|
1535
1538
|
Qn as f,
|
|
1536
1539
|
Gn as g,
|
|
1537
|
-
|
|
1540
|
+
Z as t,
|
|
1538
1541
|
S as v,
|
|
1539
|
-
|
|
1542
|
+
fe as x,
|
|
1540
1543
|
xt as z
|
|
1541
1544
|
};
|
|
1542
|
-
//# sourceMappingURL=LexicalTable.prod-
|
|
1545
|
+
//# sourceMappingURL=LexicalTable.prod-B1mw85mv.js.map
|