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