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