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