@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,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;
|
|
@@ -1,143 +1,168 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { findElementById as e, getActiveElement as t, getEventTarget as n, getShadowRoot as r } from "../utils/shadowDom.js";
|
|
2
|
+
import { applySlotToElement as i } from "../logic/slotDom.js";
|
|
3
|
+
import { syncPortalTokens as a } from "../utils/portalTokens.js";
|
|
4
|
+
import { appendToPopupContainer as o, getPopupContainerFor as s } from "../utils/popupContainer.js";
|
|
5
|
+
import { computeTooltipPlacement as c } from "../logic/tooltipGeometry.js";
|
|
5
6
|
//#region src/controllers/tooltipController.ts
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
var l = "data-ssg-tooltip", u = "data-ssg-tooltip-overflow", d = `[${l}], [${u}]`, f = 350, p = 800, m = 0, h = null, g = null, _ = 0, v = null, y, b, x = null, S = null, C = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
function w(e) {
|
|
9
|
+
b = i(e, y, b);
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
let t =
|
|
12
|
-
if (
|
|
13
|
-
let
|
|
14
|
-
return
|
|
11
|
+
function T(e) {
|
|
12
|
+
let t = s(e);
|
|
13
|
+
if (h !== null) return o(h, t), h;
|
|
14
|
+
let n = document.createElement("div");
|
|
15
|
+
return n.className = "ssg-tooltip", n.setAttribute("aria-hidden", "true"), b = void 0, w(n), o(n, t), h = n, n;
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
17
|
+
function E() {
|
|
18
|
+
g !== null && (window.clearTimeout(g), g = null);
|
|
18
19
|
}
|
|
19
|
-
var
|
|
20
|
-
function
|
|
21
|
-
|
|
20
|
+
var D = null;
|
|
21
|
+
function O() {
|
|
22
|
+
D !== null && (cancelAnimationFrame(D), D = null);
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
if (
|
|
24
|
+
function k() {
|
|
25
|
+
if (O(), typeof requestAnimationFrame != "function") return;
|
|
25
26
|
let e = () => {
|
|
26
|
-
if (
|
|
27
|
-
if (!
|
|
28
|
-
|
|
27
|
+
if (D = null, v !== null) {
|
|
28
|
+
if (!v.isConnected) {
|
|
29
|
+
A();
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
D = requestAnimationFrame(e);
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
+
D = requestAnimationFrame(e);
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
37
|
+
function A() {
|
|
38
|
+
E(), O(), v !== null && (_ = Date.now() + p), v = null, x = null, S = null, h !== null && h.classList.remove("ssg-tooltip--visible");
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function j(e) {
|
|
40
41
|
if (!e.isConnected) return;
|
|
41
|
-
let
|
|
42
|
-
if (
|
|
43
|
-
let
|
|
44
|
-
|
|
45
|
-
let
|
|
42
|
+
let t = e.getAttribute(l), n = e.getAttribute(u), r = t !== null && t !== "" ? t : n !== null && n !== "" ? n : (e.textContent ?? "").trim();
|
|
43
|
+
if (r === "") return;
|
|
44
|
+
let i = T(e);
|
|
45
|
+
i.classList.toggle("ssg-theme-dark", e.closest(".ssg-theme-dark") !== null), i.classList.toggle("ssg-theme-class", e.closest(".ssg-theme-class") !== null), i.classList.toggle("ssg-motion-off", e.closest(".ssg-motion-off") !== null), a(e, i), i.textContent = r, i.style.left = "0px", i.style.top = "0px";
|
|
46
|
+
let o = c({
|
|
46
47
|
targetRect: e.getBoundingClientRect(),
|
|
47
|
-
tipWidth:
|
|
48
|
-
tipHeight:
|
|
48
|
+
tipWidth: i.offsetWidth,
|
|
49
|
+
tipHeight: i.offsetHeight,
|
|
49
50
|
viewportWidth: window.innerWidth
|
|
50
51
|
});
|
|
51
|
-
|
|
52
|
+
i.style.left = `${o.left}px`, i.style.top = `${o.top}px`, i.classList.add("ssg-tooltip--visible"), v = e, k();
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function M(e) {
|
|
54
55
|
if (e.scrollWidth > e.clientWidth + 1) return !0;
|
|
55
56
|
for (let t of Array.from(e.children)) if (t.scrollWidth > t.clientWidth + 1) return !0;
|
|
56
57
|
return !1;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
var N = (e) => e.currentTarget;
|
|
60
|
+
function P(e) {
|
|
61
|
+
let t = n(e, N(e));
|
|
60
62
|
if (!(t instanceof Element) || typeof PointerEvent < "u" && e instanceof PointerEvent && e.buttons !== 0) return;
|
|
61
|
-
let
|
|
62
|
-
if (
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
}
|
|
68
|
-
function
|
|
69
|
-
let t = e
|
|
63
|
+
let r = t.closest(d);
|
|
64
|
+
if (r === null || r === v || !r.hasAttribute(l) && !M(r)) return;
|
|
65
|
+
let i = v !== null;
|
|
66
|
+
A(), i || Date.now() < _ ? j(r) : g = window.setTimeout(() => {
|
|
67
|
+
g = null, j(r);
|
|
68
|
+
}, f);
|
|
69
|
+
}
|
|
70
|
+
function F(e) {
|
|
71
|
+
let t = n(e, N(e));
|
|
70
72
|
if (!(t instanceof Element)) return;
|
|
71
|
-
if (e.type === "focusout" &&
|
|
73
|
+
if (e.type === "focusout" && S !== null && S.contains(t)) {
|
|
72
74
|
let t = e.relatedTarget;
|
|
73
|
-
if (!(t instanceof Node &&
|
|
74
|
-
|
|
75
|
+
if (!(t instanceof Node && S.contains(t))) {
|
|
76
|
+
A();
|
|
75
77
|
return;
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
let
|
|
79
|
-
if (
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
function j() {
|
|
84
|
-
E();
|
|
85
|
-
}
|
|
86
|
-
function M(e) {
|
|
87
|
-
_ !== null && m === _ && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse" && e.target instanceof Node && _.contains(e.target) || E();
|
|
80
|
+
let r = t.closest(d);
|
|
81
|
+
if (r === null || r === x && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse") return;
|
|
82
|
+
let i = e.relatedTarget;
|
|
83
|
+
i instanceof Node && r.contains(i) || A();
|
|
88
84
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
if (!(t instanceof Element)) return;
|
|
92
|
-
let n = t.closest(".ssg-shell"), r = n === null ? void 0 : y.get(n);
|
|
93
|
-
if (n === null || r === void 0) return;
|
|
94
|
-
let i = document.getElementById(r);
|
|
95
|
-
i === null || m === i || !i.contains(t) || L(r, n);
|
|
85
|
+
function I() {
|
|
86
|
+
A();
|
|
96
87
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
88
|
+
function L(e) {
|
|
89
|
+
let t = n(e, N(e));
|
|
90
|
+
x !== null && v === x && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse" && t instanceof Node && x.contains(t) || A();
|
|
99
91
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
92
|
+
function R(t) {
|
|
93
|
+
let r = n(t, N(t));
|
|
94
|
+
if (!(r instanceof Element)) return;
|
|
95
|
+
let i = r.closest(".ssg-shell"), a = i === null ? void 0 : C.get(i);
|
|
96
|
+
if (i === null || a === void 0) return;
|
|
97
|
+
let o = e(i, a);
|
|
98
|
+
o === null || v === o || !o.contains(r) || q(a, i);
|
|
102
99
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
100
|
+
function z(e) {
|
|
101
|
+
e.key === "Escape" && A();
|
|
102
|
+
}
|
|
103
|
+
var B = [
|
|
104
|
+
["pointerover", P],
|
|
105
|
+
["pointerout", F],
|
|
106
|
+
["focusin", P],
|
|
107
|
+
["focusout", F],
|
|
108
|
+
["pointerdown", L],
|
|
109
|
+
["pointerup", R],
|
|
110
|
+
["scroll", I],
|
|
111
|
+
["keydown", z]
|
|
112
|
+
], V = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ B.map(([e, t]) => [e, (e) => {
|
|
113
|
+
(typeof e.composedPath == "function" ? e.composedPath() : []).some((e) => V.has(e)) || t(e);
|
|
114
|
+
}]);
|
|
115
|
+
function U(e, t = B) {
|
|
116
|
+
for (let [n, r] of t) e.addEventListener(n, r, !0);
|
|
117
|
+
}
|
|
118
|
+
function W(e, t = B) {
|
|
119
|
+
for (let [n, r] of t) e.removeEventListener(n, r, !0);
|
|
120
|
+
}
|
|
121
|
+
function G(e) {
|
|
122
|
+
let t = V.get(e) ?? 0;
|
|
123
|
+
t === 0 && U(e), V.set(e, t + 1);
|
|
124
|
+
}
|
|
125
|
+
function K(e) {
|
|
126
|
+
let t = V.get(e) ?? 0;
|
|
127
|
+
t <= 1 ? (V.delete(e), W(e)) : V.set(e, t - 1);
|
|
128
|
+
}
|
|
129
|
+
function q(n, r) {
|
|
130
|
+
if (typeof requestAnimationFrame != "function" || m === 0) return () => {};
|
|
131
|
+
r !== null && C.set(r, n);
|
|
132
|
+
let i = requestAnimationFrame(() => {
|
|
133
|
+
i = requestAnimationFrame(() => {
|
|
134
|
+
if (i = 0, r !== null && C.get(r) !== n) return;
|
|
135
|
+
let a = e(r, n);
|
|
136
|
+
if (!(a !== null && r !== null && r.contains(t(r)) && a.classList.contains("ssg-body-cell--invalid") && (a.getAttribute(l) ?? "") !== "")) {
|
|
137
|
+
Y(r);
|
|
115
138
|
return;
|
|
116
139
|
}
|
|
117
|
-
|
|
140
|
+
v !== a && (A(), j(a)), v === a && (x = a, S = r);
|
|
118
141
|
});
|
|
119
142
|
});
|
|
120
143
|
return () => {
|
|
121
|
-
|
|
144
|
+
i !== 0 && cancelAnimationFrame(i);
|
|
122
145
|
};
|
|
123
146
|
}
|
|
124
|
-
function
|
|
125
|
-
e &&
|
|
147
|
+
function J(e) {
|
|
148
|
+
e && C.delete(e), Y(e);
|
|
126
149
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
150
|
+
function Y(e) {
|
|
151
|
+
x === null || e !== void 0 && e !== S || (v === x && A(), x = null, S = null);
|
|
129
152
|
}
|
|
130
|
-
function
|
|
131
|
-
|
|
132
|
-
let
|
|
133
|
-
|
|
153
|
+
function X(e, t) {
|
|
154
|
+
m += 1, m === 1 && U(window, H);
|
|
155
|
+
let n = r(t);
|
|
156
|
+
n !== null && G(n);
|
|
157
|
+
let i = !1, a = (e) => {
|
|
158
|
+
y = e, h !== null && w(h);
|
|
134
159
|
};
|
|
135
|
-
return
|
|
136
|
-
setSlot:
|
|
160
|
+
return a(e), {
|
|
161
|
+
setSlot: a,
|
|
137
162
|
dispose: () => {
|
|
138
|
-
|
|
163
|
+
i || (i = !0, n !== null && K(n), --m, m === 0 && (W(window, H), E(), O(), v = null, x = null, S = null, h !== null && (h.remove(), h = null)));
|
|
139
164
|
}
|
|
140
165
|
};
|
|
141
166
|
}
|
|
142
167
|
//#endregion
|
|
143
|
-
export {
|
|
168
|
+
export { X as acquireTooltipController, J as hideActiveCellTooltip, q as scheduleActiveCellTooltip };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/verticalGeometry.cjs");var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/shadowDom.cjs"),t=require("../logic/verticalGeometry.cjs");var n=(e,t)=>{let n=Math.max(t.totalScrollWidth-e.clientWidth,0),r=Math.max(t.headerHeight+t.physicalBodyHeight+(t.footerHeight??0)-e.clientHeight,0);e.scrollLeft>n&&(e.scrollLeft=n),e.scrollTop>r&&(e.scrollTop=r)},r=(e,n,r)=>{let i=r.headerHeight+n.top,a=i+n.height,o=r.leftPaneWidth+r.centerLeadingWidth+n.left,s=o+n.width,c=t.physicalToLogicalScrollTop(e.scrollTop,r.verticalScaleFactor),l=e.scrollLeft,u=e.clientHeight-(r.footerHeight??0),d=e.clientWidth,f=c,p=l,m=c+r.headerHeight+(r.stickyTopInset?.visibleAt(c)??0),h=c+u,g=()=>Math.max(i-r.headerHeight-(r.stickyTopInset?.coveringRowAt(n.top)??0),0);i<m?f=g():a>h&&(f=n.height>h-m?g():Math.max(a-u,0));let _=l+r.leftPaneWidth,v=l+d-r.rightPaneWidth,y=r.activeCellPinned===!0;if(!y&&o<_||!y&&s>v&&n.width>v-_?p=Math.max(o-r.leftPaneWidth,0):!y&&s>v&&(p=Math.max(s-d+r.rightPaneWidth,0)),f!==c||p!==l){let n=t.logicalToPhysicalScrollTop(f,r.verticalScaleFactor);return e.scrollTo({top:f>c?Math.ceil(n):n,left:p,behavior:`auto`}),!0}return!1},i=(e,t,n,r)=>e<n?e-n:t>r?Math.min(t-r,e-n):0,a=(n,r,a)=>{let o=n.ownerDocument,s=o.defaultView,c=n.closest(`.ssg-shell`),l=e.getActiveElement(n);if(!s||!c||!l||l!==c&&!(l.classList.contains(`ssg-ime-input`)&&c.contains(l))||c.hasAttribute(`data-ssg-pointer`))return;let u=n.getBoundingClientRect();if(u.height===0)return;let d=t.physicalToLogicalScrollTop(n.scrollTop,a.verticalScaleFactor),f=u.top+n.clientTop+a.headerHeight+r.top-d,p=f+r.height;for(let e=n.parentElement;e&&e!==o.body&&e!==o.documentElement;e=e.parentElement){let t=e.scrollHeight-e.clientHeight;if(t<=0)continue;let n=s.getComputedStyle(e).overflowY;if(n!==`auto`&&n!==`scroll`&&n!==`overlay`)continue;let r=e.getBoundingClientRect().top+e.clientTop,a=i(f,p,r,r+e.clientHeight);if(a===0)continue;let o=e.scrollTop,c=Math.min(Math.max(o+a,0),t);e.scrollTop=c,f-=c-o,p-=c-o}let m=i(f,p,0,s.innerHeight);m!==0&&s.scrollBy({top:m,behavior:`auto`})},o=()=>{let e=null,n=1,r=0;return{update:(i,a,o)=>{let s=e,c=n,l=r;if(e=i,n=a,r=i!==null&&a!==1?Math.max(i.scrollHeight-i.clientHeight,0):0,i===null||i!==s||c===a)return;let u=i.scrollTop;if(l>0&&u>=l-1)return;let d=t.logicalToPhysicalScrollTop(t.physicalToLogicalScrollTop(u,c),a);Math.abs(d-u)<1||(i.scrollTop=d,i.scrollTop!==u&&o(i.scrollTop))}}},s=1e3,c=[`wheel`,`touchstart`,`pointerdown`,`pointerup`,`pointermove`,`keydown`],l=(e,t)=>e!==null&&e.top===t.top&&e.height===t.height&&e.left===t.left&&e.width===t.width,u=(e,t,n)=>e===null||n.some(n=>!Object.is(e[n],t[n])),d=()=>{let e=null,t=null,i=null,o=null,d=()=>{i=null,o?.(),o=null},f=e=>{e.type===`pointermove`&&!(e.buttons>0)||d()},p=(e,t)=>{d(),i={cell:t,until:Date.now()+s,left:e.scrollLeft};let n=e.ownerDocument,r=setTimeout(d,s);if(typeof n?.addEventListener!=`function`){o=()=>clearTimeout(r);return}for(let e of c)n.addEventListener(e,f,{capture:!0,passive:!0});o=()=>{clearTimeout(r);for(let e of c)n.removeEventListener(e,f,{capture:!0})}};return{update:o=>{if(u(e,o,[`columnVirtualizer`,`columnMeasurements`])&&o.columnVirtualizer.measure(),u(e,o,[`scrollElement`,`totalScrollWidth`,`physicalBodyHeight`,`headerHeight`,`footerHeight`])&&o.scrollElement&&n(o.scrollElement,o),u(e,o,[`scrollElement`,`activeCellRect`,`activeCellPinned`,`activeCell`,`headerHeight`,`leftPaneWidth`,`rightPaneWidth`,`centerLeadingWidth`,`verticalScaleFactor`,`footerHeight`])){let n=t,{activeCell:s}=o,c=n!==null&&s!==null&&n.row===s.row&&n.col===s.col;t=s,!c&&s!==null&&o.isRowFollowMove?.(s)===!0?d():!c&&o.scrollElement&&o.activeCellRect&&s?(r(o.scrollElement,o.activeCellRect,o),a(o.scrollElement,o.activeCellRect,o),p(o.scrollElement,s)):c&&i!==null&&s!==null&&o.scrollElement&&o.activeCellRect&&i.cell.row===s.row&&i.cell.col===s.col&&!l(e?.activeCellRect??null,o.activeCellRect)&&(Date.now()>i.until||Math.abs(o.scrollElement.scrollLeft-i.left)>1?d():(r(o.scrollElement,o.activeCellRect,o),i={...i,left:o.scrollElement.scrollLeft}))}e=o},cancelFollow:d,dispose:d}};exports.clampScrollToContent=n,exports.createScrollScaleAnchor=o,exports.createViewportSyncController=d,exports.revealActiveCellInPage=a,exports.scrollCellIntoView=r;
|