@ishibashi0112/spreadsheet-grid-core 1.0.2 → 1.2.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/activeRowFollowController.cjs +1 -0
- package/dist/controllers/activeRowFollowController.d.ts +18 -0
- package/dist/controllers/activeRowFollowController.js +68 -0
- package/dist/controllers/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.js +17 -17
- package/dist/controllers/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.d.ts +4 -0
- package/dist/controllers/clipboardController.js +82 -54
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +1 -0
- package/dist/controllers/columnAutosizeRunner.js +17 -16
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +169 -168
- 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 +5 -1
- package/dist/controllers/contextMenuController.js +62 -40
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.d.ts +1 -0
- package/dist/controllers/editController.js +106 -99
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.d.ts +1 -0
- package/dist/controllers/fillHandleController.js +157 -157
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +6 -6
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +16 -15
- 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/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +65 -54
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +1 -0
- package/dist/controllers/keyboardController.js +46 -42
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +1 -0
- package/dist/controllers/pointerInteractionsController.js +172 -172
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +1 -0
- package/dist/controllers/popoverSupport.js +9 -4
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +2 -0
- package/dist/controllers/rowDragController.js +160 -146
- package/dist/controllers/scrollSyncController.cjs +1 -1
- package/dist/controllers/scrollSyncController.js +45 -43
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.js +19 -19
- 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 +74 -72
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +4 -1
- package/dist/controllers/viewportSyncController.js +66 -28
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.js +113 -113
- package/dist/engine/createGridEngine.cjs +3 -3
- package/dist/engine/createGridEngine.d.ts +2 -0
- package/dist/engine/createGridEngine.js +72 -70
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +18 -9
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +6 -6
- package/dist/engine/gridApi.cjs +6 -6
- package/dist/engine/gridApi.d.ts +8 -2
- package/dist/engine/gridApi.js +197 -187
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +4 -0
- package/dist/engine/notifiers.js +7 -7
- 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 +5 -0
- 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/editorValues.cjs +1 -1
- package/dist/logic/editorValues.js +37 -34
- package/dist/logic/exportCsv.cjs +3 -3
- package/dist/logic/exportCsv.d.ts +4 -1
- package/dist/logic/exportCsv.js +22 -20
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +4 -1
- package/dist/logic/exportData.js +40 -36
- 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/geometry.cjs +1 -1
- package/dist/logic/geometry.d.ts +2 -0
- package/dist/logic/geometry.js +41 -20
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +3 -2
- package/dist/logic/gridState.js +32 -23
- 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/imeInput.cjs +1 -1
- package/dist/logic/imeInput.js +6 -4
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +8 -0
- package/dist/logic/localeTextFeatures.js +11 -5
- package/dist/logic/localeTextPopups.cjs +1 -1
- package/dist/logic/localeTextPopups.d.ts +1 -0
- package/dist/logic/localeTextPopups.js +1 -0
- package/dist/logic/pasteFill.cjs +1 -0
- package/dist/logic/pasteFill.d.ts +2 -0
- package/dist/logic/pasteFill.js +25 -0
- package/dist/logic/selectEditorState.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +4 -1
- package/dist/logic/selectEditorState.js +14 -14
- 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/selectionAggregates.cjs +1 -1
- package/dist/logic/selectionAggregates.js +2 -3
- package/dist/logic/validation.cjs +1 -1
- package/dist/logic/validation.d.ts +1 -1
- package/dist/logic/validation.js +21 -21
- package/dist/logic/valueParsers.cjs +1 -0
- package/dist/logic/valueParsers.d.ts +14 -0
- package/dist/logic/valueParsers.js +23 -0
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +13 -0
- package/dist/model/gridActions.js +11 -0
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +128 -65
- package/dist/model/gridTypes.core.d.ts +345 -43
- package/dist/utils/clipboard.cjs +4 -4
- package/dist/utils/clipboard.d.ts +14 -2
- package/dist/utils/clipboard.js +101 -49
- package/dist/utils/gridVisibleBand.cjs +1 -0
- package/dist/utils/gridVisibleBand.d.ts +4 -0
- package/dist/utils/gridVisibleBand.js +24 -0
- package/dist/utils/popupContainer.cjs +1 -0
- package/dist/utils/popupContainer.d.ts +8 -0
- package/dist/utils/popupContainer.js +60 -0
- package/dist/utils/scrollBottom.cjs +1 -0
- package/dist/utils/scrollBottom.d.ts +1 -0
- package/dist/utils/scrollBottom.js +4 -0
- package/dist/utils/topAlignedInput.cjs +1 -0
- package/dist/utils/topAlignedInput.d.ts +3 -0
- package/dist/utils/topAlignedInput.js +23 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../logic/valueStore.cjs"),n=require("../logic/serverSideCache.cjs"),r=require("../logic/serverSideBlocks.cjs"),i=require("../logic/serverSideEdits.cjs");var a=100,o=64,s=120,c=3e3,l=l=>{let u=l,d=l.dataSource?.blockSize??a,f=n.createServerSideRowCache({blockSize:d,maxBlocks:l.dataSource?.maxCachedBlocks??o}),p=i.createServerSidePendingEdits(),m=l.dataSource?.initialRowCount??0,h=null,g=null,_=l.rowKeyGetter,v=new Map,y=new Set,b=new Set,x=null,S={start:0,end:0},C=0,w=0,T=new Set,E=1,D=null,O=null,k=null,A=!1,j,M=l.refreshToken,N=e=>p.getRow(e)??f.getRow(e),P=()=>({getRowCount:()=>m,getRow:e=>N(e),getSourceIndex:e=>e,getRowKey:e=>{let t=N(e);return t===void 0?e:_(t,e)}}),F=P(),I=t.createValueStore({rowModel:F,rowCount:m,loadError:h,writeError:g}),L=()=>{let e=I.getSnapshot();e.rowModel===F&&e.rowCount===m&&e.loadError===h&&e.writeError===g||I.setSnapshot({rowModel:F,rowCount:m,loadError:h,writeError:g})},R=()=>{F=P(),L()},z=()=>{C+=1,p=i.createServerSidePendingEdits(),g=null},B=()=>{k!==null&&(clearTimeout(k),k=null),D=null,O=null},V=()=>{let e=O;B(),e?.()},H=e=>{if(D===null&&T.size===0){e();return}if(D===null)D=new Set(T),k=setTimeout(()=>{k=null,V()},c);else for(let e of T)D.add(e);O=e},U=e=>{T.delete(e),D!==null&&D.delete(e)&&D.size===0&&V()},W=()=>{let e=y.size;h=e===0?null:{failedBlockCount:e},L()},G=()=>{for(let[,e]of v)e.abort();v.clear()},K=()=>{x!==null&&(clearTimeout(x),x=null)},q=e=>{let{dataSource:t,query:n}=u;if(t==null||D!==null||f.hasBlock(e)&&!b.has(e)||v.has(e))return;let r=new AbortController;v.set(e,r);let i=e*d,a=i+d;new Promise(e=>{e(t.getRows({startIndex:i,endIndex:a,query:n,signal:r.signal}))}).then(t=>{if(!r.signal.aborted&&v.get(e)===r){if(v.delete(e),f.setBlock(e,t.rows),b.delete(e),y.delete(e)&&(h=y.size===0?null:{failedBlockCount:y.size}),t.totalRowCount!==m){let n=Math.floor(m/d);t.totalRowCount>m&&m%d!==0&&n!==e&&f.hasBlock(n)&&b.add(n),m=t.totalRowCount}R()}}).catch(t=>{r.signal.aborted||v.get(e)===r&&(v.delete(e),y.add(e),W(),u.onLoadError?.(t,{startIndex:i,endIndex:a}))})},J=()=>{G();for(let e of f.loadedBlockIndexes())b.add(e);Y()},Y=()=>{let{start:e,end:t}=S,n=r.computeBlockIndexes(e,t,d,m),i=new Set(n);for(let[e,t]of v)i.has(e)||(t.abort(),v.delete(e));for(let e of n)y.has(e)||q(e)},X=()=>{K(),x=setTimeout(()=>{x=null,Y()},u.debounceMs??s)},ee=(e,t)=>{u.dataSource!=null&&(S={start:e,end:t},f.touchBlocks(r.computeBlockIndexes(e,t,d,m)),X())},Z=()=>{G(),K(),f.clear(),y.clear(),b.clear(),h=null,z()},Q=()=>{u.dataSource!=null&&(Z(),R(),H(()=>{let{start:e,end:t}=S;if(r.computeBlockIndexes(e,t,d,m).length===0){q(0);return}Y()}))},te=()=>{if(u.dataSource==null||y.size===0)return;let e=Array.from(y);y.clear(),W();for(let t of e)q(t)},ne=t=>{let n=u.dataSource?.updateRows;if(n===void 0||t.length===0)return 0;let r=i.buildServerSideRowUpdates(t,N,u.rowKeyGetter);if(r.length===0)return 0;let a=C,o=w,s=p,c=E;E+=1,T.add(c);let l=new Map;for(let e of t){let t=l.get(e.viewIndex),n={column:e.column,value:e.value};t?t.push(n):l.set(e.viewIndex,[n])}let d=r.map(e=>({viewIndex:e.rowIndex,rowKey:e.rowKey,writeId:s.beginWrite(e.rowIndex,e.row,l.get(e.rowIndex)??[])}));R();let m=r.map(e=>({rowKey:e.rowKey,columnKeys:e.changes.map(e=>e.columnKey)})),h=(e,t=m)=>{u.onWriteStateChange?.({state:e,cells:t})};return h(`pending`),new Promise(e=>{e(n({updates:r}))}).then(e=>{if(w!==o){h(`cleared`);return}let t=C!==a,n=e===void 0?void 0:e.rows,r=d.map((e,r)=>{let i=s.settleWrite(e.viewIndex,e.writeId,{ok:!0,serverRow:n?.[r]},t?void 0:f.getRow(e.viewIndex));return!t&&i.confirmedRow!==void 0&&f.updateRow(e.viewIndex,i.confirmedRow),{rowKey:e.rowKey,columnKeys:i.settledColumnKeys}});t?(D===null||!D.has(c))&&J():R(),h(`ok`,r)}).catch(t=>{if(w!==o){h(`cleared`);return}let n=C!==a,i=d.map(e=>({rowKey:e.rowKey,columnKeys:s.settleWrite(e.viewIndex,e.writeId,{ok:!1},n?void 0:f.getRow(e.viewIndex)).settledColumnKeys})),c=r.flatMap((t,r)=>{let a=i[r]?.columnKeys??[];if(a.length===0)return[];let o=t.changes.filter(e=>a.includes(e.columnKey)),s=n?void 0:N(t.rowIndex);if(s===void 0||u.rowKeyGetter(s,t.rowIndex)!==t.rowKey)return[{...t,changes:o}];let c=s;for(let n of l.get(t.rowIndex)??[])a.includes(n.column.key)&&(c=e.setCellValue(c,n.column,n.value));return[{...t,row:c,changes:o}]});c.length>0&&(g={failedRowCount:c.length},u.onWriteError?.(t,{updates:c})),n?L():R(),h(`failed`,i)}).finally(()=>{U(c)}),r.length},re=()=>{if(j!==void 0&&j===u.queryKey)return;j=u.queryKey;let{dataSource:e}=u;if(e==null)return;Z();let t=!A;if(A=!0,R(),t)(e.initialRowCount??0)<=0&&q(0);else{let e=D!==null||T.size>0;H(()=>{e&&S.end>S.start&&Y(),q(0)})}},ie=()=>{let e=u.refreshToken;if(u.dataSource==null||e===void 0){M=e;return}if(M===void 0){M=e;return}M!==e&&(M=e,Q())},$=!1,ae=()=>{u.dataSource!=null&&(m===0&&!f.hasBlock(0)&&q(0),S.end>S.start&&Y())};return{update:e=>{u=e,e.rowKeyGetter!==_&&(_=e.rowKeyGetter,R()),re(),ie(),$&&($=!1,ae())},subscribe:I.subscribe,getSnapshot:I.getSnapshot,isRowLoaded:e=>N(e)!==void 0,requestRange:ee,refresh:Q,retryFailedBlocks:te,applyCellEdits:ne,dispose:()=>{G(),K(),C+=1,w+=1,p.clear(),B(),T.clear(),$=!0}}};exports.SERVER_SIDE_WRITE_WAIT_MS=c,exports.createServerSideRowModel=l;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { setCellValue as e } from "../utils/permissions.js";
|
|
2
|
+
import { createValueStore as t } from "../logic/valueStore.js";
|
|
3
3
|
import { createServerSideRowCache as n } from "../logic/serverSideCache.js";
|
|
4
4
|
import { computeBlockIndexes as r } from "../logic/serverSideBlocks.js";
|
|
5
5
|
import { buildServerSideRowUpdates as i, createServerSidePendingEdits as a } from "../logic/serverSideEdits.js";
|
|
@@ -19,7 +19,7 @@ var o = 100, s = 64, c = 120, l = 3e3, u = (u) => {
|
|
|
19
19
|
let t = P(e);
|
|
20
20
|
return t === void 0 ? e : v(t, e);
|
|
21
21
|
}
|
|
22
|
-
}), I = F(), L =
|
|
22
|
+
}), I = F(), L = t({
|
|
23
23
|
rowModel: I,
|
|
24
24
|
rowCount: h,
|
|
25
25
|
loadError: g,
|
|
@@ -121,20 +121,20 @@ var o = 100, s = 64, c = 120, l = 3e3, u = (u) => {
|
|
|
121
121
|
let e = Array.from(b);
|
|
122
122
|
b.clear(), G();
|
|
123
123
|
for (let t of e) J(t);
|
|
124
|
-
}, re = (
|
|
124
|
+
}, re = (t) => {
|
|
125
125
|
let n = d.dataSource?.updateRows;
|
|
126
|
-
if (n === void 0 ||
|
|
127
|
-
let r = i(
|
|
126
|
+
if (n === void 0 || t.length === 0) return 0;
|
|
127
|
+
let r = i(t, P, d.rowKeyGetter);
|
|
128
128
|
if (r.length === 0) return 0;
|
|
129
129
|
let a = w, o = T, s = m, c = D;
|
|
130
130
|
D += 1, E.add(c);
|
|
131
131
|
let l = /* @__PURE__ */ new Map();
|
|
132
|
-
for (let
|
|
133
|
-
let
|
|
134
|
-
column:
|
|
135
|
-
value:
|
|
132
|
+
for (let e of t) {
|
|
133
|
+
let t = l.get(e.viewIndex), n = {
|
|
134
|
+
column: e.column,
|
|
135
|
+
value: e.value
|
|
136
136
|
};
|
|
137
|
-
|
|
137
|
+
t ? t.push(n) : l.set(e.viewIndex, [n]);
|
|
138
138
|
}
|
|
139
139
|
let u = r.map((e) => ({
|
|
140
140
|
viewIndex: e.rowIndex,
|
|
@@ -169,7 +169,7 @@ var o = 100, s = 64, c = 120, l = 3e3, u = (u) => {
|
|
|
169
169
|
};
|
|
170
170
|
});
|
|
171
171
|
t ? (O === null || !O.has(c)) && Y() : z(), h("ok", r);
|
|
172
|
-
}).catch((
|
|
172
|
+
}).catch((t) => {
|
|
173
173
|
if (T !== o) {
|
|
174
174
|
h("cleared");
|
|
175
175
|
return;
|
|
@@ -177,23 +177,23 @@ var o = 100, s = 64, c = 120, l = 3e3, u = (u) => {
|
|
|
177
177
|
let n = w !== a, i = u.map((e) => ({
|
|
178
178
|
rowKey: e.rowKey,
|
|
179
179
|
columnKeys: s.settleWrite(e.viewIndex, e.writeId, { ok: !1 }, n ? void 0 : p.getRow(e.viewIndex)).settledColumnKeys
|
|
180
|
-
})), c = r.flatMap((
|
|
180
|
+
})), c = r.flatMap((t, r) => {
|
|
181
181
|
let a = i[r]?.columnKeys ?? [];
|
|
182
182
|
if (a.length === 0) return [];
|
|
183
|
-
let o =
|
|
184
|
-
if (s === void 0 || d.rowKeyGetter(s,
|
|
185
|
-
...
|
|
183
|
+
let o = t.changes.filter((e) => a.includes(e.columnKey)), s = n ? void 0 : P(t.rowIndex);
|
|
184
|
+
if (s === void 0 || d.rowKeyGetter(s, t.rowIndex) !== t.rowKey) return [{
|
|
185
|
+
...t,
|
|
186
186
|
changes: o
|
|
187
187
|
}];
|
|
188
188
|
let c = s;
|
|
189
|
-
for (let n of l.get(
|
|
189
|
+
for (let n of l.get(t.rowIndex) ?? []) a.includes(n.column.key) && (c = e(c, n.column, n.value));
|
|
190
190
|
return [{
|
|
191
|
-
...
|
|
191
|
+
...t,
|
|
192
192
|
row: c,
|
|
193
193
|
changes: o
|
|
194
194
|
}];
|
|
195
195
|
});
|
|
196
|
-
c.length > 0 && (_ = { failedRowCount: c.length }, d.onWriteError?.(
|
|
196
|
+
c.length > 0 && (_ = { failedRowCount: c.length }, d.onWriteError?.(t, { updates: c })), n ? R() : z(), h("failed", i);
|
|
197
197
|
}).finally(() => {
|
|
198
198
|
W(c);
|
|
199
199
|
}), r.length;
|
|
@@ -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,141 +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 b() {
|
|
15
|
-
u !== null && (window.clearTimeout(u), u = null);
|
|
16
|
-
}
|
|
17
|
-
var x = null;
|
|
18
16
|
function S() {
|
|
19
|
-
|
|
17
|
+
f !== null && (window.clearTimeout(f), f = null);
|
|
18
|
+
}
|
|
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) {
|
|
52
54
|
if (e.scrollWidth > e.clientWidth + 1) return !0;
|
|
53
55
|
for (let t of Array.from(e.children)) if (t.scrollWidth > t.clientWidth + 1) return !0;
|
|
54
56
|
return !1;
|
|
55
57
|
}
|
|
56
|
-
function
|
|
58
|
+
function k(e) {
|
|
57
59
|
let t = e.target;
|
|
58
60
|
if (!(t instanceof Element) || typeof PointerEvent < "u" && e instanceof PointerEvent && e.buttons !== 0) return;
|
|
59
|
-
let n = t.closest(
|
|
60
|
-
if (n === null || n ===
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
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);
|
|
65
67
|
}
|
|
66
|
-
function
|
|
68
|
+
function A(e) {
|
|
67
69
|
let t = e.target;
|
|
68
70
|
if (!(t instanceof Element)) return;
|
|
69
|
-
if (e.type === "focusout" &&
|
|
71
|
+
if (e.type === "focusout" && v !== null && v.contains(t)) {
|
|
70
72
|
let t = e.relatedTarget;
|
|
71
|
-
if (!(t instanceof Node &&
|
|
72
|
-
|
|
73
|
+
if (!(t instanceof Node && v.contains(t))) {
|
|
74
|
+
E();
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
|
-
let n = t.closest(
|
|
77
|
-
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;
|
|
78
80
|
let r = e.relatedTarget;
|
|
79
|
-
r instanceof Node && n.contains(r) ||
|
|
81
|
+
r instanceof Node && n.contains(r) || E();
|
|
80
82
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
+
function j() {
|
|
84
|
+
E();
|
|
83
85
|
}
|
|
84
|
-
function
|
|
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();
|
|
86
88
|
}
|
|
87
|
-
function
|
|
89
|
+
function N(e) {
|
|
88
90
|
let t = e.target;
|
|
89
91
|
if (!(t instanceof Element)) return;
|
|
90
|
-
let n = t.closest(".ssg-shell"), r = n === null ? void 0 :
|
|
92
|
+
let n = t.closest(".ssg-shell"), r = n === null ? void 0 : y.get(n);
|
|
91
93
|
if (n === null || r === void 0) return;
|
|
92
94
|
let i = document.getElementById(r);
|
|
93
|
-
i === null ||
|
|
95
|
+
i === null || m === i || !i.contains(t) || L(r, n);
|
|
94
96
|
}
|
|
95
|
-
function
|
|
96
|
-
e.key === "Escape" &&
|
|
97
|
+
function P(e) {
|
|
98
|
+
e.key === "Escape" && E();
|
|
97
99
|
}
|
|
98
|
-
function
|
|
99
|
-
window.addEventListener("pointerover",
|
|
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);
|
|
100
102
|
}
|
|
101
|
-
function
|
|
102
|
-
window.removeEventListener("pointerover",
|
|
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);
|
|
103
105
|
}
|
|
104
|
-
function
|
|
105
|
-
if (typeof requestAnimationFrame != "function" ||
|
|
106
|
-
t !== null &&
|
|
106
|
+
function L(e, t) {
|
|
107
|
+
if (typeof requestAnimationFrame != "function" || u === 0) return () => {};
|
|
108
|
+
t !== null && y.set(t, e);
|
|
107
109
|
let n = requestAnimationFrame(() => {
|
|
108
110
|
n = requestAnimationFrame(() => {
|
|
109
|
-
if (n = 0, t !== null &&
|
|
110
|
-
let
|
|
111
|
-
if (!(
|
|
112
|
-
|
|
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);
|
|
113
115
|
return;
|
|
114
116
|
}
|
|
115
|
-
|
|
117
|
+
m !== r && (E(), D(r)), m === r && (_ = r, v = t);
|
|
116
118
|
});
|
|
117
119
|
});
|
|
118
120
|
return () => {
|
|
119
121
|
n !== 0 && cancelAnimationFrame(n);
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
|
-
function
|
|
123
|
-
e &&
|
|
124
|
+
function R(e) {
|
|
125
|
+
e && y.delete(e), z(e);
|
|
124
126
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
+
function z(e) {
|
|
128
|
+
_ === null || e !== void 0 && e !== v || (m === _ && E(), _ = null, v = null);
|
|
127
129
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
+
function B(e) {
|
|
131
|
+
u += 1, u === 1 && F();
|
|
130
132
|
let t = !1, n = (e) => {
|
|
131
|
-
|
|
133
|
+
h = e, d !== null && b(d);
|
|
132
134
|
};
|
|
133
135
|
return n(e), {
|
|
134
136
|
setSlot: n,
|
|
135
137
|
dispose: () => {
|
|
136
|
-
t || (t = !0, --
|
|
138
|
+
t || (t = !0, --u, u === 0 && (I(), S(), w(), m = null, _ = null, v = null, d !== null && (d.remove(), d = null)));
|
|
137
139
|
}
|
|
138
140
|
};
|
|
139
141
|
}
|
|
140
142
|
//#endregion
|
|
141
|
-
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<_||!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])),
|
|
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&&s!==null&&o.isRowFollowMove?.(s)===!0?d():!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;
|
|
@@ -25,12 +25,15 @@ export type ViewportSyncArgs<T> = {
|
|
|
25
25
|
verticalScaleFactor: number;
|
|
26
26
|
footerHeight?: number;
|
|
27
27
|
stickyTopInset?: StickyTopInset;
|
|
28
|
+
isRowFollowMove?: ((cell: CellCoord) => boolean) | undefined;
|
|
28
29
|
};
|
|
29
30
|
export type ViewportSyncController<T> = {
|
|
30
31
|
update: (args: ViewportSyncArgs<T>) => void;
|
|
32
|
+
cancelFollow: () => void;
|
|
33
|
+
dispose: () => void;
|
|
31
34
|
};
|
|
32
35
|
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">) =>
|
|
36
|
+
export declare const scrollCellIntoView: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "leftPaneWidth" | "rightPaneWidth" | "centerLeadingWidth" | "verticalScaleFactor" | "footerHeight" | "activeCellPinned" | "stickyTopInset">) => boolean;
|
|
34
37
|
export declare const revealActiveCellInPage: (scrollElement: HTMLElement, rect: ViewportCellRect, args: Pick<ViewportSyncArgs<unknown>, "headerHeight" | "verticalScaleFactor">) => void;
|
|
35
38
|
export type ScrollScaleAnchor = {
|
|
36
39
|
update: (scrollElement: HTMLElement | null, verticalScaleFactor: number, onAnchored: (scrollTop: number) => void) => void;
|
|
@@ -9,12 +9,13 @@ var n = (e, t) => {
|
|
|
9
9
|
let v = u + i.leftPaneWidth, y = u + f - i.rightPaneWidth, b = i.activeCellPinned === !0;
|
|
10
10
|
if (!b && s < v || !b && c > y && r.width > y - v ? m = Math.max(s - i.leftPaneWidth, 0) : !b && c > y && (m = Math.max(c - f + i.rightPaneWidth, 0)), p !== l || m !== u) {
|
|
11
11
|
let t = e(p, i.verticalScaleFactor);
|
|
12
|
-
n.scrollTo({
|
|
12
|
+
return n.scrollTo({
|
|
13
13
|
top: p > l ? Math.ceil(t) : t,
|
|
14
14
|
left: m,
|
|
15
15
|
behavior: "auto"
|
|
16
|
-
});
|
|
16
|
+
}), !0;
|
|
17
17
|
}
|
|
18
|
+
return !1;
|
|
18
19
|
}, i = (e, t, n, r) => e < n ? e - n : t > r ? Math.min(t - r, e - n) : 0, a = (e, n, r) => {
|
|
19
20
|
let a = e.ownerDocument, o = a.defaultView, s = e.closest(".ssg-shell"), c = a.activeElement;
|
|
20
21
|
if (!o || !s || !c || c !== s && !(c.classList.contains("ssg-ime-input") && s.contains(c)) || s.hasAttribute("data-ssg-pointer")) return;
|
|
@@ -46,32 +47,69 @@ var n = (e, t) => {
|
|
|
46
47
|
let f = e(t(d, l), o);
|
|
47
48
|
Math.abs(f - d) < 1 || (a.scrollTop = f, a.scrollTop !== d && s(a.scrollTop));
|
|
48
49
|
} };
|
|
49
|
-
}, s =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
t = n, !o && i.scrollElement && i.activeCellRect && (r(i.scrollElement, i.activeCellRect, i), a(i.scrollElement, i.activeCellRect, i));
|
|
50
|
+
}, s = 1e3, c = [
|
|
51
|
+
"wheel",
|
|
52
|
+
"touchstart",
|
|
53
|
+
"pointerdown",
|
|
54
|
+
"pointerup",
|
|
55
|
+
"pointermove",
|
|
56
|
+
"keydown"
|
|
57
|
+
], 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 = () => {
|
|
58
|
+
let e = null, t = null, i = null, o = null, d = () => {
|
|
59
|
+
i = null, o?.(), o = null;
|
|
60
|
+
}, f = (e) => {
|
|
61
|
+
e.type === "pointermove" && !(e.buttons > 0) || d();
|
|
62
|
+
}, p = (e, t) => {
|
|
63
|
+
d(), i = {
|
|
64
|
+
cell: t,
|
|
65
|
+
until: Date.now() + s,
|
|
66
|
+
left: e.scrollLeft
|
|
67
|
+
};
|
|
68
|
+
let n = e.ownerDocument, r = setTimeout(d, s);
|
|
69
|
+
if (typeof n?.addEventListener != "function") {
|
|
70
|
+
o = () => clearTimeout(r);
|
|
71
|
+
return;
|
|
72
72
|
}
|
|
73
|
-
e
|
|
74
|
-
|
|
73
|
+
for (let e of c) n.addEventListener(e, f, {
|
|
74
|
+
capture: !0,
|
|
75
|
+
passive: !0
|
|
76
|
+
});
|
|
77
|
+
o = () => {
|
|
78
|
+
clearTimeout(r);
|
|
79
|
+
for (let e of c) n.removeEventListener(e, f, { capture: !0 });
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
update: (o) => {
|
|
84
|
+
if (u(e, o, ["columnVirtualizer", "columnMeasurements"]) && o.columnVirtualizer.measure(), u(e, o, [
|
|
85
|
+
"scrollElement",
|
|
86
|
+
"totalScrollWidth",
|
|
87
|
+
"physicalBodyHeight",
|
|
88
|
+
"headerHeight",
|
|
89
|
+
"footerHeight"
|
|
90
|
+
]) && o.scrollElement && n(o.scrollElement, o), u(e, o, [
|
|
91
|
+
"scrollElement",
|
|
92
|
+
"activeCellRect",
|
|
93
|
+
"activeCellPinned",
|
|
94
|
+
"activeCell",
|
|
95
|
+
"headerHeight",
|
|
96
|
+
"leftPaneWidth",
|
|
97
|
+
"rightPaneWidth",
|
|
98
|
+
"centerLeadingWidth",
|
|
99
|
+
"verticalScaleFactor",
|
|
100
|
+
"footerHeight"
|
|
101
|
+
])) {
|
|
102
|
+
let n = t, { activeCell: s } = o, c = n !== null && s !== null && n.row === s.row && n.col === s.col;
|
|
103
|
+
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 = {
|
|
104
|
+
...i,
|
|
105
|
+
left: o.scrollElement.scrollLeft
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
e = o;
|
|
109
|
+
},
|
|
110
|
+
cancelFollow: d,
|
|
111
|
+
dispose: d
|
|
112
|
+
};
|
|
75
113
|
};
|
|
76
114
|
//#endregion
|
|
77
|
-
export { n as clampScrollToContent, o as createScrollScaleAnchor,
|
|
115
|
+
export { n as clampScrollToContent, o as createScrollScaleAnchor, d as createViewportSyncController, a as revealActiveCellInPage, r as scrollCellIntoView };
|