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