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