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