@ishibashi0112/spreadsheet-grid-core 0.39.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/LICENSE +21 -0
- package/dist/controllers/autoHeightMeasurer.cjs +1 -0
- package/dist/controllers/autoHeightMeasurer.d.ts +30 -0
- package/dist/controllers/autoHeightMeasurer.js +74 -0
- package/dist/controllers/clipboardController.cjs +2 -0
- package/dist/controllers/clipboardController.d.ts +31 -0
- package/dist/controllers/clipboardController.js +88 -0
- package/dist/controllers/columnAutosizeRunner.cjs +1 -0
- package/dist/controllers/columnAutosizeRunner.d.ts +31 -0
- package/dist/controllers/columnAutosizeRunner.js +61 -0
- package/dist/controllers/columnHeaderDragController.cjs +1 -0
- package/dist/controllers/columnHeaderDragController.d.ts +44 -0
- package/dist/controllers/columnHeaderDragController.js +256 -0
- package/dist/controllers/columnMenuController.cjs +1 -0
- package/dist/controllers/columnMenuController.d.ts +49 -0
- package/dist/controllers/columnMenuController.js +110 -0
- package/dist/controllers/contextMenuController.cjs +1 -0
- package/dist/controllers/contextMenuController.d.ts +30 -0
- package/dist/controllers/contextMenuController.js +65 -0
- package/dist/controllers/debouncedValueStore.cjs +1 -0
- package/dist/controllers/debouncedValueStore.d.ts +11 -0
- package/dist/controllers/debouncedValueStore.js +22 -0
- package/dist/controllers/editController.cjs +1 -0
- package/dist/controllers/editController.d.ts +27 -0
- package/dist/controllers/editController.js +76 -0
- package/dist/controllers/filterPopoverController.cjs +1 -0
- package/dist/controllers/filterPopoverController.d.ts +53 -0
- package/dist/controllers/filterPopoverController.js +146 -0
- package/dist/controllers/globalFilteredOrder.cjs +1 -0
- package/dist/controllers/globalFilteredOrder.d.ts +38 -0
- package/dist/controllers/globalFilteredOrder.js +78 -0
- package/dist/controllers/historyController.cjs +1 -0
- package/dist/controllers/historyController.d.ts +28 -0
- package/dist/controllers/historyController.js +52 -0
- package/dist/controllers/keyboardController.cjs +1 -0
- package/dist/controllers/keyboardController.d.ts +36 -0
- package/dist/controllers/keyboardController.js +111 -0
- package/dist/controllers/panelHeaderDragController.cjs +1 -0
- package/dist/controllers/panelHeaderDragController.d.ts +21 -0
- package/dist/controllers/panelHeaderDragController.js +32 -0
- package/dist/controllers/pointerInteractionsController.cjs +1 -0
- package/dist/controllers/pointerInteractionsController.d.ts +74 -0
- package/dist/controllers/pointerInteractionsController.js +262 -0
- package/dist/controllers/popoverSupport.cjs +1 -0
- package/dist/controllers/popoverSupport.d.ts +18 -0
- package/dist/controllers/popoverSupport.js +25 -0
- package/dist/controllers/rowDragController.cjs +1 -0
- package/dist/controllers/rowDragController.d.ts +40 -0
- package/dist/controllers/rowDragController.js +192 -0
- package/dist/controllers/scrollSyncController.cjs +1 -0
- package/dist/controllers/scrollSyncController.d.ts +17 -0
- package/dist/controllers/scrollSyncController.js +51 -0
- package/dist/controllers/selectOptionsCollector.cjs +1 -0
- package/dist/controllers/selectOptionsCollector.d.ts +31 -0
- package/dist/controllers/selectOptionsCollector.js +88 -0
- package/dist/controllers/serverSideRowModel.cjs +1 -0
- package/dist/controllers/serverSideRowModel.d.ts +36 -0
- package/dist/controllers/serverSideRowModel.js +153 -0
- package/dist/controllers/systemColorSchemeStore.cjs +1 -0
- package/dist/controllers/systemColorSchemeStore.d.ts +5 -0
- package/dist/controllers/systemColorSchemeStore.js +18 -0
- package/dist/controllers/toolPanelController.cjs +1 -0
- package/dist/controllers/toolPanelController.d.ts +36 -0
- package/dist/controllers/toolPanelController.js +112 -0
- package/dist/controllers/tooltipController.cjs +1 -0
- package/dist/controllers/tooltipController.d.ts +6 -0
- package/dist/controllers/tooltipController.js +75 -0
- package/dist/controllers/viewportSyncController.cjs +1 -0
- package/dist/controllers/viewportSyncController.d.ts +30 -0
- package/dist/controllers/viewportSyncController.js +40 -0
- package/dist/engine/columnCommands.cjs +1 -0
- package/dist/engine/columnCommands.d.ts +56 -0
- package/dist/engine/columnCommands.js +199 -0
- package/dist/engine/columnLayout.cjs +1 -0
- package/dist/engine/columnLayout.d.ts +43 -0
- package/dist/engine/columnLayout.js +91 -0
- package/dist/engine/createGridEngine.cjs +1 -0
- package/dist/engine/createGridEngine.d.ts +46 -0
- package/dist/engine/createGridEngine.js +52 -0
- package/dist/engine/filterPopoverCommands.cjs +1 -0
- package/dist/engine/filterPopoverCommands.d.ts +56 -0
- package/dist/engine/filterPopoverCommands.js +303 -0
- package/dist/engine/gridApi.cjs +1 -0
- package/dist/engine/gridApi.d.ts +61 -0
- package/dist/engine/gridApi.js +389 -0
- package/dist/engine/memo.cjs +1 -0
- package/dist/engine/memo.d.ts +2 -0
- package/dist/engine/memo.js +18 -0
- package/dist/engine/notifiers.cjs +1 -0
- package/dist/engine/notifiers.d.ts +35 -0
- package/dist/engine/notifiers.js +34 -0
- package/dist/engine/rowPipeline.cjs +1 -0
- package/dist/engine/rowPipeline.d.ts +50 -0
- package/dist/engine/rowPipeline.js +84 -0
- package/dist/engine/rowSelectionCommands.cjs +1 -0
- package/dist/engine/rowSelectionCommands.d.ts +21 -0
- package/dist/engine/rowSelectionCommands.js +57 -0
- package/dist/engine/verticalLayout.cjs +1 -0
- package/dist/engine/verticalLayout.d.ts +52 -0
- package/dist/engine/verticalLayout.js +60 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +5 -0
- package/dist/logic/aggregation.cjs +1 -0
- package/dist/logic/aggregation.d.ts +13 -0
- package/dist/logic/aggregation.js +28 -0
- package/dist/logic/autoScrollGeometry.cjs +1 -0
- package/dist/logic/autoScrollGeometry.d.ts +27 -0
- package/dist/logic/autoScrollGeometry.js +19 -0
- package/dist/logic/autoSizeOnData.cjs +1 -0
- package/dist/logic/autoSizeOnData.d.ts +10 -0
- package/dist/logic/autoSizeOnData.js +19 -0
- package/dist/logic/cellOverflowTooltip.cjs +1 -0
- package/dist/logic/cellOverflowTooltip.d.ts +5 -0
- package/dist/logic/cellOverflowTooltip.js +4 -0
- package/dist/logic/checkboxEditor.cjs +1 -0
- package/dist/logic/checkboxEditor.d.ts +12 -0
- package/dist/logic/checkboxEditor.js +17 -0
- package/dist/logic/chunkedLoop.cjs +1 -0
- package/dist/logic/chunkedLoop.d.ts +8 -0
- package/dist/logic/chunkedLoop.js +18 -0
- package/dist/logic/clearCells.cjs +1 -0
- package/dist/logic/clearCells.d.ts +31 -0
- package/dist/logic/clearCells.js +91 -0
- package/dist/logic/columnAutosize.cjs +1 -0
- package/dist/logic/columnAutosize.d.ts +18 -0
- package/dist/logic/columnAutosize.js +150 -0
- package/dist/logic/columnFlex.cjs +1 -0
- package/dist/logic/columnFlex.d.ts +4 -0
- package/dist/logic/columnFlex.js +60 -0
- package/dist/logic/columnReset.cjs +1 -0
- package/dist/logic/columnReset.d.ts +7 -0
- package/dist/logic/columnReset.js +25 -0
- package/dist/logic/contextMenuTarget.cjs +1 -0
- package/dist/logic/contextMenuTarget.d.ts +4 -0
- package/dist/logic/contextMenuTarget.js +18 -0
- package/dist/logic/cx.cjs +1 -0
- package/dist/logic/cx.d.ts +1 -0
- package/dist/logic/cx.js +6 -0
- package/dist/logic/dateFilterCondition.cjs +1 -0
- package/dist/logic/dateFilterCondition.d.ts +26 -0
- package/dist/logic/dateFilterCondition.js +110 -0
- package/dist/logic/dateFilterPresets.cjs +1 -0
- package/dist/logic/dateFilterPresets.d.ts +13 -0
- package/dist/logic/dateFilterPresets.js +30 -0
- package/dist/logic/dateFilterTree.cjs +1 -0
- package/dist/logic/dateFilterTree.d.ts +17 -0
- package/dist/logic/dateFilterTree.js +75 -0
- package/dist/logic/datePickerCalendar.cjs +1 -0
- package/dist/logic/datePickerCalendar.d.ts +12 -0
- package/dist/logic/datePickerCalendar.js +41 -0
- package/dist/logic/detailRow.cjs +1 -0
- package/dist/logic/detailRow.d.ts +38 -0
- package/dist/logic/detailRow.js +78 -0
- package/dist/logic/domGuards.cjs +1 -0
- package/dist/logic/domGuards.d.ts +7 -0
- package/dist/logic/domGuards.js +4 -0
- package/dist/logic/editorValues.cjs +1 -0
- package/dist/logic/editorValues.d.ts +5 -0
- package/dist/logic/editorValues.js +32 -0
- package/dist/logic/exportCsv.cjs +3 -0
- package/dist/logic/exportCsv.d.ts +12 -0
- package/dist/logic/exportCsv.js +19 -0
- package/dist/logic/exportData.cjs +1 -0
- package/dist/logic/exportData.d.ts +9 -0
- package/dist/logic/exportData.js +24 -0
- package/dist/logic/exportScope.cjs +1 -0
- package/dist/logic/exportScope.d.ts +3 -0
- package/dist/logic/exportScope.js +4 -0
- package/dist/logic/filterPopoverLayout.cjs +1 -0
- package/dist/logic/filterPopoverLayout.d.ts +17 -0
- package/dist/logic/filterPopoverLayout.js +13 -0
- package/dist/logic/filterPopoverOutsideClick.cjs +1 -0
- package/dist/logic/filterPopoverOutsideClick.d.ts +2 -0
- package/dist/logic/filterPopoverOutsideClick.js +4 -0
- package/dist/logic/filterSummary.cjs +1 -0
- package/dist/logic/filterSummary.d.ts +3 -0
- package/dist/logic/filterSummary.js +22 -0
- package/dist/logic/filtering.cjs +1 -0
- package/dist/logic/filtering.d.ts +33 -0
- package/dist/logic/filtering.js +313 -0
- package/dist/logic/geometry.cjs +1 -0
- package/dist/logic/geometry.d.ts +72 -0
- package/dist/logic/geometry.js +161 -0
- package/dist/logic/gridState.cjs +1 -0
- package/dist/logic/gridState.d.ts +13 -0
- package/dist/logic/gridState.js +165 -0
- package/dist/logic/grouping.cjs +1 -0
- package/dist/logic/grouping.d.ts +34 -0
- package/dist/logic/grouping.js +93 -0
- package/dist/logic/history.cjs +1 -0
- package/dist/logic/history.d.ts +16 -0
- package/dist/logic/history.js +34 -0
- package/dist/logic/inferFilterType.cjs +1 -0
- package/dist/logic/inferFilterType.d.ts +19 -0
- package/dist/logic/inferFilterType.js +54 -0
- package/dist/logic/numberFilterCondition.cjs +1 -0
- package/dist/logic/numberFilterCondition.d.ts +21 -0
- package/dist/logic/numberFilterCondition.js +130 -0
- package/dist/logic/panelDragGeometry.cjs +1 -0
- package/dist/logic/panelDragGeometry.d.ts +13 -0
- package/dist/logic/panelDragGeometry.js +10 -0
- package/dist/logic/rowHeightStore.cjs +1 -0
- package/dist/logic/rowHeightStore.d.ts +13 -0
- package/dist/logic/rowHeightStore.js +41 -0
- package/dist/logic/rowReorder.cjs +1 -0
- package/dist/logic/rowReorder.d.ts +18 -0
- package/dist/logic/rowReorder.js +22 -0
- package/dist/logic/rowSelection.cjs +1 -0
- package/dist/logic/rowSelection.d.ts +16 -0
- package/dist/logic/rowSelection.js +49 -0
- package/dist/logic/scrollHint.cjs +1 -0
- package/dist/logic/scrollHint.d.ts +41 -0
- package/dist/logic/scrollHint.js +66 -0
- package/dist/logic/scrollTargets.cjs +1 -0
- package/dist/logic/scrollTargets.d.ts +22 -0
- package/dist/logic/scrollTargets.js +24 -0
- package/dist/logic/selectEditorState.cjs +1 -0
- package/dist/logic/selectEditorState.d.ts +28 -0
- package/dist/logic/selectEditorState.js +31 -0
- package/dist/logic/selectOptions.cjs +1 -0
- package/dist/logic/selectOptions.d.ts +9 -0
- package/dist/logic/selectOptions.js +23 -0
- package/dist/logic/serverSideBlocks.cjs +1 -0
- package/dist/logic/serverSideBlocks.d.ts +2 -0
- package/dist/logic/serverSideBlocks.js +14 -0
- package/dist/logic/serverSideCache.cjs +1 -0
- package/dist/logic/serverSideCache.d.ts +14 -0
- package/dist/logic/serverSideCache.js +42 -0
- package/dist/logic/serverSideEdits.cjs +1 -0
- package/dist/logic/serverSideEdits.d.ts +16 -0
- package/dist/logic/serverSideEdits.js +47 -0
- package/dist/logic/serverSideQuery.cjs +1 -0
- package/dist/logic/serverSideQuery.d.ts +7 -0
- package/dist/logic/serverSideQuery.js +21 -0
- package/dist/logic/setFilterSearch.cjs +1 -0
- package/dist/logic/setFilterSearch.d.ts +14 -0
- package/dist/logic/setFilterSearch.js +14 -0
- package/dist/logic/setFilterSelection.cjs +1 -0
- package/dist/logic/setFilterSelection.d.ts +5 -0
- package/dist/logic/setFilterSelection.js +4 -0
- package/dist/logic/slotDom.cjs +1 -0
- package/dist/logic/slotDom.d.ts +8 -0
- package/dist/logic/slotDom.js +22 -0
- package/dist/logic/slotProps.cjs +1 -0
- package/dist/logic/slotProps.d.ts +18 -0
- package/dist/logic/slotProps.js +63 -0
- package/dist/logic/sorting.cjs +1 -0
- package/dist/logic/sorting.d.ts +11 -0
- package/dist/logic/sorting.js +96 -0
- package/dist/logic/textFilterCondition.cjs +1 -0
- package/dist/logic/textFilterCondition.d.ts +18 -0
- package/dist/logic/textFilterCondition.js +55 -0
- package/dist/logic/theme.cjs +1 -0
- package/dist/logic/theme.d.ts +3 -0
- package/dist/logic/theme.js +4 -0
- package/dist/logic/tooltipGeometry.cjs +1 -0
- package/dist/logic/tooltipGeometry.d.ts +19 -0
- package/dist/logic/tooltipGeometry.js +16 -0
- package/dist/logic/validation.cjs +1 -0
- package/dist/logic/validation.d.ts +14 -0
- package/dist/logic/validation.js +47 -0
- package/dist/logic/valueFormatters.cjs +1 -0
- package/dist/logic/valueFormatters.d.ts +9 -0
- package/dist/logic/valueFormatters.js +17 -0
- package/dist/logic/valueStore.cjs +1 -0
- package/dist/logic/valueStore.d.ts +6 -0
- package/dist/logic/valueStore.js +18 -0
- package/dist/logic/verticalGeometry.cjs +1 -0
- package/dist/logic/verticalGeometry.d.ts +58 -0
- package/dist/logic/verticalGeometry.js +90 -0
- package/dist/model/gridActions.cjs +1 -0
- package/dist/model/gridActions.d.ts +125 -0
- package/dist/model/gridActions.js +114 -0
- package/dist/model/gridReducer.cjs +1 -0
- package/dist/model/gridReducer.d.ts +4 -0
- package/dist/model/gridReducer.js +247 -0
- package/dist/model/gridSelectors.cjs +1 -0
- package/dist/model/gridSelectors.d.ts +40 -0
- package/dist/model/gridSelectors.js +68 -0
- package/dist/model/gridStore.cjs +1 -0
- package/dist/model/gridStore.d.ts +24 -0
- package/dist/model/gridStore.js +38 -0
- package/dist/model/gridTypes.core.cjs +1 -0
- package/dist/model/gridTypes.core.d.ts +797 -0
- package/dist/model/gridTypes.core.js +0 -0
- package/dist/model/gridTypes.unbound.cjs +1 -0
- package/dist/model/gridTypes.unbound.d.ts +31 -0
- package/dist/model/gridTypes.unbound.js +0 -0
- package/dist/testing/index.cjs +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.js +51 -0
- package/dist/utils/clipboard.cjs +7 -0
- package/dist/utils/clipboard.d.ts +29 -0
- package/dist/utils/clipboard.js +110 -0
- package/dist/utils/excelColumnName.cjs +1 -0
- package/dist/utils/excelColumnName.d.ts +1 -0
- package/dist/utils/excelColumnName.js +9 -0
- package/dist/utils/permissions.cjs +1 -0
- package/dist/utils/permissions.d.ts +4 -0
- package/dist/utils/permissions.js +7 -0
- package/dist/utils/scheduler.cjs +1 -0
- package/dist/utils/scheduler.d.ts +1 -0
- package/dist/utils/scheduler.js +13 -0
- package/package.json +58 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/controllers/scrollSyncController.ts
|
|
2
|
+
var e = () => {
|
|
3
|
+
let e = null, t = null, n = 0, r = null, i = null, a = () => {
|
|
4
|
+
i = null;
|
|
5
|
+
let t = r;
|
|
6
|
+
r = null, t && e?.onScroll?.(t);
|
|
7
|
+
}, o = (o) => {
|
|
8
|
+
e?.setViewState({
|
|
9
|
+
scrollTop: o.scrollTop,
|
|
10
|
+
viewportHeight: o.clientHeight,
|
|
11
|
+
viewportWidth: o.clientWidth
|
|
12
|
+
});
|
|
13
|
+
let s = () => {
|
|
14
|
+
e?.setViewState({ scrollTop: o.scrollTop });
|
|
15
|
+
let t = n > 0 ? "api" : "user";
|
|
16
|
+
t === "api" && --n;
|
|
17
|
+
let s = r;
|
|
18
|
+
r = {
|
|
19
|
+
top: o.scrollTop,
|
|
20
|
+
left: o.scrollLeft,
|
|
21
|
+
source: s?.source === "user" ? "user" : t
|
|
22
|
+
}, e?.onScroll && i === null && (i = requestAnimationFrame(a));
|
|
23
|
+
};
|
|
24
|
+
o.addEventListener("scroll", s, { passive: !0 });
|
|
25
|
+
let c = new ResizeObserver(() => {
|
|
26
|
+
e?.setViewState({
|
|
27
|
+
viewportHeight: o.clientHeight,
|
|
28
|
+
viewportWidth: o.clientWidth
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
c.observe(o), t = () => {
|
|
32
|
+
o.removeEventListener("scroll", s), i !== null && (cancelAnimationFrame(i), i = null), c.disconnect();
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
update: (n) => {
|
|
37
|
+
if (e = n, t === null) {
|
|
38
|
+
let e = n.scrollContainerRef.current;
|
|
39
|
+
e && o(e);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
markApiScroll: () => {
|
|
43
|
+
n += 1;
|
|
44
|
+
},
|
|
45
|
+
dispose: () => {
|
|
46
|
+
t?.(), t = null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { e as createScrollSyncController };
|
|
@@ -0,0 +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=>{let t=e?.filterType??null;return t===`select`||t===`set`||t===`numberSet`||t===`textSet`||t===`dateSet`},u=(e,t,r)=>{if(!e||!l(e))return o;let i=e.filterOptions&&e.filterOptions.length>0?e.filterOptions:null;if(i)return{status:`ready`,options:i,allValues:c(i),progress:1};if(t<=5e4){let e=n.collectSelectOptions(t,r);return{status:`ready`,options:e,allValues:c(e),progress:1}}return null},d={source:null,rowCount:0,result:o},f=(e,t,n)=>e.source===n&&e.rowCount===t?e.result:s,p=()=>{let r=e.createValueStore(d),o=null,s=null,l=e=>{let{getRawValueAt:o,rowCount:l}=e,u=n.createSelectOptionsAccumulator(),d=!1;s=()=>{d=!0},t.runChunked(l,e=>u.collect(o(e)),{isCancelled:()=>d,onYield:(e,t)=>{r.setSnapshot({source:o,rowCount:l,result:{status:`collecting`,options:i,allValues:a,progress:e/t}})}}).then(e=>{if(!e)return;let t=u.finalize();r.setSnapshot({source:o,rowCount:l,result:{status:`ready`,options:t,allValues:c(t),progress:1}})})};return{update:e=>{let t=o===null||o.needsAsync!==e.needsAsync||o.rowCount!==e.rowCount||o.getRawValueAt!==e.getRawValueAt;o=e,t&&(s?.(),s=null,e.needsAsync&&l(e))},subscribe:r.subscribe,getSnapshot:r.getSnapshot,dispose:()=>{s?.(),s=null}}};exports.ASYNC_SELECT_COLLECT_ROW_THRESHOLD=r,exports.IDLE_SELECT_OPTIONS_RESULT=o,exports.createSelectOptionsCollector=p,exports.resolveSyncSelectOptions=u,exports.selectCollectorResult=f;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { GridColumn } from '../model/gridTypes.unbound';
|
|
2
|
+
import { type SelectOptionEntry } from '../logic/selectOptions';
|
|
3
|
+
export declare const ASYNC_SELECT_COLLECT_ROW_THRESHOLD = 50000;
|
|
4
|
+
export type ColumnSelectOptionsStatus = 'idle' | 'collecting' | 'ready';
|
|
5
|
+
export type ColumnSelectOptionsResult = {
|
|
6
|
+
status: ColumnSelectOptionsStatus;
|
|
7
|
+
options: SelectOptionEntry[];
|
|
8
|
+
allValues: ReadonlySet<string>;
|
|
9
|
+
progress: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const IDLE_SELECT_OPTIONS_RESULT: ColumnSelectOptionsResult;
|
|
12
|
+
export type RawValueAccessor = (index: number) => unknown;
|
|
13
|
+
export declare const resolveSyncSelectOptions: <T>(column: GridColumn<T> | null, rowCount: number, getRawValueAt: RawValueAccessor) => ColumnSelectOptionsResult | null;
|
|
14
|
+
export type SelectOptionsCollectorArgs = {
|
|
15
|
+
needsAsync: boolean;
|
|
16
|
+
rowCount: number;
|
|
17
|
+
getRawValueAt: RawValueAccessor;
|
|
18
|
+
};
|
|
19
|
+
export type SelectOptionsCollectSnapshot = {
|
|
20
|
+
source: RawValueAccessor | null;
|
|
21
|
+
rowCount: number;
|
|
22
|
+
result: ColumnSelectOptionsResult;
|
|
23
|
+
};
|
|
24
|
+
export declare const selectCollectorResult: (snapshot: SelectOptionsCollectSnapshot, rowCount: number, getRawValueAt: RawValueAccessor) => ColumnSelectOptionsResult;
|
|
25
|
+
export type SelectOptionsCollector = {
|
|
26
|
+
update: (args: SelectOptionsCollectorArgs) => void;
|
|
27
|
+
subscribe: (listener: () => void) => () => void;
|
|
28
|
+
getSnapshot: () => SelectOptionsCollectSnapshot;
|
|
29
|
+
dispose: () => void;
|
|
30
|
+
};
|
|
31
|
+
export declare const createSelectOptionsCollector: () => SelectOptionsCollector;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createValueStore as e } from "../logic/valueStore.js";
|
|
2
|
+
import { runChunked as t } from "../logic/chunkedLoop.js";
|
|
3
|
+
import { collectSelectOptions as n, createSelectOptionsAccumulator as r } from "../logic/selectOptions.js";
|
|
4
|
+
//#region src/controllers/selectOptionsCollector.ts
|
|
5
|
+
var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
|
|
6
|
+
status: "idle",
|
|
7
|
+
options: a,
|
|
8
|
+
allValues: o,
|
|
9
|
+
progress: 0
|
|
10
|
+
}, c = {
|
|
11
|
+
status: "collecting",
|
|
12
|
+
options: a,
|
|
13
|
+
allValues: o,
|
|
14
|
+
progress: 0
|
|
15
|
+
}, l = (e) => new Set(e.map((e) => e.value)), u = (e) => {
|
|
16
|
+
let t = e?.filterType ?? null;
|
|
17
|
+
return t === "select" || t === "set" || t === "numberSet" || t === "textSet" || t === "dateSet";
|
|
18
|
+
}, d = (e, t, r) => {
|
|
19
|
+
if (!e || !u(e)) return s;
|
|
20
|
+
let i = e.filterOptions && e.filterOptions.length > 0 ? e.filterOptions : null;
|
|
21
|
+
if (i) return {
|
|
22
|
+
status: "ready",
|
|
23
|
+
options: i,
|
|
24
|
+
allValues: l(i),
|
|
25
|
+
progress: 1
|
|
26
|
+
};
|
|
27
|
+
if (t <= 5e4) {
|
|
28
|
+
let e = n(t, r);
|
|
29
|
+
return {
|
|
30
|
+
status: "ready",
|
|
31
|
+
options: e,
|
|
32
|
+
allValues: l(e),
|
|
33
|
+
progress: 1
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}, f = {
|
|
38
|
+
source: null,
|
|
39
|
+
rowCount: 0,
|
|
40
|
+
result: s
|
|
41
|
+
}, p = (e, t, n) => e.source === n && e.rowCount === t ? e.result : c, m = () => {
|
|
42
|
+
let n = e(f), i = null, s = null, c = (e) => {
|
|
43
|
+
let { getRawValueAt: i, rowCount: c } = e, u = r(), d = !1;
|
|
44
|
+
s = () => {
|
|
45
|
+
d = !0;
|
|
46
|
+
}, t(c, (e) => u.collect(i(e)), {
|
|
47
|
+
isCancelled: () => d,
|
|
48
|
+
onYield: (e, t) => {
|
|
49
|
+
n.setSnapshot({
|
|
50
|
+
source: i,
|
|
51
|
+
rowCount: c,
|
|
52
|
+
result: {
|
|
53
|
+
status: "collecting",
|
|
54
|
+
options: a,
|
|
55
|
+
allValues: o,
|
|
56
|
+
progress: e / t
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}).then((e) => {
|
|
61
|
+
if (!e) return;
|
|
62
|
+
let t = u.finalize();
|
|
63
|
+
n.setSnapshot({
|
|
64
|
+
source: i,
|
|
65
|
+
rowCount: c,
|
|
66
|
+
result: {
|
|
67
|
+
status: "ready",
|
|
68
|
+
options: t,
|
|
69
|
+
allValues: l(t),
|
|
70
|
+
progress: 1
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
update: (e) => {
|
|
77
|
+
let t = i === null || i.needsAsync !== e.needsAsync || i.rowCount !== e.rowCount || i.getRawValueAt !== e.getRawValueAt;
|
|
78
|
+
i = e, t && (s?.(), s = null, e.needsAsync && c(e));
|
|
79
|
+
},
|
|
80
|
+
subscribe: n.subscribe,
|
|
81
|
+
getSnapshot: n.getSnapshot,
|
|
82
|
+
dispose: () => {
|
|
83
|
+
s?.(), s = null;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
export { i as ASYNC_SELECT_COLLECT_ROW_THRESHOLD, s as IDLE_SELECT_OPTIONS_RESULT, m as createSelectOptionsCollector, d as resolveSyncSelectOptions, p as selectCollectorResult };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/serverSideCache.cjs"),n=require("../logic/serverSideBlocks.cjs"),r=require("../logic/serverSideEdits.cjs");var i=100,a=64,o=120,s=s=>{let c=s,l=s.dataSource?.blockSize??i,u=t.createServerSideRowCache({blockSize:l,maxBlocks:s.dataSource?.maxCachedBlocks??a}),d=r.createServerSidePendingEdits(),f=s.dataSource?.initialRowCount??0,p=null,m=null,h=s.rowKeyGetter,g=new Map,_=new Set,v=null,y={start:0,end:0},b=0,x=!1,S,C=s.refreshToken,w=e=>d.getRow(e)??u.getRow(e),T=()=>({getRowCount:()=>f,getRow:e=>w(e),getSourceIndex:e=>e,getRowKey:e=>{let t=w(e);return t===void 0?e:h(t,e)}}),E=T(),D=e.createValueStore({rowModel:E,rowCount:f,loadError:p,writeError:m}),O=()=>{let e=D.getSnapshot();e.rowModel===E&&e.rowCount===f&&e.loadError===p&&e.writeError===m||D.setSnapshot({rowModel:E,rowCount:f,loadError:p,writeError:m})},k=()=>{E=T(),O()},A=()=>{b+=1,d.clear(),m=null},j=()=>{let e=_.size;p=e===0?null:{failedBlockCount:e},O()},M=()=>{for(let[,e]of g)e.abort();g.clear()},N=()=>{v!==null&&(clearTimeout(v),v=null)},P=e=>{let{dataSource:t,query:n}=c;if(t==null||u.hasBlock(e)||g.has(e))return;let r=new AbortController;g.set(e,r);let i=e*l,a=i+l;t.getRows({startIndex:i,endIndex:a,query:n,signal:r.signal}).then(t=>{r.signal.aborted||g.get(e)===r&&(g.delete(e),u.setBlock(e,t.rows),_.delete(e)&&(p=_.size===0?null:{failedBlockCount:_.size}),t.totalRowCount!==f&&(f=t.totalRowCount),k())}).catch(t=>{r.signal.aborted||g.get(e)===r&&(g.delete(e),_.add(e),j(),c.onLoadError?.(t,{startIndex:i,endIndex:a}))})},F=()=>{let{start:e,end:t}=y,r=n.computeBlockIndexes(e,t,l,f),i=new Set(r);for(let[e,t]of g)i.has(e)||(t.abort(),g.delete(e));for(let e of r)P(e)},I=()=>{N(),v=setTimeout(()=>{v=null,F()},c.debounceMs??o)},L=(e,t)=>{c.dataSource!=null&&(y={start:e,end:t},u.touchBlocks(n.computeBlockIndexes(e,t,l,f)),I())},R=()=>{M(),N(),u.clear(),_.clear(),p=null,A()},z=()=>{if(c.dataSource==null)return;R(),k();let{start:e,end:t}=y;if(n.computeBlockIndexes(e,t,l,f).length===0){P(0);return}F()},B=()=>{if(c.dataSource==null||_.size===0)return;let e=Array.from(_);_.clear(),j();for(let t of e)P(t)},V=e=>{let t=c.dataSource?.updateRows;if(t===void 0||e.length===0)return 0;let n=r.buildServerSideRowUpdates(e,w,c.rowKeyGetter);if(n.length===0)return 0;let i=b,a=n.map(e=>({viewIndex:e.rowIndex,row:e.row,writeId:d.beginWrite(e.rowIndex,e.row)}));return k(),t({updates:n}).then(e=>{if(b!==i)return;let t=e===void 0?void 0:e.rows;a.forEach((e,n)=>{u.updateRow(e.viewIndex,t?.[n]??e.row),d.settleWrite(e.viewIndex,e.writeId)}),k()}).catch(e=>{if(b===i){for(let e of a)d.settleWrite(e.viewIndex,e.writeId);m={failedRowCount:n.length},c.onWriteError?.(e,{updates:n}),k()}}),n.length},H=()=>{if(S!==void 0&&S===c.queryKey)return;S=c.queryKey;let{dataSource:e}=c;if(e==null)return;R();let t=!x;x=!0,k(),t?(e.initialRowCount??0)<=0&&P(0):P(0)},U=()=>{let e=c.refreshToken;if(c.dataSource==null||e===void 0){C=e;return}if(C===void 0){C=e;return}C!==e&&(C=e,z())};return{update:e=>{c=e,e.rowKeyGetter!==h&&(h=e.rowKeyGetter,k()),H(),U()},subscribe:D.subscribe,getSnapshot:D.getSnapshot,isRowLoaded:e=>w(e)!==void 0,requestRange:L,refresh:z,retryFailedBlocks:B,applyCellEdits:V,dispose:()=>{M(),N(),b+=1,d.clear()}}};exports.createServerSideRowModel=s;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GridRowKey, RowModel, ServerSideDataSource, ServerSideLoadErrorParams, ServerSideQuery, ServerSideWriteErrorParams } from '../model/gridTypes.unbound';
|
|
2
|
+
import { type ServerSideCellEditInput } from '../logic/serverSideEdits';
|
|
3
|
+
export type ServerSideRowModelArgs<T> = {
|
|
4
|
+
dataSource?: ServerSideDataSource<T>;
|
|
5
|
+
rowKeyGetter: (row: T, index: number) => GridRowKey;
|
|
6
|
+
query: ServerSideQuery;
|
|
7
|
+
queryKey: string;
|
|
8
|
+
refreshToken?: number;
|
|
9
|
+
onLoadError?: (error: unknown, params: ServerSideLoadErrorParams) => void;
|
|
10
|
+
onWriteError?: (error: unknown, params: ServerSideWriteErrorParams<T>) => void;
|
|
11
|
+
debounceMs?: number;
|
|
12
|
+
};
|
|
13
|
+
export type ServerSideLoadErrorState = {
|
|
14
|
+
failedBlockCount: number;
|
|
15
|
+
};
|
|
16
|
+
export type ServerSideWriteErrorState = {
|
|
17
|
+
failedRowCount: number;
|
|
18
|
+
};
|
|
19
|
+
export type ServerSideRowModelSnapshot<T> = {
|
|
20
|
+
rowModel: RowModel<T>;
|
|
21
|
+
rowCount: number;
|
|
22
|
+
loadError: ServerSideLoadErrorState | null;
|
|
23
|
+
writeError: ServerSideWriteErrorState | null;
|
|
24
|
+
};
|
|
25
|
+
export type ServerSideRowModelController<T> = {
|
|
26
|
+
update: (args: ServerSideRowModelArgs<T>) => void;
|
|
27
|
+
subscribe: (listener: () => void) => () => void;
|
|
28
|
+
getSnapshot: () => ServerSideRowModelSnapshot<T>;
|
|
29
|
+
isRowLoaded: (viewIndex: number) => boolean;
|
|
30
|
+
requestRange: (startIndex: number, endIndex: number) => void;
|
|
31
|
+
refresh: () => void;
|
|
32
|
+
retryFailedBlocks: () => void;
|
|
33
|
+
applyCellEdits: (edits: ServerSideCellEditInput<T>[]) => number;
|
|
34
|
+
dispose: () => void;
|
|
35
|
+
};
|
|
36
|
+
export declare const createServerSideRowModel: <T>(initial: ServerSideRowModelArgs<T>) => ServerSideRowModelController<T>;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { createValueStore as e } from "../logic/valueStore.js";
|
|
2
|
+
import { createServerSideRowCache as t } from "../logic/serverSideCache.js";
|
|
3
|
+
import { computeBlockIndexes as n } from "../logic/serverSideBlocks.js";
|
|
4
|
+
import { buildServerSideRowUpdates as r, createServerSidePendingEdits as i } from "../logic/serverSideEdits.js";
|
|
5
|
+
//#region src/controllers/serverSideRowModel.ts
|
|
6
|
+
var a = 100, o = 64, s = 120, c = (c) => {
|
|
7
|
+
let l = c, u = c.dataSource?.blockSize ?? a, d = t({
|
|
8
|
+
blockSize: u,
|
|
9
|
+
maxBlocks: c.dataSource?.maxCachedBlocks ?? o
|
|
10
|
+
}), f = i(), p = c.dataSource?.initialRowCount ?? 0, m = null, h = null, g = c.rowKeyGetter, _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Set(), y = null, b = {
|
|
11
|
+
start: 0,
|
|
12
|
+
end: 0
|
|
13
|
+
}, x = 0, S = !1, C, w = c.refreshToken, T = (e) => f.getRow(e) ?? d.getRow(e), E = () => ({
|
|
14
|
+
getRowCount: () => p,
|
|
15
|
+
getRow: (e) => T(e),
|
|
16
|
+
getSourceIndex: (e) => e,
|
|
17
|
+
getRowKey: (e) => {
|
|
18
|
+
let t = T(e);
|
|
19
|
+
return t === void 0 ? e : g(t, e);
|
|
20
|
+
}
|
|
21
|
+
}), D = E(), O = e({
|
|
22
|
+
rowModel: D,
|
|
23
|
+
rowCount: p,
|
|
24
|
+
loadError: m,
|
|
25
|
+
writeError: h
|
|
26
|
+
}), k = () => {
|
|
27
|
+
let e = O.getSnapshot();
|
|
28
|
+
e.rowModel === D && e.rowCount === p && e.loadError === m && e.writeError === h || O.setSnapshot({
|
|
29
|
+
rowModel: D,
|
|
30
|
+
rowCount: p,
|
|
31
|
+
loadError: m,
|
|
32
|
+
writeError: h
|
|
33
|
+
});
|
|
34
|
+
}, A = () => {
|
|
35
|
+
D = E(), k();
|
|
36
|
+
}, j = () => {
|
|
37
|
+
x += 1, f.clear(), h = null;
|
|
38
|
+
}, M = () => {
|
|
39
|
+
let e = v.size;
|
|
40
|
+
m = e === 0 ? null : { failedBlockCount: e }, k();
|
|
41
|
+
}, N = () => {
|
|
42
|
+
for (let [, e] of _) e.abort();
|
|
43
|
+
_.clear();
|
|
44
|
+
}, P = () => {
|
|
45
|
+
y !== null && (clearTimeout(y), y = null);
|
|
46
|
+
}, F = (e) => {
|
|
47
|
+
let { dataSource: t, query: n } = l;
|
|
48
|
+
if (t == null || d.hasBlock(e) || _.has(e)) return;
|
|
49
|
+
let r = new AbortController();
|
|
50
|
+
_.set(e, r);
|
|
51
|
+
let i = e * u, a = i + u;
|
|
52
|
+
t.getRows({
|
|
53
|
+
startIndex: i,
|
|
54
|
+
endIndex: a,
|
|
55
|
+
query: n,
|
|
56
|
+
signal: r.signal
|
|
57
|
+
}).then((t) => {
|
|
58
|
+
r.signal.aborted || _.get(e) === r && (_.delete(e), d.setBlock(e, t.rows), v.delete(e) && (m = v.size === 0 ? null : { failedBlockCount: v.size }), t.totalRowCount !== p && (p = t.totalRowCount), A());
|
|
59
|
+
}).catch((t) => {
|
|
60
|
+
r.signal.aborted || _.get(e) === r && (_.delete(e), v.add(e), M(), l.onLoadError?.(t, {
|
|
61
|
+
startIndex: i,
|
|
62
|
+
endIndex: a
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
}, I = () => {
|
|
66
|
+
let { start: e, end: t } = b, r = n(e, t, u, p), i = new Set(r);
|
|
67
|
+
for (let [e, t] of _) i.has(e) || (t.abort(), _.delete(e));
|
|
68
|
+
for (let e of r) F(e);
|
|
69
|
+
}, L = () => {
|
|
70
|
+
P(), y = setTimeout(() => {
|
|
71
|
+
y = null, I();
|
|
72
|
+
}, l.debounceMs ?? s);
|
|
73
|
+
}, R = (e, t) => {
|
|
74
|
+
l.dataSource != null && (b = {
|
|
75
|
+
start: e,
|
|
76
|
+
end: t
|
|
77
|
+
}, d.touchBlocks(n(e, t, u, p)), L());
|
|
78
|
+
}, z = () => {
|
|
79
|
+
N(), P(), d.clear(), v.clear(), m = null, j();
|
|
80
|
+
}, B = () => {
|
|
81
|
+
if (l.dataSource == null) return;
|
|
82
|
+
z(), A();
|
|
83
|
+
let { start: e, end: t } = b;
|
|
84
|
+
if (n(e, t, u, p).length === 0) {
|
|
85
|
+
F(0);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
I();
|
|
89
|
+
}, V = () => {
|
|
90
|
+
if (l.dataSource == null || v.size === 0) return;
|
|
91
|
+
let e = Array.from(v);
|
|
92
|
+
v.clear(), M();
|
|
93
|
+
for (let t of e) F(t);
|
|
94
|
+
}, H = (e) => {
|
|
95
|
+
let t = l.dataSource?.updateRows;
|
|
96
|
+
if (t === void 0 || e.length === 0) return 0;
|
|
97
|
+
let n = r(e, T, l.rowKeyGetter);
|
|
98
|
+
if (n.length === 0) return 0;
|
|
99
|
+
let i = x, a = n.map((e) => ({
|
|
100
|
+
viewIndex: e.rowIndex,
|
|
101
|
+
row: e.row,
|
|
102
|
+
writeId: f.beginWrite(e.rowIndex, e.row)
|
|
103
|
+
}));
|
|
104
|
+
return A(), t({ updates: n }).then((e) => {
|
|
105
|
+
if (x !== i) return;
|
|
106
|
+
let t = e === void 0 ? void 0 : e.rows;
|
|
107
|
+
a.forEach((e, n) => {
|
|
108
|
+
d.updateRow(e.viewIndex, t?.[n] ?? e.row), f.settleWrite(e.viewIndex, e.writeId);
|
|
109
|
+
}), A();
|
|
110
|
+
}).catch((e) => {
|
|
111
|
+
if (x === i) {
|
|
112
|
+
for (let e of a) f.settleWrite(e.viewIndex, e.writeId);
|
|
113
|
+
h = { failedRowCount: n.length }, l.onWriteError?.(e, { updates: n }), A();
|
|
114
|
+
}
|
|
115
|
+
}), n.length;
|
|
116
|
+
}, U = () => {
|
|
117
|
+
if (C !== void 0 && C === l.queryKey) return;
|
|
118
|
+
C = l.queryKey;
|
|
119
|
+
let { dataSource: e } = l;
|
|
120
|
+
if (e == null) return;
|
|
121
|
+
z();
|
|
122
|
+
let t = !S;
|
|
123
|
+
S = !0, A(), t ? (e.initialRowCount ?? 0) <= 0 && F(0) : F(0);
|
|
124
|
+
}, W = () => {
|
|
125
|
+
let e = l.refreshToken;
|
|
126
|
+
if (l.dataSource == null || e === void 0) {
|
|
127
|
+
w = e;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (w === void 0) {
|
|
131
|
+
w = e;
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
w !== e && (w = e, B());
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
update: (e) => {
|
|
138
|
+
l = e, e.rowKeyGetter !== g && (g = e.rowKeyGetter, A()), U(), W();
|
|
139
|
+
},
|
|
140
|
+
subscribe: O.subscribe,
|
|
141
|
+
getSnapshot: O.getSnapshot,
|
|
142
|
+
isRowLoaded: (e) => T(e) !== void 0,
|
|
143
|
+
requestRange: R,
|
|
144
|
+
refresh: B,
|
|
145
|
+
retryFailedBlocks: V,
|
|
146
|
+
applyCellEdits: H,
|
|
147
|
+
dispose: () => {
|
|
148
|
+
N(), P(), x += 1, f.clear();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
//#endregion
|
|
153
|
+
export { c as createServerSideRowModel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`(prefers-color-scheme: dark)`,t=()=>typeof window<`u`&&typeof window.matchMedia==`function`,n={subscribe(n){if(!t())return()=>{};let r=window.matchMedia(e);return r.addEventListener(`change`,n),()=>{r.removeEventListener(`change`,n)}},getSnapshot(){return t()?window.matchMedia(e).matches:!1},getServerSnapshot(){return!1}};exports.systemColorSchemeStore=n;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/controllers/systemColorSchemeStore.ts
|
|
2
|
+
var e = "(prefers-color-scheme: dark)", t = () => typeof window < "u" && typeof window.matchMedia == "function", n = {
|
|
3
|
+
subscribe(n) {
|
|
4
|
+
if (!t()) return () => {};
|
|
5
|
+
let r = window.matchMedia(e);
|
|
6
|
+
return r.addEventListener("change", n), () => {
|
|
7
|
+
r.removeEventListener("change", n);
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
getSnapshot() {
|
|
11
|
+
return t() ? window.matchMedia(e).matches : !1;
|
|
12
|
+
},
|
|
13
|
+
getServerSnapshot() {
|
|
14
|
+
return !1;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { n as systemColorSchemeStore };
|
|
@@ -0,0 +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=8,a=12,o=[`filter`,`columns`,`sort`],s=e=>{let t={filter:e.canUseFilterTab,columns:e.canUseColumnsTab,sort:e.canUseSortTab};return o.filter(e=>t[e])},c=(e,t)=>e===null?null:t.includes(e)?e:t[0]??null,l=()=>{let o=null,l=e.createValueStore({requestedTab:null,layout:null,flashTick:0}),u={current:null},d=null,f=e=>{l.setSnapshot({...l.getSnapshot(),...e})},p=e=>{let t=l.getSnapshot().layout;t===e||t!==null&&e!==null&&t.top===e.top&&t.left===e.left&&t.width===e.width||f({layout:e})},m=e=>n.clampPanelDragPosition({top:e.top,left:e.left,panelWidth:r,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}),h=()=>{if(d){let e=m(d);p({top:e.top,left:e.left,width:r});return}let e=o?.gridRootRef.current??null;if(!e){p(null);return}let t=e.getBoundingClientRect(),n=t.right-r-a,s=t.top+a;n=Math.max(i,n),n=Math.min(n,window.innerWidth-r-i),s=Math.max(i,s),p({top:s,left:n,width:r})},g=()=>o!==null&&c(l.getSnapshot().requestedTab,s(o))!==null,_=()=>{f({requestedTab:null,layout:null}),y(),o!==null&&t.restoreGridFocus(o.gridRootRef)},v=t.createPopoverWindowBindings({onResize:h,onScroll:h,isInside:e=>u.current?.contains(e)===!0||o?.alliedRef?.current?.contains(e)===!0,onOutsidePointerDown:_,onKeyDown:e=>{if(e.key===`Escape`){if(o?.suppressEscape){o.onSuppressedEscape?.();return}e.preventDefault(),_()}}}),y=()=>{let e=g();e&&!v.isAttached()?(h(),v.attach()):!e&&v.isAttached()&&v.detach()};return{update:e=>{o=e,y()},subscribe:l.subscribe,getSnapshot:l.getSnapshot,panelRef:u,open:e=>{if(o===null||!s(o).includes(e))return;let n=l.getSnapshot();t.blurForPopover(o.gridRootRef.current),f({requestedTab:e,flashTick:n.requestedTab===null?n.flashTick:n.flashTick+1}),y()},close:_,move:(e,t)=>{let n=m({top:e,left:t});d=n,f({layout:{top:n.top,left:n.left,width:r}})},dispose:()=>{v.detach()}}};exports.createToolPanelController=l,exports.resolveActiveToolPanelTab=c,exports.resolveAvailableToolPanelTabs=s;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ReadonlyElementRef } from './popoverSupport';
|
|
2
|
+
export type ToolPanelTab = 'filter' | 'columns' | 'sort';
|
|
3
|
+
export type ToolPanelLayout = {
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
width: number;
|
|
7
|
+
};
|
|
8
|
+
export type ToolPanelControllerArgs = {
|
|
9
|
+
canUseFilterTab: boolean;
|
|
10
|
+
canUseColumnsTab: boolean;
|
|
11
|
+
canUseSortTab: boolean;
|
|
12
|
+
gridRootRef: ReadonlyElementRef;
|
|
13
|
+
alliedRef?: ReadonlyElementRef;
|
|
14
|
+
suppressEscape?: boolean;
|
|
15
|
+
onSuppressedEscape?: () => void;
|
|
16
|
+
};
|
|
17
|
+
export type ToolPanelSnapshot = {
|
|
18
|
+
requestedTab: ToolPanelTab | null;
|
|
19
|
+
layout: ToolPanelLayout | null;
|
|
20
|
+
flashTick: number;
|
|
21
|
+
};
|
|
22
|
+
export type ToolPanelController = {
|
|
23
|
+
update: (args: ToolPanelControllerArgs) => void;
|
|
24
|
+
subscribe: (listener: () => void) => () => void;
|
|
25
|
+
getSnapshot: () => ToolPanelSnapshot;
|
|
26
|
+
panelRef: {
|
|
27
|
+
current: HTMLDivElement | null;
|
|
28
|
+
};
|
|
29
|
+
open: (tab: ToolPanelTab) => void;
|
|
30
|
+
close: () => void;
|
|
31
|
+
move: (top: number, left: number) => void;
|
|
32
|
+
dispose: () => void;
|
|
33
|
+
};
|
|
34
|
+
export declare const resolveAvailableToolPanelTabs: (args: Pick<ToolPanelControllerArgs, "canUseFilterTab" | "canUseColumnsTab" | "canUseSortTab">) => ToolPanelTab[];
|
|
35
|
+
export declare const resolveActiveToolPanelTab: (requestedTab: ToolPanelTab | null, availableTabs: ToolPanelTab[]) => ToolPanelTab | null;
|
|
36
|
+
export declare const createToolPanelController: () => ToolPanelController;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createValueStore as e } from "../logic/valueStore.js";
|
|
2
|
+
import { blurForPopover as t, createPopoverWindowBindings as n, restoreGridFocus as r } from "./popoverSupport.js";
|
|
3
|
+
import { clampPanelDragPosition as i } from "../logic/panelDragGeometry.js";
|
|
4
|
+
//#region src/controllers/toolPanelController.ts
|
|
5
|
+
var a = 360, o = 8, s = 12, c = [
|
|
6
|
+
"filter",
|
|
7
|
+
"columns",
|
|
8
|
+
"sort"
|
|
9
|
+
], l = (e) => {
|
|
10
|
+
let t = {
|
|
11
|
+
filter: e.canUseFilterTab,
|
|
12
|
+
columns: e.canUseColumnsTab,
|
|
13
|
+
sort: e.canUseSortTab
|
|
14
|
+
};
|
|
15
|
+
return c.filter((e) => t[e]);
|
|
16
|
+
}, u = (e, t) => e === null ? null : t.includes(e) ? e : t[0] ?? null, d = () => {
|
|
17
|
+
let c = null, d = e({
|
|
18
|
+
requestedTab: null,
|
|
19
|
+
layout: null,
|
|
20
|
+
flashTick: 0
|
|
21
|
+
}), f = { current: null }, p = null, m = (e) => {
|
|
22
|
+
d.setSnapshot({
|
|
23
|
+
...d.getSnapshot(),
|
|
24
|
+
...e
|
|
25
|
+
});
|
|
26
|
+
}, h = (e) => {
|
|
27
|
+
let t = d.getSnapshot().layout;
|
|
28
|
+
t === e || t !== null && e !== null && t.top === e.top && t.left === e.left && t.width === e.width || m({ layout: e });
|
|
29
|
+
}, g = (e) => i({
|
|
30
|
+
top: e.top,
|
|
31
|
+
left: e.left,
|
|
32
|
+
panelWidth: a,
|
|
33
|
+
viewportWidth: window.innerWidth,
|
|
34
|
+
viewportHeight: window.innerHeight
|
|
35
|
+
}), _ = () => {
|
|
36
|
+
if (p) {
|
|
37
|
+
let e = g(p);
|
|
38
|
+
h({
|
|
39
|
+
top: e.top,
|
|
40
|
+
left: e.left,
|
|
41
|
+
width: a
|
|
42
|
+
});
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let e = c?.gridRootRef.current ?? null;
|
|
46
|
+
if (!e) {
|
|
47
|
+
h(null);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let t = e.getBoundingClientRect(), n = t.right - a - s, r = t.top + s;
|
|
51
|
+
n = Math.max(o, n), n = Math.min(n, window.innerWidth - a - o), r = Math.max(o, r), h({
|
|
52
|
+
top: r,
|
|
53
|
+
left: n,
|
|
54
|
+
width: a
|
|
55
|
+
});
|
|
56
|
+
}, v = () => c !== null && u(d.getSnapshot().requestedTab, l(c)) !== null, y = () => {
|
|
57
|
+
m({
|
|
58
|
+
requestedTab: null,
|
|
59
|
+
layout: null
|
|
60
|
+
}), x(), c !== null && r(c.gridRootRef);
|
|
61
|
+
}, b = n({
|
|
62
|
+
onResize: _,
|
|
63
|
+
onScroll: _,
|
|
64
|
+
isInside: (e) => f.current?.contains(e) === !0 || c?.alliedRef?.current?.contains(e) === !0,
|
|
65
|
+
onOutsidePointerDown: y,
|
|
66
|
+
onKeyDown: (e) => {
|
|
67
|
+
if (e.key === "Escape") {
|
|
68
|
+
if (c?.suppressEscape) {
|
|
69
|
+
c.onSuppressedEscape?.();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
e.preventDefault(), y();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}), x = () => {
|
|
76
|
+
let e = v();
|
|
77
|
+
e && !b.isAttached() ? (_(), b.attach()) : !e && b.isAttached() && b.detach();
|
|
78
|
+
};
|
|
79
|
+
return {
|
|
80
|
+
update: (e) => {
|
|
81
|
+
c = e, x();
|
|
82
|
+
},
|
|
83
|
+
subscribe: d.subscribe,
|
|
84
|
+
getSnapshot: d.getSnapshot,
|
|
85
|
+
panelRef: f,
|
|
86
|
+
open: (e) => {
|
|
87
|
+
if (c === null || !l(c).includes(e)) return;
|
|
88
|
+
let n = d.getSnapshot();
|
|
89
|
+
t(c.gridRootRef.current), m({
|
|
90
|
+
requestedTab: e,
|
|
91
|
+
flashTick: n.requestedTab === null ? n.flashTick : n.flashTick + 1
|
|
92
|
+
}), x();
|
|
93
|
+
},
|
|
94
|
+
close: y,
|
|
95
|
+
move: (e, t) => {
|
|
96
|
+
let n = g({
|
|
97
|
+
top: e,
|
|
98
|
+
left: t
|
|
99
|
+
});
|
|
100
|
+
p = n, m({ layout: {
|
|
101
|
+
top: n.top,
|
|
102
|
+
left: n.left,
|
|
103
|
+
width: a
|
|
104
|
+
} });
|
|
105
|
+
},
|
|
106
|
+
dispose: () => {
|
|
107
|
+
b.detach();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
//#endregion
|
|
112
|
+
export { d as createToolPanelController, u as resolveActiveToolPanelTab, l as resolveAvailableToolPanelTabs };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/slotDom.cjs"),t=require("../logic/tooltipGeometry.cjs");var n=`data-ssg-tooltip`,r=`[${n}], [data-ssg-tooltip-overflow]`,i=350,a=800,o=0,s=null,c=null,l=0,u=null,d,f;function p(t){f=e.applySlotToElement(t,d,f)}function m(){if(s!==null)return s;let e=document.createElement(`div`);return e.className=`ssg-tooltip`,e.setAttribute(`aria-hidden`,`true`),f=void 0,p(e),document.body.appendChild(e),s=e,e}function h(){c!==null&&(window.clearTimeout(c),c=null)}function g(){h(),u!==null&&(l=Date.now()+a),u=null,s!==null&&s.classList.remove(`ssg-tooltip--visible`)}function _(e){let r=e.getAttribute(n),i=r!==null&&r!==``?r:(e.textContent??``).trim();if(i===``)return;let a=m();a.classList.toggle(`ssg-theme-dark`,e.closest(`.ssg-theme-dark`)!==null),a.textContent=i,a.style.left=`0px`,a.style.top=`0px`;let o=t.computeTooltipPlacement({targetRect:e.getBoundingClientRect(),tipWidth:a.offsetWidth,tipHeight:a.offsetHeight,viewportWidth:window.innerWidth});a.style.left=`${o.left}px`,a.style.top=`${o.top}px`,a.classList.add(`ssg-tooltip--visible`),u=e}function v(e){let t=e.target;if(!(t instanceof Element))return;let a=t.closest(r);if(a===null||a===u||!a.hasAttribute(n)&&a.scrollWidth<=a.clientWidth+1)return;let o=u!==null;g(),o||Date.now()<l?_(a):c=window.setTimeout(()=>{c=null,_(a)},i)}function y(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(r);if(n===null)return;let i=e.relatedTarget;i instanceof Node&&n.contains(i)||g()}function b(){g()}function x(e){e.key===`Escape`&&g()}function S(){window.addEventListener(`pointerover`,v,!0),window.addEventListener(`pointerout`,y,!0),window.addEventListener(`focusin`,v,!0),window.addEventListener(`focusout`,y,!0),window.addEventListener(`pointerdown`,b,!0),window.addEventListener(`scroll`,b,!0),window.addEventListener(`keydown`,x,!0)}function C(){window.removeEventListener(`pointerover`,v,!0),window.removeEventListener(`pointerout`,y,!0),window.removeEventListener(`focusin`,v,!0),window.removeEventListener(`focusout`,y,!0),window.removeEventListener(`pointerdown`,b,!0),window.removeEventListener(`scroll`,b,!0),window.removeEventListener(`keydown`,x,!0)}function w(e){o+=1,o===1&&S();let t=!1,n=e=>{d=e,s!==null&&p(s)};return n(e),{setSlot:n,dispose:()=>{t||(t=!0,--o,o===0&&(C(),h(),u=null,s!==null&&(s.remove(),s=null)))}}}exports.acquireTooltipController=w;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GridResolvedSlot } from '../model/gridTypes.unbound';
|
|
2
|
+
export type TooltipController = {
|
|
3
|
+
setSlot: (slot: GridResolvedSlot | undefined) => void;
|
|
4
|
+
dispose: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function acquireTooltipController(slot?: GridResolvedSlot): TooltipController;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { applySlotToElement as e } from "../logic/slotDom.js";
|
|
2
|
+
import { computeTooltipPlacement as t } from "../logic/tooltipGeometry.js";
|
|
3
|
+
//#region src/controllers/tooltipController.ts
|
|
4
|
+
var n = "data-ssg-tooltip", r = `[${n}], [data-ssg-tooltip-overflow]`, i = 350, a = 800, o = 0, s = null, c = null, l = 0, u = null, d, f;
|
|
5
|
+
function p(t) {
|
|
6
|
+
f = e(t, d, f);
|
|
7
|
+
}
|
|
8
|
+
function m() {
|
|
9
|
+
if (s !== null) return s;
|
|
10
|
+
let e = document.createElement("div");
|
|
11
|
+
return e.className = "ssg-tooltip", e.setAttribute("aria-hidden", "true"), f = void 0, p(e), document.body.appendChild(e), s = e, e;
|
|
12
|
+
}
|
|
13
|
+
function h() {
|
|
14
|
+
c !== null && (window.clearTimeout(c), c = null);
|
|
15
|
+
}
|
|
16
|
+
function g() {
|
|
17
|
+
h(), u !== null && (l = Date.now() + a), u = null, s !== null && s.classList.remove("ssg-tooltip--visible");
|
|
18
|
+
}
|
|
19
|
+
function _(e) {
|
|
20
|
+
let r = e.getAttribute(n), i = r !== null && r !== "" ? r : (e.textContent ?? "").trim();
|
|
21
|
+
if (i === "") return;
|
|
22
|
+
let a = m();
|
|
23
|
+
a.classList.toggle("ssg-theme-dark", e.closest(".ssg-theme-dark") !== null), a.textContent = i, a.style.left = "0px", a.style.top = "0px";
|
|
24
|
+
let o = t({
|
|
25
|
+
targetRect: e.getBoundingClientRect(),
|
|
26
|
+
tipWidth: a.offsetWidth,
|
|
27
|
+
tipHeight: a.offsetHeight,
|
|
28
|
+
viewportWidth: window.innerWidth
|
|
29
|
+
});
|
|
30
|
+
a.style.left = `${o.left}px`, a.style.top = `${o.top}px`, a.classList.add("ssg-tooltip--visible"), u = e;
|
|
31
|
+
}
|
|
32
|
+
function v(e) {
|
|
33
|
+
let t = e.target;
|
|
34
|
+
if (!(t instanceof Element)) return;
|
|
35
|
+
let a = t.closest(r);
|
|
36
|
+
if (a === null || a === u || !a.hasAttribute(n) && a.scrollWidth <= a.clientWidth + 1) return;
|
|
37
|
+
let o = u !== null;
|
|
38
|
+
g(), o || Date.now() < l ? _(a) : c = window.setTimeout(() => {
|
|
39
|
+
c = null, _(a);
|
|
40
|
+
}, i);
|
|
41
|
+
}
|
|
42
|
+
function y(e) {
|
|
43
|
+
let t = e.target;
|
|
44
|
+
if (!(t instanceof Element)) return;
|
|
45
|
+
let n = t.closest(r);
|
|
46
|
+
if (n === null) return;
|
|
47
|
+
let i = e.relatedTarget;
|
|
48
|
+
i instanceof Node && n.contains(i) || g();
|
|
49
|
+
}
|
|
50
|
+
function b() {
|
|
51
|
+
g();
|
|
52
|
+
}
|
|
53
|
+
function x(e) {
|
|
54
|
+
e.key === "Escape" && g();
|
|
55
|
+
}
|
|
56
|
+
function S() {
|
|
57
|
+
window.addEventListener("pointerover", v, !0), window.addEventListener("pointerout", y, !0), window.addEventListener("focusin", v, !0), window.addEventListener("focusout", y, !0), window.addEventListener("pointerdown", b, !0), window.addEventListener("scroll", b, !0), window.addEventListener("keydown", x, !0);
|
|
58
|
+
}
|
|
59
|
+
function C() {
|
|
60
|
+
window.removeEventListener("pointerover", v, !0), window.removeEventListener("pointerout", y, !0), window.removeEventListener("focusin", v, !0), window.removeEventListener("focusout", y, !0), window.removeEventListener("pointerdown", b, !0), window.removeEventListener("scroll", b, !0), window.removeEventListener("keydown", x, !0);
|
|
61
|
+
}
|
|
62
|
+
function w(e) {
|
|
63
|
+
o += 1, o === 1 && S();
|
|
64
|
+
let t = !1, n = (e) => {
|
|
65
|
+
d = e, s !== null && p(s);
|
|
66
|
+
};
|
|
67
|
+
return n(e), {
|
|
68
|
+
setSlot: n,
|
|
69
|
+
dispose: () => {
|
|
70
|
+
t || (t = !0, --o, o === 0 && (C(), h(), u = null, s !== null && (s.remove(), s = null)));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { w as acquireTooltipController };
|
|
@@ -0,0 +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-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,d=t.clientWidth,f=c,p=l,m=c+r.headerHeight,h=c+u;i<m?f=Math.max(i-r.headerHeight,0):a>h&&(f=Math.max(a-u,0));let g=l+r.leftPaneWidth,_=l+d-r.rightPaneWidth;o<g?p=Math.max(o-r.leftPaneWidth,0):s>_&&(p=Math.max(s-d+r.rightPaneWidth,0)),(f!==c||p!==l)&&t.scrollTo({top:e.logicalToPhysicalScrollTop(f,r.verticalScaleFactor),left:p,behavior:`auto`})},r=(e,t,n)=>e===null||n.some(n=>!Object.is(e[n],t[n])),i=()=>{let e=null,i=null;return{update:a=>{if(r(e,a,[`columnVirtualizer`,`columnMeasurements`])&&a.columnVirtualizer.measure(),r(e,a,[`scrollElement`,`totalScrollWidth`,`physicalBodyHeight`,`headerHeight`])&&a.scrollElement&&t(a.scrollElement,a),r(e,a,[`scrollElement`,`activeCellRect`,`activeCell`,`headerHeight`,`leftPaneWidth`,`rightPaneWidth`,`centerLeadingWidth`,`verticalScaleFactor`])){let e=i,{activeCell:t}=a,r=e!==null&&t!==null&&e.row===t.row&&e.col===t.col;i=t,!r&&a.scrollElement&&a.activeCellRect&&n(a.scrollElement,a.activeCellRect,a)}e=a}}};exports.clampScrollToContent=t,exports.createViewportSyncController=i,exports.scrollCellIntoView=n;
|