@ishibashi0112/spreadsheet-grid-core 1.0.1 → 1.1.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/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.js +4 -2
- package/dist/controllers/clipboardController.cjs +1 -2
- package/dist/controllers/clipboardController.d.ts +3 -0
- package/dist/controllers/clipboardController.js +78 -59
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +3 -1
- package/dist/controllers/columnAutosizeRunner.js +12 -10
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +146 -140
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +71 -69
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.d.ts +4 -1
- package/dist/controllers/contextMenuController.js +55 -38
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +78 -78
- package/dist/controllers/escapeClaimController.cjs +1 -1
- package/dist/controllers/escapeClaimController.d.ts +1 -0
- package/dist/controllers/escapeClaimController.js +11 -5
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.d.ts +1 -0
- package/dist/controllers/fillHandleController.js +148 -147
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +81 -77
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +36 -29
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.d.ts +6 -0
- package/dist/controllers/historyController.js +79 -37
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +1 -0
- package/dist/controllers/keyboardController.js +116 -116
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +1 -0
- package/dist/controllers/pointerInteractionsController.js +142 -142
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +1 -0
- package/dist/controllers/popoverSupport.js +17 -7
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +151 -149
- package/dist/controllers/rowEnterController.cjs +1 -1
- package/dist/controllers/rowEnterController.d.ts +1 -0
- package/dist/controllers/rowEnterController.js +47 -42
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.js +26 -14
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +85 -66
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +4 -1
- package/dist/controllers/viewportSyncController.js +89 -30
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +16 -9
- package/dist/engine/filterPopoverCommands.cjs +1 -1
- package/dist/engine/filterPopoverCommands.d.ts +2 -0
- package/dist/engine/filterPopoverCommands.js +15 -15
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +17 -17
- package/dist/engine/gridApi.cjs +3 -3
- package/dist/engine/gridApi.d.ts +7 -2
- package/dist/engine/gridApi.js +16 -16
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +1 -0
- package/dist/engine/rowSelectionCommands.js +21 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -6
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +10 -4
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +2 -0
- package/dist/logic/autoScrollGeometry.js +3 -3
- package/dist/logic/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.d.ts +8 -2
- package/dist/logic/columnAutosize.js +102 -87
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +4 -0
- package/dist/logic/detailRow.js +18 -15
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +1 -0
- package/dist/logic/editorValues.js +37 -34
- package/dist/logic/exportCsv.cjs +3 -3
- package/dist/logic/exportCsv.d.ts +3 -1
- package/dist/logic/exportCsv.js +22 -20
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +3 -1
- package/dist/logic/exportData.js +40 -36
- package/dist/logic/filterSummary.cjs +1 -1
- package/dist/logic/filterSummary.js +9 -2
- package/dist/logic/filtering.cjs +1 -1
- package/dist/logic/filtering.d.ts +2 -1
- package/dist/logic/filtering.js +16 -3
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.d.ts +4 -3
- package/dist/logic/find.js +27 -13
- package/dist/logic/gridAsk.cjs +2 -2
- package/dist/logic/gridAsk.d.ts +7 -7
- package/dist/logic/gridAsk.js +140 -122
- package/dist/logic/gridAskLocaleText.cjs +1 -1
- package/dist/logic/gridAskLocaleText.d.ts +2 -0
- package/dist/logic/gridAskLocaleText.js +1 -0
- package/dist/logic/gridState.d.ts +2 -2
- package/dist/logic/groupExport.cjs +1 -1
- package/dist/logic/groupExport.js +28 -27
- package/dist/logic/grouping.cjs +1 -1
- package/dist/logic/grouping.d.ts +1 -0
- package/dist/logic/grouping.js +52 -41
- package/dist/logic/historyRebase.cjs +1 -0
- package/dist/logic/historyRebase.d.ts +5 -0
- package/dist/logic/historyRebase.js +36 -0
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.d.ts +2 -0
- package/dist/logic/localeText.js +1 -0
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +4 -0
- package/dist/logic/localeTextFeatures.js +10 -7
- package/dist/logic/localeTextFilters.cjs +1 -1
- package/dist/logic/localeTextFilters.d.ts +1 -0
- package/dist/logic/localeTextFilters.js +1 -0
- package/dist/logic/localeTextPopups.cjs +1 -1
- package/dist/logic/localeTextPopups.d.ts +1 -0
- package/dist/logic/localeTextPopups.js +3 -2
- package/dist/logic/numberFilterCondition.cjs +1 -1
- package/dist/logic/numberFilterCondition.d.ts +1 -1
- package/dist/logic/numberFilterCondition.js +5 -5
- package/dist/logic/scrollTargets.cjs +1 -1
- package/dist/logic/scrollTargets.js +2 -2
- package/dist/logic/selectEditorState.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +1 -0
- package/dist/logic/selectEditorState.js +8 -1
- package/dist/logic/selectLabels.cjs +1 -0
- package/dist/logic/selectLabels.d.ts +3 -0
- package/dist/logic/selectLabels.js +41 -0
- package/dist/logic/valueFormatters.d.ts +5 -5
- package/dist/logic/valueParsers.cjs +1 -0
- package/dist/logic/valueParsers.d.ts +14 -0
- package/dist/logic/valueParsers.js +23 -0
- package/dist/logic/verticalGeometry.cjs +1 -1
- package/dist/logic/verticalGeometry.d.ts +1 -0
- package/dist/logic/verticalGeometry.js +12 -8
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +2 -1
- package/dist/model/gridActions.js +3 -2
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +145 -62
- package/dist/model/gridTypes.core.d.ts +492 -315
- package/dist/utils/clipboard.cjs +4 -6
- package/dist/utils/clipboard.d.ts +15 -2
- package/dist/utils/clipboard.js +103 -48
- package/dist/utils/popupContainer.cjs +1 -0
- package/dist/utils/popupContainer.d.ts +8 -0
- package/dist/utils/popupContainer.js +60 -0
- package/package.json +1 -1
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { isInsideDetailCardOf as e } from "../logic/detailRow.js";
|
|
2
2
|
//#region src/controllers/rowEnterController.ts
|
|
3
|
-
var t = "ssg-body-row--enter", n = "--ssg-row-enter-index", r = 12, i = 1500, a = (e) => Number(e.getAttribute("data-row-index")),
|
|
3
|
+
var t = "ssg-body-row--enter", n = "--ssg-row-enter-index", r = 12, i = 1500, a = 1e3, o = (e) => Number(e.getAttribute("data-row-index")), s = /(?:^|;)\s*transform\s*:\s*([^;]+)/, c = (e) => {
|
|
4
4
|
if (!e) return null;
|
|
5
|
-
let t =
|
|
5
|
+
let t = s.exec(e);
|
|
6
6
|
return t ? t[1].trim() : null;
|
|
7
|
-
},
|
|
8
|
-
let r = null,
|
|
7
|
+
}, l = (e) => e instanceof HTMLElement && e.classList.contains("ssg-body-row"), u = "ssg-scroll-container--scrolling", d = () => {
|
|
8
|
+
let r = null, s = null, d = !1, f = {
|
|
9
9
|
skeletonEnter: !1,
|
|
10
10
|
mountEnter: !1
|
|
11
|
-
},
|
|
11
|
+
}, p = /* @__PURE__ */ new Map(), m = -Infinity, h = (e) => {
|
|
12
12
|
e.classList.remove(t), e.style.removeProperty(n);
|
|
13
|
-
let r =
|
|
14
|
-
r !== void 0 && (clearTimeout(r),
|
|
15
|
-
},
|
|
13
|
+
let r = p.get(e);
|
|
14
|
+
r !== void 0 && (clearTimeout(r), p.delete(e));
|
|
15
|
+
}, g = (e, r) => {
|
|
16
16
|
e.style.setProperty(n, String(r)), e.classList.add(t);
|
|
17
17
|
let a = () => {
|
|
18
|
-
e.removeEventListener("animationend", a),
|
|
18
|
+
e.removeEventListener("animationend", a), h(e);
|
|
19
19
|
};
|
|
20
|
-
e.addEventListener("animationend", a),
|
|
21
|
-
e.removeEventListener("animationend", a),
|
|
20
|
+
e.addEventListener("animationend", a), p.set(e, setTimeout(() => {
|
|
21
|
+
e.removeEventListener("animationend", a), h(e);
|
|
22
22
|
}, i));
|
|
23
|
-
},
|
|
23
|
+
}, _ = (e, t) => {
|
|
24
24
|
let n = [];
|
|
25
25
|
for (let r of e) {
|
|
26
26
|
if (r.style.transition) continue;
|
|
27
|
-
let e =
|
|
27
|
+
let e = c(t.get(r) ?? null), i = r.style.transform;
|
|
28
28
|
!e || !i || e === i || n.push({
|
|
29
29
|
el: r,
|
|
30
30
|
from: e,
|
|
@@ -33,46 +33,51 @@ var t = "ssg-body-row--enter", n = "--ssg-row-enter-index", r = 12, i = 1500, a
|
|
|
33
33
|
}
|
|
34
34
|
if (n.length !== 0) {
|
|
35
35
|
for (let { el: e, from: t } of n) e.style.transform = t;
|
|
36
|
-
|
|
36
|
+
s?.getBoundingClientRect();
|
|
37
37
|
for (let { el: e, to: t } of n) e.style.transform = t;
|
|
38
38
|
}
|
|
39
|
-
},
|
|
40
|
-
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(),
|
|
41
|
-
for (let
|
|
42
|
-
if (
|
|
43
|
-
let e =
|
|
44
|
-
|
|
39
|
+
}, v = (t) => l(t) && (s === null || !e(s, t)), y = (t) => {
|
|
40
|
+
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), c = [];
|
|
41
|
+
for (let a of t) {
|
|
42
|
+
if (a.type === "attributes") {
|
|
43
|
+
let e = a.target;
|
|
44
|
+
v(e) && !r.has(e) && r.set(e, a.oldValue);
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
|
-
let t =
|
|
48
|
-
|
|
49
|
-
t || !
|
|
50
|
-
}),
|
|
51
|
-
|
|
47
|
+
let t = s !== null && a.target instanceof Element && e(s, a.target);
|
|
48
|
+
a.removedNodes.forEach((e) => {
|
|
49
|
+
t || !l(e) || (e.hasAttribute("data-skeleton-row") ? n.add(o(e)) : i.add(e));
|
|
50
|
+
}), a.addedNodes.forEach((e) => {
|
|
51
|
+
v(e) && !e.hasAttribute("data-skeleton-row") && c.push(e);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
let
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
if (c.length === 0) return;
|
|
55
|
+
let d = s?.classList.contains(u) === !0;
|
|
56
|
+
f.mountEnter && !d && _(c.filter((e) => i.has(e)), r);
|
|
57
|
+
let p = f.mountEnter && !d;
|
|
58
|
+
if (p && c.some((e) => !i.has(e))) {
|
|
59
|
+
let e = Date.now();
|
|
60
|
+
p = e - m >= a, m = e;
|
|
61
|
+
}
|
|
62
|
+
let h = c.filter((e) => p && !i.has(e) || f.skeletonEnter && n.has(o(e)));
|
|
63
|
+
if (h.length === 0) return;
|
|
64
|
+
let y = Array.from(new Set(h.map(o))).sort((e, t) => e - t), b = /* @__PURE__ */ new Map();
|
|
65
|
+
y.forEach((e, t) => {
|
|
66
|
+
b.set(e, Math.min(t, 12));
|
|
62
67
|
});
|
|
63
|
-
for (let e of
|
|
64
|
-
},
|
|
65
|
-
r?.disconnect(), r = null,
|
|
66
|
-
for (let e of Array.from(
|
|
68
|
+
for (let e of h) g(e, b.get(o(e)) ?? 0);
|
|
69
|
+
}, b = () => {
|
|
70
|
+
r?.disconnect(), r = null, s = null, d = !1;
|
|
71
|
+
for (let e of Array.from(p.keys())) h(e);
|
|
67
72
|
};
|
|
68
73
|
return {
|
|
69
74
|
update: ({ scrollContainerRef: e, skeletonEnter: t, mountEnter: n }) => {
|
|
70
|
-
|
|
75
|
+
f = {
|
|
71
76
|
skeletonEnter: t,
|
|
72
77
|
mountEnter: n
|
|
73
78
|
};
|
|
74
79
|
let i = t || n ? e.current : null;
|
|
75
|
-
i ===
|
|
80
|
+
i === s && n === d || (b(), !(!i || typeof MutationObserver > "u") && (r = new MutationObserver(y), r.observe(i, n ? {
|
|
76
81
|
childList: !0,
|
|
77
82
|
subtree: !0,
|
|
78
83
|
attributes: !0,
|
|
@@ -81,10 +86,10 @@ var t = "ssg-body-row--enter", n = "--ssg-row-enter-index", r = 12, i = 1500, a
|
|
|
81
86
|
} : {
|
|
82
87
|
childList: !0,
|
|
83
88
|
subtree: !0
|
|
84
|
-
}),
|
|
89
|
+
}), s = i, d = n));
|
|
85
90
|
},
|
|
86
|
-
dispose:
|
|
91
|
+
dispose: b
|
|
87
92
|
};
|
|
88
93
|
};
|
|
89
94
|
//#endregion
|
|
90
|
-
export { t as ROW_ENTER_CLASS_NAME, i as ROW_ENTER_FALLBACK_MS, n as ROW_ENTER_INDEX_VAR, r as ROW_ENTER_STAGGER_CAP,
|
|
95
|
+
export { t as ROW_ENTER_CLASS_NAME, i as ROW_ENTER_FALLBACK_MS, n as ROW_ENTER_INDEX_VAR, a as ROW_ENTER_LIVE_WINDOW_MS, r as ROW_ENTER_STAGGER_CAP, d as createRowEnterController, c as transformOfStyleText };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs")
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs");require("./escapeClaimController.cjs");const t=require("./popoverSupport.cjs"),n=require("../logic/panelDragGeometry.cjs");var r=360,i=420,a=336,o=8,s=12,c=[`filter`,`columns`,`sort`],l=(e,t,n)=>{let r=Math.max(0,Math.min(420,t-o*2)),i=n?Math.min(a,r):r,s=e;s+i>t-o&&(s=Math.max(o,t-o-i));let c=Math.max(0,Math.min(420,t-o-s));return{top:s,maxHeight:c}},u=e=>{let t={filter:e.canUseFilterTab,columns:e.canUseColumnsTab,sort:e.canUseSortTab};return c.filter(e=>t[e])},d=(e,t)=>e===null?null:t.includes(e)?e:t[0]??null,f=()=>{let i=null,a=e.createValueStore({requestedTab:null,layout:null,flashTick:0}),c={current:null},f=null,p=e=>{a.setSnapshot({...a.getSnapshot(),...e})},m=e=>{let t=a.getSnapshot().layout;t===e||t!==null&&e!==null&&t.top===e.top&&t.left===e.left&&t.width===e.width&&t.maxHeight===e.maxHeight||p({layout:e})},h=e=>n.clampPanelDragPosition({top:e.top,left:e.left,panelWidth:r,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}),g=e=>{let t=l(e.top,window.innerHeight,!0);return{top:t.top,left:e.left,width:r,maxHeight:t.maxHeight}},_=()=>{if(f){m(g(h(f)));return}let e=i?.gridRootRef.current??null;if(!e){m(null);return}let t=e.getBoundingClientRect(),n=t.right-r-s,a=t.top+s;n=Math.max(o,n),n=Math.min(n,window.innerWidth-r-o),a=Math.max(o,a);let c=l(a,window.innerHeight,!1);m({top:c.top,left:n,width:r,maxHeight:c.maxHeight})},v=()=>i!==null&&d(a.getSnapshot().requestedTab,u(i))!==null,y=null,b=(e,n=!1)=>{let r=y;if(y=null,p({requestedTab:null,layout:null}),C(),!(i===null||!e)){if(n&&r!==null&&r.isConnected&&r!==i.gridRootRef.current){let e=document.activeElement;if(e===r||(e===null||e===document.body||c.current?.contains(e)===!0)&&(r.focus({preventScroll:!0}),document.activeElement===r))return}t.restoreGridFocus(i.gridRootRef)}},x=()=>b(!0,!0),S=t.createPopoverWindowBindings({onResize:_,onScroll:_,isInside:e=>c.current?.contains(e)===!0||i?.alliedRef?.current?.contains(e)===!0,onOutsidePointerDown:e=>b(i!==null&&t.isInsideGridRoot(i.gridRootRef,e)),getGridRoot:()=>i?.gridRootRef.current??null,onGridHidden:()=>b(!1),onKeyDown:e=>{if(e.key===`Escape`){if(i?.suppressEscape){i.onSuppressedEscape?.();return}e.preventDefault(),x()}}}),C=()=>{let e=v();e&&!S.isAttached()?(_(),S.attach()):!e&&S.isAttached()&&S.detach()};return{update:e=>{i=e,C()},subscribe:a.subscribe,getSnapshot:a.getSnapshot,panelRef:c,open:e=>{if(i===null||!u(i).includes(e))return;let n=a.getSnapshot();if(n.requestedTab===null){let e=document.activeElement;y=e instanceof HTMLElement&&e!==document.body&&e.closest(`.ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover`)===null?e:null}c.current?.contains(document.activeElement)!==!0&&t.blurForPopover(i.gridRootRef.current),p({requestedTab:e,flashTick:n.requestedTab===null?n.flashTick:n.flashTick+1}),C()},close:x,move:(e,t)=>{let n=h({top:e,left:t});f=n,p({layout:g(n)})},dispose:()=>{S.detach()}}};exports.TOOL_PANEL_MAX_HEIGHT=i,exports.createToolPanelController=f,exports.resolveActiveToolPanelTab=d,exports.resolveAvailableToolPanelTabs=u,exports.resolveToolPanelVerticalPlacement=l;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createValueStore as e } from "../logic/valueStore.js";
|
|
2
|
+
import "./escapeClaimController.js";
|
|
2
3
|
import { blurForPopover as t, createPopoverWindowBindings as n, isInsideGridRoot as r, restoreGridFocus as i } from "./popoverSupport.js";
|
|
3
4
|
import { clampPanelDragPosition as a } from "../logic/panelDragGeometry.js";
|
|
4
5
|
//#region src/controllers/toolPanelController.ts
|
|
@@ -67,34 +68,41 @@ var o = 360, s = 420, c = 336, l = 8, u = 12, d = [
|
|
|
67
68
|
width: o,
|
|
68
69
|
maxHeight: i.maxHeight
|
|
69
70
|
});
|
|
70
|
-
}, x = () => s !== null && m(c.getSnapshot().requestedTab, p(s)) !== null, S = (e) => {
|
|
71
|
-
|
|
71
|
+
}, x = () => s !== null && m(c.getSnapshot().requestedTab, p(s)) !== null, S = null, C = (e, t = !1) => {
|
|
72
|
+
let n = S;
|
|
73
|
+
if (S = null, g({
|
|
72
74
|
requestedTab: null,
|
|
73
75
|
layout: null
|
|
74
|
-
}),
|
|
75
|
-
|
|
76
|
+
}), E(), !(s === null || !e)) {
|
|
77
|
+
if (t && n !== null && n.isConnected && n !== s.gridRootRef.current) {
|
|
78
|
+
let e = document.activeElement;
|
|
79
|
+
if (e === n || (e === null || e === document.body || d.current?.contains(e) === !0) && (n.focus({ preventScroll: !0 }), document.activeElement === n)) return;
|
|
80
|
+
}
|
|
81
|
+
i(s.gridRootRef);
|
|
82
|
+
}
|
|
83
|
+
}, w = () => C(!0, !0), T = n({
|
|
76
84
|
onResize: b,
|
|
77
85
|
onScroll: b,
|
|
78
86
|
isInside: (e) => d.current?.contains(e) === !0 || s?.alliedRef?.current?.contains(e) === !0,
|
|
79
|
-
onOutsidePointerDown: (e) =>
|
|
87
|
+
onOutsidePointerDown: (e) => C(s !== null && r(s.gridRootRef, e)),
|
|
80
88
|
getGridRoot: () => s?.gridRootRef.current ?? null,
|
|
81
|
-
onGridHidden: () =>
|
|
89
|
+
onGridHidden: () => C(!1),
|
|
82
90
|
onKeyDown: (e) => {
|
|
83
91
|
if (e.key === "Escape") {
|
|
84
92
|
if (s?.suppressEscape) {
|
|
85
93
|
s.onSuppressedEscape?.();
|
|
86
94
|
return;
|
|
87
95
|
}
|
|
88
|
-
e.preventDefault(),
|
|
96
|
+
e.preventDefault(), w();
|
|
89
97
|
}
|
|
90
98
|
}
|
|
91
|
-
}),
|
|
99
|
+
}), E = () => {
|
|
92
100
|
let e = x();
|
|
93
|
-
e && !
|
|
101
|
+
e && !T.isAttached() ? (b(), T.attach()) : !e && T.isAttached() && T.detach();
|
|
94
102
|
};
|
|
95
103
|
return {
|
|
96
104
|
update: (e) => {
|
|
97
|
-
s = e,
|
|
105
|
+
s = e, E();
|
|
98
106
|
},
|
|
99
107
|
subscribe: c.subscribe,
|
|
100
108
|
getSnapshot: c.getSnapshot,
|
|
@@ -102,12 +110,16 @@ var o = 360, s = 420, c = 336, l = 8, u = 12, d = [
|
|
|
102
110
|
open: (e) => {
|
|
103
111
|
if (s === null || !p(s).includes(e)) return;
|
|
104
112
|
let n = c.getSnapshot();
|
|
105
|
-
|
|
113
|
+
if (n.requestedTab === null) {
|
|
114
|
+
let e = document.activeElement;
|
|
115
|
+
S = e instanceof HTMLElement && e !== document.body && e.closest(".ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover") === null ? e : null;
|
|
116
|
+
}
|
|
117
|
+
d.current?.contains(document.activeElement) !== !0 && t(s.gridRootRef.current), g({
|
|
106
118
|
requestedTab: e,
|
|
107
119
|
flashTick: n.requestedTab === null ? n.flashTick : n.flashTick + 1
|
|
108
|
-
}),
|
|
120
|
+
}), E();
|
|
109
121
|
},
|
|
110
|
-
close:
|
|
122
|
+
close: w,
|
|
111
123
|
move: (e, t) => {
|
|
112
124
|
let n = v({
|
|
113
125
|
top: e,
|
|
@@ -116,7 +128,7 @@ var o = 360, s = 420, c = 336, l = 8, u = 12, d = [
|
|
|
116
128
|
h = n, g({ layout: y(n) });
|
|
117
129
|
},
|
|
118
130
|
dispose: () => {
|
|
119
|
-
|
|
131
|
+
T.detach();
|
|
120
132
|
}
|
|
121
133
|
};
|
|
122
134
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),t=require("../utils/portalTokens.cjs"),n=require("../logic/tooltipGeometry.cjs");var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),t=require("../utils/portalTokens.cjs"),n=require("../utils/popupContainer.cjs"),r=require("../logic/tooltipGeometry.cjs");var i=`data-ssg-tooltip`,a=`data-ssg-tooltip-overflow`,o=`[${i}], [${a}]`,s=350,c=800,l=0,u=null,d=null,f=0,p=null,m,h,g=null,_=null,v=new WeakMap;function y(t){h=e.applySlotToElement(t,m,h)}function b(e){let t=n.getPopupContainerFor(e);if(u!==null)return n.appendToPopupContainer(u,t),u;let r=document.createElement(`div`);return r.className=`ssg-tooltip`,r.setAttribute(`aria-hidden`,`true`),h=void 0,y(r),n.appendToPopupContainer(r,t),u=r,r}function x(){d!==null&&(window.clearTimeout(d),d=null)}var S=null;function C(){S!==null&&(cancelAnimationFrame(S),S=null)}function w(){if(C(),typeof requestAnimationFrame!=`function`)return;let e=()=>{if(S=null,p!==null){if(!p.isConnected){T();return}S=requestAnimationFrame(e)}};S=requestAnimationFrame(e)}function T(){x(),C(),p!==null&&(f=Date.now()+c),p=null,g=null,_=null,u!==null&&u.classList.remove(`ssg-tooltip--visible`)}function E(e){if(!e.isConnected)return;let n=e.getAttribute(i),o=e.getAttribute(a),s=n!==null&&n!==``?n:o!==null&&o!==``?o:(e.textContent??``).trim();if(s===``)return;let c=b(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),t.syncPortalTokens(e,c),c.textContent=s,c.style.left=`0px`,c.style.top=`0px`;let l=r.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`),p=e,w()}function D(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}function O(e){let t=e.target;if(!(t instanceof Element)||typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.buttons!==0)return;let n=t.closest(o);if(n===null||n===p||!n.hasAttribute(i)&&!D(n))return;let r=p!==null;T(),r||Date.now()<f?E(n):d=window.setTimeout(()=>{d=null,E(n)},s)}function k(e){let t=e.target;if(!(t instanceof Element))return;if(e.type===`focusout`&&_!==null&&_.contains(t)){let t=e.relatedTarget;if(!(t instanceof Node&&_.contains(t))){T();return}}let n=t.closest(o);if(n===null||n===g&&typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.pointerType!==`mouse`)return;let r=e.relatedTarget;r instanceof Node&&n.contains(r)||T()}function A(){T()}function j(e){g!==null&&p===g&&typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.pointerType!==`mouse`&&e.target instanceof Node&&g.contains(e.target)||T()}function M(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.ssg-shell`),r=n===null?void 0:v.get(n);if(n===null||r===void 0)return;let i=document.getElementById(r);i===null||p===i||!i.contains(t)||I(r,n)}function N(e){e.key===`Escape`&&T()}function P(){window.addEventListener(`pointerover`,O,!0),window.addEventListener(`pointerout`,k,!0),window.addEventListener(`focusin`,O,!0),window.addEventListener(`focusout`,k,!0),window.addEventListener(`pointerdown`,j,!0),window.addEventListener(`pointerup`,M,!0),window.addEventListener(`scroll`,A,!0),window.addEventListener(`keydown`,N,!0)}function F(){window.removeEventListener(`pointerover`,O,!0),window.removeEventListener(`pointerout`,k,!0),window.removeEventListener(`focusin`,O,!0),window.removeEventListener(`focusout`,k,!0),window.removeEventListener(`pointerdown`,j,!0),window.removeEventListener(`pointerup`,M,!0),window.removeEventListener(`scroll`,A,!0),window.removeEventListener(`keydown`,N,!0)}function I(e,t){if(typeof requestAnimationFrame!=`function`||l===0)return()=>{};t!==null&&v.set(t,e);let n=requestAnimationFrame(()=>{n=requestAnimationFrame(()=>{if(n=0,t!==null&&v.get(t)!==e)return;let r=document.getElementById(e);if(!(r!==null&&t!==null&&t.contains(document.activeElement)&&r.classList.contains(`ssg-body-cell--invalid`)&&(r.getAttribute(i)??``)!==``)){R(t);return}p!==r&&(T(),E(r)),p===r&&(g=r,_=t)})});return()=>{n!==0&&cancelAnimationFrame(n)}}function L(e){e&&v.delete(e),R(e)}function R(e){g===null||e!==void 0&&e!==_||(p===g&&T(),g=null,_=null)}function z(e){l+=1,l===1&&P();let t=!1,n=e=>{m=e,u!==null&&y(u)};return n(e),{setSlot:n,dispose:()=>{t||(t=!0,--l,l===0&&(F(),x(),C(),p=null,g=null,_=null,u!==null&&(u.remove(),u=null)))}}}exports.acquireTooltipController=z,exports.hideActiveCellTooltip=L,exports.scheduleActiveCellTooltip=I;
|
|
@@ -1,124 +1,143 @@
|
|
|
1
1
|
import { applySlotToElement as e } from "../logic/slotDom.js";
|
|
2
2
|
import { syncPortalTokens as t } from "../utils/portalTokens.js";
|
|
3
|
-
import {
|
|
3
|
+
import { appendToPopupContainer as n, getPopupContainerFor as r } from "../utils/popupContainer.js";
|
|
4
|
+
import { computeTooltipPlacement as i } from "../logic/tooltipGeometry.js";
|
|
4
5
|
//#region src/controllers/tooltipController.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
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 = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function b(t) {
|
|
8
|
+
g = e(t, h, g);
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
function x(e) {
|
|
11
|
+
let t = r(e);
|
|
12
|
+
if (d !== null) return n(d, t), d;
|
|
13
|
+
let i = document.createElement("div");
|
|
14
|
+
return i.className = "ssg-tooltip", i.setAttribute("aria-hidden", "true"), g = void 0, b(i), n(i, t), d = i, i;
|
|
13
15
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
+
function S() {
|
|
17
|
+
f !== null && (window.clearTimeout(f), f = null);
|
|
16
18
|
}
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
|
|
19
|
+
var C = null;
|
|
20
|
+
function w() {
|
|
21
|
+
C !== null && (cancelAnimationFrame(C), C = null);
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
23
|
+
function T() {
|
|
24
|
+
if (w(), typeof requestAnimationFrame != "function") return;
|
|
23
25
|
let e = () => {
|
|
24
|
-
if (
|
|
25
|
-
if (!
|
|
26
|
-
|
|
26
|
+
if (C = null, m !== null) {
|
|
27
|
+
if (!m.isConnected) {
|
|
28
|
+
E();
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
C = requestAnimationFrame(e);
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
|
-
|
|
34
|
+
C = requestAnimationFrame(e);
|
|
33
35
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
+
function E() {
|
|
37
|
+
S(), w(), m !== null && (p = Date.now() + l), m = null, _ = null, v = null, d !== null && d.classList.remove("ssg-tooltip--visible");
|
|
36
38
|
}
|
|
37
|
-
function
|
|
39
|
+
function D(e) {
|
|
38
40
|
if (!e.isConnected) return;
|
|
39
|
-
let
|
|
41
|
+
let n = e.getAttribute(a), r = e.getAttribute(o), s = n !== null && n !== "" ? n : r !== null && r !== "" ? r : (e.textContent ?? "").trim();
|
|
40
42
|
if (s === "") return;
|
|
41
|
-
let c =
|
|
43
|
+
let c = x(e);
|
|
42
44
|
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), t(e, c), c.textContent = s, c.style.left = "0px", c.style.top = "0px";
|
|
43
|
-
let l =
|
|
45
|
+
let l = i({
|
|
44
46
|
targetRect: e.getBoundingClientRect(),
|
|
45
47
|
tipWidth: c.offsetWidth,
|
|
46
48
|
tipHeight: c.offsetHeight,
|
|
47
49
|
viewportWidth: window.innerWidth
|
|
48
50
|
});
|
|
49
|
-
c.style.left = `${l.left}px`, c.style.top = `${l.top}px`, c.classList.add("ssg-tooltip--visible"),
|
|
51
|
+
c.style.left = `${l.left}px`, c.style.top = `${l.top}px`, c.classList.add("ssg-tooltip--visible"), m = e, T();
|
|
50
52
|
}
|
|
51
|
-
function
|
|
53
|
+
function O(e) {
|
|
54
|
+
if (e.scrollWidth > e.clientWidth + 1) return !0;
|
|
55
|
+
for (let t of Array.from(e.children)) if (t.scrollWidth > t.clientWidth + 1) return !0;
|
|
56
|
+
return !1;
|
|
57
|
+
}
|
|
58
|
+
function k(e) {
|
|
52
59
|
let t = e.target;
|
|
53
60
|
if (!(t instanceof Element) || typeof PointerEvent < "u" && e instanceof PointerEvent && e.buttons !== 0) return;
|
|
54
|
-
let n = t.closest(
|
|
55
|
-
if (n === null || n ===
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
}
|
|
61
|
-
function
|
|
61
|
+
let n = t.closest(s);
|
|
62
|
+
if (n === null || n === m || !n.hasAttribute(a) && !O(n)) return;
|
|
63
|
+
let r = m !== null;
|
|
64
|
+
E(), r || Date.now() < p ? D(n) : f = window.setTimeout(() => {
|
|
65
|
+
f = null, D(n);
|
|
66
|
+
}, c);
|
|
67
|
+
}
|
|
68
|
+
function A(e) {
|
|
62
69
|
let t = e.target;
|
|
63
70
|
if (!(t instanceof Element)) return;
|
|
64
|
-
if (e.type === "focusout" &&
|
|
71
|
+
if (e.type === "focusout" && v !== null && v.contains(t)) {
|
|
65
72
|
let t = e.relatedTarget;
|
|
66
|
-
if (!(t instanceof Node &&
|
|
67
|
-
|
|
73
|
+
if (!(t instanceof Node && v.contains(t))) {
|
|
74
|
+
E();
|
|
68
75
|
return;
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
|
-
let n = t.closest(
|
|
72
|
-
if (n === null || n ===
|
|
78
|
+
let n = t.closest(s);
|
|
79
|
+
if (n === null || n === _ && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse") return;
|
|
73
80
|
let r = e.relatedTarget;
|
|
74
|
-
r instanceof Node && n.contains(r) ||
|
|
81
|
+
r instanceof Node && n.contains(r) || E();
|
|
75
82
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
83
|
+
function j() {
|
|
84
|
+
E();
|
|
78
85
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
86
|
+
function M(e) {
|
|
87
|
+
_ !== null && m === _ && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse" && e.target instanceof Node && _.contains(e.target) || E();
|
|
81
88
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
89
|
+
function N(e) {
|
|
90
|
+
let t = e.target;
|
|
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);
|
|
84
96
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
97
|
+
function P(e) {
|
|
98
|
+
e.key === "Escape" && E();
|
|
87
99
|
}
|
|
88
|
-
function
|
|
89
|
-
window.
|
|
100
|
+
function F() {
|
|
101
|
+
window.addEventListener("pointerover", k, !0), window.addEventListener("pointerout", A, !0), window.addEventListener("focusin", k, !0), window.addEventListener("focusout", A, !0), window.addEventListener("pointerdown", M, !0), window.addEventListener("pointerup", N, !0), window.addEventListener("scroll", j, !0), window.addEventListener("keydown", P, !0);
|
|
90
102
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
103
|
+
function I() {
|
|
104
|
+
window.removeEventListener("pointerover", k, !0), window.removeEventListener("pointerout", A, !0), window.removeEventListener("focusin", k, !0), window.removeEventListener("focusout", A, !0), window.removeEventListener("pointerdown", M, !0), window.removeEventListener("pointerup", N, !0), window.removeEventListener("scroll", j, !0), window.removeEventListener("keydown", P, !0);
|
|
105
|
+
}
|
|
106
|
+
function L(e, t) {
|
|
107
|
+
if (typeof requestAnimationFrame != "function" || u === 0) return () => {};
|
|
108
|
+
t !== null && y.set(t, e);
|
|
93
109
|
let n = requestAnimationFrame(() => {
|
|
94
110
|
n = requestAnimationFrame(() => {
|
|
95
|
-
n = 0;
|
|
96
|
-
let
|
|
97
|
-
if (!(
|
|
98
|
-
|
|
111
|
+
if (n = 0, t !== null && y.get(t) !== e) return;
|
|
112
|
+
let r = document.getElementById(e);
|
|
113
|
+
if (!(r !== null && t !== null && t.contains(document.activeElement) && r.classList.contains("ssg-body-cell--invalid") && (r.getAttribute(a) ?? "") !== "")) {
|
|
114
|
+
z(t);
|
|
99
115
|
return;
|
|
100
116
|
}
|
|
101
|
-
|
|
117
|
+
m !== r && (E(), D(r)), m === r && (_ = r, v = t);
|
|
102
118
|
});
|
|
103
119
|
});
|
|
104
120
|
return () => {
|
|
105
121
|
n !== 0 && cancelAnimationFrame(n);
|
|
106
122
|
};
|
|
107
123
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
124
|
+
function R(e) {
|
|
125
|
+
e && y.delete(e), z(e);
|
|
110
126
|
}
|
|
111
|
-
function
|
|
112
|
-
|
|
127
|
+
function z(e) {
|
|
128
|
+
_ === null || e !== void 0 && e !== v || (m === _ && E(), _ = null, v = null);
|
|
129
|
+
}
|
|
130
|
+
function B(e) {
|
|
131
|
+
u += 1, u === 1 && F();
|
|
113
132
|
let t = !1, n = (e) => {
|
|
114
|
-
|
|
133
|
+
h = e, d !== null && b(d);
|
|
115
134
|
};
|
|
116
135
|
return n(e), {
|
|
117
136
|
setSlot: n,
|
|
118
137
|
dispose: () => {
|
|
119
|
-
t || (t = !0, --
|
|
138
|
+
t || (t = !0, --u, u === 0 && (I(), S(), w(), m = null, _ = null, v = null, d !== null && (d.remove(), d = null)));
|
|
120
139
|
}
|
|
121
140
|
};
|
|
122
141
|
}
|
|
123
142
|
//#endregion
|
|
124
|
-
export {
|
|
143
|
+
export { B as acquireTooltipController, R as hideActiveCellTooltip, L as scheduleActiveCellTooltip };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/verticalGeometry.cjs");var t=(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)},n=(t,n,r)=>{let i=r.headerHeight+n.top,a=i+n.height,o=r.leftPaneWidth+r.centerLeadingWidth+n.left,s=o+n.width,c=e.physicalToLogicalScrollTop(t.scrollTop,r.verticalScaleFactor),l=t.scrollLeft,u=t.clientHeight-(r.footerHeight??0),d=t.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<_?p=Math.max(o-r.leftPaneWidth,0):!y&&s>v&&(p=Math.max(s-d+r.rightPaneWidth,0)),f!==c||p!==l){let n=e.logicalToPhysicalScrollTop(f,r.verticalScaleFactor);t.scrollTo({top:f>c?Math.ceil(n):n,left:p,behavior:`auto`})}},r=()=>{let t=null,n=1,r=0;return{update:(i,a,o)=>{let s=t,c=n,l=r;if(t=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=e.logicalToPhysicalScrollTop(e.physicalToLogicalScrollTop(u,c),a);Math.abs(d-u)<1||(i.scrollTop=d,i.scrollTop!==u&&o(i.scrollTop))}}},
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/verticalGeometry.cjs");var t=(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)},n=(t,n,r)=>{let i=r.headerHeight+n.top,a=i+n.height,o=r.leftPaneWidth+r.centerLeadingWidth+n.left,s=o+n.width,c=e.physicalToLogicalScrollTop(t.scrollTop,r.verticalScaleFactor),l=t.scrollLeft,u=t.clientHeight-(r.footerHeight??0),d=t.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=e.logicalToPhysicalScrollTop(f,r.verticalScaleFactor);return t.scrollTo({top:f>c?Math.ceil(n):n,left:p,behavior:`auto`}),!0}return!1},r=(e,t,n,r)=>e<n?e-n:t>r?Math.min(t-r,e-n):0,i=(t,n,i)=>{let a=t.ownerDocument,o=a.defaultView,s=t.closest(`.ssg-shell`),c=a.activeElement;if(!o||!s||!c||c!==s&&!(c.classList.contains(`ssg-ime-input`)&&s.contains(c))||s.hasAttribute(`data-ssg-pointer`))return;let l=t.getBoundingClientRect();if(l.height===0)return;let u=e.physicalToLogicalScrollTop(t.scrollTop,i.verticalScaleFactor),d=l.top+t.clientTop+i.headerHeight+n.top-u,f=d+n.height;for(let e=t.parentElement;e&&e!==a.body&&e!==a.documentElement;e=e.parentElement){let t=e.scrollHeight-e.clientHeight;if(t<=0)continue;let n=o.getComputedStyle(e).overflowY;if(n!==`auto`&&n!==`scroll`&&n!==`overlay`)continue;let i=e.getBoundingClientRect().top+e.clientTop,a=r(d,f,i,i+e.clientHeight);if(a===0)continue;let s=e.scrollTop,c=Math.min(Math.max(s+a,0),t);e.scrollTop=c,d-=c-s,f-=c-s}let p=r(d,f,0,o.innerHeight);p!==0&&o.scrollBy({top:p,behavior:`auto`})},a=()=>{let t=null,n=1,r=0;return{update:(i,a,o)=>{let s=t,c=n,l=r;if(t=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=e.logicalToPhysicalScrollTop(e.physicalToLogicalScrollTop(u,c),a);Math.abs(d-u)<1||(i.scrollTop=d,i.scrollTop!==u&&o(i.scrollTop))}}},o=1e3,s=[`wheel`,`touchstart`,`pointerdown`,`pointerup`,`pointermove`,`keydown`],c=(e,t)=>e!==null&&e.top===t.top&&e.height===t.height&&e.left===t.left&&e.width===t.width,l=(e,t,n)=>e===null||n.some(n=>!Object.is(e[n],t[n])),u=()=>{let e=null,r=null,a=null,u=null,d=()=>{a=null,u?.(),u=null},f=e=>{e.type===`pointermove`&&!(e.buttons>0)||d()},p=(e,t)=>{d(),a={cell:t,until:Date.now()+o,left:e.scrollLeft};let n=e.ownerDocument,r=setTimeout(d,o);if(typeof n?.addEventListener!=`function`){u=()=>clearTimeout(r);return}for(let e of s)n.addEventListener(e,f,{capture:!0,passive:!0});u=()=>{clearTimeout(r);for(let e of s)n.removeEventListener(e,f,{capture:!0})}};return{update:o=>{if(l(e,o,[`columnVirtualizer`,`columnMeasurements`])&&o.columnVirtualizer.measure(),l(e,o,[`scrollElement`,`totalScrollWidth`,`physicalBodyHeight`,`headerHeight`,`footerHeight`])&&o.scrollElement&&t(o.scrollElement,o),l(e,o,[`scrollElement`,`activeCellRect`,`activeCellPinned`,`activeCell`,`headerHeight`,`leftPaneWidth`,`rightPaneWidth`,`centerLeadingWidth`,`verticalScaleFactor`,`footerHeight`])){let t=r,{activeCell:s}=o,l=t!==null&&s!==null&&t.row===s.row&&t.col===s.col;r=s,!l&&o.scrollElement&&o.activeCellRect&&s?(n(o.scrollElement,o.activeCellRect,o),i(o.scrollElement,o.activeCellRect,o),p(o.scrollElement,s)):l&&a!==null&&s!==null&&o.scrollElement&&o.activeCellRect&&a.cell.row===s.row&&a.cell.col===s.col&&!c(e?.activeCellRect??null,o.activeCellRect)&&(Date.now()>a.until||Math.abs(o.scrollElement.scrollLeft-a.left)>1?d():(n(o.scrollElement,o.activeCellRect,o),a={...a,left:o.scrollElement.scrollLeft}))}e=o},cancelFollow:d,dispose:d}};exports.clampScrollToContent=t,exports.createScrollScaleAnchor=a,exports.createViewportSyncController=u,exports.revealActiveCellInPage=i,exports.scrollCellIntoView=n;
|
|
@@ -28,9 +28,12 @@ export type ViewportSyncArgs<T> = {
|
|
|
28
28
|
};
|
|
29
29
|
export type ViewportSyncController<T> = {
|
|
30
30
|
update: (args: ViewportSyncArgs<T>) => void;
|
|
31
|
+
cancelFollow: () => void;
|
|
32
|
+
dispose: () => void;
|
|
31
33
|
};
|
|
32
34
|
export declare const clampScrollToContent: (scrollElement: HTMLElement, args: Pick<ViewportSyncArgs<unknown>, "totalScrollWidth" | "physicalBodyHeight" | "headerHeight" | "footerHeight">) => void;
|
|
33
|
-
export declare const scrollCellIntoView: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "leftPaneWidth" | "rightPaneWidth" | "centerLeadingWidth" | "verticalScaleFactor" | "footerHeight" | "activeCellPinned" | "stickyTopInset">) =>
|
|
35
|
+
export declare const scrollCellIntoView: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "leftPaneWidth" | "rightPaneWidth" | "centerLeadingWidth" | "verticalScaleFactor" | "footerHeight" | "activeCellPinned" | "stickyTopInset">) => boolean;
|
|
36
|
+
export declare const revealActiveCellInPage: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "verticalScaleFactor">) => void;
|
|
34
37
|
export type ScrollScaleAnchor = {
|
|
35
38
|
update: (scrollElement: HTMLElement | null, verticalScaleFactor: number, onAnchored: (scrollTop: number) => void) => void;
|
|
36
39
|
};
|