@uva-glass/component-library 3.33.1 → 3.33.3
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-B84LhBo3.js → Lexical.prod-BjpEXQJZ.js} +1440 -1365
- package/dist/Lexical.prod-BjpEXQJZ.js.map +1 -0
- package/dist/LexicalClipboard.prod-B4j0EyWx.js +276 -0
- package/dist/LexicalClipboard.prod-B4j0EyWx.js.map +1 -0
- package/dist/{LexicalLink.prod-DoU9RL94.js → LexicalLink.prod-CYNCWmMx.js} +38 -38
- package/dist/{LexicalLink.prod-DoU9RL94.js.map → LexicalLink.prod-CYNCWmMx.js.map} +1 -1
- package/dist/{LexicalList.prod-Cw2TK1jY.js → LexicalList.prod-BRwEushm.js} +189 -204
- package/dist/LexicalList.prod-BRwEushm.js.map +1 -0
- package/dist/{LexicalSelection.prod-TB5pn9xc.js → LexicalSelection.prod-DYo5_Y2k.js} +25 -25
- package/dist/{LexicalSelection.prod-TB5pn9xc.js.map → LexicalSelection.prod-DYo5_Y2k.js.map} +1 -1
- package/dist/{LexicalTable.prod-9xjyWB0C.js → LexicalTable.prod-BArw8Dt5.js} +458 -457
- package/dist/LexicalTable.prod-BArw8Dt5.js.map +1 -0
- package/dist/{LexicalUtils.prod-CD3xGFhm.js → LexicalUtils.prod-DJRX2pwP.js} +48 -48
- package/dist/{LexicalUtils.prod-CD3xGFhm.js.map → LexicalUtils.prod-DJRX2pwP.js.map} +1 -1
- package/dist/Sortable.module-B6I6E9un.js +26 -0
- package/dist/Sortable.module-B6I6E9un.js.map +1 -0
- package/dist/{SortableProvider-DisCfTTN.js → SortableProvider-l8-7ClBJ.js} +2 -2
- package/dist/{SortableProvider-DisCfTTN.js.map → SortableProvider-l8-7ClBJ.js.map} +1 -1
- package/dist/{TablePlugin-oF-gInNx.js → TablePlugin-BagQHe1w.js} +64 -64
- package/dist/{TablePlugin-oF-gInNx.js.map → TablePlugin-BagQHe1w.js.map} +1 -1
- package/dist/assets/Sortable.css +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
- package/dist/components/CheckboxTree/CheckboxTree.stories.js +1 -1
- package/dist/components/FormInput/FormInput.js +2 -2
- package/dist/components/InputField/InputField.stories.js +2 -2
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +2 -2
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
- package/dist/components/RadioTabSelector/RadioTabSelector.js +2 -2
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +2 -2
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +9 -9
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +9 -9
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +3 -3
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +41 -41
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +25 -25
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +5 -5
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +8 -8
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +14 -14
- package/dist/components/RteEditor/Plugins/index.js +1 -1
- package/dist/components/RteEditor/RteEditor.js +172 -172
- package/dist/components/RteEditor/RteEditor.js.map +1 -1
- package/dist/components/RteEditor/helpers.js +6 -6
- package/dist/components/Sortable/Sortable.js +1 -1
- package/dist/components/Sortable/SortableProvider.js +1 -1
- package/dist/components/Sortable/components/SortableContainer.js +2 -2
- package/dist/components/Sortable/components/SortableHandle.js +1 -1
- package/dist/components/Sortable/components/SortableItem.js +2 -2
- package/dist/components/index.js +1 -1
- package/dist/{helpers-CMG0anwr.js → helpers-DM8qHaKY.js} +54 -54
- package/dist/helpers-DM8qHaKY.js.map +1 -0
- package/dist/{index-KJPw-7za.js → index-Ccsg2cb2.js} +285 -284
- package/dist/index-Ccsg2cb2.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/storybook__react.d.js +1 -1
- package/package.json +14 -14
- package/dist/Lexical.prod-B84LhBo3.js.map +0 -1
- package/dist/LexicalClipboard.prod-DLgWWXys.js +0 -255
- package/dist/LexicalClipboard.prod-DLgWWXys.js.map +0 -1
- package/dist/LexicalList.prod-Cw2TK1jY.js.map +0 -1
- package/dist/LexicalTable.prod-9xjyWB0C.js.map +0 -1
- package/dist/Sortable.module--kgnzOjW.js +0 -26
- package/dist/Sortable.module--kgnzOjW.js.map +0 -1
- package/dist/helpers-CMG0anwr.js.map +0 -1
- package/dist/index-KJPw-7za.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { w as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
class ce extends
|
|
1
|
+
import { w as T, r as Z, i as ge, _ as vt, j as Xt, N as Yt, T as xt, S as qt, L as jt } from "./LexicalUtils.prod-DJRX2pwP.js";
|
|
2
|
+
import { y as Ge, v as Ne, h as Qe, d as Vt, i as Ce, e as ct, R as I, r as et, j as Zt, k as Tt, T as re, l as Gt, W as De, n as Rt, g as z, f as Qt, o as be, m as D, D as B, P as Ue, C as Ae, q as en, A as tn, t as nn, x as on, z as Ie, I as rn, F as ln, G as Ft, _ as sn, U as j, K as an, N as cn, O as un, Q as hn, $ as dn, V as fn, X as gn, Y as mn, Z as fe, E as ne, a0 as Me, a1 as pn, a as Kt, a2 as Cn, B as tt, a3 as _n, u as Sn, a4 as Ee, a5 as wn, a6 as yn, a7 as ut, a8 as bn, a9 as ht, s as Nn, aa as dt, M as ft, S as Re, ab as vn, w as xn, ac as Tn, ad as Rn } from "./Lexical.prod-BjpEXQJZ.js";
|
|
3
|
+
import { F as Fn, J as Kn } from "./LexicalClipboard.prod-B4j0EyWx.js";
|
|
4
|
+
const nt = /^(\d+(?:\.\d+)?)px$/, L = { BOTH: 3, COLUMN: 2, NO_STATUS: 0, ROW: 1 };
|
|
5
|
+
class ce extends Ge {
|
|
6
6
|
static getType() {
|
|
7
7
|
return "tablecell";
|
|
8
8
|
}
|
|
@@ -13,7 +13,7 @@ class ce extends Qe {
|
|
|
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: gt, priority: 0 }), th: (e) => ({ conversion: gt, priority: 0 }) };
|
|
17
17
|
}
|
|
18
18
|
static importJSON(e) {
|
|
19
19
|
return X().updateFromJSON(e);
|
|
@@ -21,23 +21,23 @@ class ce extends Qe {
|
|
|
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 =
|
|
24
|
+
constructor(e = L.NO_STATUS, t = 1, o, r) {
|
|
25
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), Xe(this.__verticalAlign) && (t.style.verticalAlign = this.__verticalAlign), Z(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 (Ne(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(), ...Xe(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 ce extends Qe {
|
|
|
56
56
|
getTag() {
|
|
57
57
|
return this.hasHeader() ? "th" : "td";
|
|
58
58
|
}
|
|
59
|
-
setHeaderStyles(e, t =
|
|
59
|
+
setHeaderStyles(e, t = L.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 ce extends Qe {
|
|
|
92
92
|
return (this.getHeaderStyles() & e) === e;
|
|
93
93
|
}
|
|
94
94
|
hasHeader() {
|
|
95
|
-
return this.getLatest().__headerState !==
|
|
95
|
+
return this.getLatest().__headerState !== L.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,19 +110,19 @@ class ce extends Qe {
|
|
|
110
110
|
return !1;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function Xe(n) {
|
|
114
114
|
return n === "middle" || n === "bottom";
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function gt(n) {
|
|
117
117
|
const e = n, t = n.nodeName.toLowerCase();
|
|
118
118
|
let o;
|
|
119
|
-
|
|
120
|
-
const r = X(t === "th" ?
|
|
119
|
+
nt.test(e.style.width) && (o = parseFloat(e.style.width));
|
|
120
|
+
const r = X(t === "th" ? L.ROW : L.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
|
-
|
|
125
|
+
Xe(l) && (r.__verticalAlign = l);
|
|
126
126
|
const i = e.style, u = (i && i.textDecoration || "").split(" "), m = i.fontWeight === "700" || i.fontWeight === "bold", h = u.includes("line-through"), p = i.fontStyle === "italic", C = u.includes("underline");
|
|
127
127
|
return { after: (a) => {
|
|
128
128
|
const c = [];
|
|
@@ -130,38 +130,38 @@ function ft(n) {
|
|
|
130
130
|
const d = () => {
|
|
131
131
|
if (f) {
|
|
132
132
|
const g = f.getFirstChild();
|
|
133
|
-
|
|
133
|
+
ct(g) && f.getChildrenSize() === 1 && g.remove();
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
for (const g of a)
|
|
136
|
+
for (const g of a) Vt(g) || Ce(g) || ct(g) ? (Ce(g) && (m && g.toggleFormat("bold"), h && g.toggleFormat("strikethrough"), p && g.toggleFormat("italic"), C && g.toggleFormat("underline")), f ? f.append(g) : (f = I().append(g), c.push(f))) : (c.push(g), d(), f = null);
|
|
137
137
|
return d(), c.length === 0 && c.push(I()), c;
|
|
138
138
|
}, node: r };
|
|
139
139
|
}
|
|
140
|
-
function X(n =
|
|
141
|
-
return
|
|
140
|
+
function X(n = L.NO_STATUS, e = 1, t) {
|
|
141
|
+
return Qe(new ce(n, e, t));
|
|
142
142
|
}
|
|
143
143
|
function w(n) {
|
|
144
144
|
return n instanceof ce;
|
|
145
145
|
}
|
|
146
|
-
const
|
|
147
|
-
function
|
|
146
|
+
const On = Qt("INSERT_TABLE_COMMAND");
|
|
147
|
+
function y(n, ...e) {
|
|
148
148
|
const t = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
|
|
149
149
|
o.append("code", n);
|
|
150
150
|
for (const r of e) o.append("v", r);
|
|
151
151
|
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.`);
|
|
152
152
|
}
|
|
153
|
-
class
|
|
153
|
+
class Te extends Ge {
|
|
154
154
|
static getType() {
|
|
155
155
|
return "tablerow";
|
|
156
156
|
}
|
|
157
157
|
static clone(e) {
|
|
158
|
-
return new
|
|
158
|
+
return new Te(e.__height, e.__key);
|
|
159
159
|
}
|
|
160
160
|
static importDOM() {
|
|
161
|
-
return { tr: (e) => ({ conversion:
|
|
161
|
+
return { tr: (e) => ({ conversion: An, priority: 0 }) };
|
|
162
162
|
}
|
|
163
163
|
static importJSON(e) {
|
|
164
|
-
return
|
|
164
|
+
return xe().updateFromJSON(e);
|
|
165
165
|
}
|
|
166
166
|
updateFromJSON(e) {
|
|
167
167
|
return super.updateFromJSON(e).setHeight(e.height);
|
|
@@ -200,119 +200,119 @@ class xe extends Qe {
|
|
|
200
200
|
return !1;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function An(n) {
|
|
204
204
|
const e = n;
|
|
205
205
|
let t;
|
|
206
|
-
return
|
|
206
|
+
return nt.test(e.style.height) && (t = parseFloat(e.style.height)), { after: (o) => vt(o, w), node: xe(t) };
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
return
|
|
208
|
+
function xe(n) {
|
|
209
|
+
return Qe(new Te(n));
|
|
210
210
|
}
|
|
211
211
|
function A(n) {
|
|
212
|
-
return n instanceof
|
|
212
|
+
return n instanceof Te;
|
|
213
213
|
}
|
|
214
|
-
const
|
|
215
|
-
function
|
|
216
|
-
const o =
|
|
214
|
+
const ot = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, En = ot && "documentMode" in document ? document.documentMode : null, mt = ot && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
215
|
+
function $n(n, e, t = !0) {
|
|
216
|
+
const o = st();
|
|
217
217
|
for (let r = 0; r < n; r++) {
|
|
218
|
-
const s =
|
|
218
|
+
const s = xe();
|
|
219
219
|
for (let l = 0; l < e; l++) {
|
|
220
|
-
let i =
|
|
221
|
-
typeof t == "object" ? (r === 0 && t.rows && (i |=
|
|
220
|
+
let i = L.NO_STATUS;
|
|
221
|
+
typeof t == "object" ? (r === 0 && t.rows && (i |= L.ROW), l === 0 && t.columns && (i |= L.COLUMN)) : t && (r === 0 && (i |= L.ROW), l === 0 && (i |= L.COLUMN));
|
|
222
222
|
const u = X(i), m = I();
|
|
223
|
-
m.append(
|
|
223
|
+
m.append(et()), u.append(m), s.append(u);
|
|
224
224
|
}
|
|
225
225
|
o.append(s);
|
|
226
226
|
}
|
|
227
227
|
return o;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
const e =
|
|
229
|
+
function io(n) {
|
|
230
|
+
const e = T(n, (t) => w(t));
|
|
231
231
|
return w(e) ? e : null;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
const e =
|
|
233
|
+
function Ot(n) {
|
|
234
|
+
const e = T(n, (t) => A(t));
|
|
235
235
|
if (A(e)) return e;
|
|
236
236
|
throw new Error("Expected table cell to be inside of table row.");
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
const e =
|
|
240
|
-
if (
|
|
238
|
+
function At(n) {
|
|
239
|
+
const e = T(n, (t) => k(t));
|
|
240
|
+
if (k(e)) return e;
|
|
241
241
|
throw new Error("Expected table cell to be inside of table.");
|
|
242
242
|
}
|
|
243
|
-
function io(n) {
|
|
244
|
-
const e = Kt(n);
|
|
245
|
-
return Ot(e).getChildren().findIndex((t) => t.is(e));
|
|
246
|
-
}
|
|
247
243
|
function ao(n) {
|
|
248
|
-
|
|
244
|
+
const e = Ot(n);
|
|
245
|
+
return At(e).getChildren().findIndex((t) => t.is(e));
|
|
246
|
+
}
|
|
247
|
+
function co(n) {
|
|
248
|
+
return Ot(n).getChildren().findIndex((e) => e.is(n));
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
const
|
|
250
|
+
ot && "InputEvent" in window && !En && new window.InputEvent("input");
|
|
251
|
+
const Ye = (n, e) => n === L.BOTH || n === e ? e : L.NO_STATUS;
|
|
252
252
|
function kn(n, e = !0) {
|
|
253
253
|
const [, , t] = G(n), [o, r] = U(t, n, n), s = o[0].length, { startRow: l } = r;
|
|
254
254
|
let i = null;
|
|
255
255
|
if (e) {
|
|
256
|
-
const u = l + n.__rowSpan - 1, m = o[u], h =
|
|
256
|
+
const u = l + n.__rowSpan - 1, m = o[u], h = xe();
|
|
257
257
|
for (let C = 0; C < s; C++) {
|
|
258
258
|
const { cell: a, startRow: c } = m[C];
|
|
259
259
|
if (c + a.__rowSpan - 1 <= u) {
|
|
260
|
-
const f = m[C].cell.__headerState, d =
|
|
260
|
+
const f = m[C].cell.__headerState, d = Ye(f, L.COLUMN);
|
|
261
261
|
h.append(X(d).append(I()));
|
|
262
262
|
} else a.setRowSpan(a.__rowSpan + 1);
|
|
263
263
|
}
|
|
264
264
|
const p = t.getChildAtIndex(u);
|
|
265
|
-
A(p) ||
|
|
265
|
+
A(p) || y(256), p.insertAfter(h), i = h;
|
|
266
266
|
} else {
|
|
267
|
-
const u = l, m = o[u], h =
|
|
267
|
+
const u = l, m = o[u], h = xe();
|
|
268
268
|
for (let C = 0; C < s; C++) {
|
|
269
269
|
const { cell: a, startRow: c } = m[C];
|
|
270
270
|
if (c === u) {
|
|
271
|
-
const f = m[C].cell.__headerState, d =
|
|
271
|
+
const f = m[C].cell.__headerState, d = Ye(f, L.COLUMN);
|
|
272
272
|
h.append(X(d).append(I()));
|
|
273
273
|
} else a.setRowSpan(a.__rowSpan + 1);
|
|
274
274
|
}
|
|
275
275
|
const p = t.getChildAtIndex(u);
|
|
276
|
-
A(p) ||
|
|
276
|
+
A(p) || y(257), p.insertBefore(h), i = h;
|
|
277
277
|
}
|
|
278
278
|
return i;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function Mn(n, e = !0, t = !0) {
|
|
281
281
|
const [, , o] = G(n), [r, s] = U(o, n, n), l = r.length, { startColumn: i } = s, u = e ? i + n.__colSpan - 1 : i - 1, m = o.getFirstChild();
|
|
282
|
-
A(m) ||
|
|
282
|
+
A(m) || y(120);
|
|
283
283
|
let h = null;
|
|
284
|
-
function p(c =
|
|
284
|
+
function p(c = L.NO_STATUS) {
|
|
285
285
|
const f = X(c).append(I());
|
|
286
286
|
return h === null && (h = f), f;
|
|
287
287
|
}
|
|
288
288
|
let C = m;
|
|
289
289
|
e: for (let c = 0; c < l; c++) {
|
|
290
290
|
if (c !== 0) {
|
|
291
|
-
const
|
|
292
|
-
A(
|
|
291
|
+
const b = C.getNextSibling();
|
|
292
|
+
A(b) || y(121), C = b;
|
|
293
293
|
}
|
|
294
|
-
const f = r[c], d = f[u < 0 ? 0 : u].cell.__headerState, g =
|
|
294
|
+
const f = r[c], d = f[u < 0 ? 0 : u].cell.__headerState, g = Ye(d, L.ROW);
|
|
295
295
|
if (u < 0) {
|
|
296
|
-
|
|
296
|
+
Et(C, p(g));
|
|
297
297
|
continue;
|
|
298
298
|
}
|
|
299
299
|
const { cell: _, startColumn: S, startRow: N } = f[u];
|
|
300
300
|
if (S + _.__colSpan - 1 <= u) {
|
|
301
|
-
let
|
|
302
|
-
for (;
|
|
303
|
-
if (
|
|
301
|
+
let b = _, x = N, E = u;
|
|
302
|
+
for (; x !== c && b.__rowSpan > 1; ) {
|
|
303
|
+
if (E -= _.__colSpan, !(E >= 0)) {
|
|
304
304
|
C.append(p(g));
|
|
305
305
|
continue e;
|
|
306
306
|
}
|
|
307
307
|
{
|
|
308
|
-
const { cell:
|
|
309
|
-
|
|
308
|
+
const { cell: $, startRow: K } = f[E];
|
|
309
|
+
b = $, x = K;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
b.insertAfter(p(g));
|
|
313
313
|
} else _.setColSpan(_.__colSpan + 1);
|
|
314
314
|
}
|
|
315
|
-
h !== null && t &&
|
|
315
|
+
h !== null && t && zn(h);
|
|
316
316
|
const a = o.getColWidths();
|
|
317
317
|
if (a) {
|
|
318
318
|
const c = [...a], f = u < 0 ? 0 : u, d = c[f];
|
|
@@ -320,7 +320,7 @@ function $n(n, e = !0, t = !0) {
|
|
|
320
320
|
}
|
|
321
321
|
return h;
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function uo(n, e) {
|
|
324
324
|
const t = n.getChildren();
|
|
325
325
|
for (let o = 0; o < t.length; o++) {
|
|
326
326
|
const r = t[o];
|
|
@@ -332,17 +332,17 @@ function co(n, e) {
|
|
|
332
332
|
}
|
|
333
333
|
return n;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function zn(n) {
|
|
336
336
|
const e = n.getFirstDescendant();
|
|
337
337
|
e == null ? n.selectStart() : e.getParentOrThrow().selectStart();
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function Et(n, e) {
|
|
340
340
|
const t = n.getFirstChild();
|
|
341
341
|
t !== null ? t.insertBefore(e) : n.append(e);
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Ln(n) {
|
|
344
344
|
if (n.length === 0) return null;
|
|
345
|
-
const e =
|
|
345
|
+
const e = At(n[0]), [t] = oe(e, null, null);
|
|
346
346
|
let o = 1 / 0, r = -1 / 0, s = 1 / 0, l = -1 / 0;
|
|
347
347
|
const i = /* @__PURE__ */ new Set();
|
|
348
348
|
for (const a of t) for (const c of a) {
|
|
@@ -364,23 +364,23 @@ function zn(n) {
|
|
|
364
364
|
const f = t[a][c];
|
|
365
365
|
if (!f.cell) continue;
|
|
366
366
|
const d = f.cell, g = d.getKey();
|
|
367
|
-
C.has(g) || (C.add(g),
|
|
367
|
+
C.has(g) || (C.add(g), Wn(d) || p.append(...d.getChildren()), d.remove());
|
|
368
368
|
}
|
|
369
369
|
return p.getChildrenSize() === 0 && p.append(I()), p;
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function Wn(n) {
|
|
372
372
|
if (n.getChildrenSize() !== 1) return !1;
|
|
373
373
|
const e = n.getFirstChildOrThrow();
|
|
374
|
-
return !(!
|
|
374
|
+
return !(!tt(e) || !e.isEmpty());
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function Hn(n) {
|
|
377
377
|
const [e, t, o] = G(n), r = e.__colSpan, s = e.__rowSpan;
|
|
378
378
|
if (r === 1 && s === 1) return;
|
|
379
|
-
const [l, i] = U(o, e, e), { startColumn: u, startRow: m } = i, h = e.__headerState &
|
|
379
|
+
const [l, i] = U(o, e, e), { startColumn: u, startRow: m } = i, h = e.__headerState & L.COLUMN, p = Array.from({ length: r }, (c, f) => {
|
|
380
380
|
let d = h;
|
|
381
381
|
for (let g = 0; d !== 0 && g < l.length; g++) d &= l[g][f + u].cell.__headerState;
|
|
382
382
|
return d;
|
|
383
|
-
}), C = e.__headerState &
|
|
383
|
+
}), C = e.__headerState & L.ROW, a = Array.from({ length: s }, (c, f) => {
|
|
384
384
|
let d = C;
|
|
385
385
|
for (let g = 0; d !== 0 && g < l[0].length; g++) d &= l[f + m][g].cell.__headerState;
|
|
386
386
|
return d;
|
|
@@ -393,13 +393,13 @@ function Wn(n) {
|
|
|
393
393
|
let c;
|
|
394
394
|
for (let f = 1; f < s; f++) {
|
|
395
395
|
const d = m + f, g = l[d];
|
|
396
|
-
c = (c || t).getNextSibling(), A(c) ||
|
|
396
|
+
c = (c || t).getNextSibling(), A(c) || y(125);
|
|
397
397
|
let _ = null;
|
|
398
398
|
for (let S = 0; S < u; S++) {
|
|
399
|
-
const N = g[S],
|
|
400
|
-
N.startRow === d && (_ =
|
|
399
|
+
const N = g[S], b = N.cell;
|
|
400
|
+
N.startRow === d && (_ = b), b.__colSpan > 1 && (S += b.__colSpan - 1);
|
|
401
401
|
}
|
|
402
|
-
if (_ === null) for (let S = r - 1; S >= 0; S--)
|
|
402
|
+
if (_ === null) for (let S = r - 1; S >= 0; S--) Et(c, X(p[S] | a[f]).append(I()));
|
|
403
403
|
else for (let S = r - 1; S >= 0; S--) _.insertAfter(X(p[S] | a[f]).append(I()));
|
|
404
404
|
}
|
|
405
405
|
e.setRowSpan(1);
|
|
@@ -407,7 +407,7 @@ function Wn(n) {
|
|
|
407
407
|
}
|
|
408
408
|
function U(n, e, t) {
|
|
409
409
|
const [o, r, s] = oe(n, e, t);
|
|
410
|
-
return r === null &&
|
|
410
|
+
return r === null && y(207), s === null && y(208), [o, r, s];
|
|
411
411
|
}
|
|
412
412
|
function oe(n, e, t) {
|
|
413
413
|
const o = [];
|
|
@@ -419,10 +419,10 @@ function oe(n, e, t) {
|
|
|
419
419
|
const i = n.getChildren();
|
|
420
420
|
for (let u = 0; u < i.length; u++) {
|
|
421
421
|
const m = i[u];
|
|
422
|
-
A(m) ||
|
|
422
|
+
A(m) || y(209);
|
|
423
423
|
const h = l(u);
|
|
424
424
|
for (let p = m.getFirstChild(), C = 0; p != null; p = p.getNextSibling()) {
|
|
425
|
-
for (w(p) ||
|
|
425
|
+
for (w(p) || y(147); h[C] !== void 0; ) C++;
|
|
426
426
|
const a = { cell: p, startColumn: C, startRow: u }, { __rowSpan: c, __colSpan: f } = p;
|
|
427
427
|
for (let d = 0; d < c && !(u + d >= i.length); d++) {
|
|
428
428
|
const g = l(u + d);
|
|
@@ -437,18 +437,18 @@ function G(n) {
|
|
|
437
437
|
let e;
|
|
438
438
|
if (n instanceof ce) e = n;
|
|
439
439
|
else if ("__type" in n) {
|
|
440
|
-
const r =
|
|
441
|
-
w(r) ||
|
|
440
|
+
const r = T(n, w);
|
|
441
|
+
w(r) || y(148), e = r;
|
|
442
442
|
} else {
|
|
443
|
-
const r =
|
|
444
|
-
w(r) ||
|
|
443
|
+
const r = T(n.getNode(), w);
|
|
444
|
+
w(r) || y(148), e = r;
|
|
445
445
|
}
|
|
446
446
|
const t = e.getParent();
|
|
447
|
-
A(t) ||
|
|
447
|
+
A(t) || y(149);
|
|
448
448
|
const o = t.getParent();
|
|
449
|
-
return
|
|
449
|
+
return k(o) || y(210), [e, t, o];
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function $e(n, e, t) {
|
|
452
452
|
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), i = Math.max(e.startRow + e.cell.__rowSpan - 1, t.startRow + t.cell.__rowSpan - 1);
|
|
453
453
|
do {
|
|
454
454
|
o = !1;
|
|
@@ -464,7 +464,7 @@ function Ee(n, e, t) {
|
|
|
464
464
|
} while (o);
|
|
465
465
|
return { maxColumn: l, maxRow: i, minColumn: r, minRow: s };
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function pt(n) {
|
|
468
468
|
const [e, , t] = G(n), o = t.getChildren(), r = o.length, s = o[0].getChildren().length, l = new Array(r);
|
|
469
469
|
for (let i = 0; i < r; i++) l[i] = new Array(s);
|
|
470
470
|
for (let i = 0; i < r; i++) {
|
|
@@ -480,18 +480,18 @@ function mt(n) {
|
|
|
480
480
|
}
|
|
481
481
|
return null;
|
|
482
482
|
}
|
|
483
|
-
function
|
|
483
|
+
function Ct(n) {
|
|
484
484
|
const [[e, t, o, r], [s, l, i, u]] = ["anchor", "focus"].map((m) => {
|
|
485
|
-
const h = n[m].getNode(), p =
|
|
486
|
-
w(p) ||
|
|
485
|
+
const h = n[m].getNode(), p = T(h, w);
|
|
486
|
+
w(p) || y(238, m, h.getKey(), h.getType());
|
|
487
487
|
const C = p.getParent();
|
|
488
|
-
A(C) ||
|
|
488
|
+
A(C) || y(239, m);
|
|
489
489
|
const a = C.getParent();
|
|
490
|
-
return
|
|
490
|
+
return k(a) || y(240, m), [h, p, C, a];
|
|
491
491
|
});
|
|
492
|
-
return r.is(u) ||
|
|
492
|
+
return r.is(u) || y(241), { anchorCell: t, anchorNode: e, anchorRow: o, anchorTable: r, focusCell: l, focusNode: s, focusRow: i, focusTable: u };
|
|
493
493
|
}
|
|
494
|
-
class
|
|
494
|
+
class ze {
|
|
495
495
|
constructor(e, t, o) {
|
|
496
496
|
this.anchor = t, this.focus = o, t._selection = this, o._selection = this, this._cachedNodes = null, this.dirty = !1, this.tableKey = e;
|
|
497
497
|
}
|
|
@@ -517,7 +517,7 @@ class Me {
|
|
|
517
517
|
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;
|
|
518
518
|
}
|
|
519
519
|
clone() {
|
|
520
|
-
return new
|
|
520
|
+
return new ze(this.tableKey, Ee(this.anchor.key, this.anchor.offset, this.anchor.type), Ee(this.focus.key, this.focus.offset, this.focus.type));
|
|
521
521
|
}
|
|
522
522
|
isCollapsed() {
|
|
523
523
|
return !1;
|
|
@@ -533,20 +533,20 @@ class Me {
|
|
|
533
533
|
let t = 0;
|
|
534
534
|
this.getNodes().filter(w).forEach((r) => {
|
|
535
535
|
const s = r.getFirstChild();
|
|
536
|
-
|
|
536
|
+
tt(s) && (t |= s.getTextFormat());
|
|
537
537
|
});
|
|
538
|
-
const o =
|
|
538
|
+
const o = Rn[e];
|
|
539
539
|
return !!(t & o);
|
|
540
540
|
}
|
|
541
541
|
insertNodes(e) {
|
|
542
542
|
const t = this.focus.getNode();
|
|
543
|
-
D(t) ||
|
|
543
|
+
D(t) || y(151), xn(t.select(0, t.getChildrenSize())).insertNodes(e);
|
|
544
544
|
}
|
|
545
545
|
getShape() {
|
|
546
|
-
const { anchorCell: e, focusCell: t } =
|
|
547
|
-
o === null &&
|
|
548
|
-
const r =
|
|
549
|
-
r === null &&
|
|
546
|
+
const { anchorCell: e, focusCell: t } = Ct(this), o = pt(e);
|
|
547
|
+
o === null && y(153);
|
|
548
|
+
const r = pt(t);
|
|
549
|
+
r === null && y(155);
|
|
550
550
|
const s = Math.min(o.columnIndex, r.columnIndex), l = Math.max(o.columnIndex + o.colSpan - 1, r.columnIndex + r.colSpan - 1), i = Math.min(o.rowIndex, r.rowIndex), u = Math.max(o.rowIndex + o.rowSpan - 1, r.rowIndex + r.rowSpan - 1);
|
|
551
551
|
return { fromX: Math.min(s, l), fromY: Math.min(i, u), toX: Math.max(s, l), toY: Math.max(i, u) };
|
|
552
552
|
}
|
|
@@ -554,27 +554,27 @@ class Me {
|
|
|
554
554
|
if (!this.isValid()) return [];
|
|
555
555
|
const e = this._cachedNodes;
|
|
556
556
|
if (e !== null) return e;
|
|
557
|
-
const { anchorTable: t, anchorCell: o, focusCell: r } =
|
|
557
|
+
const { anchorTable: t, anchorCell: o, focusCell: r } = Ct(this), s = r.getParents()[1];
|
|
558
558
|
if (s !== t) {
|
|
559
559
|
if (t.isParentOf(r)) {
|
|
560
560
|
const d = s.getParent();
|
|
561
|
-
d == null &&
|
|
561
|
+
d == null && y(159), this.set(this.tableKey, r.getKey(), d.getKey());
|
|
562
562
|
} else {
|
|
563
563
|
const d = t.getParent();
|
|
564
|
-
d == null &&
|
|
564
|
+
d == null && y(158), this.set(this.tableKey, d.getKey(), r.getKey());
|
|
565
565
|
}
|
|
566
566
|
return this.getNodes();
|
|
567
567
|
}
|
|
568
|
-
const [l, i, u] = U(t, o, r), { minColumn: m, maxColumn: h, minRow: p, maxRow: C } =
|
|
568
|
+
const [l, i, u] = U(t, o, r), { minColumn: m, maxColumn: h, minRow: p, maxRow: C } = $e(l, i, u), a = /* @__PURE__ */ new Map([[t.getKey(), t]]);
|
|
569
569
|
let c = null;
|
|
570
570
|
for (let d = p; d <= C; d++) for (let g = m; g <= h; g++) {
|
|
571
571
|
const { cell: _ } = l[d][g], S = _.getParent();
|
|
572
|
-
A(S) ||
|
|
572
|
+
A(S) || y(160), S !== c && (a.set(S.getKey(), S), c = S), a.has(_.getKey()) || Bn(_, (N) => {
|
|
573
573
|
a.set(N.getKey(), N);
|
|
574
574
|
});
|
|
575
575
|
}
|
|
576
576
|
const f = Array.from(a.values());
|
|
577
|
-
return
|
|
577
|
+
return Tn() || (this._cachedNodes = f), f;
|
|
578
578
|
}
|
|
579
579
|
getTextContent() {
|
|
580
580
|
const e = this.getNodes().filter((o) => w(o));
|
|
@@ -588,31 +588,31 @@ class Me {
|
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
function O(n) {
|
|
591
|
-
return n instanceof
|
|
591
|
+
return n instanceof ze;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
594
|
-
const n =
|
|
595
|
-
return new
|
|
593
|
+
function $t() {
|
|
594
|
+
const n = Ee("root", 0, "element"), e = Ee("root", 0, "element");
|
|
595
|
+
return new ze("root", n, e);
|
|
596
596
|
}
|
|
597
|
-
function
|
|
597
|
+
function Pn(n, e, t) {
|
|
598
598
|
n.getKey(), e.getKey(), t.getKey();
|
|
599
|
-
const o = B(), r = O(o) ? o.clone() :
|
|
599
|
+
const o = B(), r = O(o) ? o.clone() : $t();
|
|
600
600
|
return r.set(n.getKey(), e.getKey(), t.getKey()), r;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function Bn(n, e) {
|
|
603
603
|
const t = [[n]];
|
|
604
604
|
for (let o = t.at(-1); o !== void 0 && t.length > 0; o = t.at(-1)) {
|
|
605
605
|
const r = o.pop();
|
|
606
606
|
r === void 0 ? t.pop() : e(r) !== !1 && D(r) && t.push(r.getChildren());
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
function kt(n, e =
|
|
610
|
-
const t =
|
|
611
|
-
|
|
609
|
+
function kt(n, e = Tt()) {
|
|
610
|
+
const t = Ae(n);
|
|
611
|
+
k(t) || y(231, n);
|
|
612
612
|
const o = ie(t, e.getElementByKey(n));
|
|
613
|
-
return o === null &&
|
|
613
|
+
return o === null && y(232, n), { tableElement: o, tableNode: t };
|
|
614
614
|
}
|
|
615
|
-
class
|
|
615
|
+
class Dn {
|
|
616
616
|
constructor(e, t) {
|
|
617
617
|
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();
|
|
618
618
|
}
|
|
@@ -650,7 +650,7 @@ class Bn {
|
|
|
650
650
|
const e = this.editor;
|
|
651
651
|
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();
|
|
652
652
|
const { tableNode: t, tableElement: o } = this.$lookup();
|
|
653
|
-
|
|
653
|
+
Fe(e, me(t, o), null), B() !== null && (ne(null), e.dispatchCommand(fe, void 0));
|
|
654
654
|
}
|
|
655
655
|
$enableHighlightStyle() {
|
|
656
656
|
const e = this.editor, { tableElement: t } = this.$lookup();
|
|
@@ -662,9 +662,9 @@ class Bn {
|
|
|
662
662
|
}
|
|
663
663
|
$updateTableTableSelection(e) {
|
|
664
664
|
if (e !== null) {
|
|
665
|
-
e.tableKey !== this.tableNodeKey &&
|
|
665
|
+
e.tableKey !== this.tableNodeKey && y(233, e.tableKey, this.tableNodeKey);
|
|
666
666
|
const t = this.editor;
|
|
667
|
-
this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(),
|
|
667
|
+
this.tableSelection = e, this.isHighlightingCells = !0, this.$disableHighlightStyle(), this.updateDOMSelection(), Fe(t, this.table, this.tableSelection);
|
|
668
668
|
} else this.$clearHighlight();
|
|
669
669
|
}
|
|
670
670
|
setShouldCheckSelection() {
|
|
@@ -682,7 +682,7 @@ class Bn {
|
|
|
682
682
|
}
|
|
683
683
|
updateDOMSelection() {
|
|
684
684
|
if (this.anchorCell !== null && this.focusCell !== null) {
|
|
685
|
-
const e =
|
|
685
|
+
const e = Me(this.editor._window);
|
|
686
686
|
e && e.rangeCount > 0 && e.removeAllRanges();
|
|
687
687
|
}
|
|
688
688
|
}
|
|
@@ -692,113 +692,113 @@ class Bn {
|
|
|
692
692
|
if (s === this.focusX && l === this.focusY) return !1;
|
|
693
693
|
} else this.isHighlightingCells = !0, this.$disableHighlightStyle();
|
|
694
694
|
if (this.focusX = s, this.focusY = l, this.isHighlightingCells) {
|
|
695
|
-
const i =
|
|
696
|
-
if (this.tableSelection != null && this.anchorCellNodeKey != null && i !== null) return this.focusCellNodeKey = i.getKey(), this.tableSelection =
|
|
695
|
+
const i = je(r, e.elem);
|
|
696
|
+
if (this.tableSelection != null && this.anchorCellNodeKey != null && i !== null) return this.focusCellNodeKey = i.getKey(), this.tableSelection = Pn(r, this.$getAnchorTableCellOrThrow(), i), ne(this.tableSelection), o.dispatchCommand(fe, void 0), Fe(o, this.table, this.tableSelection), !0;
|
|
697
697
|
}
|
|
698
698
|
return !1;
|
|
699
699
|
}
|
|
700
700
|
$getAnchorTableCell() {
|
|
701
|
-
return this.anchorCellNodeKey ?
|
|
701
|
+
return this.anchorCellNodeKey ? Ae(this.anchorCellNodeKey) : null;
|
|
702
702
|
}
|
|
703
703
|
$getAnchorTableCellOrThrow() {
|
|
704
704
|
const e = this.$getAnchorTableCell();
|
|
705
|
-
return e === null &&
|
|
705
|
+
return e === null && y(234), e;
|
|
706
706
|
}
|
|
707
707
|
$getFocusTableCell() {
|
|
708
|
-
return this.focusCellNodeKey ?
|
|
708
|
+
return this.focusCellNodeKey ? Ae(this.focusCellNodeKey) : null;
|
|
709
709
|
}
|
|
710
710
|
$getFocusTableCellOrThrow() {
|
|
711
711
|
const e = this.$getFocusTableCell();
|
|
712
|
-
return e === null &&
|
|
712
|
+
return e === null && y(235), e;
|
|
713
713
|
}
|
|
714
714
|
$setAnchorCellForSelection(e) {
|
|
715
715
|
this.isHighlightingCells = !1, this.anchorCell = e, this.anchorX = e.x, this.anchorY = e.y;
|
|
716
|
-
const { tableNode: t } = this.$lookup(), o =
|
|
716
|
+
const { tableNode: t } = this.$lookup(), o = je(t, e.elem);
|
|
717
717
|
if (o !== null) {
|
|
718
718
|
const r = o.getKey();
|
|
719
|
-
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() :
|
|
719
|
+
this.tableSelection = this.tableSelection != null ? this.tableSelection.clone() : $t(), this.anchorCellNodeKey = r;
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
$formatCells(e) {
|
|
723
723
|
const t = B();
|
|
724
|
-
O(t) ||
|
|
725
|
-
const o =
|
|
726
|
-
l.length > 0 ||
|
|
727
|
-
const i = l[0].getFirstChild(), u =
|
|
724
|
+
O(t) || y(236);
|
|
725
|
+
const o = Cn(), r = o.anchor, s = o.focus, l = t.getNodes().filter(w);
|
|
726
|
+
l.length > 0 || y(237);
|
|
727
|
+
const i = l[0].getFirstChild(), u = tt(i) ? i.getFormatFlags(e, null) : null;
|
|
728
728
|
l.forEach((m) => {
|
|
729
729
|
r.set(m.getKey(), 0, "element"), s.set(m.getKey(), m.getChildrenSize(), "element"), o.formatText(e, u);
|
|
730
730
|
}), ne(t), this.editor.dispatchCommand(fe, void 0);
|
|
731
731
|
}
|
|
732
732
|
$clearText() {
|
|
733
|
-
const { editor: e } = this, t =
|
|
734
|
-
if (
|
|
733
|
+
const { editor: e } = this, t = Ae(this.tableNodeKey);
|
|
734
|
+
if (!k(t)) throw new Error("Expected TableNode.");
|
|
735
735
|
const o = B();
|
|
736
|
-
O(o) ||
|
|
736
|
+
O(o) || y(253);
|
|
737
737
|
const r = o.getNodes().filter(w), s = t.getFirstChild(), l = t.getLastChild();
|
|
738
738
|
if (r.length > 0 && s !== null && l !== null && A(s) && A(l) && r[0] === s.getFirstChild() && r[r.length - 1] === l.getLastChild()) {
|
|
739
739
|
t.selectPrevious();
|
|
740
740
|
const i = t.getParent();
|
|
741
|
-
return t.remove(), void (
|
|
741
|
+
return t.remove(), void (_n(i) && i.isEmpty() && e.dispatchCommand(Kt, void 0));
|
|
742
742
|
}
|
|
743
743
|
r.forEach((i) => {
|
|
744
744
|
if (D(i)) {
|
|
745
|
-
const u = I(), m =
|
|
745
|
+
const u = I(), m = et();
|
|
746
746
|
u.append(m), i.append(u), i.getChildren().forEach((h) => {
|
|
747
747
|
h !== u && h.remove();
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
|
-
}),
|
|
750
|
+
}), Fe(e, this.table, null), ne(null), e.dispatchCommand(fe, void 0);
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
|
-
const qe = "__lexicalTableSelection",
|
|
753
|
+
const qe = "__lexicalTableSelection", In = (n) => !(1 & ~n.buttons);
|
|
754
754
|
function de(n) {
|
|
755
|
-
return
|
|
755
|
+
return Ne(n) && n.nodeName === "TABLE";
|
|
756
756
|
}
|
|
757
757
|
function ie(n, e) {
|
|
758
758
|
if (!e) return e;
|
|
759
759
|
const t = de(e) ? e : n.getDOMSlot(e).element;
|
|
760
|
-
return t.nodeName !== "TABLE" &&
|
|
760
|
+
return t.nodeName !== "TABLE" && y(245, e.nodeName), t;
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function rt(n) {
|
|
763
763
|
return n._window;
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function ve(n, e) {
|
|
766
766
|
for (let t = e, o = null; t !== null; t = t.getParent()) {
|
|
767
767
|
if (n.is(t)) return o;
|
|
768
768
|
w(t) && (o = t);
|
|
769
769
|
}
|
|
770
770
|
return null;
|
|
771
771
|
}
|
|
772
|
-
const
|
|
773
|
-
function
|
|
774
|
-
const r = t.getRootElement(), s =
|
|
775
|
-
r !== null && s !== null ||
|
|
776
|
-
const l = new
|
|
772
|
+
const Jn = [[en, "down"], [tn, "up"], [nn, "backward"], [on, "forward"]], Un = [ln, Ft, sn], Xn = [an, cn];
|
|
773
|
+
function Yn(n, e, t, o) {
|
|
774
|
+
const r = t.getRootElement(), s = rt(t);
|
|
775
|
+
r !== null && s !== null || y(246);
|
|
776
|
+
const l = new Dn(t, n.getKey()), i = ie(n, e);
|
|
777
777
|
(function(a, c) {
|
|
778
|
-
|
|
778
|
+
_t(a) !== null && y(205), a[qe] = c;
|
|
779
779
|
})(i, l), l.listenersToRemove.add(() => function(a, c) {
|
|
780
|
-
|
|
780
|
+
_t(a) === c && delete a[qe];
|
|
781
781
|
}(i, l));
|
|
782
782
|
const u = (a) => {
|
|
783
783
|
if (l.pointerType = a.pointerType, a.button !== 0 || !be(a.target) || !s) return;
|
|
784
784
|
const c = ke(a.target);
|
|
785
785
|
c !== null && t.update(() => {
|
|
786
|
-
const f =
|
|
787
|
-
if (
|
|
788
|
-
const d = f.anchor.getNode(), g =
|
|
789
|
-
g ? (l.$setAnchorCellForSelection(se(l, g)), l.$setFocusCellForSelection(c),
|
|
790
|
-
} else l.$setAnchorCellForSelection(c);
|
|
786
|
+
const f = Ue();
|
|
787
|
+
if (mt && a.shiftKey && V(f, n) && (z(f) || O(f))) {
|
|
788
|
+
const d = f.anchor.getNode(), g = ve(n, f.anchor.getNode());
|
|
789
|
+
g ? (l.$setAnchorCellForSelection(se(l, g)), l.$setFocusCellForSelection(c), ee(a)) : (n.isBefore(d) ? n.selectStart() : n.selectEnd()).anchor.set(f.anchor.key, f.anchor.offset, f.anchor.type);
|
|
790
|
+
} else a.pointerType !== "touch" && l.$setAnchorCellForSelection(c);
|
|
791
791
|
}), (() => {
|
|
792
792
|
if (l.isSelecting) return;
|
|
793
793
|
const f = () => {
|
|
794
794
|
l.isSelecting = !1, s.removeEventListener("pointerup", f), s.removeEventListener("pointermove", d);
|
|
795
795
|
}, d = (g) => {
|
|
796
|
-
if (!
|
|
796
|
+
if (!In(g) && l.isSelecting) return l.isSelecting = !1, s.removeEventListener("pointerup", f), void s.removeEventListener("pointermove", d);
|
|
797
797
|
if (!be(g.target)) return;
|
|
798
798
|
let _ = null;
|
|
799
|
-
const S = !(
|
|
800
|
-
if (S) _ =
|
|
801
|
-
else for (const N of document.elementsFromPoint(g.clientX, g.clientY)) if (_ =
|
|
799
|
+
const S = !(mt || i.contains(g.target));
|
|
800
|
+
if (S) _ = St(i, g.target);
|
|
801
|
+
else for (const N of document.elementsFromPoint(g.clientX, g.clientY)) if (_ = St(i, N), _) break;
|
|
802
802
|
!_ || l.focusCell !== null && _.elem === l.focusCell.elem || (l.setNextFocus({ focusCell: _, override: S }), t.dispatchCommand(fe, void 0));
|
|
803
803
|
};
|
|
804
804
|
l.isSelecting = !0, s.addEventListener("pointerup", f, l.listenerOptions), s.addEventListener("pointermove", d, l.listenerOptions);
|
|
@@ -823,216 +823,217 @@ function Xn(n, e, t, o) {
|
|
|
823
823
|
s.addEventListener("pointerdown", h, l.listenerOptions), l.listenersToRemove.add(() => {
|
|
824
824
|
s.removeEventListener("pointerdown", h);
|
|
825
825
|
});
|
|
826
|
-
for (const [a, c] of
|
|
827
|
-
l.listenersToRemove.add(t.registerCommand(
|
|
826
|
+
for (const [a, c] of Jn) l.listenersToRemove.add(t.registerCommand(a, (f) => Lt(t, f, c, n, l), Ie));
|
|
827
|
+
l.listenersToRemove.add(t.registerCommand(rn, (a) => {
|
|
828
828
|
const c = B();
|
|
829
829
|
if (O(c)) {
|
|
830
|
-
const f =
|
|
831
|
-
if (f !== null) return
|
|
830
|
+
const f = ve(n, c.focus.getNode());
|
|
831
|
+
if (f !== null) return ee(a), f.selectEnd(), !0;
|
|
832
832
|
}
|
|
833
833
|
return !1;
|
|
834
|
-
},
|
|
834
|
+
}, Ie));
|
|
835
835
|
const p = (a) => () => {
|
|
836
836
|
const c = B();
|
|
837
|
-
if (!
|
|
837
|
+
if (!V(c, n)) return !1;
|
|
838
838
|
if (O(c)) return l.$clearText(), !0;
|
|
839
|
-
if (
|
|
840
|
-
if (!w(
|
|
839
|
+
if (z(c)) {
|
|
840
|
+
if (!w(ve(n, c.anchor.getNode()))) return !1;
|
|
841
841
|
const f = c.anchor.getNode(), d = c.focus.getNode(), g = n.isParentOf(f), _ = n.isParentOf(d);
|
|
842
842
|
if (g && !_ || _ && !g) return l.$clearText(), !0;
|
|
843
|
-
const S =
|
|
843
|
+
const S = T(c.anchor.getNode(), (b) => D(b)), N = S && T(S, (b) => D(b) && w(b.getParent()));
|
|
844
844
|
if (!D(N) || !D(S)) return !1;
|
|
845
|
-
if (a ===
|
|
845
|
+
if (a === Ft && N.getPreviousSibling() === null) return !0;
|
|
846
846
|
}
|
|
847
847
|
return !1;
|
|
848
848
|
};
|
|
849
|
-
for (const a of
|
|
849
|
+
for (const a of Un) l.listenersToRemove.add(t.registerCommand(a, p(a), j));
|
|
850
850
|
const C = (a) => {
|
|
851
851
|
const c = B();
|
|
852
|
-
if (!O(c) && !
|
|
852
|
+
if (!O(c) && !z(c)) return !1;
|
|
853
853
|
const f = n.isParentOf(c.anchor.getNode());
|
|
854
854
|
if (f !== n.isParentOf(c.focus.getNode())) {
|
|
855
855
|
const d = f ? "anchor" : "focus", g = f ? "focus" : "anchor", { key: _, offset: S, type: N } = c[g];
|
|
856
856
|
return n[c[d].isBefore(c[g]) ? "selectPrevious" : "selectNext"]()[g].set(_, S, N), !1;
|
|
857
857
|
}
|
|
858
|
-
return !!
|
|
858
|
+
return !!V(c, n) && !!O(c) && (a && (a.preventDefault(), a.stopPropagation()), l.$clearText(), !0);
|
|
859
859
|
};
|
|
860
|
-
for (const a of
|
|
861
|
-
return l.listenersToRemove.add(t.registerCommand(
|
|
860
|
+
for (const a of Xn) l.listenersToRemove.add(t.registerCommand(a, C, j));
|
|
861
|
+
return l.listenersToRemove.add(t.registerCommand(un, (a) => {
|
|
862
862
|
const c = B();
|
|
863
863
|
if (c) {
|
|
864
|
-
if (!O(c) && !
|
|
865
|
-
|
|
864
|
+
if (!O(c) && !z(c)) return !1;
|
|
865
|
+
Fn(t, jt(a, ClipboardEvent) ? a : null, Kn(c));
|
|
866
866
|
const f = C(a);
|
|
867
|
-
return
|
|
867
|
+
return z(c) ? (c.removeText(), !0) : f;
|
|
868
868
|
}
|
|
869
869
|
return !1;
|
|
870
|
-
},
|
|
870
|
+
}, j)), l.listenersToRemove.add(t.registerCommand(hn, (a) => {
|
|
871
871
|
const c = B();
|
|
872
|
-
if (!
|
|
872
|
+
if (!V(c, n)) return !1;
|
|
873
873
|
if (O(c)) return l.$formatCells(a), !0;
|
|
874
|
-
if (
|
|
875
|
-
const f =
|
|
874
|
+
if (z(c)) {
|
|
875
|
+
const f = T(c.anchor.getNode(), (d) => w(d));
|
|
876
876
|
if (!w(f)) return !1;
|
|
877
877
|
}
|
|
878
878
|
return !1;
|
|
879
|
-
},
|
|
879
|
+
}, j)), l.listenersToRemove.add(t.registerCommand(dn, (a) => {
|
|
880
880
|
const c = B();
|
|
881
|
-
if (!O(c) || !
|
|
881
|
+
if (!O(c) || !V(c, n)) return !1;
|
|
882
882
|
const f = c.anchor.getNode(), d = c.focus.getNode();
|
|
883
883
|
if (!w(f) || !w(d)) return !1;
|
|
884
|
-
if (function(K,
|
|
884
|
+
if (function(K, M) {
|
|
885
885
|
if (O(K)) {
|
|
886
|
-
const R = K.anchor.getNode(),
|
|
887
|
-
if (
|
|
888
|
-
const [
|
|
889
|
-
return R.getKey() ===
|
|
886
|
+
const R = K.anchor.getNode(), F = K.focus.getNode();
|
|
887
|
+
if (M && R && F) {
|
|
888
|
+
const [W] = U(M, R, F);
|
|
889
|
+
return R.getKey() === W[0][0].cell.getKey() && F.getKey() === W[W.length - 1].at(-1).cell.getKey();
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
return !1;
|
|
893
893
|
}(c, n)) return n.setFormat(a), !0;
|
|
894
|
-
const [g, _, S] = U(n, f, d), N = Math.max(_.startRow + _.cell.__rowSpan - 1, S.startRow + S.cell.__rowSpan - 1),
|
|
895
|
-
for (let K =
|
|
896
|
-
const R = g[K][
|
|
897
|
-
if (
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
for (let
|
|
901
|
-
const
|
|
902
|
-
D(
|
|
894
|
+
const [g, _, S] = U(n, f, d), N = Math.max(_.startRow + _.cell.__rowSpan - 1, S.startRow + S.cell.__rowSpan - 1), b = Math.max(_.startColumn + _.cell.__colSpan - 1, S.startColumn + S.cell.__colSpan - 1), x = Math.min(_.startRow, S.startRow), E = Math.min(_.startColumn, S.startColumn), $ = /* @__PURE__ */ new Set();
|
|
895
|
+
for (let K = x; K <= N; K++) for (let M = E; M <= b; M++) {
|
|
896
|
+
const R = g[K][M].cell;
|
|
897
|
+
if ($.has(R)) continue;
|
|
898
|
+
$.add(R), R.setFormat(a);
|
|
899
|
+
const F = R.getChildren();
|
|
900
|
+
for (let W = 0; W < F.length; W++) {
|
|
901
|
+
const P = F[W];
|
|
902
|
+
D(P) && !P.isInline() && P.setFormat(a);
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
905
|
return !0;
|
|
906
|
-
},
|
|
906
|
+
}, j)), l.listenersToRemove.add(t.registerCommand(fn, (a) => {
|
|
907
907
|
const c = B();
|
|
908
|
-
if (!
|
|
908
|
+
if (!V(c, n)) return !1;
|
|
909
909
|
if (O(c)) return l.$clearHighlight(), !1;
|
|
910
|
-
if (
|
|
911
|
-
const f =
|
|
910
|
+
if (z(c)) {
|
|
911
|
+
const f = T(c.anchor.getNode(), (d) => w(d));
|
|
912
912
|
if (!w(f)) return !1;
|
|
913
913
|
if (typeof a == "string") {
|
|
914
914
|
const d = bt(t, c, n);
|
|
915
|
-
if (d) return
|
|
915
|
+
if (d) return yt(d, n, [et(a)]), !0;
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
918
|
return !1;
|
|
919
|
-
},
|
|
919
|
+
}, j)), o && l.listenersToRemove.add(t.registerCommand(gn, (a) => {
|
|
920
920
|
const c = B();
|
|
921
|
-
if (!
|
|
922
|
-
const f =
|
|
923
|
-
return !(f === null || !n.is(pe(f))) && (
|
|
921
|
+
if (!z(c) || !c.isCollapsed() || !V(c, n)) return !1;
|
|
922
|
+
const f = ye(c.anchor.getNode());
|
|
923
|
+
return !(f === null || !n.is(pe(f))) && (ee(a), function(d, g) {
|
|
924
924
|
const _ = g === "next" ? "getNextSibling" : "getPreviousSibling", S = g === "next" ? "getFirstChild" : "getLastChild", N = d[_]();
|
|
925
925
|
if (D(N)) return N.selectEnd();
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
for (let
|
|
929
|
-
const
|
|
930
|
-
if (D(
|
|
926
|
+
const b = T(d, A);
|
|
927
|
+
b === null && y(247);
|
|
928
|
+
for (let E = b[_](); A(E); E = E[_]()) {
|
|
929
|
+
const $ = E[S]();
|
|
930
|
+
if (D($)) return $.selectEnd();
|
|
931
931
|
}
|
|
932
|
-
const
|
|
933
|
-
|
|
932
|
+
const x = T(b, k);
|
|
933
|
+
x === null && y(248), g === "next" ? x.selectNext() : x.selectPrevious();
|
|
934
934
|
}(f, a.shiftKey ? "previous" : "next"), !0);
|
|
935
|
-
},
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
935
|
+
}, j)), l.listenersToRemove.add(t.registerCommand(mn, (a) => n.isSelected(), Ie)), l.listenersToRemove.add(t.registerCommand(Rt, (a, c) => {
|
|
936
|
+
if (t !== c) return !1;
|
|
937
|
+
const { nodes: f, selection: d } = a, g = d.getStartEndPoints(), _ = O(d), S = z(d) && T(d.anchor.getNode(), (v) => w(v)) !== null && T(d.focus.getNode(), (v) => w(v)) !== null || _;
|
|
938
|
+
if (f.length !== 1 || !k(f[0]) || !S || g === null) return !1;
|
|
939
|
+
const [N, b] = g, [x, E, $] = G(N), K = T(b.getNode(), (v) => w(v));
|
|
940
|
+
if (!(w(x) && w(K) && A(E) && k($))) return !1;
|
|
941
|
+
const M = f[0], [R, F, W] = U($, x, K), [P] = oe(M, null, null), te = R.length, _e = te > 0 ? R[0].length : 0;
|
|
942
|
+
let Y = F.startRow, H = F.startColumn, le = P.length, ue = le > 0 ? P[0].length : 0;
|
|
943
|
+
if (_) {
|
|
944
|
+
const v = $e(R, F, W), J = v.maxRow - v.minRow + 1, q = v.maxColumn - v.minColumn + 1;
|
|
945
|
+
Y = v.minRow, H = v.minColumn, le = Math.min(le, J), ue = Math.min(ue, q);
|
|
945
946
|
}
|
|
946
|
-
let
|
|
947
|
-
const
|
|
948
|
-
for (let v =
|
|
949
|
-
const
|
|
950
|
-
|
|
947
|
+
let Le = !1;
|
|
948
|
+
const Wt = Math.min(te, Y + le) - 1, Ht = Math.min(_e, H + ue) - 1, it = /* @__PURE__ */ new Set();
|
|
949
|
+
for (let v = Y; v <= Wt; v++) for (let J = H; J <= Ht; J++) {
|
|
950
|
+
const q = R[v][J];
|
|
951
|
+
it.has(q.cell.getKey()) || q.cell.__rowSpan === 1 && q.cell.__colSpan === 1 || (Hn(q.cell), it.add(q.cell.getKey()), Le = !0);
|
|
951
952
|
}
|
|
952
|
-
let [
|
|
953
|
-
const
|
|
954
|
-
for (let v = 0; v < Ht; v++)
|
|
955
|
-
kn(_e[H - 1][0].cell);
|
|
956
|
-
const Pt = ue - le + Y;
|
|
953
|
+
let [Se] = oe($.getWritable(), null, null);
|
|
954
|
+
const Pt = le - te + Y;
|
|
957
955
|
for (let v = 0; v < Pt; v++)
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
for (let v =
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
956
|
+
kn(Se[te - 1][0].cell);
|
|
957
|
+
const Bt = ue - _e + H;
|
|
958
|
+
for (let v = 0; v < Bt; v++)
|
|
959
|
+
Mn(Se[0][_e - 1].cell, !0, !1);
|
|
960
|
+
[Se] = oe($.getWritable(), null, null);
|
|
961
|
+
for (let v = Y; v < Y + le; v++) for (let J = H; J < H + ue; J++) {
|
|
962
|
+
const q = v - Y, at = J - H, We = P[q][at];
|
|
963
|
+
if (We.startRow !== q || We.startColumn !== at) continue;
|
|
964
|
+
const we = We.cell;
|
|
965
|
+
if (we.__rowSpan !== 1 || we.__colSpan !== 1) {
|
|
966
|
+
const Q = [], It = Math.min(v + we.__rowSpan, Y + le) - 1, Jt = Math.min(J + we.__colSpan, H + ue) - 1;
|
|
967
|
+
for (let Pe = v; Pe <= It; Pe++) for (let Be = J; Be <= Jt; Be++) {
|
|
968
|
+
const Ut = Se[Pe][Be];
|
|
969
|
+
Q.push(Ut.cell);
|
|
969
970
|
}
|
|
970
|
-
|
|
971
|
+
Ln(Q), Le = !0;
|
|
971
972
|
}
|
|
972
|
-
const { cell:
|
|
973
|
-
|
|
974
|
-
Ce(
|
|
975
|
-
}),
|
|
973
|
+
const { cell: He } = Se[v][J], Dt = He.getChildren();
|
|
974
|
+
we.getChildren().forEach((Q) => {
|
|
975
|
+
Ce(Q) && I().append(Q), He.append(Q);
|
|
976
|
+
}), Dt.forEach((Q) => Q.remove());
|
|
976
977
|
}
|
|
977
|
-
if (
|
|
978
|
-
const [v] = oe(
|
|
979
|
-
v[
|
|
978
|
+
if (_ && Le) {
|
|
979
|
+
const [v] = oe($.getWritable(), null, null);
|
|
980
|
+
v[F.startRow][F.startColumn].cell.selectEnd();
|
|
980
981
|
}
|
|
981
982
|
return !0;
|
|
982
|
-
},
|
|
983
|
-
const a = B(), c =
|
|
983
|
+
}, j)), l.listenersToRemove.add(t.registerCommand(fe, () => {
|
|
984
|
+
const a = B(), c = Ue(), f = l.getAndClearNextFocus();
|
|
984
985
|
if (f !== null) {
|
|
985
986
|
const { focusCell: d } = f;
|
|
986
987
|
if (O(a) && a.tableKey === l.tableNodeKey) return (d.x !== l.focusX || d.y !== l.focusY) && (l.$setFocusCellForSelection(d), !0);
|
|
987
|
-
if (d !== l.anchorCell &&
|
|
988
|
+
if (d !== l.anchorCell && V(a, n)) return l.$setFocusCellForSelection(d), !0;
|
|
988
989
|
}
|
|
989
|
-
if (l.getAndClearShouldCheckSelection() &&
|
|
990
|
-
const d = a.anchor.getNode(), g = n.getFirstChild(), _ =
|
|
990
|
+
if (l.getAndClearShouldCheckSelection() && z(c) && z(a) && a.isCollapsed()) {
|
|
991
|
+
const d = a.anchor.getNode(), g = n.getFirstChild(), _ = ye(d);
|
|
991
992
|
if (_ !== null && A(g)) {
|
|
992
993
|
const S = g.getFirstChild();
|
|
993
|
-
if (w(S) && n.is(
|
|
994
|
+
if (w(S) && n.is(T(_, (N) => N.is(n) || N.is(S)))) return S.selectStart(), !0;
|
|
994
995
|
}
|
|
995
996
|
}
|
|
996
|
-
if (
|
|
997
|
-
const { anchor: d, focus: g } = a, _ = d.getNode(), S = g.getNode(), N =
|
|
998
|
-
if (
|
|
997
|
+
if (z(a)) {
|
|
998
|
+
const { anchor: d, focus: g } = a, _ = d.getNode(), S = g.getNode(), N = ye(_), b = ye(S), x = !(!N || !n.is(pe(N))), E = !(!b || !n.is(pe(b))), $ = x !== E, K = x && E, M = a.isBackward();
|
|
999
|
+
if ($) {
|
|
999
1000
|
const R = a.clone();
|
|
1000
|
-
if (
|
|
1001
|
-
const [
|
|
1002
|
-
R.focus.set(
|
|
1003
|
-
} else if (
|
|
1004
|
-
const [
|
|
1005
|
-
R.anchor.set(
|
|
1001
|
+
if (E) {
|
|
1002
|
+
const [F] = U(n, b, b), W = F[0][0].cell, P = F[F.length - 1].at(-1).cell;
|
|
1003
|
+
R.focus.set(M ? W.getKey() : P.getKey(), M ? W.getChildrenSize() : P.getChildrenSize(), "element");
|
|
1004
|
+
} else if (x) {
|
|
1005
|
+
const [F] = U(n, N, N), W = F[0][0].cell, P = F[F.length - 1].at(-1).cell;
|
|
1006
|
+
R.anchor.set(M ? P.getKey() : W.getKey(), M ? P.getChildrenSize() : 0, "element");
|
|
1006
1007
|
}
|
|
1007
|
-
ne(R),
|
|
1008
|
-
} else if (K && (N.is(
|
|
1009
|
-
const R =
|
|
1010
|
-
R && !R.is(
|
|
1008
|
+
ne(R), wt(t, l);
|
|
1009
|
+
} else if (K && (N.is(b) || (l.$setAnchorCellForSelection(se(l, N)), l.$setFocusCellForSelection(se(l, b), !0)), l.pointerType === "touch" && l.isSelecting && a.isCollapsed() && z(c) && c.isCollapsed())) {
|
|
1010
|
+
const R = ye(c.anchor.getNode());
|
|
1011
|
+
R && !R.is(b) && (l.$setAnchorCellForSelection(se(l, R)), l.$setFocusCellForSelection(se(l, b), !0), l.pointerType = null);
|
|
1011
1012
|
}
|
|
1012
1013
|
} else if (a && O(a) && a.is(c) && a.tableKey === n.getKey()) {
|
|
1013
|
-
const d =
|
|
1014
|
+
const d = Me(s);
|
|
1014
1015
|
if (d && d.anchorNode && d.focusNode) {
|
|
1015
1016
|
const g = re(d.focusNode), _ = g && !n.isParentOf(g), S = re(d.anchorNode), N = S && n.isParentOf(S);
|
|
1016
1017
|
if (_ && N && d.rangeCount > 0) {
|
|
1017
|
-
const
|
|
1018
|
-
|
|
1018
|
+
const b = pn(d, t);
|
|
1019
|
+
b && (b.anchor.set(n.getKey(), a.isBackward() ? n.getChildrenSize() : 0, "element"), d.removeAllRanges(), ne(b));
|
|
1019
1020
|
}
|
|
1020
1021
|
}
|
|
1021
1022
|
}
|
|
1022
1023
|
return a && !a.is(c) && (O(a) || O(c)) && l.tableSelection && !l.tableSelection.is(c) ? (O(a) && a.tableKey === l.tableNodeKey ? l.$updateTableTableSelection(a) : !O(a) && O(c) && c.tableKey === l.tableNodeKey && l.$updateTableTableSelection(null), !1) : (l.hasHijackedSelectionStyles && !n.isSelected() ? function(d, g) {
|
|
1023
|
-
g.$enableHighlightStyle(),
|
|
1024
|
+
g.$enableHighlightStyle(), lt(g.table, (_) => {
|
|
1024
1025
|
const S = _.elem;
|
|
1025
|
-
_.highlighted = !1,
|
|
1026
|
+
_.highlighted = !1, zt(d, _), S.getAttribute("style") || S.removeAttribute("style");
|
|
1026
1027
|
});
|
|
1027
|
-
}(t, l) : !l.hasHijackedSelectionStyles && n.isSelected() &&
|
|
1028
|
-
},
|
|
1028
|
+
}(t, l) : !l.hasHijackedSelectionStyles && n.isSelected() && wt(t, l), !1);
|
|
1029
|
+
}, j)), l.listenersToRemove.add(t.registerCommand(Kt, () => {
|
|
1029
1030
|
const a = B();
|
|
1030
|
-
if (!
|
|
1031
|
+
if (!z(a) || !a.isCollapsed() || !V(a, n)) return !1;
|
|
1031
1032
|
const c = bt(t, a, n);
|
|
1032
|
-
return !!c && (
|
|
1033
|
-
},
|
|
1033
|
+
return !!c && (yt(c, n), !0);
|
|
1034
|
+
}, j)), l;
|
|
1034
1035
|
}
|
|
1035
|
-
function
|
|
1036
|
+
function _t(n) {
|
|
1036
1037
|
return n[qe] || null;
|
|
1037
1038
|
}
|
|
1038
1039
|
function ke(n) {
|
|
@@ -1047,7 +1048,7 @@ function ke(n) {
|
|
|
1047
1048
|
}
|
|
1048
1049
|
return null;
|
|
1049
1050
|
}
|
|
1050
|
-
function
|
|
1051
|
+
function St(n, e) {
|
|
1051
1052
|
if (!n.contains(e)) return null;
|
|
1052
1053
|
let t = null;
|
|
1053
1054
|
for (let o = e; o != null; o = o.parentNode) {
|
|
@@ -1088,14 +1089,14 @@ function me(n, e) {
|
|
|
1088
1089
|
}
|
|
1089
1090
|
return o.columns = s + 1, o.rows = l + 1, o;
|
|
1090
1091
|
}
|
|
1091
|
-
function
|
|
1092
|
+
function Fe(n, e, t) {
|
|
1092
1093
|
const o = new Set(t ? t.getNodes() : []);
|
|
1093
|
-
|
|
1094
|
+
lt(e, (r, s) => {
|
|
1094
1095
|
const l = r.elem;
|
|
1095
|
-
o.has(s) ? (r.highlighted = !0,
|
|
1096
|
+
o.has(s) ? (r.highlighted = !0, Mt(n, r)) : (r.highlighted = !1, zt(n, r), l.getAttribute("style") || l.removeAttribute("style"));
|
|
1096
1097
|
});
|
|
1097
1098
|
}
|
|
1098
|
-
function
|
|
1099
|
+
function lt(n, e) {
|
|
1099
1100
|
const { domRows: t } = n;
|
|
1100
1101
|
for (let o = 0; o < t.length; o++) {
|
|
1101
1102
|
const r = t[o];
|
|
@@ -1107,9 +1108,9 @@ function rt(n, e) {
|
|
|
1107
1108
|
}
|
|
1108
1109
|
}
|
|
1109
1110
|
}
|
|
1110
|
-
function
|
|
1111
|
-
e.$disableHighlightStyle(),
|
|
1112
|
-
t.highlighted = !0,
|
|
1111
|
+
function wt(n, e) {
|
|
1112
|
+
e.$disableHighlightStyle(), lt(e.table, (t) => {
|
|
1113
|
+
t.highlighted = !0, Mt(n, t);
|
|
1113
1114
|
});
|
|
1114
1115
|
}
|
|
1115
1116
|
const qn = (n, e, t, o, r) => {
|
|
@@ -1117,16 +1118,16 @@ const qn = (n, e, t, o, r) => {
|
|
|
1117
1118
|
switch (r) {
|
|
1118
1119
|
case "backward":
|
|
1119
1120
|
case "forward":
|
|
1120
|
-
return t !== (s ? n.table.columns - 1 : 0) ?
|
|
1121
|
+
return t !== (s ? n.table.columns - 1 : 0) ? Oe(e.getCellNodeFromCordsOrThrow(t + (s ? 1 : -1), o, n.table), s) : o !== (s ? n.table.rows - 1 : 0) ? Oe(e.getCellNodeFromCordsOrThrow(s ? 0 : n.table.columns - 1, o + (s ? 1 : -1), n.table), s) : s ? e.selectNext() : e.selectPrevious(), !0;
|
|
1121
1122
|
case "up":
|
|
1122
|
-
return o !== 0 ?
|
|
1123
|
+
return o !== 0 ? Oe(e.getCellNodeFromCordsOrThrow(t, o - 1, n.table), !1) : e.selectPrevious(), !0;
|
|
1123
1124
|
case "down":
|
|
1124
|
-
return o !== n.table.rows - 1 ?
|
|
1125
|
+
return o !== n.table.rows - 1 ? Oe(e.getCellNodeFromCordsOrThrow(t, o + 1, n.table), !0) : e.selectNext(), !0;
|
|
1125
1126
|
default:
|
|
1126
1127
|
return !1;
|
|
1127
1128
|
}
|
|
1128
1129
|
};
|
|
1129
|
-
function
|
|
1130
|
+
function Je(n, e) {
|
|
1130
1131
|
let t, o;
|
|
1131
1132
|
if (e.startColumn === n.minColumn) t = "minColumn";
|
|
1132
1133
|
else {
|
|
@@ -1140,120 +1141,120 @@ function Ie(n, e) {
|
|
|
1140
1141
|
}
|
|
1141
1142
|
return [t, o];
|
|
1142
1143
|
}
|
|
1143
|
-
function
|
|
1144
|
+
function Ke([n, e]) {
|
|
1144
1145
|
return [n === "minColumn" ? "maxColumn" : "minColumn", e === "minRow" ? "maxRow" : "minRow"];
|
|
1145
1146
|
}
|
|
1146
1147
|
function he(n, e, [t, o]) {
|
|
1147
1148
|
const r = e[o], s = n[r];
|
|
1148
|
-
s === void 0 &&
|
|
1149
|
+
s === void 0 && y(250, o, String(r));
|
|
1149
1150
|
const l = e[t], i = s[l];
|
|
1150
|
-
return i === void 0 &&
|
|
1151
|
-
}
|
|
1152
|
-
function
|
|
1153
|
-
const s =
|
|
1154
|
-
const { minColumn:
|
|
1155
|
-
let
|
|
1156
|
-
const
|
|
1157
|
-
for (let
|
|
1158
|
-
for (let
|
|
1159
|
-
return { bottomSpan:
|
|
1160
|
-
}(e, s), { topSpan: i, leftSpan: u, bottomSpan: m, rightSpan: h } = l, p = function(
|
|
1161
|
-
const
|
|
1162
|
-
return
|
|
1163
|
-
}(s, t), [C, a] =
|
|
1151
|
+
return i === void 0 && y(250, t, String(l)), i;
|
|
1152
|
+
}
|
|
1153
|
+
function jn(n, e, t, o, r) {
|
|
1154
|
+
const s = $e(e, t, o), l = function(x, E) {
|
|
1155
|
+
const { minColumn: $, maxColumn: K, minRow: M, maxRow: R } = E;
|
|
1156
|
+
let F = 1, W = 1, P = 1, te = 1;
|
|
1157
|
+
const _e = x[M], Y = x[R];
|
|
1158
|
+
for (let H = $; H <= K; H++) F = Math.max(F, _e[H].cell.__rowSpan), te = Math.max(te, Y[H].cell.__rowSpan);
|
|
1159
|
+
for (let H = M; H <= R; H++) W = Math.max(W, x[H][$].cell.__colSpan), P = Math.max(P, x[H][K].cell.__colSpan);
|
|
1160
|
+
return { bottomSpan: te, leftSpan: W, rightSpan: P, topSpan: F };
|
|
1161
|
+
}(e, s), { topSpan: i, leftSpan: u, bottomSpan: m, rightSpan: h } = l, p = function(x, E) {
|
|
1162
|
+
const $ = Je(x, E);
|
|
1163
|
+
return $ === null && y(249, E.cell.getKey()), $;
|
|
1164
|
+
}(s, t), [C, a] = Ke(p);
|
|
1164
1165
|
let c = s[C], f = s[a];
|
|
1165
1166
|
r === "forward" ? c += C === "maxColumn" ? 1 : u : r === "backward" ? c -= C === "minColumn" ? 1 : h : r === "down" ? f += a === "maxRow" ? 1 : i : r === "up" && (f -= a === "minRow" ? 1 : m);
|
|
1166
1167
|
const d = e[f];
|
|
1167
1168
|
if (d === void 0) return !1;
|
|
1168
1169
|
const g = d[c];
|
|
1169
1170
|
if (g === void 0) return !1;
|
|
1170
|
-
const [_, S] = function(
|
|
1171
|
-
const K =
|
|
1172
|
-
if (
|
|
1173
|
-
const R =
|
|
1174
|
-
if (R) return [he(
|
|
1175
|
-
const
|
|
1176
|
-
return [he(
|
|
1177
|
-
}(e, t, g), N = se(n, _.cell),
|
|
1178
|
-
return n.$setAnchorCellForSelection(N), n.$setFocusCellForSelection(
|
|
1179
|
-
}
|
|
1180
|
-
function
|
|
1181
|
-
if (
|
|
1171
|
+
const [_, S] = function(x, E, $) {
|
|
1172
|
+
const K = $e(x, E, $), M = Je(K, E);
|
|
1173
|
+
if (M) return [he(x, K, M), he(x, K, Ke(M))];
|
|
1174
|
+
const R = Je(K, $);
|
|
1175
|
+
if (R) return [he(x, K, Ke(R)), he(x, K, R)];
|
|
1176
|
+
const F = ["minColumn", "minRow"];
|
|
1177
|
+
return [he(x, K, F), he(x, K, Ke(F))];
|
|
1178
|
+
}(e, t, g), N = se(n, _.cell), b = se(n, S.cell);
|
|
1179
|
+
return n.$setAnchorCellForSelection(N), n.$setFocusCellForSelection(b, !0), !0;
|
|
1180
|
+
}
|
|
1181
|
+
function V(n, e) {
|
|
1182
|
+
if (z(n) || O(n)) {
|
|
1182
1183
|
const t = e.isParentOf(n.anchor.getNode()), o = e.isParentOf(n.focus.getNode());
|
|
1183
1184
|
return t && o;
|
|
1184
1185
|
}
|
|
1185
1186
|
return !1;
|
|
1186
1187
|
}
|
|
1187
|
-
function
|
|
1188
|
+
function Oe(n, e) {
|
|
1188
1189
|
e ? n.selectStart() : n.selectEnd();
|
|
1189
1190
|
}
|
|
1190
|
-
function
|
|
1191
|
+
function Mt(n, e) {
|
|
1191
1192
|
const t = e.elem, o = n._config.theme;
|
|
1192
|
-
w(re(t)) ||
|
|
1193
|
+
w(re(t)) || y(131), Z(t, o.tableCellSelected);
|
|
1193
1194
|
}
|
|
1194
|
-
function
|
|
1195
|
+
function zt(n, e) {
|
|
1195
1196
|
const t = e.elem;
|
|
1196
|
-
w(re(t)) ||
|
|
1197
|
+
w(re(t)) || y(131);
|
|
1197
1198
|
const o = n._config.theme;
|
|
1198
1199
|
ge(t, o.tableCellSelected);
|
|
1199
1200
|
}
|
|
1200
|
-
function
|
|
1201
|
-
const e =
|
|
1201
|
+
function ye(n) {
|
|
1202
|
+
const e = T(n, w);
|
|
1202
1203
|
return w(e) ? e : null;
|
|
1203
1204
|
}
|
|
1204
1205
|
function pe(n) {
|
|
1205
|
-
const e =
|
|
1206
|
-
return
|
|
1206
|
+
const e = T(n, k);
|
|
1207
|
+
return k(e) ? e : null;
|
|
1207
1208
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const i =
|
|
1210
|
-
if (
|
|
1209
|
+
function Vn(n, e, t, o, r, s, l) {
|
|
1210
|
+
const i = wn(t.focus, r ? "previous" : "next");
|
|
1211
|
+
if (yn(i)) return !1;
|
|
1211
1212
|
let u = i;
|
|
1212
|
-
for (const d of
|
|
1213
|
+
for (const d of ut(i).iterNodeCarets("shadowRoot")) {
|
|
1213
1214
|
if (!bn(d) || !D(d.origin)) return !1;
|
|
1214
1215
|
u = d;
|
|
1215
1216
|
}
|
|
1216
1217
|
const m = u.getParentAtCaret();
|
|
1217
1218
|
if (!w(m)) return !1;
|
|
1218
1219
|
const h = m, p = function(d) {
|
|
1219
|
-
for (const g of
|
|
1220
|
+
for (const g of ut(d).iterNodeCarets("root")) {
|
|
1220
1221
|
const { origin: _ } = g;
|
|
1221
1222
|
if (w(_)) {
|
|
1222
|
-
if (
|
|
1223
|
+
if (ht(g)) return Nn(_, d.direction);
|
|
1223
1224
|
} else if (!A(_)) break;
|
|
1224
1225
|
}
|
|
1225
1226
|
return null;
|
|
1226
|
-
}(
|
|
1227
|
+
}(dt(h, u.direction)), C = T(h, k);
|
|
1227
1228
|
if (!C || !C.is(s)) return !1;
|
|
1228
1229
|
const a = n.getElementByKey(h.getKey()), c = ke(a);
|
|
1229
1230
|
if (!a || !c) return !1;
|
|
1230
|
-
const f =
|
|
1231
|
+
const f = Zn(n, C);
|
|
1231
1232
|
if (l.table = f, p) if (o === "extend") {
|
|
1232
1233
|
const d = ke(n.getElementByKey(p.origin.getKey()));
|
|
1233
1234
|
if (!d) return !1;
|
|
1234
1235
|
l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(d, !0);
|
|
1235
1236
|
} else {
|
|
1236
|
-
const d =
|
|
1237
|
-
|
|
1237
|
+
const d = ft(p);
|
|
1238
|
+
Re(t.anchor, d), Re(t.focus, d);
|
|
1238
1239
|
}
|
|
1239
1240
|
else if (o === "extend") l.$setAnchorCellForSelection(c), l.$setFocusCellForSelection(c, !0);
|
|
1240
1241
|
else {
|
|
1241
1242
|
const d = function(g) {
|
|
1242
|
-
const _ =
|
|
1243
|
-
return
|
|
1244
|
-
}(
|
|
1245
|
-
|
|
1243
|
+
const _ = vn(g);
|
|
1244
|
+
return ht(_) ? ft(_) : g;
|
|
1245
|
+
}(dt(C, i.direction));
|
|
1246
|
+
Re(t.anchor, d), Re(t.focus, d);
|
|
1246
1247
|
}
|
|
1247
|
-
return
|
|
1248
|
+
return ee(e), !0;
|
|
1248
1249
|
}
|
|
1249
|
-
function
|
|
1250
|
+
function Lt(n, e, t, o, r) {
|
|
1250
1251
|
if ((t === "up" || t === "down") && function(l) {
|
|
1251
1252
|
const i = l.getRootElement();
|
|
1252
1253
|
return i ? i.hasAttribute("aria-controls") && i.getAttribute("aria-controls") === "typeahead-menu" : !1;
|
|
1253
1254
|
}(n)) return !1;
|
|
1254
1255
|
const s = B();
|
|
1255
|
-
if (!
|
|
1256
|
-
if (
|
|
1256
|
+
if (!V(s, o)) {
|
|
1257
|
+
if (z(s)) {
|
|
1257
1258
|
if (t === "backward") {
|
|
1258
1259
|
if (s.focus.offset > 0) return !1;
|
|
1259
1260
|
const l = function(u) {
|
|
@@ -1265,13 +1266,13 @@ function zt(n, e, t, o, r) {
|
|
|
1265
1266
|
}(s.focus.getNode());
|
|
1266
1267
|
if (!l) return !1;
|
|
1267
1268
|
const i = l.getPreviousSibling();
|
|
1268
|
-
return
|
|
1269
|
+
return !!k(i) && (ee(e), e.shiftKey ? s.focus.set(i.getParentOrThrow().getKey(), i.getIndexWithinParent(), "element") : i.selectEnd(), !0);
|
|
1269
1270
|
}
|
|
1270
1271
|
if (e.shiftKey && (t === "up" || t === "down")) {
|
|
1271
1272
|
const l = s.focus.getNode();
|
|
1272
1273
|
if (!s.isCollapsed() && (t === "up" && !s.isBackward() || t === "down" && s.isBackward())) {
|
|
1273
|
-
let i =
|
|
1274
|
-
if (w(i) && (i =
|
|
1274
|
+
let i = T(l, (C) => k(C));
|
|
1275
|
+
if (w(i) && (i = T(i, k)), i !== o || !i) return !1;
|
|
1275
1276
|
const u = t === "down" ? i.getNextSibling() : i.getPreviousSibling();
|
|
1276
1277
|
if (!u) return !1;
|
|
1277
1278
|
let m = 0;
|
|
@@ -1279,11 +1280,11 @@ function zt(n, e, t, o, r) {
|
|
|
1279
1280
|
let h = u;
|
|
1280
1281
|
t === "up" && D(u) && (h = u.getLastChild() || u, m = Ce(h) ? h.getTextContentSize() : 0);
|
|
1281
1282
|
const p = s.clone();
|
|
1282
|
-
return p.focus.set(h.getKey(), m, Ce(h) ? "text" : "element"), ne(p),
|
|
1283
|
+
return p.focus.set(h.getKey(), m, Ce(h) ? "text" : "element"), ne(p), ee(e), !0;
|
|
1283
1284
|
}
|
|
1284
|
-
if (
|
|
1285
|
+
if (Sn(l)) {
|
|
1285
1286
|
const i = t === "up" ? s.getNodes()[s.getNodes().length - 1] : s.getNodes()[0];
|
|
1286
|
-
if (i &&
|
|
1287
|
+
if (i && ve(o, i) !== null) {
|
|
1287
1288
|
const u = o.getFirstDescendant(), m = o.getLastDescendant();
|
|
1288
1289
|
if (!u || !m) return !1;
|
|
1289
1290
|
const [h] = G(u), [p] = G(m), C = o.getCordsFromCellNode(h, r.table), a = o.getCordsFromCellNode(p, r.table), c = o.getDOMCellFromCordsOrThrow(C.x, C.y, r.table), f = o.getDOMCellFromCordsOrThrow(a.x, a.y, r.table);
|
|
@@ -1292,37 +1293,37 @@ function zt(n, e, t, o, r) {
|
|
|
1292
1293
|
return !1;
|
|
1293
1294
|
}
|
|
1294
1295
|
{
|
|
1295
|
-
let i =
|
|
1296
|
-
if (w(i) && (i =
|
|
1296
|
+
let i = T(l, (m) => D(m) && !m.isInline());
|
|
1297
|
+
if (w(i) && (i = T(i, k)), !i) return !1;
|
|
1297
1298
|
const u = t === "down" ? i.getNextSibling() : i.getPreviousSibling();
|
|
1298
|
-
if (
|
|
1299
|
+
if (k(u) && r.tableNodeKey === u.getKey()) {
|
|
1299
1300
|
const m = u.getFirstDescendant(), h = u.getLastDescendant();
|
|
1300
1301
|
if (!m || !h) return !1;
|
|
1301
1302
|
const [p] = G(m), [C] = G(h), a = s.clone();
|
|
1302
|
-
return a.focus.set((t === "up" ? p : C).getKey(), t === "up" ? 0 : C.getChildrenSize(), "element"),
|
|
1303
|
+
return a.focus.set((t === "up" ? p : C).getKey(), t === "up" ? 0 : C.getChildrenSize(), "element"), ee(e), ne(a), !0;
|
|
1303
1304
|
}
|
|
1304
1305
|
}
|
|
1305
1306
|
}
|
|
1306
1307
|
}
|
|
1307
|
-
return t === "down" &&
|
|
1308
|
+
return t === "down" && Ze(n) && r.setShouldCheckSelection(), !1;
|
|
1308
1309
|
}
|
|
1309
|
-
if (
|
|
1310
|
+
if (z(s)) {
|
|
1310
1311
|
if (t === "backward" || t === "forward")
|
|
1311
|
-
return
|
|
1312
|
+
return Vn(n, e, s, e.shiftKey ? "extend" : "move", t === "backward", o, r);
|
|
1312
1313
|
if (s.isCollapsed()) {
|
|
1313
|
-
const { anchor: l, focus: i } = s, u =
|
|
1314
|
+
const { anchor: l, focus: i } = s, u = T(l.getNode(), w), m = T(i.getNode(), w);
|
|
1314
1315
|
if (!w(u) || !u.is(m)) return !1;
|
|
1315
1316
|
const h = pe(u);
|
|
1316
1317
|
if (h !== o && h != null) {
|
|
1317
1318
|
const g = ie(h, n.getElementByKey(h.getKey()));
|
|
1318
|
-
if (g != null) return r.table = me(h, g),
|
|
1319
|
+
if (g != null) return r.table = me(h, g), Lt(n, e, t, h, r);
|
|
1319
1320
|
}
|
|
1320
1321
|
const p = n.getElementByKey(u.__key), C = n.getElementByKey(l.key);
|
|
1321
1322
|
if (C == null || p == null) return !1;
|
|
1322
1323
|
let a;
|
|
1323
1324
|
if (l.type === "element") a = C.getBoundingClientRect();
|
|
1324
1325
|
else {
|
|
1325
|
-
const g =
|
|
1326
|
+
const g = Me(rt(n));
|
|
1326
1327
|
if (g === null || g.rangeCount === 0) return !1;
|
|
1327
1328
|
a = g.getRangeAt(0).getBoundingClientRect();
|
|
1328
1329
|
}
|
|
@@ -1332,7 +1333,7 @@ function zt(n, e, t, o, r) {
|
|
|
1332
1333
|
if (f == null) return !1;
|
|
1333
1334
|
const d = f.getBoundingClientRect();
|
|
1334
1335
|
if (t === "up" ? d.top > a.top - a.height : a.bottom + a.height > d.bottom) {
|
|
1335
|
-
|
|
1336
|
+
ee(e);
|
|
1336
1337
|
const g = o.getCordsFromCellNode(u, r.table);
|
|
1337
1338
|
if (!e.shiftKey) return qn(r, o, g.x, g.y, t);
|
|
1338
1339
|
{
|
|
@@ -1343,38 +1344,38 @@ function zt(n, e, t, o, r) {
|
|
|
1343
1344
|
}
|
|
1344
1345
|
}
|
|
1345
1346
|
} else if (O(s)) {
|
|
1346
|
-
const { anchor: l, focus: i } = s, u =
|
|
1347
|
-
|
|
1347
|
+
const { anchor: l, focus: i } = s, u = T(l.getNode(), w), m = T(i.getNode(), w), [h] = s.getNodes();
|
|
1348
|
+
k(h) || y(251);
|
|
1348
1349
|
const p = ie(h, n.getElementByKey(h.getKey()));
|
|
1349
|
-
if (!w(u) || !w(m) ||
|
|
1350
|
+
if (!w(u) || !w(m) || !k(h) || p == null) return !1;
|
|
1350
1351
|
r.$updateTableTableSelection(s);
|
|
1351
1352
|
const C = me(h, p), a = o.getCordsFromCellNode(u, C), c = o.getDOMCellFromCordsOrThrow(a.x, a.y, C);
|
|
1352
|
-
if (r.$setAnchorCellForSelection(c),
|
|
1353
|
+
if (r.$setAnchorCellForSelection(c), ee(e), e.shiftKey) {
|
|
1353
1354
|
const [f, d, g] = U(o, u, m);
|
|
1354
|
-
return
|
|
1355
|
+
return jn(r, f, d, g, t);
|
|
1355
1356
|
}
|
|
1356
1357
|
return m.selectEnd(), !0;
|
|
1357
1358
|
}
|
|
1358
1359
|
return !1;
|
|
1359
1360
|
}
|
|
1360
|
-
function
|
|
1361
|
+
function ee(n) {
|
|
1361
1362
|
n.preventDefault(), n.stopImmediatePropagation(), n.stopPropagation();
|
|
1362
1363
|
}
|
|
1363
|
-
function
|
|
1364
|
+
function yt(n, e, t) {
|
|
1364
1365
|
const o = I();
|
|
1365
1366
|
n === "first" ? e.insertBefore(o) : e.insertAfter(o), o.append(...t || []), o.selectEnd();
|
|
1366
1367
|
}
|
|
1367
1368
|
function bt(n, e, t) {
|
|
1368
1369
|
const o = t.getParent();
|
|
1369
1370
|
if (!o) return;
|
|
1370
|
-
const r =
|
|
1371
|
+
const r = Me(rt(n));
|
|
1371
1372
|
if (!r) return;
|
|
1372
1373
|
const s = r.anchorNode, l = n.getElementByKey(o.getKey()), i = ie(t, n.getElementByKey(t.getKey()));
|
|
1373
1374
|
if (!s || !l || !i || !l.contains(s) || i.contains(s)) return;
|
|
1374
|
-
const u =
|
|
1375
|
+
const u = T(e.anchor.getNode(), (_) => w(_));
|
|
1375
1376
|
if (!u) return;
|
|
1376
|
-
const m =
|
|
1377
|
-
if (
|
|
1377
|
+
const m = T(u, (_) => k(_));
|
|
1378
|
+
if (!k(m) || !m.is(t)) return;
|
|
1378
1379
|
const [h, p] = U(t, u, u), C = h[0][0], a = h[h.length - 1][h[0].length - 1], { startRow: c, startColumn: f } = p, d = c === C.startRow && f === C.startColumn, g = c === a.startRow && f === a.startColumn;
|
|
1379
1380
|
return d ? "first" : g ? "last" : void 0;
|
|
1380
1381
|
}
|
|
@@ -1382,10 +1383,10 @@ function se(n, e) {
|
|
|
1382
1383
|
const { tableNode: t } = n.$lookup(), o = t.getCordsFromCellNode(e, n.table);
|
|
1383
1384
|
return t.getDOMCellFromCordsOrThrow(o.x, o.y, n.table);
|
|
1384
1385
|
}
|
|
1385
|
-
function
|
|
1386
|
-
return
|
|
1386
|
+
function je(n, e, t) {
|
|
1387
|
+
return ve(n, re(e, t));
|
|
1387
1388
|
}
|
|
1388
|
-
function
|
|
1389
|
+
function Nt(n, e, t) {
|
|
1389
1390
|
if (!e.theme.tableAlignment) return;
|
|
1390
1391
|
const o = [], r = [];
|
|
1391
1392
|
for (const s of ["center", "right"]) {
|
|
@@ -1394,14 +1395,14 @@ function yt(n, e, t) {
|
|
|
1394
1395
|
}
|
|
1395
1396
|
ge(n, ...o), Z(n, ...r);
|
|
1396
1397
|
}
|
|
1397
|
-
const
|
|
1398
|
-
function
|
|
1399
|
-
return
|
|
1398
|
+
const Ve = /* @__PURE__ */ new WeakSet();
|
|
1399
|
+
function Ze(n = Tt()) {
|
|
1400
|
+
return Ve.has(n);
|
|
1400
1401
|
}
|
|
1401
|
-
function
|
|
1402
|
-
e ?
|
|
1402
|
+
function ho(n, e) {
|
|
1403
|
+
e ? Ve.add(n) : Ve.delete(n);
|
|
1403
1404
|
}
|
|
1404
|
-
class ae extends
|
|
1405
|
+
class ae extends Ge {
|
|
1405
1406
|
static getType() {
|
|
1406
1407
|
return "table";
|
|
1407
1408
|
}
|
|
@@ -1419,10 +1420,10 @@ class ae extends Qe {
|
|
|
1419
1420
|
super.afterCloneFrom(e), this.__colWidths = e.__colWidths, this.__rowStriping = e.__rowStriping, this.__frozenColumnCount = e.__frozenColumnCount, this.__frozenRowCount = e.__frozenRowCount;
|
|
1420
1421
|
}
|
|
1421
1422
|
static importDOM() {
|
|
1422
|
-
return { table: (e) => ({ conversion:
|
|
1423
|
+
return { table: (e) => ({ conversion: Gn, priority: 1 }) };
|
|
1423
1424
|
}
|
|
1424
1425
|
static importJSON(e) {
|
|
1425
|
-
return
|
|
1426
|
+
return st().updateFromJSON(e);
|
|
1426
1427
|
}
|
|
1427
1428
|
updateFromJSON(e) {
|
|
1428
1429
|
return super.updateFromJSON(e).setRowStriping(e.rowStriping || !1).setFrozenColumns(e.frozenColumnCount || 0).setFrozenRows(e.frozenRowCount || 0).setColWidths(e.colWidths);
|
|
@@ -1438,13 +1439,13 @@ class ae extends Qe {
|
|
|
1438
1439
|
}
|
|
1439
1440
|
getDOMSlot(e) {
|
|
1440
1441
|
const t = de(e) ? e : e.querySelector("table");
|
|
1441
|
-
return de(t) ||
|
|
1442
|
+
return de(t) || y(229), super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"));
|
|
1442
1443
|
}
|
|
1443
1444
|
createDOM(e, t) {
|
|
1444
1445
|
const o = document.createElement("table");
|
|
1445
1446
|
this.__style && (o.style.cssText = this.__style);
|
|
1446
1447
|
const r = document.createElement("colgroup");
|
|
1447
|
-
if (o.appendChild(r),
|
|
1448
|
+
if (o.appendChild(r), Zt(r), Z(o, e.theme.table), this.updateTableElement(null, o, e), Ze(t)) {
|
|
1448
1449
|
const s = document.createElement("div"), l = e.theme.tableScrollableWrapper;
|
|
1449
1450
|
return l ? Z(s, l) : s.style.cssText = "overflow-x: auto;", s.appendChild(o), this.updateTableWrapper(null, s, o, e), s;
|
|
1450
1451
|
}
|
|
@@ -1469,18 +1470,18 @@ class ae extends Qe {
|
|
|
1469
1470
|
C && (p.style.width = `${C}px`), m.push(p);
|
|
1470
1471
|
}
|
|
1471
1472
|
u.replaceChildren(...m);
|
|
1472
|
-
}(t, 0, this.getColumnCount(), this.getColWidths()),
|
|
1473
|
+
}(t, 0, this.getColumnCount(), this.getColWidths()), Nt(t, o, this.getFormatType());
|
|
1473
1474
|
}
|
|
1474
1475
|
updateDOM(e, t, o) {
|
|
1475
1476
|
const r = this.getDOMSlot(t).element;
|
|
1476
|
-
return t === r ===
|
|
1477
|
+
return t === r === Ze() || (Ne(s = t) && s.nodeName === "DIV" && this.updateTableWrapper(e, t, r, o), this.updateTableElement(e, r, o), !1);
|
|
1477
1478
|
var s;
|
|
1478
1479
|
}
|
|
1479
1480
|
exportDOM(e) {
|
|
1480
1481
|
const t = super.exportDOM(e), { element: o } = t;
|
|
1481
1482
|
return { after: (r) => {
|
|
1482
|
-
if (t.after && (r = t.after(r)), !de(r) &&
|
|
1483
|
-
|
|
1483
|
+
if (t.after && (r = t.after(r)), !de(r) && Ne(r) && (r = r.querySelector("table")), !de(r)) return null;
|
|
1484
|
+
Nt(r, e._config, this.getFormatType());
|
|
1484
1485
|
const [s] = oe(this, null, null), l = /* @__PURE__ */ new Map();
|
|
1485
1486
|
for (const h of s) for (const p of h) {
|
|
1486
1487
|
const C = p.cell.getKey();
|
|
@@ -1509,7 +1510,7 @@ class ae extends Qe {
|
|
|
1509
1510
|
r.append(h);
|
|
1510
1511
|
}
|
|
1511
1512
|
return r;
|
|
1512
|
-
}, element: !de(o) &&
|
|
1513
|
+
}, element: !de(o) && Ne(o) ? o.querySelector("table") : o };
|
|
1513
1514
|
}
|
|
1514
1515
|
canBeEmpty() {
|
|
1515
1516
|
return !1;
|
|
@@ -1524,7 +1525,7 @@ class ae extends Qe {
|
|
|
1524
1525
|
if (l != null) for (let i = 0; i < l.length; i++) {
|
|
1525
1526
|
const u = l[i];
|
|
1526
1527
|
if (u == null) continue;
|
|
1527
|
-
const { elem: m } = u, h =
|
|
1528
|
+
const { elem: m } = u, h = je(this, m);
|
|
1528
1529
|
if (h !== null && e.is(h)) return { x: i, y: s };
|
|
1529
1530
|
}
|
|
1530
1531
|
}
|
|
@@ -1588,19 +1589,19 @@ class ae extends Qe {
|
|
|
1588
1589
|
}), t;
|
|
1589
1590
|
}
|
|
1590
1591
|
}
|
|
1591
|
-
function
|
|
1592
|
+
function Zn(n, e) {
|
|
1592
1593
|
const t = n.getElementByKey(e.getKey());
|
|
1593
|
-
return t === null &&
|
|
1594
|
+
return t === null && y(230), me(e, t);
|
|
1594
1595
|
}
|
|
1595
|
-
function
|
|
1596
|
-
const e =
|
|
1596
|
+
function Gn(n) {
|
|
1597
|
+
const e = st();
|
|
1597
1598
|
n.hasAttribute("data-lexical-row-striping") && e.setRowStriping(!0), n.hasAttribute("data-lexical-frozen-column") && e.setFrozenColumns(1), n.hasAttribute("data-lexical-frozen-row") && e.setFrozenRows(1);
|
|
1598
1599
|
const t = n.querySelector(":scope > colgroup");
|
|
1599
1600
|
if (t) {
|
|
1600
1601
|
let o = [];
|
|
1601
1602
|
for (const r of t.querySelectorAll(":scope > col")) {
|
|
1602
1603
|
let s = r.style.width || "";
|
|
1603
|
-
if (!
|
|
1604
|
+
if (!nt.test(s) && (s = r.getAttribute("width") || "", !/^\d+$/.test(s))) {
|
|
1604
1605
|
o = void 0;
|
|
1605
1606
|
break;
|
|
1606
1607
|
}
|
|
@@ -1608,35 +1609,35 @@ function Qn(n) {
|
|
|
1608
1609
|
}
|
|
1609
1610
|
o && e.setColWidths(o);
|
|
1610
1611
|
}
|
|
1611
|
-
return { after: (o) =>
|
|
1612
|
+
return { after: (o) => vt(o, A), node: e };
|
|
1612
1613
|
}
|
|
1613
|
-
function
|
|
1614
|
-
return
|
|
1614
|
+
function st() {
|
|
1615
|
+
return Qe(new ae());
|
|
1615
1616
|
}
|
|
1616
|
-
function
|
|
1617
|
+
function k(n) {
|
|
1617
1618
|
return n instanceof ae;
|
|
1618
1619
|
}
|
|
1619
|
-
function
|
|
1620
|
-
const o = B() ||
|
|
1621
|
-
if (!o || !
|
|
1622
|
-
const r =
|
|
1620
|
+
function Qn({ rows: n, columns: e, includeHeaders: t }) {
|
|
1621
|
+
const o = B() || Ue();
|
|
1622
|
+
if (!o || !z(o) || pe(o.anchor.getNode())) return !1;
|
|
1623
|
+
const r = $n(Number(n), Number(e), t);
|
|
1623
1624
|
qt(r);
|
|
1624
1625
|
const s = r.getFirstDescendant();
|
|
1625
1626
|
return Ce(s) && s.select(), !0;
|
|
1626
1627
|
}
|
|
1627
|
-
function Gn(n) {
|
|
1628
|
-
A(n.getParent()) ? n.isEmpty() && n.append(I()) : n.remove();
|
|
1629
|
-
}
|
|
1630
1628
|
function eo(n) {
|
|
1631
|
-
|
|
1629
|
+
A(n.getParent()) ? n.isEmpty() && n.append(I()) : n.remove();
|
|
1632
1630
|
}
|
|
1633
1631
|
function to(n) {
|
|
1634
|
-
|
|
1632
|
+
k(n.getParent()) ? xt(n, w) : n.remove();
|
|
1633
|
+
}
|
|
1634
|
+
function no(n) {
|
|
1635
|
+
xt(n, A);
|
|
1635
1636
|
const [e] = oe(n, null, null), t = e.reduce((r, s) => Math.max(r, s.length), 0), o = n.getChildren();
|
|
1636
1637
|
for (let r = 0; r < e.length; ++r) {
|
|
1637
1638
|
const s = o[r];
|
|
1638
1639
|
if (!s) continue;
|
|
1639
|
-
A(s) ||
|
|
1640
|
+
A(s) || y(254, s.constructor.name, s.getType());
|
|
1640
1641
|
const l = e[r].reduce((i, u) => u ? 1 + i : i, 0);
|
|
1641
1642
|
if (l !== t) for (let i = l; i < t; ++i) {
|
|
1642
1643
|
const u = X();
|
|
@@ -1644,30 +1645,30 @@ function to(n) {
|
|
|
1644
1645
|
}
|
|
1645
1646
|
}
|
|
1646
1647
|
}
|
|
1647
|
-
function
|
|
1648
|
+
function oo(n) {
|
|
1648
1649
|
if (n.detail < 3 || !be(n.target)) return !1;
|
|
1649
1650
|
const e = re(n.target);
|
|
1650
1651
|
if (e === null) return !1;
|
|
1651
|
-
const t =
|
|
1652
|
+
const t = T(e, (o) => D(o) && !o.isInline());
|
|
1652
1653
|
return t === null ? !1 : !!w(t.getParent()) && (t.select(0), !0);
|
|
1653
1654
|
}
|
|
1654
|
-
function
|
|
1655
|
+
function fo(n) {
|
|
1655
1656
|
return n.registerNodeTransform(ce, (e) => {
|
|
1656
1657
|
if (e.getColSpan() > 1 || e.getRowSpan() > 1) {
|
|
1657
1658
|
const [, , t] = G(e), [o] = U(t, e, e), r = o.length, s = o[0].length;
|
|
1658
1659
|
let l = t.getFirstChild();
|
|
1659
|
-
A(l) ||
|
|
1660
|
+
A(l) || y(175);
|
|
1660
1661
|
const i = [];
|
|
1661
1662
|
for (let u = 0; u < r; u++) {
|
|
1662
|
-
u !== 0 && (l = l.getNextSibling(), A(l) ||
|
|
1663
|
+
u !== 0 && (l = l.getNextSibling(), A(l) || y(175));
|
|
1663
1664
|
let m = null;
|
|
1664
1665
|
for (let h = 0; h < s; h++) {
|
|
1665
1666
|
const p = o[u][h], C = p.cell;
|
|
1666
1667
|
if (p.startRow === u && p.startColumn === h) m = C, i.push(C);
|
|
1667
1668
|
else if (C.getColSpan() > 1 || C.getRowSpan() > 1) {
|
|
1668
|
-
w(C) ||
|
|
1669
|
+
w(C) || y(176);
|
|
1669
1670
|
const a = X(C.__headerState);
|
|
1670
|
-
m !== null ? m.insertAfter(a) :
|
|
1671
|
+
m !== null ? m.insertAfter(a) : Yt(l, a);
|
|
1671
1672
|
}
|
|
1672
1673
|
}
|
|
1673
1674
|
}
|
|
@@ -1675,9 +1676,9 @@ function ho(n) {
|
|
|
1675
1676
|
}
|
|
1676
1677
|
});
|
|
1677
1678
|
}
|
|
1678
|
-
function
|
|
1679
|
+
function go(n, e = !0) {
|
|
1679
1680
|
const t = /* @__PURE__ */ new Map(), o = (s, l, i) => {
|
|
1680
|
-
const u = ie(s, i), m =
|
|
1681
|
+
const u = ie(s, i), m = Yn(s, u, n, e);
|
|
1681
1682
|
t.set(l, [m, u]);
|
|
1682
1683
|
}, r = n.registerMutationListener(ae, (s) => {
|
|
1683
1684
|
n.getEditorState().read(() => {
|
|
@@ -1695,27 +1696,27 @@ function fo(n, e = !0) {
|
|
|
1695
1696
|
for (const [, [s]] of t) s.removeListeners();
|
|
1696
1697
|
};
|
|
1697
1698
|
}
|
|
1698
|
-
function
|
|
1699
|
-
return n.hasNodes([ae]) ||
|
|
1699
|
+
function mo(n) {
|
|
1700
|
+
return n.hasNodes([ae]) || y(255), Xt(n.registerCommand(On, Qn, De), n.registerCommand(Rt, ({ nodes: e, selection: t }, o) => n !== o || !z(t) ? !1 : pe(t.anchor.getNode()) !== null && e.some(k), De), n.registerCommand(Gt, oo, De), n.registerNodeTransform(ae, no), n.registerNodeTransform(Te, to), n.registerNodeTransform(ce, eo));
|
|
1700
1701
|
}
|
|
1701
1702
|
export {
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1703
|
+
co as B,
|
|
1704
|
+
At as H,
|
|
1705
|
+
xe as K,
|
|
1706
|
+
$n as L,
|
|
1707
|
+
Te as O,
|
|
1708
|
+
ao as P,
|
|
1708
1709
|
w as R,
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1710
|
+
fo as S,
|
|
1711
|
+
io as W,
|
|
1712
|
+
uo as Z,
|
|
1712
1713
|
ae as a,
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1714
|
+
mo as b,
|
|
1715
|
+
ho as c,
|
|
1716
|
+
Ze as s,
|
|
1716
1717
|
X as v,
|
|
1717
|
-
|
|
1718
|
+
go as w,
|
|
1718
1719
|
ce as y,
|
|
1719
|
-
|
|
1720
|
+
Ot as z
|
|
1720
1721
|
};
|
|
1721
|
-
//# sourceMappingURL=LexicalTable.prod-
|
|
1722
|
+
//# sourceMappingURL=LexicalTable.prod-BArw8Dt5.js.map
|