@ishibashi0112/spreadsheet-grid-core 1.2.0 → 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.d.ts +1 -0
- package/dist/controllers/clipboardController.js +79 -70
- 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 -0
- package/dist/controllers/detailRowController.d.ts +41 -0
- package/dist/controllers/detailRowController.js +97 -0
- 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 +4 -0
- package/dist/controllers/keyboardController.js +101 -97
- package/dist/controllers/liveUiState.cjs +1 -0
- package/dist/controllers/liveUiState.d.ts +7 -0
- package/dist/controllers/liveUiState.js +4 -0
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +1 -0
- package/dist/controllers/pointerInteractionsController.js +127 -126
- 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/cellCommands.cjs +1 -0
- package/dist/engine/cellCommands.d.ts +27 -0
- package/dist/engine/cellCommands.js +89 -0
- 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 +3 -0
- package/dist/engine/gridApi.js +158 -144
- 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/cellPlacement.cjs +1 -0
- package/dist/logic/cellPlacement.d.ts +22 -0
- package/dist/logic/cellPlacement.js +44 -0
- 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/density.cjs +1 -0
- package/dist/logic/density.d.ts +5 -0
- package/dist/logic/density.js +17 -0
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +6 -1
- package/dist/logic/detailRow.js +21 -17
- package/dist/logic/domGuards.cjs +1 -1
- package/dist/logic/domGuards.d.ts +10 -0
- package/dist/logic/domGuards.js +18 -2
- package/dist/logic/editorKeys.cjs +1 -0
- package/dist/logic/editorKeys.d.ts +30 -0
- package/dist/logic/editorKeys.js +34 -0
- package/dist/logic/editorStart.cjs +1 -0
- package/dist/logic/editorStart.d.ts +7 -0
- package/dist/logic/editorStart.js +23 -0
- 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/gridBarSummary.cjs +1 -0
- package/dist/logic/gridBarSummary.d.ts +27 -0
- package/dist/logic/gridBarSummary.js +137 -0
- 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.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +27 -4
- package/dist/logic/selectEditorState.js +29 -14
- 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/editorVisibleBounds.cjs +1 -0
- package/dist/utils/editorVisibleBounds.d.ts +10 -0
- package/dist/utils/editorVisibleBounds.js +40 -0
- package/dist/utils/errorBubblePlacement.cjs +1 -0
- package/dist/utils/errorBubblePlacement.d.ts +8 -0
- package/dist/utils/errorBubblePlacement.js +26 -0
- package/dist/utils/multilineEditor.cjs +2 -0
- package/dist/utils/multilineEditor.d.ts +7 -0
- package/dist/utils/multilineEditor.js +22 -0
- 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,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;
|
|
@@ -1,136 +1,137 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getActiveElement as e } from "../utils/shadowDom.js";
|
|
2
|
+
import { createValueStore as t } from "../logic/valueStore.js";
|
|
2
3
|
import "./escapeClaimController.js";
|
|
3
|
-
import { blurForPopover as
|
|
4
|
-
import { clampPanelDragPosition as
|
|
4
|
+
import { blurForPopover as n, createPopoverWindowBindings as r, isInsideGridRoot as i, restoreGridFocus as a } from "./popoverSupport.js";
|
|
5
|
+
import { clampPanelDragPosition as o } from "../logic/panelDragGeometry.js";
|
|
5
6
|
//#region src/controllers/toolPanelController.ts
|
|
6
|
-
var
|
|
7
|
+
var s = 360, c = 420, l = 336, u = 8, d = 12, f = [
|
|
7
8
|
"filter",
|
|
8
9
|
"columns",
|
|
9
10
|
"sort"
|
|
10
|
-
],
|
|
11
|
-
let r = Math.max(0, Math.min(420, t -
|
|
12
|
-
a + i > t -
|
|
13
|
-
let o = Math.max(0, Math.min(420, t -
|
|
11
|
+
], p = (e, t, n) => {
|
|
12
|
+
let r = Math.max(0, Math.min(420, t - u * 2)), i = n ? Math.min(l, r) : r, a = e;
|
|
13
|
+
a + i > t - u && (a = Math.max(u, t - u - i));
|
|
14
|
+
let o = Math.max(0, Math.min(420, t - u - a));
|
|
14
15
|
return {
|
|
15
16
|
top: a,
|
|
16
17
|
maxHeight: o
|
|
17
18
|
};
|
|
18
|
-
},
|
|
19
|
+
}, m = (e) => {
|
|
19
20
|
let t = {
|
|
20
21
|
filter: e.canUseFilterTab,
|
|
21
22
|
columns: e.canUseColumnsTab,
|
|
22
23
|
sort: e.canUseSortTab
|
|
23
24
|
};
|
|
24
|
-
return
|
|
25
|
-
},
|
|
26
|
-
let
|
|
25
|
+
return f.filter((e) => t[e]);
|
|
26
|
+
}, h = (e, t) => e === null ? null : t.includes(e) ? e : t[0] ?? null, g = () => {
|
|
27
|
+
let c = null, l = t({
|
|
27
28
|
requestedTab: null,
|
|
28
29
|
layout: null,
|
|
29
30
|
flashTick: 0
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
...
|
|
31
|
+
}), f = { current: null }, g = null, _ = (e) => {
|
|
32
|
+
l.setSnapshot({
|
|
33
|
+
...l.getSnapshot(),
|
|
33
34
|
...e
|
|
34
35
|
});
|
|
35
|
-
},
|
|
36
|
-
let t =
|
|
37
|
-
t === e || t !== null && e !== null && t.top === e.top && t.left === e.left && t.width === e.width && t.maxHeight === e.maxHeight ||
|
|
38
|
-
},
|
|
36
|
+
}, v = (e) => {
|
|
37
|
+
let t = l.getSnapshot().layout;
|
|
38
|
+
t === e || t !== null && e !== null && t.top === e.top && t.left === e.left && t.width === e.width && t.maxHeight === e.maxHeight || _({ layout: e });
|
|
39
|
+
}, y = (e) => o({
|
|
39
40
|
top: e.top,
|
|
40
41
|
left: e.left,
|
|
41
|
-
panelWidth:
|
|
42
|
+
panelWidth: s,
|
|
42
43
|
viewportWidth: window.innerWidth,
|
|
43
44
|
viewportHeight: window.innerHeight
|
|
44
|
-
}),
|
|
45
|
-
let t =
|
|
45
|
+
}), b = (e) => {
|
|
46
|
+
let t = p(e.top, window.innerHeight, !0);
|
|
46
47
|
return {
|
|
47
48
|
top: t.top,
|
|
48
49
|
left: e.left,
|
|
49
|
-
width:
|
|
50
|
+
width: s,
|
|
50
51
|
maxHeight: t.maxHeight
|
|
51
52
|
};
|
|
52
|
-
},
|
|
53
|
-
if (
|
|
54
|
-
|
|
53
|
+
}, x = () => {
|
|
54
|
+
if (g) {
|
|
55
|
+
v(b(y(g)));
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
let e =
|
|
58
|
+
let e = c?.gridRootRef.current ?? null;
|
|
58
59
|
if (!e) {
|
|
59
|
-
|
|
60
|
+
v(null);
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
let t = e.getBoundingClientRect(), n = t.right -
|
|
63
|
-
n = Math.max(
|
|
64
|
-
let i =
|
|
65
|
-
|
|
63
|
+
let t = e.getBoundingClientRect(), n = t.right - s - d, r = t.top + d;
|
|
64
|
+
n = Math.max(u, n), n = Math.min(n, window.innerWidth - s - u), r = Math.max(u, r);
|
|
65
|
+
let i = p(r, window.innerHeight, !1);
|
|
66
|
+
v({
|
|
66
67
|
top: i.top,
|
|
67
68
|
left: n,
|
|
68
|
-
width:
|
|
69
|
+
width: s,
|
|
69
70
|
maxHeight: i.maxHeight
|
|
70
71
|
});
|
|
71
|
-
},
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
72
|
+
}, S = () => c !== null && h(l.getSnapshot().requestedTab, m(c)) !== null, C = null, w = (t, n = !1) => {
|
|
73
|
+
let r = C;
|
|
74
|
+
if (C = null, _({
|
|
74
75
|
requestedTab: null,
|
|
75
76
|
layout: null
|
|
76
|
-
}),
|
|
77
|
-
if (
|
|
78
|
-
let
|
|
79
|
-
if (
|
|
77
|
+
}), D(), !(c === null || !t)) {
|
|
78
|
+
if (n && r !== null && r.isConnected && r !== c.gridRootRef.current) {
|
|
79
|
+
let t = e(r);
|
|
80
|
+
if (t === r || (t === null || t === document.body || f.current?.contains(t) === !0) && (r.focus({ preventScroll: !0 }), e(r) === r)) return;
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
+
a(c.gridRootRef);
|
|
82
83
|
}
|
|
83
|
-
},
|
|
84
|
-
onResize:
|
|
85
|
-
onScroll:
|
|
86
|
-
isInside: (e) =>
|
|
87
|
-
onOutsidePointerDown: (e) =>
|
|
88
|
-
getGridRoot: () =>
|
|
89
|
-
onGridHidden: () =>
|
|
84
|
+
}, T = () => w(!0, !0), E = r({
|
|
85
|
+
onResize: x,
|
|
86
|
+
onScroll: x,
|
|
87
|
+
isInside: (e) => f.current?.contains(e) === !0 || c?.alliedRef?.current?.contains(e) === !0,
|
|
88
|
+
onOutsidePointerDown: (e) => w(c !== null && i(c.gridRootRef, e)),
|
|
89
|
+
getGridRoot: () => c?.gridRootRef.current ?? null,
|
|
90
|
+
onGridHidden: () => w(!1),
|
|
90
91
|
onKeyDown: (e) => {
|
|
91
92
|
if (e.key === "Escape") {
|
|
92
|
-
if (
|
|
93
|
-
|
|
93
|
+
if (c?.suppressEscape) {
|
|
94
|
+
c.onSuppressedEscape?.();
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
|
-
e.preventDefault(),
|
|
97
|
+
e.preventDefault(), T();
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
|
-
}),
|
|
100
|
-
let e =
|
|
101
|
-
e && !
|
|
100
|
+
}), D = () => {
|
|
101
|
+
let e = S();
|
|
102
|
+
e && !E.isAttached() ? (x(), E.attach()) : !e && E.isAttached() && E.detach();
|
|
102
103
|
};
|
|
103
104
|
return {
|
|
104
105
|
update: (e) => {
|
|
105
|
-
|
|
106
|
+
c = e, D();
|
|
106
107
|
},
|
|
107
|
-
subscribe:
|
|
108
|
-
getSnapshot:
|
|
109
|
-
panelRef:
|
|
110
|
-
open: (
|
|
111
|
-
if (
|
|
112
|
-
let
|
|
113
|
-
if (
|
|
114
|
-
let
|
|
115
|
-
|
|
108
|
+
subscribe: l.subscribe,
|
|
109
|
+
getSnapshot: l.getSnapshot,
|
|
110
|
+
panelRef: f,
|
|
111
|
+
open: (t) => {
|
|
112
|
+
if (c === null || !m(c).includes(t)) return;
|
|
113
|
+
let r = l.getSnapshot();
|
|
114
|
+
if (r.requestedTab === null) {
|
|
115
|
+
let t = e(c.gridRootRef.current);
|
|
116
|
+
C = t instanceof HTMLElement && t !== document.body && t.closest(".ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover") === null ? t : null;
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
-
requestedTab:
|
|
119
|
-
flashTick:
|
|
120
|
-
}),
|
|
118
|
+
f.current?.contains(e(c.gridRootRef.current)) !== !0 && n(c.gridRootRef.current), _({
|
|
119
|
+
requestedTab: t,
|
|
120
|
+
flashTick: r.requestedTab === null ? r.flashTick : r.flashTick + 1
|
|
121
|
+
}), D();
|
|
121
122
|
},
|
|
122
|
-
close:
|
|
123
|
+
close: T,
|
|
123
124
|
move: (e, t) => {
|
|
124
|
-
let n =
|
|
125
|
+
let n = y({
|
|
125
126
|
top: e,
|
|
126
127
|
left: t
|
|
127
128
|
});
|
|
128
|
-
|
|
129
|
+
g = n, _({ layout: b(n) });
|
|
129
130
|
},
|
|
130
131
|
dispose: () => {
|
|
131
|
-
|
|
132
|
+
E.detach();
|
|
132
133
|
}
|
|
133
134
|
};
|
|
134
135
|
};
|
|
135
136
|
//#endregion
|
|
136
|
-
export {
|
|
137
|
+
export { c as TOOL_PANEL_MAX_HEIGHT, g as createToolPanelController, h as resolveActiveToolPanelTab, m as resolveAvailableToolPanelTabs, p as resolveToolPanelVerticalPlacement };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/shadowDom.cjs"),t=require("../logic/slotDom.cjs"),n=require("../utils/portalTokens.cjs"),r=require("../utils/popupContainer.cjs"),i=require("../logic/tooltipGeometry.cjs");var a=`data-ssg-tooltip`,o=`data-ssg-tooltip-overflow`,s=`[${a}], [${o}]`,c=350,l=800,u=0,d=null,f=null,p=0,m=null,h,g,_=null,v=null,y=new WeakMap;function b(e){g=t.applySlotToElement(e,h,g)}function x(e){let t=r.getPopupContainerFor(e);if(d!==null)return r.appendToPopupContainer(d,t),d;let n=document.createElement(`div`);return n.className=`ssg-tooltip`,n.setAttribute(`aria-hidden`,`true`),g=void 0,b(n),r.appendToPopupContainer(n,t),d=n,n}function S(){f!==null&&(window.clearTimeout(f),f=null)}var C=null;function w(){C!==null&&(cancelAnimationFrame(C),C=null)}function T(){if(w(),typeof requestAnimationFrame!=`function`)return;let e=()=>{if(C=null,m!==null){if(!m.isConnected){E();return}C=requestAnimationFrame(e)}};C=requestAnimationFrame(e)}function E(){S(),w(),m!==null&&(p=Date.now()+l),m=null,_=null,v=null,d!==null&&d.classList.remove(`ssg-tooltip--visible`)}function D(e){if(!e.isConnected)return;let t=e.getAttribute(a),r=e.getAttribute(o),s=t!==null&&t!==``?t:r!==null&&r!==``?r:(e.textContent??``).trim();if(s===``)return;let c=x(e);c.classList.toggle(`ssg-theme-dark`,e.closest(`.ssg-theme-dark`)!==null),c.classList.toggle(`ssg-theme-class`,e.closest(`.ssg-theme-class`)!==null),c.classList.toggle(`ssg-motion-off`,e.closest(`.ssg-motion-off`)!==null),n.syncPortalTokens(e,c),c.textContent=s,c.style.left=`0px`,c.style.top=`0px`;let l=i.computeTooltipPlacement({targetRect:e.getBoundingClientRect(),tipWidth:c.offsetWidth,tipHeight:c.offsetHeight,viewportWidth:window.innerWidth});c.style.left=`${l.left}px`,c.style.top=`${l.top}px`,c.classList.add(`ssg-tooltip--visible`),m=e,T()}function O(e){if(e.scrollWidth>e.clientWidth+1)return!0;for(let t of Array.from(e.children))if(t.scrollWidth>t.clientWidth+1)return!0;return!1}var k=e=>e.currentTarget;function A(t){let n=e.getEventTarget(t,k(t));if(!(n instanceof Element)||typeof PointerEvent<`u`&&t instanceof PointerEvent&&t.buttons!==0)return;let r=n.closest(s);if(r===null||r===m||!r.hasAttribute(a)&&!O(r))return;let i=m!==null;E(),i||Date.now()<p?D(r):f=window.setTimeout(()=>{f=null,D(r)},c)}function j(t){let n=e.getEventTarget(t,k(t));if(!(n instanceof Element))return;if(t.type===`focusout`&&v!==null&&v.contains(n)){let e=t.relatedTarget;if(!(e instanceof Node&&v.contains(e))){E();return}}let r=n.closest(s);if(r===null||r===_&&typeof PointerEvent<`u`&&t instanceof PointerEvent&&t.pointerType!==`mouse`)return;let i=t.relatedTarget;i instanceof Node&&r.contains(i)||E()}function M(){E()}function N(t){let n=e.getEventTarget(t,k(t));_!==null&&m===_&&typeof PointerEvent<`u`&&t instanceof PointerEvent&&t.pointerType!==`mouse`&&n instanceof Node&&_.contains(n)||E()}function P(t){let n=e.getEventTarget(t,k(t));if(!(n instanceof Element))return;let r=n.closest(`.ssg-shell`),i=r===null?void 0:y.get(r);if(r===null||i===void 0)return;let a=e.findElementById(r,i);a===null||m===a||!a.contains(n)||U(i,r)}function F(e){e.key===`Escape`&&E()}var I=[[`pointerover`,A],[`pointerout`,j],[`focusin`,A],[`focusout`,j],[`pointerdown`,N],[`pointerup`,P],[`scroll`,M],[`keydown`,F]],L=new Map,R=I.map(([e,t])=>[e,e=>{(typeof e.composedPath==`function`?e.composedPath():[]).some(e=>L.has(e))||t(e)}]);function z(e,t=I){for(let[n,r]of t)e.addEventListener(n,r,!0)}function B(e,t=I){for(let[n,r]of t)e.removeEventListener(n,r,!0)}function V(e){let t=L.get(e)??0;t===0&&z(e),L.set(e,t+1)}function H(e){let t=L.get(e)??0;t<=1?(L.delete(e),B(e)):L.set(e,t-1)}function U(t,n){if(typeof requestAnimationFrame!=`function`||u===0)return()=>{};n!==null&&y.set(n,t);let r=requestAnimationFrame(()=>{r=requestAnimationFrame(()=>{if(r=0,n!==null&&y.get(n)!==t)return;let i=e.findElementById(n,t);if(!(i!==null&&n!==null&&n.contains(e.getActiveElement(n))&&i.classList.contains(`ssg-body-cell--invalid`)&&(i.getAttribute(a)??``)!==``)){G(n);return}m!==i&&(E(),D(i)),m===i&&(_=i,v=n)})});return()=>{r!==0&&cancelAnimationFrame(r)}}function W(e){e&&y.delete(e),G(e)}function G(e){_===null||e!==void 0&&e!==v||(m===_&&E(),_=null,v=null)}function K(t,n){u+=1,u===1&&z(window,R);let r=e.getShadowRoot(n);r!==null&&V(r);let i=!1,a=e=>{h=e,d!==null&&b(d)};return a(t),{setSlot:a,dispose:()=>{i||(i=!0,r!==null&&H(r),--u,u===0&&(B(window,R),S(),w(),m=null,_=null,v=null,d!==null&&(d.remove(),d=null)))}}}exports.acquireTooltipController=K,exports.hideActiveCellTooltip=W,exports.scheduleActiveCellTooltip=U;
|
|
@@ -5,4 +5,4 @@ export type TooltipController = {
|
|
|
5
5
|
};
|
|
6
6
|
export declare function scheduleActiveCellTooltip(cellId: string, focusRoot: Element | null): () => void;
|
|
7
7
|
export declare function hideActiveCellTooltip(focusRoot?: Element | null): void;
|
|
8
|
-
export declare function acquireTooltipController(slot?: GridResolvedSlot): TooltipController;
|
|
8
|
+
export declare function acquireTooltipController(slot?: GridResolvedSlot, root?: Element | null): TooltipController;
|