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