@lavalogic/scoria 0.37.44 → 0.37.45
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/README.md +58 -58
- package/dist/Components/AccordionGroup.svelte +46 -46
- package/dist/Components/AccordionGroupButton.svelte +76 -76
- package/dist/Components/Action.svelte +136 -136
- package/dist/Components/ActionProps.d.ts +2 -6
- package/dist/Components/AlertModal.svelte +195 -183
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +702 -702
- package/dist/Components/Base/BaseModal.svelte +125 -125
- package/dist/Components/Base/ContextWrapper.svelte +72 -72
- package/dist/Components/Base/Pagination.svelte +198 -198
- package/dist/Components/Base/Snippets.svelte +36 -36
- package/dist/Components/BigRadioSet.svelte +38 -38
- package/dist/Components/Bubble.svelte +101 -101
- package/dist/Components/Button.svelte +209 -209
- package/dist/Components/ButtonProps.d.ts +2 -6
- package/dist/Components/Checkbox.svelte +86 -86
- package/dist/Components/CollapsibleCard.svelte +78 -78
- package/dist/Components/Contexts/ContextMenu.svelte +164 -164
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
- package/dist/Components/Contexts/ContextMenuOption.svelte +60 -60
- package/dist/Components/Contexts/Toast.svelte +83 -83
- package/dist/Components/Contexts/ToastContainer.svelte +65 -65
- package/dist/Components/Contexts/Tooltip.svelte +37 -37
- package/dist/Components/DataMatrixIcon.svelte +112 -112
- package/dist/Components/DataMatrixIconProps.d.ts +3 -13
- package/dist/Components/DateInput.svelte +148 -148
- package/dist/Components/DatePicker.svelte +300 -300
- package/dist/Components/DesktopModal.svelte +90 -90
- package/dist/Components/Dial.svelte +204 -204
- package/dist/Components/DialProps.d.ts +1 -18
- package/dist/Components/DimensionInput.svelte +170 -170
- package/dist/Components/DragMenu/DragMenuHolder.svelte +119 -119
- package/dist/Components/DragMenu/DraggableCard.svelte +77 -77
- package/dist/Components/FileCard.svelte +24 -24
- package/dist/Components/FileUpload.svelte +236 -236
- package/dist/Components/GridInput.svelte +196 -200
- package/dist/Components/GridInputSet.svelte +29 -29
- package/dist/Components/HorizontalTabGroup.svelte +82 -82
- package/dist/Components/HorizontalTabGroupButton.svelte +44 -44
- package/dist/Components/Icon.svelte +128 -128
- package/dist/Components/IconProps.d.ts +2 -7
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/LoadingAnimation.svelte +29 -29
- package/dist/Components/LoadingModal.svelte +45 -45
- package/dist/Components/LoadingOverlay.svelte +25 -25
- package/dist/Components/LoadingOverlayProps.d.ts +3 -7
- package/dist/Components/Modal.svelte +258 -258
- package/dist/Components/ModalProps.d.ts +0 -3
- package/dist/Components/MultiSelect.svelte +220 -220
- package/dist/Components/MultiSelectCommonProps.d.ts +6 -17
- package/dist/Components/Nav/Nav.svelte +99 -99
- package/dist/Components/Nav/NavProps.d.ts +4 -11
- package/dist/Components/Nav/NavServiceMenuList.svelte +43 -43
- package/dist/Components/Nav/NavTab.svelte +62 -62
- package/dist/Components/Nav/ServiceMenuItem.svelte +100 -100
- package/dist/Components/Nav/ServicesNav.svelte +80 -80
- package/dist/Components/NumberInput.svelte +157 -157
- package/dist/Components/PageHeading.svelte +25 -25
- package/dist/Components/PasswordInput.svelte +88 -88
- package/dist/Components/Portal.svelte +36 -36
- package/dist/Components/ProgressBubble.svelte +107 -108
- package/dist/Components/ProgressBubbleProps.d.ts +3 -3
- package/dist/Components/QuerySelect.svelte +366 -366
- package/dist/Components/QuerySelectProps.d.ts +4 -14
- package/dist/Components/SingleSelect.svelte +250 -250
- package/dist/Components/SingleSelectCommonProps.d.ts +3 -19
- package/dist/Components/StepButton.svelte +70 -70
- package/dist/Components/StepForm.svelte +140 -140
- package/dist/Components/Switch.svelte +69 -69
- package/dist/Components/Table/ARCHITECTURE.md +298 -0
- package/dist/Components/Table/Body/QuickSearchCell.svelte +679 -694
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +51 -51
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +59 -59
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +456 -478
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +79 -79
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +185 -188
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +124 -124
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +120 -120
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +230 -230
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +105 -105
- package/dist/Components/Table/Body/Rows/Columns/SelectColumn.d.ts +12 -9
- package/dist/Components/Table/Body/Rows/Columns/SelectTableCell.d.ts +5 -5
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +87 -87
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +126 -126
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +159 -159
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +246 -246
- package/dist/Components/Table/Body/Rows/Columns/TableDatePickerProps.d.ts +4 -4
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +216 -216
- package/dist/Components/Table/Body/Rows/Columns/TableQueryCell.d.ts +6 -5
- package/dist/Components/Table/Body/Rows/Columns/TableQueryColumn.d.ts +7 -6
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +252 -257
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +179 -179
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +221 -229
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte.d.ts +11 -11
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +197 -197
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +190 -190
- package/dist/Components/Table/Body/Rows/TableRow.svelte +290 -290
- package/dist/Components/Table/Body/TableBody.svelte +155 -155
- package/dist/Components/Table/ColumnDefinitions/ExampleItemColumnDefRepository.svelte.js +2 -3
- package/dist/Components/Table/ColumnFactory.svelte.d.ts +9 -11
- package/dist/Components/Table/ColumnFactory.svelte.js +101 -118
- package/dist/Components/Table/ColumnKindRegistry.d.ts +112 -0
- package/dist/Components/Table/ColumnKindRegistry.js +63 -0
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +41 -41
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +30 -30
- package/dist/Components/Table/Headers/TableHead.svelte +415 -413
- package/dist/Components/Table/Misc/ColumnPanel.svelte +94 -94
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +112 -112
- package/dist/Components/Table/Misc/FilterInput.svelte +620 -644
- package/dist/Components/Table/Misc/FilterInput.svelte.d.ts +12 -12
- package/dist/Components/Table/Misc/FilterInputProps.d.ts +2 -2
- package/dist/Components/Table/Misc/FilterPanel.svelte +257 -257
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +30 -30
- package/dist/Components/Table/Misc/SidePanel.svelte +35 -35
- package/dist/Components/Table/Misc/TableFooter.svelte +311 -311
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +125 -125
- package/dist/Components/Table/Misc/TableSidebar.svelte +157 -157
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +100 -100
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +107 -107
- package/dist/Components/Table/NestedTable.svelte +130 -133
- package/dist/Components/Table/SubApis.svelte.d.ts +1 -5
- package/dist/Components/Table/SubApis.svelte.js +33 -32
- package/dist/Components/Table/Table.svelte +692 -745
- package/dist/Components/Table/TableHelpers.svelte.d.ts +6 -19
- package/dist/Components/Table/TableHelpers.svelte.js +6 -14
- package/dist/Components/Table/Types/Columns/Column.d.ts +2 -2
- package/dist/Components/Table/Types/Columns/DateColumn.d.ts +3 -3
- package/dist/Components/Table/Types/Columns/DateTableCell.d.ts +7 -7
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/AccessorDef.svelte.d.ts +7 -8
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/AccessorDef.svelte.js +4 -5
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.d.ts +11 -14
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/CheckboxDef.svelte.js +3 -4
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/DateInputDef.svelte.d.ts +7 -11
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/DateInputDef.svelte.js +3 -3
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/NumberInputDef.svelte.d.ts +13 -18
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/NumberInputDef.svelte.js +4 -5
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.d.ts +5 -5
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.js +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.d.ts +15 -12
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.js +4 -5
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/TextInputDef.svelte.d.ts +8 -12
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/TextInputDef.svelte.js +3 -3
- package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.d.ts +6 -6
- package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.js +3 -3
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +49 -16
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js +27 -5
- package/dist/Components/Table/Types/Columns/Definitions/Display/AbstractDisplayDef.svelte.d.ts +7 -7
- package/dist/Components/Table/Types/Columns/Definitions/Display/AbstractDisplayDef.svelte.js +4 -4
- package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.d.ts +5 -5
- package/dist/Components/Table/Types/Columns/Definitions/Display/BubbleDef.svelte.js +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.d.ts +5 -5
- package/dist/Components/Table/Types/Columns/Definitions/Display/DisplayDef.svelte.js +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.d.ts +5 -5
- package/dist/Components/Table/Types/Columns/Definitions/Display/ProgressBarDef.svelte.js +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.d.ts +5 -5
- package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.js +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.d.ts +11 -19
- package/dist/Components/Table/Types/Columns/Definitions/Expand/ExpandDef.svelte.js +4 -8
- package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.d.ts +6 -7
- package/dist/Components/Table/Types/Columns/Definitions/FilterOnly/FilterOnlyDef.svelte.js +3 -4
- package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.d.ts +9 -9
- package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.js +4 -4
- package/dist/Components/Table/Types/Columns/ExpandTableCell.d.ts +5 -5
- package/dist/Components/Table/Types/Columns/ProgressBarTableCell.d.ts +6 -6
- package/dist/Components/Table/Types/Columns/TableCell.d.ts +7 -6
- package/dist/Components/Table/Types/Context/ClipboardState.svelte.d.ts +98 -0
- package/dist/Components/Table/Types/Context/ClipboardState.svelte.js +290 -0
- package/dist/Components/Table/Types/Context/ColumnLayoutState.svelte.d.ts +17 -45
- package/dist/Components/Table/Types/Context/ColumnLayoutState.svelte.js +17 -45
- package/dist/Components/Table/Types/Context/FilteringState.svelte.d.ts +9 -20
- package/dist/Components/Table/Types/Context/FilteringState.svelte.js +9 -20
- package/dist/Components/Table/Types/Context/FocusState.svelte.d.ts +23 -42
- package/dist/Components/Table/Types/Context/FocusState.svelte.js +32 -59
- package/dist/Components/Table/Types/Context/ITable.d.ts +5 -8
- package/dist/Components/Table/Types/Context/PreferencesState.svelte.d.ts +29 -56
- package/dist/Components/Table/Types/Context/PreferencesState.svelte.js +28 -55
- package/dist/Components/Table/Types/Context/QueryValuesState.svelte.d.ts +50 -0
- package/dist/Components/Table/Types/Context/QueryValuesState.svelte.js +62 -0
- package/dist/Components/Table/Types/Context/SelectionState.svelte.d.ts +17 -28
- package/dist/Components/Table/Types/Context/SelectionState.svelte.js +17 -28
- package/dist/Components/Table/Types/Context/SortingState.svelte.d.ts +15 -29
- package/dist/Components/Table/Types/Context/SortingState.svelte.js +17 -31
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +212 -325
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +292 -706
- package/dist/Components/Table/Types/Context/VirtualisationState.svelte.d.ts +62 -79
- package/dist/Components/Table/Types/Context/VirtualisationState.svelte.js +54 -73
- package/dist/Components/Table/Types/DataRepository/BuiltInRemoteRepository.svelte.d.ts +16 -27
- package/dist/Components/Table/Types/DataRepository/BuiltInRemoteRepository.svelte.js +16 -27
- package/dist/Components/Table/Types/DataRepository/IDataRepository.d.ts +12 -15
- package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.d.ts +15 -30
- package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.js +16 -28
- package/dist/Components/Table/Types/Header.d.ts +4 -4
- package/dist/Components/Table/Types/HeaderGroup.d.ts +5 -5
- package/dist/Components/Table/Types/Public/index.d.ts +2 -4
- package/dist/Components/Table/Types/Public/index.js +2 -4
- package/dist/Components/Table/clipboardEscape.d.ts +32 -0
- package/dist/Components/Table/clipboardEscape.js +45 -0
- package/dist/Components/Table/createTable.svelte.d.ts +8 -18
- package/dist/Components/Table/createTable.svelte.js +19 -47
- package/dist/Components/Test/TestContextConsumer.svelte +13 -13
- package/dist/Components/TextArea.svelte +130 -130
- package/dist/Components/TextInput.svelte +176 -176
- package/dist/Components/ThreeStateRadio.svelte +131 -131
- package/dist/Components/Touch/BoolCard.svelte +45 -45
- package/dist/Components/Touch/DateModal.svelte +209 -209
- package/dist/Components/Touch/EditCard.svelte +59 -59
- package/dist/Components/Touch/InfoCard.svelte +31 -31
- package/dist/Components/Touch/InfoTextCard.svelte +28 -28
- package/dist/Components/Touch/ModalExplanation.svelte +17 -17
- package/dist/Components/Touch/NumberKeyboard.svelte +225 -225
- package/dist/Components/Touch/NumberModal.svelte +79 -79
- package/dist/Components/Touch/PlusMinusCard.svelte +46 -46
- package/dist/Components/Touch/SelectModal.svelte +123 -123
- package/dist/Components/Touch/SummaryCard.svelte +93 -93
- package/dist/Components/Touch/TextAreaModal.svelte +95 -95
- package/dist/Components/Touch/TextModal.svelte +106 -106
- package/dist/Components/Touch/TouchCard.svelte +33 -33
- package/dist/Components/Touch/TouchModal.svelte +274 -274
- package/dist/Components/Touch/UtilityButton.svelte +109 -109
- package/dist/Components/VerticalTabGroup.svelte +79 -79
- package/dist/Components/VerticalTabGroupButton.svelte +58 -58
- package/dist/Contexts/ToastContext.svelte.js +3 -4
- package/dist/Helpers/Datamatrix.d.ts +19 -19
- package/dist/Helpers/Datamatrix.js +291 -291
- package/dist/Helpers/Helpers.svelte.d.ts +2 -4
- package/dist/Helpers/Helpers.svelte.js +2 -4
- package/dist/Helpers/dropdownPortal.d.ts +26 -41
- package/dist/Helpers/dropdownPortal.js +62 -116
- package/dist/Types/Examples/ExampleModal.svelte +35 -35
- package/dist/index.d.ts +0 -1
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +134 -134
- package/dist/scss/_mixins.scss +3348 -3360
- package/dist/scss/_motion.scss +57 -57
- package/dist/scss/_sizing.scss +85 -85
- package/dist/scss/_transitions.scss +8 -8
- package/package.json +2 -1
|
@@ -1,76 +1,63 @@
|
|
|
1
1
|
import type { Row } from './Row.js';
|
|
2
2
|
/**
|
|
3
3
|
* Dependency surface that `VirtualisationState` reads from the
|
|
4
|
-
* surrounding `TableContext`.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* other Phase 6 sub-contexts.
|
|
4
|
+
* surrounding `TableContext`. Each dependency is a thunk so the
|
|
5
|
+
* sub-context never holds a direct reference to the parent; reactivity
|
|
6
|
+
* threads through `$derived`.
|
|
8
7
|
*/
|
|
9
8
|
export interface VirtualisationStateDeps<T extends object> {
|
|
10
|
-
/**
|
|
11
|
-
* `paginationRowModel.rows`
|
|
9
|
+
/** Full, ordered row list currently in scope
|
|
10
|
+
* (`paginationRowModel.rows` from `TableContext`). */
|
|
12
11
|
getRows: () => ReadonlyArray<Row<T>>;
|
|
13
|
-
/** Per-row height lookup.
|
|
14
|
-
* `_columnLayout` row-height pool
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* estimated-row-height fallback is used. */
|
|
12
|
+
/** Per-row height lookup. Reads the largest observed height across
|
|
13
|
+
* sides from the `_columnLayout` row-height pool. Returning
|
|
14
|
+
* `undefined` or 0 means "not observed yet" and the estimated
|
|
15
|
+
* row-height fallback is used. */
|
|
18
16
|
getRowHeight: (rowId: string) => number | undefined;
|
|
19
|
-
/** Estimated row height
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* any row has been observed. */
|
|
17
|
+
/** Estimated row height when no observation is available yet.
|
|
18
|
+
* Defaults to 48 (the `--height: 3rem` baseline); compact tables
|
|
19
|
+
* pass a smaller estimate so `totalHeight` is in the right
|
|
20
|
+
* ballpark before any row is observed. */
|
|
24
21
|
getEstimatedRowHeight: () => number;
|
|
25
22
|
}
|
|
26
23
|
/**
|
|
27
|
-
*
|
|
28
|
-
* `_virtualisationThreshold` (default 100) only
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* rendered directly, matching the legacy behaviour.
|
|
24
|
+
* Row virtualisation. When the row count exceeds
|
|
25
|
+
* `_virtualisationThreshold` (default 100), only viewport rows plus a
|
|
26
|
+
* small overscan band above and below are rendered; the remaining body
|
|
27
|
+
* height is reserved by two spacer `<tr>` rows in `TableBody.svelte`.
|
|
28
|
+
* Below threshold every row is rendered directly.
|
|
33
29
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* specific concerns the column-layout code does not need;
|
|
40
|
-
* - the heights map on `_columnLayout` is keyed by `(side, rowId)`
|
|
41
|
-
* while virtualisation only ever wants the max across sides
|
|
42
|
-
* (which determines the row's slot height);
|
|
30
|
+
* Owns its own sub-context (rather than living on `_columnLayout`)
|
|
31
|
+
* because:
|
|
32
|
+
* - threshold + overscan + scroll position are virtualisation-only;
|
|
33
|
+
* - `_columnLayout`'s height map is keyed by `(side, rowId)` whereas
|
|
34
|
+
* virtualisation needs the max across sides (the row's slot height);
|
|
43
35
|
* - the `visibleRange` / `visibleRows` derived chain is read by all
|
|
44
|
-
* three `TableBody` instances
|
|
45
|
-
*
|
|
36
|
+
* three `TableBody` instances and keeping it separate avoids growing
|
|
37
|
+
* `_columnLayout` into a god-object.
|
|
46
38
|
*
|
|
47
|
-
* Scroll synchronisation: the three side `<table>` elements
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* `.
|
|
52
|
-
* `clientHeight` via `registerScrollPosition`.
|
|
39
|
+
* Scroll synchronisation: the three side `<table>` elements share the
|
|
40
|
+
* same `.datatable` overflow container, so vertical scrolling is
|
|
41
|
+
* already shared. ONE scroll listener (attached in `Table.svelte` on
|
|
42
|
+
* the outer `.datatable`) reports `scrollTop` and `clientHeight` via
|
|
43
|
+
* `registerScrollPosition`.
|
|
53
44
|
*
|
|
54
|
-
*
|
|
55
|
-
* `row.id` (the visible index as a string assigned by
|
|
45
|
+
* Keying: rows are keyed by `row.id` (the visible index assigned by
|
|
56
46
|
* `paginationRowModel`), so `{#each visibleRows as { row } (row.id)}`
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* not by index or `row.id`, so virtualisation is transparent to it.
|
|
47
|
+
* keeps Svelte's diffing intact. `_selection._keyCache` is keyed by
|
|
48
|
+
* `row.original`, so virtualisation is transparent to it.
|
|
60
49
|
*/
|
|
61
50
|
export declare class VirtualisationState<T extends object> {
|
|
62
51
|
private readonly _deps;
|
|
63
52
|
private readonly _virtualisationThreshold;
|
|
64
53
|
private readonly _overscan;
|
|
65
54
|
/** Latest scroll position reported by the host. 0 by default so the
|
|
66
|
-
* first paint (before any scroll event) shows the top of the
|
|
67
|
-
* list. */
|
|
55
|
+
* first paint (before any scroll event) shows the top of the list. */
|
|
68
56
|
private _scrollTop;
|
|
69
|
-
/** Latest viewport height reported by the host.
|
|
70
|
-
*
|
|
71
|
-
* against
|
|
72
|
-
*
|
|
73
|
-
* smaller. */
|
|
57
|
+
/** Latest viewport height reported by the host. 600 is a sensible
|
|
58
|
+
* pre-measurement fallback so virtualisation has something to clip
|
|
59
|
+
* against; overscan keeps the initial paint reasonable when the
|
|
60
|
+
* real height is smaller. */
|
|
74
61
|
private _viewportHeight;
|
|
75
62
|
constructor(deps: VirtualisationStateDeps<T>, options?: {
|
|
76
63
|
threshold?: number;
|
|
@@ -81,11 +68,11 @@ export declare class VirtualisationState<T extends object> {
|
|
|
81
68
|
get scrollTop(): number;
|
|
82
69
|
get viewportHeight(): number;
|
|
83
70
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
71
|
+
* True when the current row count is above the virtualisation
|
|
72
|
+
* threshold. Below threshold the public API still works
|
|
73
|
+
* (`visibleRows` returns every row, padding spacers are 0), but
|
|
74
|
+
* consumers can short-circuit virtualisation-only DOM work by
|
|
75
|
+
* reading this flag.
|
|
89
76
|
*/
|
|
90
77
|
readonly isVirtualised: boolean;
|
|
91
78
|
/**
|
|
@@ -96,26 +83,23 @@ export declare class VirtualisationState<T extends object> {
|
|
|
96
83
|
*/
|
|
97
84
|
private _resolveHeight;
|
|
98
85
|
/**
|
|
99
|
-
* Sum of all row heights.
|
|
100
|
-
*
|
|
86
|
+
* Sum of all row heights. The body container reserves this height
|
|
87
|
+
* so the scrollbar matches the un-virtualised height.
|
|
101
88
|
*
|
|
102
|
-
* Below threshold the value is still correct
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* threshold - the natural row flow does the right thing.
|
|
89
|
+
* Below threshold the value is still correct, but consumers should
|
|
90
|
+
* generally not apply it as `min-height` - the natural row flow is
|
|
91
|
+
* fine and forcing the min-height fights against zero-row layout.
|
|
106
92
|
*/
|
|
107
93
|
readonly totalHeight: number;
|
|
108
94
|
/**
|
|
109
|
-
* Half-open `[start, end)` row-index range
|
|
110
|
-
*
|
|
111
|
-
* `[
|
|
112
|
-
*
|
|
113
|
-
* `_overscan` rows above and below.
|
|
95
|
+
* Half-open `[start, end)` row-index range to render. Below threshold
|
|
96
|
+
* this is the full `[0, rows.length)`. Above threshold it is the
|
|
97
|
+
* slice covering `[scrollTop, scrollTop + viewportHeight]` widened
|
|
98
|
+
* by `_overscan` rows on each side.
|
|
114
99
|
*
|
|
115
|
-
* The
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* well under a millisecond.
|
|
100
|
+
* The O(N) walk re-runs only when `_scrollTop`, `_viewportHeight`,
|
|
101
|
+
* the rows array, or a relevant row height changes; well under a
|
|
102
|
+
* millisecond for N up to a few thousand.
|
|
119
103
|
*/
|
|
120
104
|
readonly visibleRange: {
|
|
121
105
|
start: number;
|
|
@@ -153,15 +137,14 @@ export declare class VirtualisationState<T extends object> {
|
|
|
153
137
|
*/
|
|
154
138
|
readonly bottomSpacerHeight: number;
|
|
155
139
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* `.datatable` container; the three side TableBody instances
|
|
159
|
-
*
|
|
160
|
-
* extra plumbing.
|
|
140
|
+
* Report the current scroll position and viewport height. Called by
|
|
141
|
+
* `Table.svelte` from a single scroll listener on the outer
|
|
142
|
+
* `.datatable` container; the three side TableBody instances read
|
|
143
|
+
* the resulting `visibleRows` and stay in sync.
|
|
161
144
|
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
145
|
+
* Early-exits when neither value changed so identical back-to-back
|
|
146
|
+
* scroll events (common on macOS rubber-band) do not re-trigger the
|
|
147
|
+
* derived chain.
|
|
165
148
|
*/
|
|
166
149
|
readonly registerScrollPosition: (scrollTop: number, viewportHeight: number) => void;
|
|
167
150
|
}
|
|
@@ -1,65 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `_virtualisationThreshold` (default 100) only
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* rendered directly, matching the legacy behaviour.
|
|
2
|
+
* Row virtualisation. When the row count exceeds
|
|
3
|
+
* `_virtualisationThreshold` (default 100), only viewport rows plus a
|
|
4
|
+
* small overscan band above and below are rendered; the remaining body
|
|
5
|
+
* height is reserved by two spacer `<tr>` rows in `TableBody.svelte`.
|
|
6
|
+
* Below threshold every row is rendered directly.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* specific concerns the column-layout code does not need;
|
|
15
|
-
* - the heights map on `_columnLayout` is keyed by `(side, rowId)`
|
|
16
|
-
* while virtualisation only ever wants the max across sides
|
|
17
|
-
* (which determines the row's slot height);
|
|
8
|
+
* Owns its own sub-context (rather than living on `_columnLayout`)
|
|
9
|
+
* because:
|
|
10
|
+
* - threshold + overscan + scroll position are virtualisation-only;
|
|
11
|
+
* - `_columnLayout`'s height map is keyed by `(side, rowId)` whereas
|
|
12
|
+
* virtualisation needs the max across sides (the row's slot height);
|
|
18
13
|
* - the `visibleRange` / `visibleRows` derived chain is read by all
|
|
19
|
-
* three `TableBody` instances
|
|
20
|
-
*
|
|
14
|
+
* three `TableBody` instances and keeping it separate avoids growing
|
|
15
|
+
* `_columnLayout` into a god-object.
|
|
21
16
|
*
|
|
22
|
-
* Scroll synchronisation: the three side `<table>` elements
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* `.
|
|
27
|
-
* `clientHeight` via `registerScrollPosition`.
|
|
17
|
+
* Scroll synchronisation: the three side `<table>` elements share the
|
|
18
|
+
* same `.datatable` overflow container, so vertical scrolling is
|
|
19
|
+
* already shared. ONE scroll listener (attached in `Table.svelte` on
|
|
20
|
+
* the outer `.datatable`) reports `scrollTop` and `clientHeight` via
|
|
21
|
+
* `registerScrollPosition`.
|
|
28
22
|
*
|
|
29
|
-
*
|
|
30
|
-
* `row.id` (the visible index as a string assigned by
|
|
23
|
+
* Keying: rows are keyed by `row.id` (the visible index assigned by
|
|
31
24
|
* `paginationRowModel`), so `{#each visibleRows as { row } (row.id)}`
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* not by index or `row.id`, so virtualisation is transparent to it.
|
|
25
|
+
* keeps Svelte's diffing intact. `_selection._keyCache` is keyed by
|
|
26
|
+
* `row.original`, so virtualisation is transparent to it.
|
|
35
27
|
*/
|
|
36
28
|
export class VirtualisationState {
|
|
37
29
|
_deps;
|
|
38
30
|
_virtualisationThreshold;
|
|
39
31
|
_overscan;
|
|
40
32
|
/** Latest scroll position reported by the host. 0 by default so the
|
|
41
|
-
* first paint (before any scroll event) shows the top of the
|
|
42
|
-
* list. */
|
|
33
|
+
* first paint (before any scroll event) shows the top of the list. */
|
|
43
34
|
_scrollTop = $state(0);
|
|
44
|
-
/** Latest viewport height reported by the host.
|
|
45
|
-
*
|
|
46
|
-
* against
|
|
47
|
-
*
|
|
48
|
-
* smaller. */
|
|
35
|
+
/** Latest viewport height reported by the host. 600 is a sensible
|
|
36
|
+
* pre-measurement fallback so virtualisation has something to clip
|
|
37
|
+
* against; overscan keeps the initial paint reasonable when the
|
|
38
|
+
* real height is smaller. */
|
|
49
39
|
_viewportHeight = $state(600);
|
|
50
40
|
constructor(deps, options = {}) {
|
|
51
41
|
this._deps = deps;
|
|
52
42
|
this._virtualisationThreshold = options.threshold ?? 100;
|
|
53
|
-
// Overscan
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
// the `$derived` chain reschedules and re-renders the visible
|
|
59
|
-
// slice. 30 rows is enough to absorb a typical wheel flick at
|
|
60
|
-
// 60Hz while still keeping the rendered cell count bounded
|
|
61
|
-
// (~52 rows for a 600px viewport at the default 28-48px row
|
|
62
|
-
// height: 12 visible + 30 below + 10 above = 52).
|
|
43
|
+
// Overscan rows above and below the viewport stay rendered so a
|
|
44
|
+
// fast wheel-scroll does not surface an empty grey band before
|
|
45
|
+
// the next paint. 30 rows is enough to absorb a typical 60Hz
|
|
46
|
+
// wheel flick while keeping the rendered cell count bounded
|
|
47
|
+
// (~52 rows for a 600px viewport at default row heights).
|
|
63
48
|
this._overscan = options.overscan ?? 30;
|
|
64
49
|
}
|
|
65
50
|
get virtualisationThreshold() {
|
|
@@ -75,11 +60,11 @@ export class VirtualisationState {
|
|
|
75
60
|
return this._viewportHeight;
|
|
76
61
|
}
|
|
77
62
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
63
|
+
* True when the current row count is above the virtualisation
|
|
64
|
+
* threshold. Below threshold the public API still works
|
|
65
|
+
* (`visibleRows` returns every row, padding spacers are 0), but
|
|
66
|
+
* consumers can short-circuit virtualisation-only DOM work by
|
|
67
|
+
* reading this flag.
|
|
83
68
|
*/
|
|
84
69
|
isVirtualised = $derived.by(() => this._deps.getRows().length > this._virtualisationThreshold);
|
|
85
70
|
/**
|
|
@@ -96,13 +81,12 @@ export class VirtualisationState {
|
|
|
96
81
|
return this._deps.getEstimatedRowHeight();
|
|
97
82
|
}
|
|
98
83
|
/**
|
|
99
|
-
* Sum of all row heights.
|
|
100
|
-
*
|
|
84
|
+
* Sum of all row heights. The body container reserves this height
|
|
85
|
+
* so the scrollbar matches the un-virtualised height.
|
|
101
86
|
*
|
|
102
|
-
* Below threshold the value is still correct
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* threshold - the natural row flow does the right thing.
|
|
87
|
+
* Below threshold the value is still correct, but consumers should
|
|
88
|
+
* generally not apply it as `min-height` - the natural row flow is
|
|
89
|
+
* fine and forcing the min-height fights against zero-row layout.
|
|
106
90
|
*/
|
|
107
91
|
totalHeight = $derived.by(() => {
|
|
108
92
|
const rows = this._deps.getRows();
|
|
@@ -113,16 +97,14 @@ export class VirtualisationState {
|
|
|
113
97
|
return total;
|
|
114
98
|
});
|
|
115
99
|
/**
|
|
116
|
-
* Half-open `[start, end)` row-index range
|
|
117
|
-
*
|
|
118
|
-
* `[
|
|
119
|
-
*
|
|
120
|
-
* `_overscan` rows above and below.
|
|
100
|
+
* Half-open `[start, end)` row-index range to render. Below threshold
|
|
101
|
+
* this is the full `[0, rows.length)`. Above threshold it is the
|
|
102
|
+
* slice covering `[scrollTop, scrollTop + viewportHeight]` widened
|
|
103
|
+
* by `_overscan` rows on each side.
|
|
121
104
|
*
|
|
122
|
-
* The
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* well under a millisecond.
|
|
105
|
+
* The O(N) walk re-runs only when `_scrollTop`, `_viewportHeight`,
|
|
106
|
+
* the rows array, or a relevant row height changes; well under a
|
|
107
|
+
* millisecond for N up to a few thousand.
|
|
126
108
|
*/
|
|
127
109
|
visibleRange = $derived.by(() => {
|
|
128
110
|
const rows = this._deps.getRows();
|
|
@@ -216,15 +198,14 @@ export class VirtualisationState {
|
|
|
216
198
|
return total;
|
|
217
199
|
});
|
|
218
200
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* `.datatable` container; the three side TableBody instances
|
|
222
|
-
*
|
|
223
|
-
* extra plumbing.
|
|
201
|
+
* Report the current scroll position and viewport height. Called by
|
|
202
|
+
* `Table.svelte` from a single scroll listener on the outer
|
|
203
|
+
* `.datatable` container; the three side TableBody instances read
|
|
204
|
+
* the resulting `visibleRows` and stay in sync.
|
|
224
205
|
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
206
|
+
* Early-exits when neither value changed so identical back-to-back
|
|
207
|
+
* scroll events (common on macOS rubber-band) do not re-trigger the
|
|
208
|
+
* derived chain.
|
|
228
209
|
*/
|
|
229
210
|
registerScrollPosition = (scrollTop, viewportHeight) => {
|
|
230
211
|
if (scrollTop === this._scrollTop && viewportHeight === this._viewportHeight) {
|
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Built-in remote data repository used by
|
|
2
|
+
* Built-in remote data repository used by
|
|
3
|
+
* `createTable({ rows: { kind: 'remote' } })`. Owns URL construction,
|
|
4
|
+
* filter encoding, pagination, sort, debouncing, and page-size
|
|
5
|
+
* persistence so consumers do not have to reimplement them.
|
|
3
6
|
*
|
|
4
|
-
*
|
|
5
|
-
* filter
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* The default filter-encoding strategy is `'query-string'`, producing
|
|
8
|
+
* `?filter[<id>]=<value>&page=<n>&pageSize=<m>&sort=<col>&direction=<asc|desc>`.
|
|
9
|
+
* Pass a custom `filterEncoding: { encode }` for backends that expect a
|
|
10
|
+
* different shape, or drop to `kind: 'custom'` for full control.
|
|
8
11
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `filterEncoding: { encode }` function. Consumers needing complete
|
|
13
|
-
* control over the request lifecycle drop to `kind: 'custom'`, which
|
|
14
|
-
* bypasses this repository entirely.
|
|
15
|
-
*
|
|
16
|
-
* The repository extends `TableDataRepository` for its pagination-state /
|
|
17
|
-
* filter-modes / force-refresh plumbing and implements
|
|
18
|
-
* `IRemoteDataRepository<TRow>` for the surface `TableContext` consumes.
|
|
12
|
+
* Extends `TableDataRepository` for pagination / filter-modes /
|
|
13
|
+
* force-refresh plumbing and implements `IRemoteDataRepository<TRow>`
|
|
14
|
+
* for the surface `TableContext` consumes.
|
|
19
15
|
*
|
|
20
16
|
* @remarks
|
|
21
17
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* needing the rich encoding the FloWMS repo currently does should pass
|
|
28
|
-
* a custom encoder in Phase 1 and we will lift the common encodings
|
|
29
|
-
* into the library in Phase 2 once the audit of the consumer's actual
|
|
30
|
-
* backend shape is complete.
|
|
31
|
-
* - The five filter callbacks (`dateFilter` / `numberFilter` / etc.).
|
|
32
|
-
* These are local-only and not meaningful for a remote source. The
|
|
33
|
-
* interface inherits them as optional; left undefined here.
|
|
18
|
+
* The default encoder emits raw `?filter[<id>]=<JSON-encoded-value>` and
|
|
19
|
+
* does NOT cover rich filter modes (`StringFilterMode.NotIn`, `[min,max]`
|
|
20
|
+
* range tuples, etc.); pass a custom encoder if the backend needs them.
|
|
21
|
+
* The five local-only filter callbacks (`dateFilter` / `numberFilter` /
|
|
22
|
+
* etc.) are inherited as optional and left undefined here.
|
|
34
23
|
*/
|
|
35
24
|
import type { ColumnFiltersState } from '../Filtering/ColumnFiltersState.js';
|
|
36
25
|
import type { FilterMode } from '../Filtering/FilterMode.js';
|
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Built-in remote data repository used by
|
|
2
|
+
* Built-in remote data repository used by
|
|
3
|
+
* `createTable({ rows: { kind: 'remote' } })`. Owns URL construction,
|
|
4
|
+
* filter encoding, pagination, sort, debouncing, and page-size
|
|
5
|
+
* persistence so consumers do not have to reimplement them.
|
|
3
6
|
*
|
|
4
|
-
*
|
|
5
|
-
* filter
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* The default filter-encoding strategy is `'query-string'`, producing
|
|
8
|
+
* `?filter[<id>]=<value>&page=<n>&pageSize=<m>&sort=<col>&direction=<asc|desc>`.
|
|
9
|
+
* Pass a custom `filterEncoding: { encode }` for backends that expect a
|
|
10
|
+
* different shape, or drop to `kind: 'custom'` for full control.
|
|
8
11
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `filterEncoding: { encode }` function. Consumers needing complete
|
|
13
|
-
* control over the request lifecycle drop to `kind: 'custom'`, which
|
|
14
|
-
* bypasses this repository entirely.
|
|
15
|
-
*
|
|
16
|
-
* The repository extends `TableDataRepository` for its pagination-state /
|
|
17
|
-
* filter-modes / force-refresh plumbing and implements
|
|
18
|
-
* `IRemoteDataRepository<TRow>` for the surface `TableContext` consumes.
|
|
12
|
+
* Extends `TableDataRepository` for pagination / filter-modes /
|
|
13
|
+
* force-refresh plumbing and implements `IRemoteDataRepository<TRow>`
|
|
14
|
+
* for the surface `TableContext` consumes.
|
|
19
15
|
*
|
|
20
16
|
* @remarks
|
|
21
17
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* needing the rich encoding the FloWMS repo currently does should pass
|
|
28
|
-
* a custom encoder in Phase 1 and we will lift the common encodings
|
|
29
|
-
* into the library in Phase 2 once the audit of the consumer's actual
|
|
30
|
-
* backend shape is complete.
|
|
31
|
-
* - The five filter callbacks (`dateFilter` / `numberFilter` / etc.).
|
|
32
|
-
* These are local-only and not meaningful for a remote source. The
|
|
33
|
-
* interface inherits them as optional; left undefined here.
|
|
18
|
+
* The default encoder emits raw `?filter[<id>]=<JSON-encoded-value>` and
|
|
19
|
+
* does NOT cover rich filter modes (`StringFilterMode.NotIn`, `[min,max]`
|
|
20
|
+
* range tuples, etc.); pass a custom encoder if the backend needs them.
|
|
21
|
+
* The five local-only filter callbacks (`dateFilter` / `numberFilter` /
|
|
22
|
+
* etc.) are inherited as optional and left undefined here.
|
|
34
23
|
*/
|
|
35
24
|
import { browser } from '$app/environment';
|
|
36
25
|
import { devCatch } from '../../../../Helpers/Helpers.svelte.js';
|
|
@@ -10,23 +10,21 @@ import type { SortingState } from './SortingState.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* Union surface implemented by both `LocalTableDataRepository` and any
|
|
12
12
|
* consumer-supplied remote repository. `TableContext` reads from `dataRepo`
|
|
13
|
-
* and `paginationRepo` via this contract;
|
|
14
|
-
*
|
|
13
|
+
* and `paginationRepo` via this contract; reactivity is exposed through
|
|
14
|
+
* the underlying `$state`-backed properties on the implementation.
|
|
15
15
|
*
|
|
16
|
-
* Implementers
|
|
16
|
+
* Implementers must guarantee:
|
|
17
17
|
*
|
|
18
18
|
* - Snapshot consistency: `data`, `totalRows`, `pageStartIndex`,
|
|
19
|
-
* `pageEndIndexExclusive`, and `paginationState` must
|
|
20
|
-
*
|
|
21
|
-
* - Filter safety (remote): `filterBy` accepts `unknown
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* can accept page-size inputs from a `<select>` element. Callers that hold
|
|
29
|
-
* the base interface should always pass `number`.
|
|
19
|
+
* `pageEndIndexExclusive`, and `paginationState` must describe the same
|
|
20
|
+
* logical page when read together.
|
|
21
|
+
* - Filter safety (remote): `filterBy` accepts `unknown`; remote
|
|
22
|
+
* implementations MUST escape values before forwarding to a backend
|
|
23
|
+
* (URL encoding, parameterised SQL, etc.). scoria does not enforce
|
|
24
|
+
* this and no validation happens server-side on its behalf.
|
|
25
|
+
* - LSP: concrete repositories widen `setPageSize` to
|
|
26
|
+
* `(size: number | string) => void` so they can accept raw `<select>`
|
|
27
|
+
* values; callers holding the base interface should pass `number`.
|
|
30
28
|
*/
|
|
31
29
|
export interface IDataRepository<T extends object> {
|
|
32
30
|
paginationState: PaginationState;
|
|
@@ -52,7 +50,6 @@ export interface IDataRepository<T extends object> {
|
|
|
52
50
|
pageStartIndex: number;
|
|
53
51
|
pageEndIndexExclusive: number;
|
|
54
52
|
previouslyViewedPage: number;
|
|
55
|
-
__queryValues: SvelteMap<string, unknown>;
|
|
56
53
|
readonly paginationType: PaginationType;
|
|
57
54
|
filterType: FilterType;
|
|
58
55
|
data: Array<T>;
|
|
@@ -8,9 +8,9 @@ import type { IDataRepository } from './IDataRepository.js';
|
|
|
8
8
|
import type { SortingState } from './SortingState.js';
|
|
9
9
|
/**
|
|
10
10
|
* Pagination state with the read-only contract enforced at the type
|
|
11
|
-
* level.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* level. Consumers reassign the whole shape through the public setter
|
|
12
|
+
* (rather than mutating fields) so the previously-viewed page is
|
|
13
|
+
* tracked.
|
|
14
14
|
*/
|
|
15
15
|
export interface ReadonlyPaginationState extends PaginationState {
|
|
16
16
|
readonly pageIndex: number;
|
|
@@ -21,12 +21,6 @@ export interface ReadonlyPaginationState extends PaginationState {
|
|
|
21
21
|
* Owns pagination state with localStorage write-through on `pageSize`,
|
|
22
22
|
* the reactive filter-mode map, the force-refresh hook, and shared
|
|
23
23
|
* static helpers for parsing comma-separated filter input.
|
|
24
|
-
*
|
|
25
|
-
* The `out FilterValueType` variance annotation is currently advisory:
|
|
26
|
-
* `filtering` reads the parameter (contravariant) but `__queryValues`
|
|
27
|
-
* does not currently use it. A proper variance audit is deferred to a
|
|
28
|
-
* future workorder; the existing annotation does not break type
|
|
29
|
-
* checking.
|
|
30
24
|
*/
|
|
31
25
|
export declare abstract class TableDataRepository<T extends object, out FilterValueType> implements IDataRepository<T> {
|
|
32
26
|
private tableName;
|
|
@@ -58,22 +52,14 @@ export declare abstract class TableDataRepository<T extends object, out FilterVa
|
|
|
58
52
|
abstract pageStartIndex: number;
|
|
59
53
|
abstract pageEndIndexExclusive: number;
|
|
60
54
|
constructor(tableName: string, getUserId: () => string | undefined);
|
|
61
|
-
/**
|
|
62
|
-
* Reactive bag of consumer-defined query values keyed by column id.
|
|
63
|
-
* Stored as `unknown` because the shape depends on the column type;
|
|
64
|
-
* narrowing to `FilterValueType` is deferred (would force consumers
|
|
65
|
-
* to choose a single value type at construction time, which is too
|
|
66
|
-
* restrictive for tables mixing several filter modes).
|
|
67
|
-
*/
|
|
68
|
-
__queryValues: SvelteMap<string, unknown>;
|
|
69
55
|
private _paginationState;
|
|
70
56
|
/** Current page index plus the configured page size. */
|
|
71
57
|
get paginationState(): ReadonlyPaginationState;
|
|
72
58
|
/**
|
|
73
|
-
*
|
|
59
|
+
* Replace pagination state and write the new `pageSize` through to
|
|
74
60
|
* localStorage. Idempotent: identical states are dropped so the
|
|
75
|
-
* previously-viewed-page tracker
|
|
76
|
-
*
|
|
61
|
+
* previously-viewed-page tracker keeps its value when the same state
|
|
62
|
+
* is reassigned (e.g. from a `$derived` re-evaluation).
|
|
77
63
|
*/
|
|
78
64
|
set paginationState(v: ReadonlyPaginationState);
|
|
79
65
|
private _previouslyViewedPage;
|
|
@@ -96,21 +82,20 @@ export declare abstract class TableDataRepository<T extends object, out FilterVa
|
|
|
96
82
|
*/
|
|
97
83
|
get forceRefresh(): () => void;
|
|
98
84
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
85
|
+
* @deprecated Assigning the setter both replaces the callback AND
|
|
86
|
+
* invokes it immediately, which is a footgun for callers wiring it up
|
|
87
|
+
* inside a constructor or `$effect.pre`. Use `registerRefreshMethod`
|
|
88
|
+
* to assign without the implicit invoke; call `repo.forceRefresh()`
|
|
89
|
+
* via the getter when an explicit refresh is wanted.
|
|
102
90
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* `triggerRefresh()` method and remove the side effect from the
|
|
106
|
-
* setter. Behaviour preserved here to avoid breaking existing
|
|
107
|
-
* consumers.
|
|
91
|
+
* Behaviour is preserved for backwards compatibility; the setter logs
|
|
92
|
+
* a dev-only warning so existing call sites surface in development.
|
|
108
93
|
*/
|
|
109
94
|
set forceRefresh(v: () => void);
|
|
110
95
|
/**
|
|
111
96
|
* Registers a refresh callback without invoking it. Preferred over
|
|
112
|
-
* the `forceRefresh` setter
|
|
113
|
-
*
|
|
97
|
+
* the deprecated `forceRefresh` setter; call `repo.forceRefresh()`
|
|
98
|
+
* separately when an explicit refresh is wanted.
|
|
114
99
|
*/
|
|
115
100
|
readonly registerRefreshMethod: (method: () => void) => void;
|
|
116
101
|
/**
|