@ishibashi0112/spreadsheet-grid-core 1.0.0 → 1.0.2
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 +2 -1
- package/dist/controllers/clipboardController.js +79 -63
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +4 -1
- package/dist/controllers/columnAutosizeRunner.js +60 -33
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.d.ts +4 -0
- package/dist/controllers/columnHeaderDragController.js +205 -184
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +1 -1
- package/dist/controllers/dateRolloverStore.cjs +1 -1
- package/dist/controllers/dateRolloverStore.js +1 -1
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +90 -74
- package/dist/controllers/escapeClaimController.cjs +1 -0
- package/dist/controllers/escapeClaimController.d.ts +19 -0
- package/dist/controllers/escapeClaimController.js +36 -0
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.js +77 -74
- 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 +2 -0
- package/dist/controllers/findController.js +103 -75
- package/dist/controllers/globalFilteredOrder.cjs +1 -1
- package/dist/controllers/globalFilteredOrder.js +52 -21
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.js +137 -140
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.js +159 -144
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.js +14 -6
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +131 -128
- 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/scrollSyncController.cjs +1 -1
- package/dist/controllers/scrollSyncController.d.ts +1 -1
- package/dist/controllers/scrollSyncController.js +7 -4
- package/dist/controllers/selectOptionsCollector.cjs +1 -1
- package/dist/controllers/selectOptionsCollector.d.ts +5 -2
- package/dist/controllers/selectOptionsCollector.js +39 -27
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.d.ts +6 -0
- package/dist/controllers/toolPanelController.js +69 -59
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.d.ts +2 -0
- package/dist/controllers/tooltipController.js +86 -39
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +5 -0
- package/dist/controllers/viewportSyncController.js +40 -9
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.js +2 -1
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.d.ts +2 -0
- package/dist/engine/columnLayout.js +51 -18
- 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 +2 -1
- package/dist/engine/gridApi.js +19 -19
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.js +46 -46
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +9 -1
- package/dist/engine/rowSelectionCommands.js +45 -25
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +8 -5
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +5 -1
- package/dist/logic/autoScrollGeometry.js +6 -6
- package/dist/logic/clearCells.cjs +1 -1
- package/dist/logic/clearCells.js +13 -13
- 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/columnReset.cjs +1 -1
- package/dist/logic/columnReset.d.ts +1 -0
- package/dist/logic/columnReset.js +21 -19
- 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 +49 -23
- package/dist/logic/elementScale.cjs +1 -0
- package/dist/logic/elementScale.d.ts +8 -0
- package/dist/logic/elementScale.js +14 -0
- 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.js +14 -11
- 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/focusCycle.cjs +1 -0
- package/dist/logic/focusCycle.d.ts +1 -0
- package/dist/logic/focusCycle.js +15 -0
- 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/labelRows.cjs +1 -1
- package/dist/logic/labelRows.d.ts +2 -0
- package/dist/logic/labelRows.js +8 -4
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.d.ts +2 -0
- package/dist/logic/localeText.js +2 -1
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.js +2 -2
- 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.js +2 -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/rowSelection.cjs +1 -1
- package/dist/logic/rowSelection.d.ts +4 -0
- package/dist/logic/rowSelection.js +31 -8
- 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/selectOptions.cjs +1 -1
- package/dist/logic/selectOptions.d.ts +2 -2
- package/dist/logic/selectOptions.js +16 -12
- package/dist/logic/selectionOverlayGeometry.cjs +1 -1
- package/dist/logic/selectionOverlayGeometry.js +12 -12
- package/dist/logic/sorting.cjs +1 -1
- package/dist/logic/sorting.d.ts +1 -0
- package/dist/logic/sorting.js +24 -12
- package/dist/logic/valueFormatters.d.ts +5 -5
- 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 +365 -318
- package/dist/utils/clipboard.cjs +3 -5
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.js +25 -22
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/controllers/scrollSyncController.ts
|
|
2
2
|
var e = "ssg-scroll-container--scrolling", t = 120, n = () => {
|
|
3
|
-
let t = null, n = null, r =
|
|
3
|
+
let t = null, n = null, r = !1, i = null, a = null, o = null, s = null, c = () => {
|
|
4
4
|
a = null;
|
|
5
5
|
let e = i;
|
|
6
6
|
i = null, e && t?.onScroll?.(e);
|
|
@@ -14,8 +14,8 @@ var e = "ssg-scroll-container--scrolling", t = 120, n = () => {
|
|
|
14
14
|
t?.setViewState({ scrollTop: u.scrollTop }), u.classList.add(e), o !== null && clearTimeout(o), o = setTimeout(() => {
|
|
15
15
|
o = null, u.classList.remove(e);
|
|
16
16
|
}, 120);
|
|
17
|
-
let n = r
|
|
18
|
-
|
|
17
|
+
let n = r ? "api" : "user";
|
|
18
|
+
r = !1;
|
|
19
19
|
let s = i;
|
|
20
20
|
i = {
|
|
21
21
|
top: u.scrollTop,
|
|
@@ -55,7 +55,10 @@ var e = "ssg-scroll-container--scrolling", t = 120, n = () => {
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
markApiScroll: () => {
|
|
58
|
-
|
|
58
|
+
let e = r;
|
|
59
|
+
return r = !0, () => {
|
|
60
|
+
r = e;
|
|
61
|
+
};
|
|
59
62
|
},
|
|
60
63
|
dispose: () => {
|
|
61
64
|
n?.(), n = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/selectOptions.cjs");var r=5e4,i=[],a=new Set,o={status:`idle`,options:i,allValues:a,progress:0},s={status:`collecting`,options:i,allValues:a,progress:0},c=e=>new Set(e.map(e=>e.value)),l=e=>e===`select`||e===`set`||e===`numberSet`||e===`textSet`||e===`dateSet`,u=e=>{let t=e?.filterType??null;return t===`select`||t===`set`||t===`numberSet`||t===`textSet`||t===`dateSet`},d=(e,t,r)=>{if(!e||!u(e))return o;let
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/selectOptions.cjs");var r=5e4,i=[],a=new Set,o={status:`idle`,options:i,allValues:a,progress:0},s={status:`collecting`,options:i,allValues:a,progress:0},c=e=>new Set(e.map(e=>e.value)),l=e=>e===`select`||e===`set`||e===`numberSet`||e===`textSet`||e===`dateSet`,u=e=>{let t=e?.filterType??null;return t===`select`||t===`set`||t===`numberSet`||t===`textSet`||t===`dateSet`},d=(e,t,r,i=!1)=>{if(!e||!u(e))return o;let a=e.filterOptions&&e.filterOptions.length>0?e.filterOptions:null;if(a)return{status:`ready`,options:a,allValues:c(a),progress:1};if(t<=5e4){let e=n.collectSelectOptions(t,r,i);return{status:`ready`,options:e,allValues:c(e),progress:1}}return null},f={source:null,rowCount:0,result:o},p=(e,t,n,r)=>e.source===n&&e.rowCount===t||r!==void 0&&e.sourceKey===r&&e.result.status===`ready`?e.result:s,m=()=>{let r=e.createValueStore(f),o=null,s=null,l=null,u=e=>{let{getRawValueAt:f,rowCount:p,sourceKey:m}=e,h=n.createSelectOptionsAccumulator(e.numeric===!0),g=!1,_=()=>{g=!0};s=_,l=e,t.runChunked(p,e=>h.collect(f(e)),{isCancelled:()=>g,onYield:(e,t)=>{let n=r.getSnapshot();m!==void 0&&n.sourceKey===m&&n.result.status===`ready`||n.source===f&&n.rowCount===p&&n.result.status===`ready`||r.setSnapshot({source:f,rowCount:p,sourceKey:m,result:{status:`collecting`,options:i,allValues:a,progress:e/t}})}}).then(t=>{if(s===_&&(s=null,l=null),!t)return;let n=h.finalize();r.setSnapshot({source:f,rowCount:p,sourceKey:m,result:{status:`ready`,options:n,allValues:c(n),progress:1}}),o!==null&&o!==e&&o.needsAsync&&d(o,e)&&u(o)})},d=(e,t)=>e.rowCount!==t.rowCount||e.getRawValueAt!==t.getRawValueAt||e.numeric!==t.numeric;return{update:e=>{let t=o===null||o.needsAsync!==e.needsAsync||o.rowCount!==e.rowCount||o.getRawValueAt!==e.getRawValueAt||o.numeric!==e.numeric;if(o=e,!t||e.needsAsync&&l!==null&&s!==null&&e.sourceKey!==void 0&&l.sourceKey===e.sourceKey&&l.numeric===e.numeric)return;if(s?.(),s=null,l=null,e.needsAsync){u(e);return}let n=r.getSnapshot();n.sourceKey!==void 0&&r.setSnapshot({...n,sourceKey:void 0})},subscribe:r.subscribe,getSnapshot:r.getSnapshot,dispose:()=>{s!==null&&(s(),s=null,l=null,o=null)}}};exports.ASYNC_SELECT_COLLECT_ROW_THRESHOLD=r,exports.IDLE_SELECT_OPTIONS_RESULT=o,exports.createSelectOptionsCollector=m,exports.isSelectLikeFilterType=l,exports.resolveSyncSelectOptions=d,exports.selectCollectorResult=p;
|
|
@@ -13,18 +13,21 @@ export type ColumnSelectOptionsResult = {
|
|
|
13
13
|
export declare const IDLE_SELECT_OPTIONS_RESULT: ColumnSelectOptionsResult;
|
|
14
14
|
export type RawValueAccessor = (index: number) => unknown;
|
|
15
15
|
export declare const isSelectLikeFilterType: (filterType: string | null | undefined) => boolean;
|
|
16
|
-
export declare const resolveSyncSelectOptions: <T>(column: GridColumn<T> | null, rowCount: number, getRawValueAt: RawValueAccessor) => ColumnSelectOptionsResult | null;
|
|
16
|
+
export declare const resolveSyncSelectOptions: <T>(column: GridColumn<T> | null, rowCount: number, getRawValueAt: RawValueAccessor, numeric?: boolean) => ColumnSelectOptionsResult | null;
|
|
17
17
|
export type SelectOptionsCollectorArgs = {
|
|
18
18
|
needsAsync: boolean;
|
|
19
19
|
rowCount: number;
|
|
20
20
|
getRawValueAt: RawValueAccessor;
|
|
21
|
+
numeric?: boolean;
|
|
22
|
+
sourceKey?: string;
|
|
21
23
|
};
|
|
22
24
|
export type SelectOptionsCollectSnapshot = {
|
|
23
25
|
source: RawValueAccessor | null;
|
|
24
26
|
rowCount: number;
|
|
27
|
+
sourceKey?: string;
|
|
25
28
|
result: ColumnSelectOptionsResult;
|
|
26
29
|
};
|
|
27
|
-
export declare const selectCollectorResult: (snapshot: SelectOptionsCollectSnapshot, rowCount: number, getRawValueAt: RawValueAccessor) => ColumnSelectOptionsResult;
|
|
30
|
+
export declare const selectCollectorResult: (snapshot: SelectOptionsCollectSnapshot, rowCount: number, getRawValueAt: RawValueAccessor, sourceKey?: string) => ColumnSelectOptionsResult;
|
|
28
31
|
export type SelectOptionsCollector = {
|
|
29
32
|
update: (args: SelectOptionsCollectorArgs) => void;
|
|
30
33
|
subscribe: (listener: () => void) => () => void;
|
|
@@ -15,17 +15,17 @@ var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
|
|
|
15
15
|
}, l = (e) => new Set(e.map((e) => e.value)), u = (e) => e === "select" || e === "set" || e === "numberSet" || e === "textSet" || e === "dateSet", d = (e) => {
|
|
16
16
|
let t = e?.filterType ?? null;
|
|
17
17
|
return t === "select" || t === "set" || t === "numberSet" || t === "textSet" || t === "dateSet";
|
|
18
|
-
}, f = (e, t, r) => {
|
|
18
|
+
}, f = (e, t, r, i = !1) => {
|
|
19
19
|
if (!e || !d(e)) return s;
|
|
20
|
-
let
|
|
21
|
-
if (
|
|
20
|
+
let a = e.filterOptions && e.filterOptions.length > 0 ? e.filterOptions : null;
|
|
21
|
+
if (a) return {
|
|
22
22
|
status: "ready",
|
|
23
|
-
options:
|
|
24
|
-
allValues: l(
|
|
23
|
+
options: a,
|
|
24
|
+
allValues: l(a),
|
|
25
25
|
progress: 1
|
|
26
26
|
};
|
|
27
27
|
if (t <= 5e4) {
|
|
28
|
-
let e = n(t, r);
|
|
28
|
+
let e = n(t, r, i);
|
|
29
29
|
return {
|
|
30
30
|
status: "ready",
|
|
31
31
|
options: e,
|
|
@@ -38,17 +38,19 @@ var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
|
|
|
38
38
|
source: null,
|
|
39
39
|
rowCount: 0,
|
|
40
40
|
result: s
|
|
41
|
-
}, m = (e, t, n) => e.source === n && e.rowCount === t ? e.result : c, h = () => {
|
|
42
|
-
let n = e(p), i = null, s = null, c = (e) => {
|
|
43
|
-
let { getRawValueAt:
|
|
44
|
-
|
|
41
|
+
}, m = (e, t, n, r) => e.source === n && e.rowCount === t || r !== void 0 && e.sourceKey === r && e.result.status === "ready" ? e.result : c, h = () => {
|
|
42
|
+
let n = e(p), i = null, s = null, c = null, u = (e) => {
|
|
43
|
+
let { getRawValueAt: f, rowCount: p, sourceKey: m } = e, h = r(e.numeric === !0), g = !1, _ = () => {
|
|
44
|
+
g = !0;
|
|
45
45
|
};
|
|
46
|
-
s =
|
|
47
|
-
isCancelled: () =>
|
|
46
|
+
s = _, c = e, t(p, (e) => h.collect(f(e)), {
|
|
47
|
+
isCancelled: () => g,
|
|
48
48
|
onYield: (e, t) => {
|
|
49
|
-
n.
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
let r = n.getSnapshot();
|
|
50
|
+
m !== void 0 && r.sourceKey === m && r.result.status === "ready" || r.source === f && r.rowCount === p && r.result.status === "ready" || n.setSnapshot({
|
|
51
|
+
source: f,
|
|
52
|
+
rowCount: p,
|
|
53
|
+
sourceKey: m,
|
|
52
54
|
result: {
|
|
53
55
|
status: "collecting",
|
|
54
56
|
options: a,
|
|
@@ -57,30 +59,40 @@ var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
|
|
|
57
59
|
}
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
|
-
}).then((
|
|
61
|
-
if (s ===
|
|
62
|
-
let
|
|
62
|
+
}).then((t) => {
|
|
63
|
+
if (s === _ && (s = null, c = null), !t) return;
|
|
64
|
+
let r = h.finalize();
|
|
63
65
|
n.setSnapshot({
|
|
64
|
-
source:
|
|
65
|
-
rowCount:
|
|
66
|
+
source: f,
|
|
67
|
+
rowCount: p,
|
|
68
|
+
sourceKey: m,
|
|
66
69
|
result: {
|
|
67
70
|
status: "ready",
|
|
68
|
-
options:
|
|
69
|
-
allValues: l(
|
|
71
|
+
options: r,
|
|
72
|
+
allValues: l(r),
|
|
70
73
|
progress: 1
|
|
71
74
|
}
|
|
72
|
-
});
|
|
75
|
+
}), i !== null && i !== e && i.needsAsync && d(i, e) && u(i);
|
|
73
76
|
});
|
|
74
|
-
};
|
|
77
|
+
}, d = (e, t) => e.rowCount !== t.rowCount || e.getRawValueAt !== t.getRawValueAt || e.numeric !== t.numeric;
|
|
75
78
|
return {
|
|
76
79
|
update: (e) => {
|
|
77
|
-
let t = i === null || i.needsAsync !== e.needsAsync || i.rowCount !== e.rowCount || i.getRawValueAt !== e.getRawValueAt;
|
|
78
|
-
i = e, t &&
|
|
80
|
+
let t = i === null || i.needsAsync !== e.needsAsync || i.rowCount !== e.rowCount || i.getRawValueAt !== e.getRawValueAt || i.numeric !== e.numeric;
|
|
81
|
+
if (i = e, !t || e.needsAsync && c !== null && s !== null && e.sourceKey !== void 0 && c.sourceKey === e.sourceKey && c.numeric === e.numeric) return;
|
|
82
|
+
if (s?.(), s = null, c = null, e.needsAsync) {
|
|
83
|
+
u(e);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
let r = n.getSnapshot();
|
|
87
|
+
r.sourceKey !== void 0 && n.setSnapshot({
|
|
88
|
+
...r,
|
|
89
|
+
sourceKey: void 0
|
|
90
|
+
});
|
|
79
91
|
},
|
|
80
92
|
subscribe: n.subscribe,
|
|
81
93
|
getSnapshot: n.getSnapshot,
|
|
82
94
|
dispose: () => {
|
|
83
|
-
s !== null && (s(), s = null, i = null);
|
|
95
|
+
s !== null && (s(), s = null, c = null, i = null);
|
|
84
96
|
}
|
|
85
97
|
};
|
|
86
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("./popoverSupport.cjs"),n=require("../logic/panelDragGeometry.cjs");var r=360,i=
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),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=e=>{p({requestedTab:null,layout:null}),S(),i!==null&&e&&t.restoreGridFocus(i.gridRootRef)},b=()=>y(!0),x=t.createPopoverWindowBindings({onResize:_,onScroll:_,isInside:e=>c.current?.contains(e)===!0||i?.alliedRef?.current?.contains(e)===!0,onOutsidePointerDown:e=>y(i!==null&&t.isInsideGridRoot(i.gridRootRef,e)),getGridRoot:()=>i?.gridRootRef.current??null,onGridHidden:()=>y(!1),onKeyDown:e=>{if(e.key===`Escape`){if(i?.suppressEscape){i.onSuppressedEscape?.();return}e.preventDefault(),b()}}}),S=()=>{let e=v();e&&!x.isAttached()?(_(),x.attach()):!e&&x.isAttached()&&x.detach()};return{update:e=>{i=e,S()},subscribe:a.subscribe,getSnapshot:a.getSnapshot,panelRef:c,open:e=>{if(i===null||!u(i).includes(e))return;let n=a.getSnapshot();t.blurForPopover(i.gridRootRef.current),p({requestedTab:e,flashTick:n.requestedTab===null?n.flashTick:n.flashTick+1}),S()},close:b,move:(e,t)=>{let n=h({top:e,left:t});f=n,p({layout:g(n)})},dispose:()=>{x.detach()}}};exports.TOOL_PANEL_MAX_HEIGHT=i,exports.createToolPanelController=f,exports.resolveActiveToolPanelTab=d,exports.resolveAvailableToolPanelTabs=u,exports.resolveToolPanelVerticalPlacement=l;
|
|
@@ -4,6 +4,7 @@ export type ToolPanelLayout = {
|
|
|
4
4
|
top: number;
|
|
5
5
|
left: number;
|
|
6
6
|
width: number;
|
|
7
|
+
maxHeight: number;
|
|
7
8
|
};
|
|
8
9
|
export type ToolPanelControllerArgs = {
|
|
9
10
|
canUseFilterTab: boolean;
|
|
@@ -31,6 +32,11 @@ export type ToolPanelController = {
|
|
|
31
32
|
move: (top: number, left: number) => void;
|
|
32
33
|
dispose: () => void;
|
|
33
34
|
};
|
|
35
|
+
export declare const TOOL_PANEL_MAX_HEIGHT = 420;
|
|
36
|
+
export declare const resolveToolPanelVerticalPlacement: (top: number, viewportHeight: number, dragged: boolean) => {
|
|
37
|
+
top: number;
|
|
38
|
+
maxHeight: number;
|
|
39
|
+
};
|
|
34
40
|
export declare const resolveAvailableToolPanelTabs: (args: Pick<ToolPanelControllerArgs, "canUseFilterTab" | "canUseColumnsTab" | "canUseSortTab">) => ToolPanelTab[];
|
|
35
41
|
export declare const resolveActiveToolPanelTab: (requestedTab: ToolPanelTab | null, availableTabs: ToolPanelTab[]) => ToolPanelTab | null;
|
|
36
42
|
export declare const createToolPanelController: () => ToolPanelController;
|
|
@@ -2,113 +2,123 @@ import { createValueStore as e } from "../logic/valueStore.js";
|
|
|
2
2
|
import { blurForPopover as t, createPopoverWindowBindings as n, isInsideGridRoot as r, restoreGridFocus as i } from "./popoverSupport.js";
|
|
3
3
|
import { clampPanelDragPosition as a } from "../logic/panelDragGeometry.js";
|
|
4
4
|
//#region src/controllers/toolPanelController.ts
|
|
5
|
-
var o = 360, s =
|
|
5
|
+
var o = 360, s = 420, c = 336, l = 8, u = 12, d = [
|
|
6
6
|
"filter",
|
|
7
7
|
"columns",
|
|
8
8
|
"sort"
|
|
9
|
-
],
|
|
9
|
+
], f = (e, t, n) => {
|
|
10
|
+
let r = Math.max(0, Math.min(420, t - l * 2)), i = n ? Math.min(c, r) : r, a = e;
|
|
11
|
+
a + i > t - l && (a = Math.max(l, t - l - i));
|
|
12
|
+
let o = Math.max(0, Math.min(420, t - l - a));
|
|
13
|
+
return {
|
|
14
|
+
top: a,
|
|
15
|
+
maxHeight: o
|
|
16
|
+
};
|
|
17
|
+
}, p = (e) => {
|
|
10
18
|
let t = {
|
|
11
19
|
filter: e.canUseFilterTab,
|
|
12
20
|
columns: e.canUseColumnsTab,
|
|
13
21
|
sort: e.canUseSortTab
|
|
14
22
|
};
|
|
15
|
-
return
|
|
16
|
-
},
|
|
17
|
-
let
|
|
23
|
+
return d.filter((e) => t[e]);
|
|
24
|
+
}, m = (e, t) => e === null ? null : t.includes(e) ? e : t[0] ?? null, h = () => {
|
|
25
|
+
let s = null, c = e({
|
|
18
26
|
requestedTab: null,
|
|
19
27
|
layout: null,
|
|
20
28
|
flashTick: 0
|
|
21
|
-
}),
|
|
22
|
-
|
|
23
|
-
...
|
|
29
|
+
}), d = { current: null }, h = null, g = (e) => {
|
|
30
|
+
c.setSnapshot({
|
|
31
|
+
...c.getSnapshot(),
|
|
24
32
|
...e
|
|
25
33
|
});
|
|
26
|
-
},
|
|
27
|
-
let t =
|
|
28
|
-
t === e || t !== null && e !== null && t.top === e.top && t.left === e.left && t.width === e.width ||
|
|
29
|
-
},
|
|
34
|
+
}, _ = (e) => {
|
|
35
|
+
let t = c.getSnapshot().layout;
|
|
36
|
+
t === e || t !== null && e !== null && t.top === e.top && t.left === e.left && t.width === e.width && t.maxHeight === e.maxHeight || g({ layout: e });
|
|
37
|
+
}, v = (e) => a({
|
|
30
38
|
top: e.top,
|
|
31
39
|
left: e.left,
|
|
32
40
|
panelWidth: o,
|
|
33
41
|
viewportWidth: window.innerWidth,
|
|
34
42
|
viewportHeight: window.innerHeight
|
|
35
|
-
}),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
}), y = (e) => {
|
|
44
|
+
let t = f(e.top, window.innerHeight, !0);
|
|
45
|
+
return {
|
|
46
|
+
top: t.top,
|
|
47
|
+
left: e.left,
|
|
48
|
+
width: o,
|
|
49
|
+
maxHeight: t.maxHeight
|
|
50
|
+
};
|
|
51
|
+
}, b = () => {
|
|
52
|
+
if (h) {
|
|
53
|
+
_(y(v(h)));
|
|
43
54
|
return;
|
|
44
55
|
}
|
|
45
|
-
let e =
|
|
56
|
+
let e = s?.gridRootRef.current ?? null;
|
|
46
57
|
if (!e) {
|
|
47
|
-
|
|
58
|
+
_(null);
|
|
48
59
|
return;
|
|
49
60
|
}
|
|
50
|
-
let t = e.getBoundingClientRect(), n = t.right - o -
|
|
51
|
-
n = Math.max(
|
|
52
|
-
|
|
61
|
+
let t = e.getBoundingClientRect(), n = t.right - o - u, r = t.top + u;
|
|
62
|
+
n = Math.max(l, n), n = Math.min(n, window.innerWidth - o - l), r = Math.max(l, r);
|
|
63
|
+
let i = f(r, window.innerHeight, !1);
|
|
64
|
+
_({
|
|
65
|
+
top: i.top,
|
|
53
66
|
left: n,
|
|
54
|
-
width: o
|
|
67
|
+
width: o,
|
|
68
|
+
maxHeight: i.maxHeight
|
|
55
69
|
});
|
|
56
|
-
},
|
|
57
|
-
|
|
70
|
+
}, x = () => s !== null && m(c.getSnapshot().requestedTab, p(s)) !== null, S = (e) => {
|
|
71
|
+
g({
|
|
58
72
|
requestedTab: null,
|
|
59
73
|
layout: null
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
onResize:
|
|
63
|
-
onScroll:
|
|
64
|
-
isInside: (e) =>
|
|
65
|
-
onOutsidePointerDown: (e) =>
|
|
66
|
-
getGridRoot: () =>
|
|
67
|
-
onGridHidden: () =>
|
|
74
|
+
}), T(), s !== null && e && i(s.gridRootRef);
|
|
75
|
+
}, C = () => S(!0), w = n({
|
|
76
|
+
onResize: b,
|
|
77
|
+
onScroll: b,
|
|
78
|
+
isInside: (e) => d.current?.contains(e) === !0 || s?.alliedRef?.current?.contains(e) === !0,
|
|
79
|
+
onOutsidePointerDown: (e) => S(s !== null && r(s.gridRootRef, e)),
|
|
80
|
+
getGridRoot: () => s?.gridRootRef.current ?? null,
|
|
81
|
+
onGridHidden: () => S(!1),
|
|
68
82
|
onKeyDown: (e) => {
|
|
69
83
|
if (e.key === "Escape") {
|
|
70
|
-
if (
|
|
71
|
-
|
|
84
|
+
if (s?.suppressEscape) {
|
|
85
|
+
s.onSuppressedEscape?.();
|
|
72
86
|
return;
|
|
73
87
|
}
|
|
74
|
-
e.preventDefault(),
|
|
88
|
+
e.preventDefault(), C();
|
|
75
89
|
}
|
|
76
90
|
}
|
|
77
|
-
}),
|
|
78
|
-
let e =
|
|
79
|
-
e && !
|
|
91
|
+
}), T = () => {
|
|
92
|
+
let e = x();
|
|
93
|
+
e && !w.isAttached() ? (b(), w.attach()) : !e && w.isAttached() && w.detach();
|
|
80
94
|
};
|
|
81
95
|
return {
|
|
82
96
|
update: (e) => {
|
|
83
|
-
|
|
97
|
+
s = e, T();
|
|
84
98
|
},
|
|
85
|
-
subscribe:
|
|
86
|
-
getSnapshot:
|
|
87
|
-
panelRef:
|
|
99
|
+
subscribe: c.subscribe,
|
|
100
|
+
getSnapshot: c.getSnapshot,
|
|
101
|
+
panelRef: d,
|
|
88
102
|
open: (e) => {
|
|
89
|
-
if (
|
|
90
|
-
let n =
|
|
91
|
-
t(
|
|
103
|
+
if (s === null || !p(s).includes(e)) return;
|
|
104
|
+
let n = c.getSnapshot();
|
|
105
|
+
t(s.gridRootRef.current), g({
|
|
92
106
|
requestedTab: e,
|
|
93
107
|
flashTick: n.requestedTab === null ? n.flashTick : n.flashTick + 1
|
|
94
|
-
}),
|
|
108
|
+
}), T();
|
|
95
109
|
},
|
|
96
|
-
close:
|
|
110
|
+
close: C,
|
|
97
111
|
move: (e, t) => {
|
|
98
|
-
let n =
|
|
112
|
+
let n = v({
|
|
99
113
|
top: e,
|
|
100
114
|
left: t
|
|
101
115
|
});
|
|
102
|
-
|
|
103
|
-
top: n.top,
|
|
104
|
-
left: n.left,
|
|
105
|
-
width: o
|
|
106
|
-
} });
|
|
116
|
+
h = n, g({ layout: y(n) });
|
|
107
117
|
},
|
|
108
118
|
dispose: () => {
|
|
109
|
-
|
|
119
|
+
w.detach();
|
|
110
120
|
}
|
|
111
121
|
};
|
|
112
122
|
};
|
|
113
123
|
//#endregion
|
|
114
|
-
export {
|
|
124
|
+
export { s as TOOL_PANEL_MAX_HEIGHT, h as createToolPanelController, m as resolveActiveToolPanelTab, p as resolveAvailableToolPanelTabs, f as resolveToolPanelVerticalPlacement };
|
|
@@ -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 r=`data-ssg-tooltip`,i=`data-ssg-tooltip-overflow`,a=`[${r}], [${i}]`,o=350,s=800,c=0,l=null,u=null,d=0,f=null,p,m;function
|
|
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 r=`data-ssg-tooltip`,i=`data-ssg-tooltip-overflow`,a=`[${r}], [${i}]`,o=350,s=800,c=0,l=null,u=null,d=0,f=null,p,m,h=null,g=null,_=new WeakMap;function v(t){m=e.applySlotToElement(t,p,m)}function y(){if(l!==null)return l;let e=document.createElement(`div`);return e.className=`ssg-tooltip`,e.setAttribute(`aria-hidden`,`true`),m=void 0,v(e),document.body.appendChild(e),l=e,e}function b(){u!==null&&(window.clearTimeout(u),u=null)}var x=null;function S(){x!==null&&(cancelAnimationFrame(x),x=null)}function C(){if(S(),typeof requestAnimationFrame!=`function`)return;let e=()=>{if(x=null,f!==null){if(!f.isConnected){w();return}x=requestAnimationFrame(e)}};x=requestAnimationFrame(e)}function w(){b(),S(),f!==null&&(d=Date.now()+s),f=null,h=null,g=null,l!==null&&l.classList.remove(`ssg-tooltip--visible`)}function T(e){if(!e.isConnected)return;let a=e.getAttribute(r),o=e.getAttribute(i),s=a!==null&&a!==``?a:o!==null&&o!==``?o:(e.textContent??``).trim();if(s===``)return;let c=y();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=n.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`),f=e,C()}function E(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 D(e){let t=e.target;if(!(t instanceof Element)||typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.buttons!==0)return;let n=t.closest(a);if(n===null||n===f||!n.hasAttribute(r)&&!E(n))return;let i=f!==null;w(),i||Date.now()<d?T(n):u=window.setTimeout(()=>{u=null,T(n)},o)}function O(e){let t=e.target;if(!(t instanceof Element))return;if(e.type===`focusout`&&g!==null&&g.contains(t)){let t=e.relatedTarget;if(!(t instanceof Node&&g.contains(t))){w();return}}let n=t.closest(a);if(n===null||n===h&&typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.pointerType!==`mouse`)return;let r=e.relatedTarget;r instanceof Node&&n.contains(r)||w()}function k(){w()}function A(e){h!==null&&f===h&&typeof PointerEvent<`u`&&e instanceof PointerEvent&&e.pointerType!==`mouse`&&e.target instanceof Node&&h.contains(e.target)||w()}function j(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.ssg-shell`),r=n===null?void 0:_.get(n);if(n===null||r===void 0)return;let i=document.getElementById(r);i===null||f===i||!i.contains(t)||F(r,n)}function M(e){e.key===`Escape`&&w()}function N(){window.addEventListener(`pointerover`,D,!0),window.addEventListener(`pointerout`,O,!0),window.addEventListener(`focusin`,D,!0),window.addEventListener(`focusout`,O,!0),window.addEventListener(`pointerdown`,A,!0),window.addEventListener(`pointerup`,j,!0),window.addEventListener(`scroll`,k,!0),window.addEventListener(`keydown`,M,!0)}function P(){window.removeEventListener(`pointerover`,D,!0),window.removeEventListener(`pointerout`,O,!0),window.removeEventListener(`focusin`,D,!0),window.removeEventListener(`focusout`,O,!0),window.removeEventListener(`pointerdown`,A,!0),window.removeEventListener(`pointerup`,j,!0),window.removeEventListener(`scroll`,k,!0),window.removeEventListener(`keydown`,M,!0)}function F(e,t){if(typeof requestAnimationFrame!=`function`||c===0)return()=>{};t!==null&&_.set(t,e);let n=requestAnimationFrame(()=>{n=requestAnimationFrame(()=>{if(n=0,t!==null&&_.get(t)!==e)return;let i=document.getElementById(e);if(!(i!==null&&t!==null&&t.contains(document.activeElement)&&i.classList.contains(`ssg-body-cell--invalid`)&&(i.getAttribute(r)??``)!==``)){L(t);return}f!==i&&(w(),T(i)),f===i&&(h=i,g=t)})});return()=>{n!==0&&cancelAnimationFrame(n)}}function I(e){e&&_.delete(e),L(e)}function L(e){h===null||e!==void 0&&e!==g||(f===h&&w(),h=null,g=null)}function R(e){c+=1,c===1&&N();let t=!1,n=e=>{p=e,l!==null&&v(l)};return n(e),{setSlot:n,dispose:()=>{t||(t=!0,--c,c===0&&(P(),b(),S(),f=null,h=null,g=null,l!==null&&(l.remove(),l=null)))}}}exports.acquireTooltipController=R,exports.hideActiveCellTooltip=I,exports.scheduleActiveCellTooltip=F;
|
|
@@ -3,4 +3,6 @@ export type TooltipController = {
|
|
|
3
3
|
setSlot: (slot: GridResolvedSlot | undefined) => void;
|
|
4
4
|
dispose: () => void;
|
|
5
5
|
};
|
|
6
|
+
export declare function scheduleActiveCellTooltip(cellId: string, focusRoot: Element | null): () => void;
|
|
7
|
+
export declare function hideActiveCellTooltip(focusRoot?: Element | null): void;
|
|
6
8
|
export declare function acquireTooltipController(slot?: GridResolvedSlot): TooltipController;
|
|
@@ -2,43 +2,43 @@ import { applySlotToElement as e } from "../logic/slotDom.js";
|
|
|
2
2
|
import { syncPortalTokens as t } from "../utils/portalTokens.js";
|
|
3
3
|
import { computeTooltipPlacement as n } from "../logic/tooltipGeometry.js";
|
|
4
4
|
//#region src/controllers/tooltipController.ts
|
|
5
|
-
var r = "data-ssg-tooltip", i = "data-ssg-tooltip-overflow", a = `[${r}], [${i}]`, o = 350, s = 800, c = 0, l = null, u = null, d = 0, f = null, p, m;
|
|
6
|
-
function
|
|
5
|
+
var r = "data-ssg-tooltip", i = "data-ssg-tooltip-overflow", a = `[${r}], [${i}]`, o = 350, s = 800, c = 0, l = null, u = null, d = 0, f = null, p, m, h = null, g = null, _ = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
function v(t) {
|
|
7
7
|
m = e(t, p, m);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function y() {
|
|
10
10
|
if (l !== null) return l;
|
|
11
11
|
let e = document.createElement("div");
|
|
12
|
-
return e.className = "ssg-tooltip", e.setAttribute("aria-hidden", "true"), m = void 0,
|
|
12
|
+
return e.className = "ssg-tooltip", e.setAttribute("aria-hidden", "true"), m = void 0, v(e), document.body.appendChild(e), l = e, e;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function b() {
|
|
15
15
|
u !== null && (window.clearTimeout(u), u = null);
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
|
|
17
|
+
var x = null;
|
|
18
|
+
function S() {
|
|
19
|
+
x !== null && (cancelAnimationFrame(x), x = null);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
21
|
+
function C() {
|
|
22
|
+
if (S(), typeof requestAnimationFrame != "function") return;
|
|
23
23
|
let e = () => {
|
|
24
|
-
if (
|
|
24
|
+
if (x = null, f !== null) {
|
|
25
25
|
if (!f.isConnected) {
|
|
26
|
-
|
|
26
|
+
w();
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
x = requestAnimationFrame(e);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
x = requestAnimationFrame(e);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
34
|
+
function w() {
|
|
35
|
+
b(), S(), f !== null && (d = Date.now() + s), f = null, h = null, g = null, l !== null && l.classList.remove("ssg-tooltip--visible");
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function T(e) {
|
|
38
38
|
if (!e.isConnected) return;
|
|
39
39
|
let a = e.getAttribute(r), o = e.getAttribute(i), s = a !== null && a !== "" ? a : o !== null && o !== "" ? o : (e.textContent ?? "").trim();
|
|
40
40
|
if (s === "") return;
|
|
41
|
-
let c =
|
|
41
|
+
let c = y();
|
|
42
42
|
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
43
|
let l = n({
|
|
44
44
|
targetRect: e.getBoundingClientRect(),
|
|
@@ -46,49 +46,96 @@ function S(e) {
|
|
|
46
46
|
tipHeight: c.offsetHeight,
|
|
47
47
|
viewportWidth: window.innerWidth
|
|
48
48
|
});
|
|
49
|
-
c.style.left = `${l.left}px`, c.style.top = `${l.top}px`, c.classList.add("ssg-tooltip--visible"), f = e,
|
|
49
|
+
c.style.left = `${l.left}px`, c.style.top = `${l.top}px`, c.classList.add("ssg-tooltip--visible"), f = e, C();
|
|
50
|
+
}
|
|
51
|
+
function E(e) {
|
|
52
|
+
if (e.scrollWidth > e.clientWidth + 1) return !0;
|
|
53
|
+
for (let t of Array.from(e.children)) if (t.scrollWidth > t.clientWidth + 1) return !0;
|
|
54
|
+
return !1;
|
|
50
55
|
}
|
|
51
|
-
function
|
|
56
|
+
function D(e) {
|
|
52
57
|
let t = e.target;
|
|
53
58
|
if (!(t instanceof Element) || typeof PointerEvent < "u" && e instanceof PointerEvent && e.buttons !== 0) return;
|
|
54
59
|
let n = t.closest(a);
|
|
55
|
-
if (n === null || n === f || !n.hasAttribute(r) && n
|
|
60
|
+
if (n === null || n === f || !n.hasAttribute(r) && !E(n)) return;
|
|
56
61
|
let i = f !== null;
|
|
57
|
-
|
|
58
|
-
u = null,
|
|
62
|
+
w(), i || Date.now() < d ? T(n) : u = window.setTimeout(() => {
|
|
63
|
+
u = null, T(n);
|
|
59
64
|
}, o);
|
|
60
65
|
}
|
|
61
|
-
function
|
|
66
|
+
function O(e) {
|
|
62
67
|
let t = e.target;
|
|
63
68
|
if (!(t instanceof Element)) return;
|
|
69
|
+
if (e.type === "focusout" && g !== null && g.contains(t)) {
|
|
70
|
+
let t = e.relatedTarget;
|
|
71
|
+
if (!(t instanceof Node && g.contains(t))) {
|
|
72
|
+
w();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
64
76
|
let n = t.closest(a);
|
|
65
|
-
if (n === null) return;
|
|
77
|
+
if (n === null || n === h && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse") return;
|
|
66
78
|
let r = e.relatedTarget;
|
|
67
|
-
r instanceof Node && n.contains(r) ||
|
|
79
|
+
r instanceof Node && n.contains(r) || w();
|
|
68
80
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
81
|
+
function k() {
|
|
82
|
+
w();
|
|
71
83
|
}
|
|
72
|
-
function
|
|
73
|
-
e.
|
|
84
|
+
function A(e) {
|
|
85
|
+
h !== null && f === h && typeof PointerEvent < "u" && e instanceof PointerEvent && e.pointerType !== "mouse" && e.target instanceof Node && h.contains(e.target) || w();
|
|
86
|
+
}
|
|
87
|
+
function j(e) {
|
|
88
|
+
let t = e.target;
|
|
89
|
+
if (!(t instanceof Element)) return;
|
|
90
|
+
let n = t.closest(".ssg-shell"), r = n === null ? void 0 : _.get(n);
|
|
91
|
+
if (n === null || r === void 0) return;
|
|
92
|
+
let i = document.getElementById(r);
|
|
93
|
+
i === null || f === i || !i.contains(t) || F(r, n);
|
|
94
|
+
}
|
|
95
|
+
function M(e) {
|
|
96
|
+
e.key === "Escape" && w();
|
|
97
|
+
}
|
|
98
|
+
function N() {
|
|
99
|
+
window.addEventListener("pointerover", D, !0), window.addEventListener("pointerout", O, !0), window.addEventListener("focusin", D, !0), window.addEventListener("focusout", O, !0), window.addEventListener("pointerdown", A, !0), window.addEventListener("pointerup", j, !0), window.addEventListener("scroll", k, !0), window.addEventListener("keydown", M, !0);
|
|
100
|
+
}
|
|
101
|
+
function P() {
|
|
102
|
+
window.removeEventListener("pointerover", D, !0), window.removeEventListener("pointerout", O, !0), window.removeEventListener("focusin", D, !0), window.removeEventListener("focusout", O, !0), window.removeEventListener("pointerdown", A, !0), window.removeEventListener("pointerup", j, !0), window.removeEventListener("scroll", k, !0), window.removeEventListener("keydown", M, !0);
|
|
103
|
+
}
|
|
104
|
+
function F(e, t) {
|
|
105
|
+
if (typeof requestAnimationFrame != "function" || c === 0) return () => {};
|
|
106
|
+
t !== null && _.set(t, e);
|
|
107
|
+
let n = requestAnimationFrame(() => {
|
|
108
|
+
n = requestAnimationFrame(() => {
|
|
109
|
+
if (n = 0, t !== null && _.get(t) !== e) return;
|
|
110
|
+
let i = document.getElementById(e);
|
|
111
|
+
if (!(i !== null && t !== null && t.contains(document.activeElement) && i.classList.contains("ssg-body-cell--invalid") && (i.getAttribute(r) ?? "") !== "")) {
|
|
112
|
+
L(t);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
f !== i && (w(), T(i)), f === i && (h = i, g = t);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
return () => {
|
|
119
|
+
n !== 0 && cancelAnimationFrame(n);
|
|
120
|
+
};
|
|
74
121
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
122
|
+
function I(e) {
|
|
123
|
+
e && _.delete(e), L(e);
|
|
77
124
|
}
|
|
78
|
-
function
|
|
79
|
-
|
|
125
|
+
function L(e) {
|
|
126
|
+
h === null || e !== void 0 && e !== g || (f === h && w(), h = null, g = null);
|
|
80
127
|
}
|
|
81
|
-
function
|
|
82
|
-
c += 1, c === 1 &&
|
|
128
|
+
function R(e) {
|
|
129
|
+
c += 1, c === 1 && N();
|
|
83
130
|
let t = !1, n = (e) => {
|
|
84
|
-
p = e, l !== null &&
|
|
131
|
+
p = e, l !== null && v(l);
|
|
85
132
|
};
|
|
86
133
|
return n(e), {
|
|
87
134
|
setSlot: n,
|
|
88
135
|
dispose: () => {
|
|
89
|
-
t || (t = !0, --c, c === 0 && (
|
|
136
|
+
t || (t = !0, --c, c === 0 && (P(), b(), S(), f = null, h = null, g = null, l !== null && (l.remove(), l = null)));
|
|
90
137
|
}
|
|
91
138
|
};
|
|
92
139
|
}
|
|
93
140
|
//#endregion
|
|
94
|
-
export {
|
|
141
|
+
export { R as acquireTooltipController, I as hideActiveCellTooltip, F 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=(e,t,n)=>e===null||n.some(n=>!Object.is(e[n],t[n])),
|
|
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);t.scrollTo({top:f>c?Math.ceil(n):n,left:p,behavior:`auto`})}},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=(e,t,n)=>e===null||n.some(n=>!Object.is(e[n],t[n])),s=()=>{let e=null,r=null;return{update:a=>{if(o(e,a,[`columnVirtualizer`,`columnMeasurements`])&&a.columnVirtualizer.measure(),o(e,a,[`scrollElement`,`totalScrollWidth`,`physicalBodyHeight`,`headerHeight`,`footerHeight`])&&a.scrollElement&&t(a.scrollElement,a),o(e,a,[`scrollElement`,`activeCellRect`,`activeCellPinned`,`activeCell`,`headerHeight`,`leftPaneWidth`,`rightPaneWidth`,`centerLeadingWidth`,`verticalScaleFactor`,`footerHeight`])){let e=r,{activeCell:t}=a,o=e!==null&&t!==null&&e.row===t.row&&e.col===t.col;r=t,!o&&a.scrollElement&&a.activeCellRect&&(n(a.scrollElement,a.activeCellRect,a),i(a.scrollElement,a.activeCellRect,a))}e=a}}};exports.clampScrollToContent=t,exports.createScrollScaleAnchor=a,exports.createViewportSyncController=s,exports.revealActiveCellInPage=i,exports.scrollCellIntoView=n;
|
|
@@ -31,4 +31,9 @@ export type ViewportSyncController<T> = {
|
|
|
31
31
|
};
|
|
32
32
|
export declare const clampScrollToContent: (scrollElement: HTMLElement, args: Pick<ViewportSyncArgs<unknown>, "totalScrollWidth" | "physicalBodyHeight" | "headerHeight" | "footerHeight">) => void;
|
|
33
33
|
export declare const scrollCellIntoView: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "leftPaneWidth" | "rightPaneWidth" | "centerLeadingWidth" | "verticalScaleFactor" | "footerHeight" | "activeCellPinned" | "stickyTopInset">) => void;
|
|
34
|
+
export declare const revealActiveCellInPage: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "verticalScaleFactor">) => void;
|
|
35
|
+
export type ScrollScaleAnchor = {
|
|
36
|
+
update: (scrollElement: HTMLElement | null, verticalScaleFactor: number, onAnchored: (scrollTop: number) => void) => void;
|
|
37
|
+
};
|
|
38
|
+
export declare const createScrollScaleAnchor: () => ScrollScaleAnchor;
|
|
34
39
|
export declare const createViewportSyncController: <T>() => ViewportSyncController<T>;
|