@ishibashi0112/spreadsheet-grid-core 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.js +79 -71
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +75 -73
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.js +63 -61
- package/dist/controllers/detailRowController.cjs +1 -1
- package/dist/controllers/detailRowController.js +60 -59
- package/dist/controllers/detailTabOrder.cjs +1 -1
- package/dist/controllers/detailTabOrder.js +17 -16
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.d.ts +4 -1
- package/dist/controllers/editController.js +163 -91
- package/dist/controllers/escapeClaimController.cjs +1 -1
- package/dist/controllers/escapeClaimController.js +23 -19
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +107 -106
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +1 -0
- package/dist/controllers/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +87 -76
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +3 -0
- package/dist/controllers/keyboardController.js +15 -13
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +3 -0
- package/dist/controllers/popoverSupport.js +62 -41
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.js +74 -73
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.d.ts +1 -1
- package/dist/controllers/tooltipController.js +122 -97
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.js +55 -54
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.d.ts +2 -1
- package/dist/engine/columnCommands.js +98 -67
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +2 -2
- package/dist/engine/gridApi.cjs +6 -5
- package/dist/engine/gridApi.d.ts +1 -0
- package/dist/engine/gridApi.js +151 -143
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +5 -0
- package/dist/engine/rowSelectionCommands.js +73 -38
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +2 -2
- package/dist/logic/contextMenuTarget.cjs +1 -1
- package/dist/logic/contextMenuTarget.d.ts +20 -2
- package/dist/logic/contextMenuTarget.js +62 -3
- package/dist/logic/dateFilterCondition.cjs +1 -1
- package/dist/logic/dateFilterCondition.d.ts +1 -0
- package/dist/logic/dateFilterCondition.js +17 -13
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +2 -1
- package/dist/logic/detailRow.js +19 -18
- package/dist/logic/domGuards.cjs +1 -1
- package/dist/logic/domGuards.d.ts +5 -0
- package/dist/logic/domGuards.js +11 -1
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +1 -0
- package/dist/logic/editorValues.js +10 -7
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +1 -0
- package/dist/logic/gridState.js +19 -16
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.js +2 -2
- package/dist/logic/rowDragTarget.cjs +1 -0
- package/dist/logic/rowDragTarget.d.ts +14 -0
- package/dist/logic/rowDragTarget.js +47 -0
- package/dist/logic/selectEditorState.d.ts +4 -4
- package/dist/logic/valueFormatters.d.ts +8 -3
- package/dist/model/gridTypes.core.d.ts +31 -12
- package/dist/utils/clipboard.cjs +4 -4
- package/dist/utils/clipboard.js +60 -59
- package/dist/utils/popupContainer.cjs +1 -1
- package/dist/utils/popupContainer.js +35 -28
- package/dist/utils/shadowDom.cjs +1 -0
- package/dist/utils/shadowDom.d.ts +5 -0
- package/dist/utils/shadowDom.js +33 -0
- package/package.json +1 -1
|
@@ -1,112 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { getActiveElement as e, getEventTarget as t } from "../utils/shadowDom.js";
|
|
2
|
+
import { isInsideDetailCardOf as n } from "../logic/detailRow.js";
|
|
3
|
+
import { isImeComposingKeyEvent as r } from "../logic/domGuards.js";
|
|
4
|
+
import { resolveElementScale as i } from "../logic/elementScale.js";
|
|
5
|
+
import { resolveGridVisibleBand as a } from "../utils/gridVisibleBand.js";
|
|
6
|
+
import { alignInputTextToTop as o } from "../utils/topAlignedInput.js";
|
|
6
7
|
//#region src/controllers/imeInputController.ts
|
|
7
|
-
var
|
|
8
|
-
let i =
|
|
9
|
-
for (let
|
|
10
|
-
if (e
|
|
11
|
-
let i =
|
|
8
|
+
var s = 24, c = "ssg-ime-input--composing", l = (e, t, r) => {
|
|
9
|
+
let i = e.querySelectorAll(`.ssg-body-row[data-row-index="${t.row}"]`);
|
|
10
|
+
for (let t of Array.from(i)) {
|
|
11
|
+
if (n(e, t)) continue;
|
|
12
|
+
let i = t.querySelectorAll(".ssg-body-cell");
|
|
12
13
|
for (let e of Array.from(i)) if (e.getAttribute("data-ssg-col-key") === r) return e;
|
|
13
14
|
}
|
|
14
15
|
return null;
|
|
15
|
-
},
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
let
|
|
20
|
-
if (!
|
|
21
|
-
let
|
|
22
|
-
if (!
|
|
23
|
-
let f =
|
|
24
|
-
if (
|
|
25
|
-
let e =
|
|
16
|
+
}, u = (e, t) => e === t || e !== null && t !== null && e.row === t.row && e.col === t.col, d = () => {
|
|
17
|
+
let n = null, d = null, f = null, p = null, m = !1, h = null, g = !1, _ = !1, v = !1, y = null, b = null, x = () => n?.gridRootRef.current ?? null, S = () => {
|
|
18
|
+
d && e(d) !== d && d.focus({ preventScroll: !0 });
|
|
19
|
+
}, C = (e, t) => {
|
|
20
|
+
let r = x(), c = n?.resolveCell(e) ?? null;
|
|
21
|
+
if (!d || !r || !c) return !1;
|
|
22
|
+
let u = l(r, e, c.colKey);
|
|
23
|
+
if (!u) return !1;
|
|
24
|
+
let f = r.getBoundingClientRect(), p = u.getBoundingClientRect(), m = i(r, f), h = p.top, g = p.bottom;
|
|
25
|
+
if (t) {
|
|
26
|
+
let e = a(u);
|
|
26
27
|
if (e !== null) {
|
|
27
28
|
let t = Math.max(h, e.top), n = Math.min(g, e.bottom);
|
|
28
|
-
n - t >=
|
|
29
|
+
n - t >= s * m.y && (h = t, g = n);
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
let _ = (g - h) / m.y;
|
|
32
|
-
return
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
return d.style.left = `${(p.left - f.left) / m.x - r.clientLeft}px`, d.style.top = `${(h - f.top) / m.y - r.clientTop}px`, d.style.width = `${p.width / m.x}px`, d.style.height = `${_}px`, d.style.textAlign = t && c.align ? c.align : "", o(d, t && u.classList.contains("ssg-body-cell--valign-top"), _), !0;
|
|
34
|
+
}, w = () => {
|
|
35
|
+
let e = d?.ownerDocument.defaultView ?? null;
|
|
36
|
+
e === null || b !== null || (b = {
|
|
37
|
+
view: e,
|
|
38
|
+
id: e.requestAnimationFrame(() => {
|
|
39
|
+
b = null, !(n === null || !n.enabled || h !== null || g || n.activeCell === null) && u(y, n.activeCell) && (C(n.activeCell, !1) || (y = null));
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}, T = () => {
|
|
43
|
+
b !== null && (b.view.cancelAnimationFrame(b.id), b = null);
|
|
44
|
+
}, E = () => {
|
|
45
|
+
d && (d.classList.remove(c), d.value = "", d.style.textAlign = "", o(d, !1, 0));
|
|
46
|
+
}, D = (e) => {
|
|
47
|
+
n === null || !n.enabled || n.editing || _ || e.target === f && S();
|
|
48
|
+
}, O = () => {
|
|
49
|
+
if (n === null || !n.enabled || n.editing || n.activeCell === null) {
|
|
50
|
+
h = null;
|
|
40
51
|
return;
|
|
41
52
|
}
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
cell:
|
|
45
|
-
allowed:
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
let
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
+
let e = n.activeCell, t = n.canStartEdit(e);
|
|
54
|
+
h = {
|
|
55
|
+
cell: e,
|
|
56
|
+
allowed: t
|
|
57
|
+
}, v = !1, t && (d?.classList.add(c), C(e, !0), y = e);
|
|
58
|
+
}, k = (t) => {
|
|
59
|
+
let r = h;
|
|
60
|
+
h = null;
|
|
61
|
+
let i = v;
|
|
62
|
+
if (v = !1, !d || r === null || !r.allowed || i) {
|
|
63
|
+
E();
|
|
53
64
|
return;
|
|
54
65
|
}
|
|
55
|
-
let
|
|
66
|
+
let a = d.value || t.data || "";
|
|
56
67
|
queueMicrotask(() => {
|
|
57
|
-
let t =
|
|
58
|
-
if (
|
|
59
|
-
|
|
68
|
+
let t = d;
|
|
69
|
+
if (n === null || !n.enabled || !t || a === "" || e(t) !== t || !n.canStartEdit(r.cell)) {
|
|
70
|
+
E();
|
|
60
71
|
return;
|
|
61
72
|
}
|
|
62
|
-
let
|
|
63
|
-
if (
|
|
64
|
-
|
|
73
|
+
let i = n.resolveEditText ? n.resolveEditText(r.cell, a) : a;
|
|
74
|
+
if (i === null || i === "") {
|
|
75
|
+
E();
|
|
65
76
|
return;
|
|
66
77
|
}
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
g = !0, n.startEdit(r.cell, i), requestAnimationFrame(() => {
|
|
79
|
+
g && n !== null && !n.editing && (g = !1, E());
|
|
69
80
|
});
|
|
70
81
|
});
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
if (
|
|
75
|
-
let
|
|
76
|
-
if (
|
|
77
|
-
|
|
82
|
+
}, A = () => {
|
|
83
|
+
h === null && !g && d && (d.value = "");
|
|
84
|
+
}, j = (n) => {
|
|
85
|
+
if (t(n, d) !== d || n.key !== "Tab" || n.defaultPrevented || r(n) || e(d) !== d) return;
|
|
86
|
+
let i = x();
|
|
87
|
+
if (i) {
|
|
88
|
+
_ = !0;
|
|
78
89
|
try {
|
|
79
|
-
|
|
90
|
+
i.focus({ preventScroll: !0 });
|
|
80
91
|
} finally {
|
|
81
|
-
|
|
92
|
+
_ = !1;
|
|
82
93
|
}
|
|
83
94
|
}
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
typeof document > "u" ||
|
|
90
|
-
},
|
|
91
|
-
|
|
95
|
+
}, M = () => {
|
|
96
|
+
h !== null && (v = !0);
|
|
97
|
+
}, N = (e) => {
|
|
98
|
+
f !== e && (f?.removeEventListener("focus", D), f = e, f?.addEventListener("focus", D));
|
|
99
|
+
}, P = (e) => {
|
|
100
|
+
typeof document > "u" || m === e || (m = e, e ? (document.addEventListener("keydown", j), document.addEventListener("pointerdown", M, !0)) : (document.removeEventListener("keydown", j), document.removeEventListener("pointerdown", M, !0)));
|
|
101
|
+
}, F = (e) => {
|
|
102
|
+
p !== e && (p && (p.removeEventListener("compositionstart", O), p.removeEventListener("compositionend", k), p.removeEventListener("input", A)), p = e, p && (p.addEventListener("compositionstart", O), p.addEventListener("compositionend", k), p.addEventListener("input", A)));
|
|
92
103
|
};
|
|
93
104
|
return {
|
|
94
105
|
update: (t) => {
|
|
95
|
-
|
|
96
|
-
let
|
|
97
|
-
if (
|
|
98
|
-
|
|
106
|
+
n = t;
|
|
107
|
+
let r = t.gridRootRef.current;
|
|
108
|
+
if (N(t.enabled ? r : null), F(t.enabled ? d : null), P(t.enabled), !t.enabled) {
|
|
109
|
+
h = null, g = !1, E(), d && r && e(d) === d && r.focus({ preventScroll: !0 });
|
|
99
110
|
return;
|
|
100
111
|
}
|
|
101
|
-
|
|
112
|
+
g && t.editing && (g = !1, E()), !(h !== null || g) && (t.activeCell !== null && !u(y, t.activeCell) && C(t.activeCell, !1) && (y = t.activeCell, w()), !t.editing && r && e(r) === r && S());
|
|
102
113
|
},
|
|
103
|
-
attach: (
|
|
104
|
-
|
|
114
|
+
attach: (e) => {
|
|
115
|
+
d !== e && (d = e, F(n?.enabled ? d : null), d && (typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches && (d.inputMode = "none"), y = null));
|
|
105
116
|
},
|
|
106
117
|
dispose: () => {
|
|
107
|
-
|
|
118
|
+
T(), F(null), N(null), P(!1), h = null, g = !1, n = null;
|
|
108
119
|
}
|
|
109
120
|
};
|
|
110
121
|
};
|
|
111
122
|
//#endregion
|
|
112
|
-
export {
|
|
123
|
+
export { c as IME_INPUT_COMPOSING_CLASS, d as createImeInputController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../utils/permissions.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/domGuards.cjs"),a=require("./liveUiState.cjs"),o=require("./clipboardController.cjs"),s=require("./escapeClaimController.cjs");var c=10,l=(e,t,n,r)=>{if(!e.getLabelRow)return t;let i=e.getRowCount(),a=t;for(;a>=0&&a<i&&e.getLabelRow(a);)a+=n;return a>=0&&a<i?a:r},u=e=>l(e,0,1,0),d=e=>n.resolveFirstDataColIndex(e),f=(e,t)=>({row:u(e),col:d(t)}),p=()=>{let n=null,p=e=>{n=e},m=(e,t)=>l(e,t,-1,l(e,t,1,t)),h=e=>{let t=e.getRowCount()-1;return l(e,t,-1,t)},g=(t,r,i)=>{if(n===null)return;let{dispatch:o}=n,s=a.readLiveUiState(n);if(i){let n=s.selection?.type===`cell`?s.selection.range.start:t;o(e.gridActions.startSelection(n)),o(e.gridActions.updateSelection(r)),o(e.gridActions.endSelection()),o(e.gridActions.activateCell(r));return}o(e.gridActions.startSelection(r)),o(e.gridActions.endSelection()),o(e.gridActions.activateCell(r))},_=()=>{if(n===null||a.readLiveUiState(n).activeCell)return!1;let{rowModel:e,visibleColumns:t}=n;if(e.getRowCount()===0||t.length===0)return!0;let r=f(e,t);return g(r,r,!1),!0},v=e=>{let t=n===null?void 0:a.readLiveUiState(n);return e&&t?.selection?.type===`cell`?t.selection.range.end:t?.activeCell??{row:0,col:0}},y=(e,t,i)=>{if(n===null)return;let{rowModel:a,visibleColumns:o}=n,s=a.getRowCount();if(s===0||o.length===0||_())return;let c=v(i),u=r.clamp(c.row+e,0,s-1);u=e===0?m(a,u):l(a,u,e>0?1:-1,c.row);let d={row:u,col:r.clamp(c.col+t,0,o.length-1)};g(c,d,i)},b=(e,t)=>{if(n===null)return;let{rowModel:
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../model/gridActions.cjs"),t=require("../utils/permissions.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/domGuards.cjs"),a=require("./liveUiState.cjs"),o=require("./clipboardController.cjs"),s=require("./escapeClaimController.cjs");var c=10,l=(e,t,n,r)=>{if(!e.getLabelRow)return t;let i=e.getRowCount(),a=t;for(;a>=0&&a<i&&e.getLabelRow(a);)a+=n;return a>=0&&a<i?a:r},u=e=>l(e,0,1,0),d=e=>n.resolveFirstDataColIndex(e),f=(e,t)=>({row:u(e),col:d(t)}),p=()=>{let n=null,p=e=>{n=e},m=(e,t)=>l(e,t,-1,l(e,t,1,t)),h=e=>{let t=e.getRowCount()-1;return l(e,t,-1,t)},g=(t,r,i)=>{if(n===null)return;let{dispatch:o}=n,s=a.readLiveUiState(n);if(i){let n=s.selection?.type===`cell`?s.selection.range.start:t;o(e.gridActions.startSelection(n)),o(e.gridActions.updateSelection(r)),o(e.gridActions.endSelection()),o(e.gridActions.activateCell(r));return}o(e.gridActions.startSelection(r)),o(e.gridActions.endSelection()),o(e.gridActions.activateCell(r))},_=()=>{if(n===null||a.readLiveUiState(n).activeCell)return!1;let{rowModel:e,visibleColumns:t}=n;if(e.getRowCount()===0||t.length===0)return!0;let r=f(e,t);return g(r,r,!1),!0},v=e=>{let t=n===null?void 0:a.readLiveUiState(n);return e&&t?.selection?.type===`cell`?t.selection.range.end:t?.activeCell??{row:0,col:0}},y=(e,t,i)=>{if(n===null)return;let{rowModel:a,visibleColumns:o}=n,s=a.getRowCount();if(s===0||o.length===0||_())return;let c=v(i),u=r.clamp(c.row+e,0,s-1);u=e===0?m(a,u):l(a,u,e>0?1:-1,c.row);let d={row:u,col:r.clamp(c.col+t,0,o.length-1)};g(c,d,i)},b=(e,t,i)=>{if(n===null)return;let{rowModel:o,visibleColumns:s}=n,c=a.readLiveUiState(n);if(o.getRowCount()===0||s.length===0)return;let l=c.activeCell?v(t):{row:u(o),col:d(s)},f=e(l,o,s),p=r.clamp(f.col,0,s.length-1);g(l,{row:m(o,r.clamp(f.row,0,o.getRowCount()-1)),col:p},t&&c.activeCell!==null);let h=i===void 0?null:n.scrollContainerRef?.current??null,_=s[p]?.pinned;h!==null&&(i===`start`?_===`left`:_===`right`)&&(h.scrollLeft=i===`start`?0:Math.max(h.scrollWidth-h.clientWidth,0))},x=(e,t,i)=>{let a=t.getRowCount(),o=n?.resolvePageRow?n.resolvePageRow(e.row,i):e.row+i*c,s=r.clamp(i>0?Math.max(o,e.row+1):Math.min(o,e.row-1),0,a-1),u=l(t,s,i,-1);return u>=0?u:l(t,s,i>0?-1:1,e.row)};return{update:p,handleKeyDown:async r=>{if(n===null)return;let{rowModel:c,visibleColumns:l,readOnly:f,canEditCell:p,setEditorInitialValue:m,dispatch:g,handleCopy:v,openFind:S,handleCellDoubleClick:C,selectEntireGrid:w,onUndo:T,onRedo:E,onClearSelection:D,enableClearOnDelete:O,onToggleCheckboxCell:k,onToggleGroup:A,onToggleDetailRow:j}=n,M=a.readLiveUiState(n),N=n.getUiState?o.computeIsWholeGridSelected(M.selection,c.getRowCount(),l.length):n.isWholeGridSelected;if(i.shouldIgnoreGridKeydown(r.target)||a.isEditingAtEvent(n)||r.isComposing&&i.isImeInputTarget(r.target))return;if((r.ctrlKey||r.metaKey)&&r.key.toLowerCase()===`c`){r.preventDefault(),await v();return}if((r.ctrlKey||r.metaKey)&&r.key.toLowerCase()===`f`&&S){r.preventDefault(),S();return}if((r.ctrlKey||r.metaKey)&&r.key.toLowerCase()===`a`){if(r.preventDefault(),N){g(e.gridActions.clearSelection()),g(e.gridActions.activateCell(null));return}w();return}if((r.ctrlKey||r.metaKey)&&!r.isComposing){if(r.key.toLowerCase()===`z`){r.preventDefault(),r.shiftKey?E():T();return}if(r.key.toLowerCase()===`y`&&!r.shiftKey){r.preventDefault(),E();return}}let P=r.ctrlKey||r.metaKey;if((r.key===`ContextMenu`||r.key===`F10`&&r.shiftKey)&&!P&&!r.altKey&&M.activeCell&&n.openContextMenu?.(M.activeCell)){r.preventDefault();return}if(r.key===`ArrowDown`&&r.altKey&&!P&&!r.shiftKey&&M.activeCell&&n.openColumnMenu?.(M.activeCell.col)){r.preventDefault();return}if(P&&!r.altKey&&(r.key===`ArrowUp`||r.key===`ArrowDown`)){r.preventDefault();let e=r.key===`ArrowDown`;b((t,n)=>({row:e?h(n):u(n),col:t.col}),r.shiftKey);return}if(P&&!r.altKey&&(r.key===`ArrowLeft`||r.key===`ArrowRight`)){r.preventDefault();let e=r.key===`ArrowRight`;b((t,n,r)=>({row:t.row,col:e?r.length-1:d(r)}),r.shiftKey,e?`end`:`start`);return}if((r.key===`Home`||r.key===`End`)&&!r.altKey){r.preventDefault();let e=r.key===`End`;b((t,n,r)=>({row:P?e?h(n):u(n):t.row,col:e?r.length-1:d(r)}),r.shiftKey,e?`end`:`start`);return}if((r.key===`PageDown`||r.key===`PageUp`)&&!P&&!r.altKey){if(r.preventDefault(),_())return;let e=r.key===`PageDown`?1:-1;b((t,n)=>({row:x(t,n,e),col:t.col}),r.shiftKey);return}if(r.key===`ArrowUp`){r.preventDefault(),y(-1,0,r.shiftKey);return}if(r.key===`ArrowDown`){r.preventDefault(),y(1,0,r.shiftKey);return}if(r.key===`ArrowLeft`){r.preventDefault(),y(0,-1,r.shiftKey);return}if(r.key===`ArrowRight`){r.preventDefault(),y(0,1,r.shiftKey);return}if(r.key===`Tab`){if(!M.activeCell&&!r.shiftKey){if(n.rowModel.getRowCount()===0||n.visibleColumns.length===0)return;r.preventDefault(),_();return}let e=M.activeCell?.col??0;if(r.shiftKey?e<=d(n.visibleColumns):e>=n.visibleColumns.length-1){!r.shiftKey&&M.activeCell&&n.onTabPastLastColumn?.(M.activeCell.row)&&r.preventDefault();return}r.preventDefault(),y(0,r.shiftKey?-1:1,!1);return}if(r.key===`Escape`){s.isClearableSelection(M.selection)&&r.preventDefault(),g(e.gridActions.clearSelection());return}if((r.key===`Delete`||r.key===`Backspace`)&&O){r.preventDefault(),D();return}if((r.key===`Enter`||r.key===` `)&&M.activeCell){let e=c.getGroupRow?.(M.activeCell.row);if(e){r.preventDefault(),A(e.groupKey);return}if(j&&l[M.activeCell.col]?.key===`__ssg_detail_toggle__`&&j(M.activeCell)){r.preventDefault();return}}if(r.key===`Enter`||r.key===`F2`){if(r.preventDefault(),M.activeCell){C(M.activeCell);return}r.key===`Enter`&&_();return}if(r.key===` `&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&r.preventDefault(),i.isPrintableKey(r)&&M.activeCell){let n=c.getRow(M.activeCell.row),i=l[M.activeCell.col];if(!n||!i||!t.isViewCellEditable({readOnly:f,canEditCell:p},c,M.activeCell.row,M.activeCell.col,n,i))return;if(i.editor?.type===`checkbox`){r.preventDefault(),r.key===` `&&k(M.activeCell);return}r.preventDefault(),m(r.key),g(e.gridActions.startEdit(M.activeCell))}}}};exports.createKeyboardController=p,exports.resolveFirstDataCell=f;
|
|
@@ -35,6 +35,9 @@ export type KeyboardControllerArgs<T> = {
|
|
|
35
35
|
openColumnMenu?: (col: number) => boolean;
|
|
36
36
|
openContextMenu?: (cell: CellCoord) => boolean;
|
|
37
37
|
onTabPastLastColumn?: (viewRowIndex: number) => boolean;
|
|
38
|
+
scrollContainerRef?: {
|
|
39
|
+
readonly current: HTMLElement | null;
|
|
40
|
+
} | undefined;
|
|
38
41
|
};
|
|
39
42
|
export declare const resolveFirstDataCell: <T>(rowModel: RowModel<T>, visibleColumns: GridColumn<T>[]) => CellCoord;
|
|
40
43
|
export type KeyboardController<T> = {
|
|
@@ -53,18 +53,20 @@ var d = 10, f = (e, t, n, r) => {
|
|
|
53
53
|
col: r(c.col + t, 0, o.length - 1)
|
|
54
54
|
};
|
|
55
55
|
y(c, u, i);
|
|
56
|
-
}, C = (e, t) => {
|
|
56
|
+
}, C = (e, t, i) => {
|
|
57
57
|
if (n === null) return;
|
|
58
|
-
let { rowModel:
|
|
59
|
-
if (
|
|
60
|
-
let
|
|
61
|
-
row: p(
|
|
62
|
-
col: m(
|
|
63
|
-
},
|
|
64
|
-
y(
|
|
65
|
-
row: _(
|
|
66
|
-
col:
|
|
67
|
-
}, t &&
|
|
58
|
+
let { rowModel: a, visibleColumns: o } = n, s = c(n);
|
|
59
|
+
if (a.getRowCount() === 0 || o.length === 0) return;
|
|
60
|
+
let l = s.activeCell ? x(t) : {
|
|
61
|
+
row: p(a),
|
|
62
|
+
col: m(o)
|
|
63
|
+
}, u = e(l, a, o), d = r(u.col, 0, o.length - 1);
|
|
64
|
+
y(l, {
|
|
65
|
+
row: _(a, r(u.row, 0, a.getRowCount() - 1)),
|
|
66
|
+
col: d
|
|
67
|
+
}, t && s.activeCell !== null);
|
|
68
|
+
let f = i === void 0 ? null : n.scrollContainerRef?.current ?? null, h = o[d]?.pinned;
|
|
69
|
+
f !== null && (i === "start" ? h === "left" : h === "right") && (f.scrollLeft = i === "start" ? 0 : Math.max(f.scrollWidth - f.clientWidth, 0));
|
|
68
70
|
}, w = (e, t, i) => {
|
|
69
71
|
let a = t.getRowCount(), o = n?.resolvePageRow ? n.resolvePageRow(e.row, i) : e.row + i * d, s = r(i > 0 ? Math.max(o, e.row + 1) : Math.min(o, e.row - 1), 0, a - 1), c = f(t, s, i, -1);
|
|
70
72
|
return c >= 0 ? c : f(t, s, i > 0 ? -1 : 1, e.row);
|
|
@@ -125,7 +127,7 @@ var d = 10, f = (e, t, n, r) => {
|
|
|
125
127
|
C((t, n, r) => ({
|
|
126
128
|
row: t.row,
|
|
127
129
|
col: e ? r.length - 1 : m(r)
|
|
128
|
-
}), r.shiftKey);
|
|
130
|
+
}), r.shiftKey, e ? "end" : "start");
|
|
129
131
|
return;
|
|
130
132
|
}
|
|
131
133
|
if ((r.key === "Home" || r.key === "End") && !r.altKey) {
|
|
@@ -134,7 +136,7 @@ var d = 10, f = (e, t, n, r) => {
|
|
|
134
136
|
C((t, n, r) => ({
|
|
135
137
|
row: L ? e ? v(n) : p(n) : t.row,
|
|
136
138
|
col: e ? r.length - 1 : m(r)
|
|
137
|
-
}), r.shiftKey);
|
|
139
|
+
}), r.shiftKey, e ? "end" : "start");
|
|
138
140
|
return;
|
|
139
141
|
}
|
|
140
142
|
if ((r.key === "PageDown" || r.key === "PageUp") && !L && !r.altKey) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs");require("../logic/domGuards.cjs"),require("./escapeClaimController.cjs");var t=e
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/shadowDom.cjs"),t=require("../logic/detailRow.cjs");require("../logic/domGuards.cjs"),require("./escapeClaimController.cjs");var n=t=>{let n=e.getActiveElement(t);n instanceof HTMLElement&&n.blur(),t?.blur()},r=`input, textarea, select, [contenteditable]:not([contenteditable="false"])`,i=n=>{let i=n.current,a=i===null?null:e.getActiveElement(i);i!==null&&a!==null&&!i.contains(a)&&a.closest(`.ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover`)!==null&&(a.matches(r)?queueMicrotask(()=>{let t=n.current,r=t===null?null:e.getActiveElement(t);t!==null&&(r===null||r===t.ownerDocument.body)&&t.focus({preventScroll:!0})}):i.focus({preventScroll:!0})),requestAnimationFrame(()=>{let r=n.current;if(r===null||t.isFocusInsideDetailCard(r))return;let i=e.getActiveElement(r);i!==null&&i!==r&&r.contains(i)&&i.closest(`.ssg-cell-editor`)!==null||i!==null&&!r.contains(i)&&i.closest(`.ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover`)!==null||r.focus()})},a=`.ssg-toolpanel, .ssg-filter-popover`,o=t=>{let n=t.current,r=n===null?null:e.getActiveElement(n);return r!==null&&typeof r.closest==`function`&&r.closest(a)!==null},s=(e,t)=>e.current?.contains(t)===!0,c=(t,n,r=`[role="menuitem"]`)=>{let i=e.getActiveElement(t),a=i instanceof HTMLElement&&i!==t&&t.contains(i);if(a&&!i.matches(r))return!1;let o=n.key;if(o===`ArrowDown`||o===`ArrowUp`||o===`Home`||o===`End`){n.preventDefault();let e=Array.from(t.querySelectorAll(`${r}:not(:disabled):not([aria-disabled="true"])`));if(e.length===0)return!0;let s=a?e.indexOf(i):-1,c;return c=o===`Home`?0:o===`End`?e.length-1:o===`ArrowDown`?s<0?0:(s+1)%e.length:s<0?e.length-1:(s-1+e.length)%e.length,e[c]?.focus(),!0}return!a&&(o===`PageUp`||o===`PageDown`||o===` `||o===`ArrowLeft`||o===`ArrowRight`)?(n.preventDefault(),!0):!1},l=(t,n)=>{if(t===null||!t.isConnected)return;let r=e.getActiveElement(t),i=r!==null&&n!=null&&(r===n||n.contains(r)&&r.hasAttribute(`data-ssg-ime-input`));(r===null||r===t.ownerDocument.body||i)&&t.focus({preventScroll:!0})},u=t=>{let n=t.ownerDocument.defaultView;n!==null&&n.requestAnimationFrame(()=>{if(!t.isConnected)return;let n=e.getActiveElement(t);(n===null||n===t.ownerDocument.body||n===t.ownerDocument.documentElement)&&t.focus({preventScroll:!0})})},d=new Set,f=t=>{let n=!1,r=()=>t.onResize?.(),i=e=>t.onScroll?.(e),a=n=>{let r=e.getEventTarget(n,t.getGridRoot?.()??null);r&&(t.isInside(r)||t.onOutsidePointerDown(r))},o=e=>t.onKeyDown?.(e),s=null,c=null,l=()=>{let e=t.onOtherGridPopupOpen,n=t.getGridRoot?.()??null;if(!(!e||!n)){for(let e of Array.from(d))e.owner!==n&&(d.delete(e),e.close());c={owner:n,close:e},d.add(c)}},u=()=>{let e=t.getGridRoot?.()??null,r=t.onGridHidden;!e||!r||typeof ResizeObserver>`u`||(s=new ResizeObserver(t=>{let i=t[t.length-1];if(!n||!i||i.contentRect.width!==0||i.contentRect.height!==0)return;let a=e.getBoundingClientRect();a.width===0&&a.height===0&&r()}),s.observe(e))};return{attach:()=>{n||(n=!0,window.addEventListener(`resize`,r),window.addEventListener(`scroll`,i,!0),window.addEventListener(`pointerdown`,a),window.addEventListener(`keydown`,o,!0),u(),l())},detach:()=>{n&&(n=!1,c!==null&&(d.delete(c),c=null),s?.disconnect(),s=null,window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,i,!0),window.removeEventListener(`pointerdown`,a),window.removeEventListener(`keydown`,o,!0))},isAttached:()=>n}};exports.blurForPopover=n,exports.createPopoverWindowBindings=f,exports.focusPanelIfIdle=l,exports.handleMenuKeyNavigation=c,exports.isFocusInPopupOpenedFromMenu=o,exports.isInsideGridRoot=s,exports.keepFocusAfterPress=u,exports.restoreGridFocus=i;
|
|
@@ -3,9 +3,11 @@ export type ReadonlyElementRef<E extends HTMLElement = HTMLElement> = {
|
|
|
3
3
|
};
|
|
4
4
|
export declare const blurForPopover: (gridRoot: HTMLElement | null) => void;
|
|
5
5
|
export declare const restoreGridFocus: (gridRootRef: ReadonlyElementRef) => void;
|
|
6
|
+
export declare const isFocusInPopupOpenedFromMenu: (gridRootRef: ReadonlyElementRef) => boolean;
|
|
6
7
|
export declare const isInsideGridRoot: (gridRootRef: ReadonlyElementRef, target: Node) => boolean;
|
|
7
8
|
export declare const handleMenuKeyNavigation: (panel: HTMLElement, event: KeyboardEvent, itemSelector?: string) => boolean;
|
|
8
9
|
export declare const focusPanelIfIdle: (panel: HTMLElement | null, gridRoot?: HTMLElement | null) => void;
|
|
10
|
+
export declare const keepFocusAfterPress: (trigger: HTMLElement) => void;
|
|
9
11
|
export type PopoverWindowHandlers = {
|
|
10
12
|
onResize?: () => void;
|
|
11
13
|
onScroll?: (event: Event) => void;
|
|
@@ -14,6 +16,7 @@ export type PopoverWindowHandlers = {
|
|
|
14
16
|
onKeyDown?: (event: KeyboardEvent) => void;
|
|
15
17
|
getGridRoot?: () => HTMLElement | null;
|
|
16
18
|
onGridHidden?: () => void;
|
|
19
|
+
onOtherGridPopupOpen?: () => void;
|
|
17
20
|
};
|
|
18
21
|
export type PopoverWindowBindings = {
|
|
19
22
|
attach: () => void;
|
|
@@ -1,58 +1,79 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getActiveElement as e, getEventTarget as t } from "../utils/shadowDom.js";
|
|
2
|
+
import { isFocusInsideDetailCard as n } from "../logic/detailRow.js";
|
|
2
3
|
import "../logic/domGuards.js";
|
|
3
4
|
import "./escapeClaimController.js";
|
|
4
5
|
//#region src/controllers/popoverSupport.ts
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
var r = (t) => {
|
|
7
|
+
let n = e(t);
|
|
8
|
+
n instanceof HTMLElement && n.blur(), t?.blur();
|
|
9
|
+
}, i = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])", a = (t) => {
|
|
10
|
+
let r = t.current, a = r === null ? null : e(r);
|
|
11
|
+
r !== null && a !== null && !r.contains(a) && a.closest(".ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover") !== null && (a.matches(i) ? queueMicrotask(() => {
|
|
12
|
+
let n = t.current, r = n === null ? null : e(n);
|
|
13
|
+
n !== null && (r === null || r === n.ownerDocument.body) && n.focus({ preventScroll: !0 });
|
|
12
14
|
}) : r.focus({ preventScroll: !0 })), requestAnimationFrame(() => {
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
let
|
|
16
|
-
|
|
15
|
+
let r = t.current;
|
|
16
|
+
if (r === null || n(r)) return;
|
|
17
|
+
let i = e(r);
|
|
18
|
+
i !== null && i !== r && r.contains(i) && i.closest(".ssg-cell-editor") !== null || i !== null && !r.contains(i) && i.closest(".ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover") !== null || r.focus();
|
|
17
19
|
});
|
|
18
|
-
},
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
}, o = ".ssg-toolpanel, .ssg-filter-popover", s = (t) => {
|
|
21
|
+
let n = t.current, r = n === null ? null : e(n);
|
|
22
|
+
return r !== null && typeof r.closest == "function" && r.closest(o) !== null;
|
|
23
|
+
}, c = (e, t) => e.current?.contains(t) === !0, l = (t, n, r = "[role=\"menuitem\"]") => {
|
|
24
|
+
let i = e(t), a = i instanceof HTMLElement && i !== t && t.contains(i);
|
|
25
|
+
if (a && !i.matches(r)) return !1;
|
|
26
|
+
let o = n.key;
|
|
27
|
+
if (o === "ArrowDown" || o === "ArrowUp" || o === "Home" || o === "End") {
|
|
28
|
+
n.preventDefault();
|
|
29
|
+
let e = Array.from(t.querySelectorAll(`${r}:not(:disabled):not([aria-disabled="true"])`));
|
|
30
|
+
if (e.length === 0) return !0;
|
|
31
|
+
let s = a ? e.indexOf(i) : -1, c;
|
|
32
|
+
return c = o === "Home" ? 0 : o === "End" ? e.length - 1 : o === "ArrowDown" ? s < 0 ? 0 : (s + 1) % e.length : s < 0 ? e.length - 1 : (s - 1 + e.length) % e.length, e[c]?.focus(), !0;
|
|
28
33
|
}
|
|
29
|
-
return !
|
|
30
|
-
},
|
|
31
|
-
if (
|
|
32
|
-
let
|
|
33
|
-
(
|
|
34
|
-
},
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
return !a && (o === "PageUp" || o === "PageDown" || o === " " || o === "ArrowLeft" || o === "ArrowRight") ? (n.preventDefault(), !0) : !1;
|
|
35
|
+
}, u = (t, n) => {
|
|
36
|
+
if (t === null || !t.isConnected) return;
|
|
37
|
+
let r = e(t), i = r !== null && n != null && (r === n || n.contains(r) && r.hasAttribute("data-ssg-ime-input"));
|
|
38
|
+
(r === null || r === t.ownerDocument.body || i) && t.focus({ preventScroll: !0 });
|
|
39
|
+
}, d = (t) => {
|
|
40
|
+
let n = t.ownerDocument.defaultView;
|
|
41
|
+
n !== null && n.requestAnimationFrame(() => {
|
|
42
|
+
if (!t.isConnected) return;
|
|
43
|
+
let n = e(t);
|
|
44
|
+
(n === null || n === t.ownerDocument.body || n === t.ownerDocument.documentElement) && t.focus({ preventScroll: !0 });
|
|
45
|
+
});
|
|
46
|
+
}, f = /* @__PURE__ */ new Set(), p = (e) => {
|
|
47
|
+
let n = !1, r = () => e.onResize?.(), i = (t) => e.onScroll?.(t), a = (n) => {
|
|
48
|
+
let r = t(n, e.getGridRoot?.() ?? null);
|
|
49
|
+
r && (e.isInside(r) || e.onOutsidePointerDown(r));
|
|
50
|
+
}, o = (t) => e.onKeyDown?.(t), s = null, c = null, l = () => {
|
|
51
|
+
let t = e.onOtherGridPopupOpen, n = e.getGridRoot?.() ?? null;
|
|
52
|
+
if (!(!t || !n)) {
|
|
53
|
+
for (let e of Array.from(f)) e.owner !== n && (f.delete(e), e.close());
|
|
54
|
+
c = {
|
|
55
|
+
owner: n,
|
|
56
|
+
close: t
|
|
57
|
+
}, f.add(c);
|
|
58
|
+
}
|
|
59
|
+
}, u = () => {
|
|
60
|
+
let t = e.getGridRoot?.() ?? null, r = e.onGridHidden;
|
|
61
|
+
!t || !r || typeof ResizeObserver > "u" || (s = new ResizeObserver((e) => {
|
|
41
62
|
let i = e[e.length - 1];
|
|
42
|
-
if (!
|
|
43
|
-
let a =
|
|
63
|
+
if (!n || !i || i.contentRect.width !== 0 || i.contentRect.height !== 0) return;
|
|
64
|
+
let a = t.getBoundingClientRect();
|
|
44
65
|
a.width === 0 && a.height === 0 && r();
|
|
45
|
-
}),
|
|
66
|
+
}), s.observe(t));
|
|
46
67
|
};
|
|
47
68
|
return {
|
|
48
69
|
attach: () => {
|
|
49
|
-
|
|
70
|
+
n || (n = !0, window.addEventListener("resize", r), window.addEventListener("scroll", i, !0), window.addEventListener("pointerdown", a), window.addEventListener("keydown", o, !0), u(), l());
|
|
50
71
|
},
|
|
51
72
|
detach: () => {
|
|
52
|
-
|
|
73
|
+
n && (n = !1, c !== null && (f.delete(c), c = null), s?.disconnect(), s = null, window.removeEventListener("resize", r), window.removeEventListener("scroll", i, !0), window.removeEventListener("pointerdown", a), window.removeEventListener("keydown", o, !0));
|
|
53
74
|
},
|
|
54
|
-
isAttached: () =>
|
|
75
|
+
isAttached: () => n
|
|
55
76
|
};
|
|
56
77
|
};
|
|
57
78
|
//#endregion
|
|
58
|
-
export {
|
|
79
|
+
export { r as blurForPopover, p as createPopoverWindowBindings, u as focusPanelIfIdle, l as handleMenuKeyNavigation, s as isFocusInPopupOpenedFromMenu, c as isInsideGridRoot, d as keepFocusAfterPress, a as restoreGridFocus };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs");require("./escapeClaimController.cjs");const
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/shadowDom.cjs"),t=require("../logic/valueStore.cjs");require("./escapeClaimController.cjs");const n=require("./popoverSupport.cjs"),r=require("../logic/panelDragGeometry.cjs");var i=360,a=420,o=336,s=8,c=12,l=[`filter`,`columns`,`sort`],u=(e,t,n)=>{let r=Math.max(0,Math.min(420,t-s*2)),i=n?Math.min(o,r):r,a=e;a+i>t-s&&(a=Math.max(s,t-s-i));let c=Math.max(0,Math.min(420,t-s-a));return{top:a,maxHeight:c}},d=e=>{let t={filter:e.canUseFilterTab,columns:e.canUseColumnsTab,sort:e.canUseSortTab};return l.filter(e=>t[e])},f=(e,t)=>e===null?null:t.includes(e)?e:t[0]??null,p=()=>{let a=null,o=t.createValueStore({requestedTab:null,layout:null,flashTick:0}),l={current:null},p=null,m=e=>{o.setSnapshot({...o.getSnapshot(),...e})},h=e=>{let t=o.getSnapshot().layout;t===e||t!==null&&e!==null&&t.top===e.top&&t.left===e.left&&t.width===e.width&&t.maxHeight===e.maxHeight||m({layout:e})},g=e=>r.clampPanelDragPosition({top:e.top,left:e.left,panelWidth:i,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}),_=e=>{let t=u(e.top,window.innerHeight,!0);return{top:t.top,left:e.left,width:i,maxHeight:t.maxHeight}},v=()=>{if(p){h(_(g(p)));return}let e=a?.gridRootRef.current??null;if(!e){h(null);return}let t=e.getBoundingClientRect(),n=t.right-i-c,r=t.top+c;n=Math.max(s,n),n=Math.min(n,window.innerWidth-i-s),r=Math.max(s,r);let o=u(r,window.innerHeight,!1);h({top:o.top,left:n,width:i,maxHeight:o.maxHeight})},y=()=>a!==null&&f(o.getSnapshot().requestedTab,d(a))!==null,b=null,x=(t,r=!1)=>{let i=b;if(b=null,m({requestedTab:null,layout:null}),w(),!(a===null||!t)){if(r&&i!==null&&i.isConnected&&i!==a.gridRootRef.current){let t=e.getActiveElement(i);if(t===i||(t===null||t===document.body||l.current?.contains(t)===!0)&&(i.focus({preventScroll:!0}),e.getActiveElement(i)===i))return}n.restoreGridFocus(a.gridRootRef)}},S=()=>x(!0,!0),C=n.createPopoverWindowBindings({onResize:v,onScroll:v,isInside:e=>l.current?.contains(e)===!0||a?.alliedRef?.current?.contains(e)===!0,onOutsidePointerDown:e=>x(a!==null&&n.isInsideGridRoot(a.gridRootRef,e)),getGridRoot:()=>a?.gridRootRef.current??null,onGridHidden:()=>x(!1),onKeyDown:e=>{if(e.key===`Escape`){if(a?.suppressEscape){a.onSuppressedEscape?.();return}e.preventDefault(),S()}}}),w=()=>{let e=y();e&&!C.isAttached()?(v(),C.attach()):!e&&C.isAttached()&&C.detach()};return{update:e=>{a=e,w()},subscribe:o.subscribe,getSnapshot:o.getSnapshot,panelRef:l,open:t=>{if(a===null||!d(a).includes(t))return;let r=o.getSnapshot();if(r.requestedTab===null){let t=e.getActiveElement(a.gridRootRef.current);b=t instanceof HTMLElement&&t!==document.body&&t.closest(`.ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover`)===null?t:null}l.current?.contains(e.getActiveElement(a.gridRootRef.current))!==!0&&n.blurForPopover(a.gridRootRef.current),m({requestedTab:t,flashTick:r.requestedTab===null?r.flashTick:r.flashTick+1}),w()},close:S,move:(e,t)=>{let n=g({top:e,left:t});p=n,m({layout:_(n)})},dispose:()=>{C.detach()}}};exports.TOOL_PANEL_MAX_HEIGHT=a,exports.createToolPanelController=p,exports.resolveActiveToolPanelTab=f,exports.resolveAvailableToolPanelTabs=d,exports.resolveToolPanelVerticalPlacement=u;
|