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