@lavalogic/scoria 0.37.55 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Components/Table/ARCHITECTURE.md +22 -22
- package/dist/Components/Table/Misc/ColumnPanel.svelte +1 -61
- package/dist/Components/Table/Misc/ColumnPanel.svelte.d.ts +2 -24
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +3 -92
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte.d.ts +2 -24
- package/dist/Components/Table/Misc/ColumnPanelModalProps.d.ts +2 -2
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte +644 -0
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte.d.ts +26 -0
- package/dist/Components/Table/Misc/TableConfigurationModalProps.d.ts +13 -0
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +27 -0
- package/dist/Components/Table/Misc/TableSidebar.svelte +45 -2
- package/dist/Components/Table/Misc/TableViewDropdown.svelte +175 -0
- package/dist/Components/Table/Misc/TableViewDropdown.svelte.d.ts +25 -0
- package/dist/Components/Table/SubApis.svelte.js +0 -41
- package/dist/Components/Table/Types/Columns/JSONTableLayout.d.ts +5 -5
- package/dist/Components/Table/Types/Context/ColumnLayoutState.svelte.d.ts +5 -5
- package/dist/Components/Table/Types/Context/ColumnLayoutState.svelte.js +5 -5
- package/dist/Components/Table/Types/Context/PreferencesState.svelte.d.ts +106 -147
- package/dist/Components/Table/Types/Context/PreferencesState.svelte.js +156 -203
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +323 -44
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +687 -187
- package/dist/Components/Table/Types/Context/TableInitOptions.d.ts +9 -0
- package/dist/Components/Table/Types/Context/ViewState.svelte.d.ts +152 -0
- package/dist/Components/Table/Types/Context/ViewState.svelte.js +223 -0
- package/dist/Components/Table/Types/ExpandedPanel.d.ts +9 -5
- package/dist/Components/Table/Types/ExpandedPanel.js +9 -5
- package/dist/Components/Table/Types/Persistence/DatatableView.d.ts +95 -0
- package/dist/Components/Table/Types/Persistence/DatatableViewEnvelope.d.ts +21 -0
- package/dist/Components/Table/Types/Persistence/DatatableViewEnvelope.js +1 -0
- package/dist/Components/Table/Types/Persistence/DatatableViewKind.d.ts +10 -0
- package/dist/Components/Table/Types/Persistence/DatatableViewKind.js +1 -0
- package/dist/Components/Table/Types/Persistence/JSONActiveView.d.ts +58 -0
- package/dist/Components/Table/Types/Persistence/JSONActiveView.js +41 -0
- package/dist/Components/Table/Types/Persistence/JSONTableFilter.d.ts +53 -0
- package/dist/Components/Table/Types/Persistence/JSONTableFilter.js +42 -0
- package/dist/Components/Table/Types/Persistence/RemoteTableLayoutAdapter.d.ts +47 -0
- package/dist/Components/Table/Types/Persistence/RemoteTableLayoutAdapter.js +1 -0
- package/dist/Components/Table/Types/Public/CreateTableOptions.d.ts +10 -0
- package/dist/Components/Table/Types/Public/TablePersistence.d.ts +1 -4
- package/dist/Components/Table/Types/Public/TableSubApis.d.ts +0 -18
- package/dist/Components/Table/Types/Public/index.d.ts +1 -1
- package/dist/Components/Table/createTable.svelte.js +2 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +9 -0
- package/package.json +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDefSet.d.ts +0 -20
- package/dist/Components/Table/Types/Columns/Definitions/JSONColumnDefSet.d.ts +0 -25
- /package/dist/Components/Table/{Types/Columns/Definitions/ColumnDefSet.js → Misc/TableConfigurationModalProps.js} +0 -0
- /package/dist/Components/Table/Types/{Columns/Definitions/JSONColumnDefSet.js → Persistence/DatatableView.js} +0 -0
|
@@ -2,16 +2,19 @@ import { ClipboardState } from './ClipboardState.svelte.js';
|
|
|
2
2
|
import { PreferencesState } from './PreferencesState.svelte.js';
|
|
3
3
|
import { QueryValuesState } from './QueryValuesState.svelte.js';
|
|
4
4
|
import { SelectionState } from './SelectionState.svelte.js';
|
|
5
|
+
import { ViewState } from './ViewState.svelte.js';
|
|
5
6
|
import { SvelteMap } from 'svelte/reactivity';
|
|
6
7
|
import type { Updater } from 'svelte/store';
|
|
7
8
|
import type { ColumnPinningState } from '../Columns/ColumnPinningState.js';
|
|
8
9
|
import type { ColumnSizingState } from '../Columns/ColumnSizingState.js';
|
|
9
10
|
import type { ColumnDef } from '../Columns/Definitions/ColumnDef.svelte.js';
|
|
10
|
-
import type { ColumnDefSet } from '../Columns/Definitions/ColumnDefSet.js';
|
|
11
11
|
import type { DefsWrapper } from '../Columns/DefsWrapper.js';
|
|
12
12
|
import type { VisibilityState } from '../Columns/VisibilityState.js';
|
|
13
13
|
import type { CellCoordinates } from '../Coordinates/CellCoordinates.js';
|
|
14
14
|
import type { VisualColumnIndex } from '../Coordinates/ColumnIndices.js';
|
|
15
|
+
import type { RemoteTableLayoutAdapter } from '../Persistence/RemoteTableLayoutAdapter.js';
|
|
16
|
+
import type { DatatableView } from '../Persistence/DatatableView.js';
|
|
17
|
+
import type { DatatableViewKind } from '../Persistence/DatatableViewKind.js';
|
|
15
18
|
import type { IDataRepository } from '../DataRepository/IDataRepository.js';
|
|
16
19
|
import { SortingState } from './SortingState.svelte.js';
|
|
17
20
|
import { FilteringState } from './FilteringState.svelte.js';
|
|
@@ -60,6 +63,18 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
60
63
|
selectionExtractor: TableInitOptions<T, RowIdType>['selectionExtractor'];
|
|
61
64
|
getUserId: () => string | undefined;
|
|
62
65
|
private _onEditCell;
|
|
66
|
+
/**
|
|
67
|
+
* Stable per-table identifier supplied by the host app, or
|
|
68
|
+
* `undefined` when remote saved views are disabled. Stored only;
|
|
69
|
+
* later steps consume it.
|
|
70
|
+
*/
|
|
71
|
+
readonly datatableUuid: string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Injected backend adapter for saved layouts/filters, or
|
|
74
|
+
* `undefined` when remote saved views are disabled. Stored only;
|
|
75
|
+
* later steps consume it.
|
|
76
|
+
*/
|
|
77
|
+
readonly remoteLayouts: RemoteTableLayoutAdapter | undefined;
|
|
63
78
|
readonly debug: boolean;
|
|
64
79
|
static readonly identifier: unique symbol;
|
|
65
80
|
/**
|
|
@@ -71,7 +86,19 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
71
86
|
* `init`.
|
|
72
87
|
*/
|
|
73
88
|
static init<T extends object, RowIdType extends Primitive>(defaultColumnDefs: DefsWrapper<T>, tableName: string, dataRepo: IDataRepository<T>, options: TableInitOptions<T, RowIdType>): TableContext<T, RowIdType>;
|
|
74
|
-
protected constructor(INTERNAL_ONLY: symbol, defaultColumnDefs: DefsWrapper<T>, tableName: string, dataRepo: IDataRepository<T>, allowCopy: boolean, enableResize: boolean, allowColumnReordering: boolean, allowQuickFiltering: boolean, showQuickFilterByDefault: boolean, allowAdvancedFiltering: boolean, toolbarPosition: ToolbarPosition, displayFooter: boolean, selectionExtractor: TableInitOptions<T, RowIdType>['selectionExtractor'], getUserId: () => string | undefined, _onEditCell: TableInitOptions<T, RowIdType>['onEditCell'],
|
|
89
|
+
protected constructor(INTERNAL_ONLY: symbol, defaultColumnDefs: DefsWrapper<T>, tableName: string, dataRepo: IDataRepository<T>, allowCopy: boolean, enableResize: boolean, allowColumnReordering: boolean, allowQuickFiltering: boolean, showQuickFilterByDefault: boolean, allowAdvancedFiltering: boolean, toolbarPosition: ToolbarPosition, displayFooter: boolean, selectionExtractor: TableInitOptions<T, RowIdType>['selectionExtractor'], getUserId: () => string | undefined, _onEditCell: TableInitOptions<T, RowIdType>['onEditCell'],
|
|
90
|
+
/**
|
|
91
|
+
* Stable per-table identifier supplied by the host app, or
|
|
92
|
+
* `undefined` when remote saved views are disabled. Stored only;
|
|
93
|
+
* later steps consume it.
|
|
94
|
+
*/
|
|
95
|
+
datatableUuid: string | undefined,
|
|
96
|
+
/**
|
|
97
|
+
* Injected backend adapter for saved layouts/filters, or
|
|
98
|
+
* `undefined` when remote saved views are disabled. Stored only;
|
|
99
|
+
* later steps consume it.
|
|
100
|
+
*/
|
|
101
|
+
remoteLayouts: RemoteTableLayoutAdapter | undefined, debug: boolean);
|
|
75
102
|
private isSelectable;
|
|
76
103
|
/**
|
|
77
104
|
* `false` until the boot-time layout hydration (`_hydrateLayout`)
|
|
@@ -88,6 +115,13 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
88
115
|
* to run after the component is gone.
|
|
89
116
|
*/
|
|
90
117
|
private _layoutPersistTimer;
|
|
118
|
+
/**
|
|
119
|
+
* Pending debounce timer for the filter auto-persist. The filter
|
|
120
|
+
* counterpart of `_layoutPersistTimer`; deliberately not cleared on
|
|
121
|
+
* teardown for the same reason - a still-pending `persistFilter`
|
|
122
|
+
* write should flush, and it only touches `localStorage`.
|
|
123
|
+
*/
|
|
124
|
+
private _filterPersistTimer;
|
|
91
125
|
private _paginationRepo;
|
|
92
126
|
get paginationRepo(): IDataRepository<T> | undefined;
|
|
93
127
|
set paginationRepo(v: IDataRepository<T> | undefined);
|
|
@@ -129,16 +163,6 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
129
163
|
/** Delegates to `_columnLayout.columnDefs`. */
|
|
130
164
|
get columnDefs(): Array<ColumnDef<T>>;
|
|
131
165
|
set columnDefs(v: Array<ColumnDef<T>>);
|
|
132
|
-
/**
|
|
133
|
-
* Delegates to `_preferences._columnPresets`. The setter is private
|
|
134
|
-
* because the public write path is `saveColumnPreset` (which also
|
|
135
|
-
* persists to localStorage); internal call sites that need to
|
|
136
|
-
* mutate the list directly call `_preferences.setPresets(...)`.
|
|
137
|
-
*/
|
|
138
|
-
get columnPresets(): ReadonlyArray<ColumnDefSet<T>>;
|
|
139
|
-
/** Delegates to `_preferences._selectedPreset`. */
|
|
140
|
-
get selectedPreset(): ColumnDefSet<T> | undefined;
|
|
141
|
-
set selectedPreset(v: ColumnDefSet<T> | undefined);
|
|
142
166
|
/**
|
|
143
167
|
* Delegates to `_focus._focusedRowIndices`. Populated by the
|
|
144
168
|
* focus-derived `$effect` in the constructor through
|
|
@@ -329,27 +353,81 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
329
353
|
/**
|
|
330
354
|
* Persistence / preferences sub-context:
|
|
331
355
|
*
|
|
332
|
-
* - saved column-presets list and currently-selected preset
|
|
333
|
-
* (`columnPresets`, `selectedPreset`);
|
|
334
356
|
* - `userIdSegment` `$derived` (namespaces every
|
|
335
357
|
* `scoria-table:<user>:<tableName>:<suffix>` storage key);
|
|
336
|
-
* - `
|
|
337
|
-
*
|
|
338
|
-
* - `loadPresets` / `loadSelectedPresetName` / `loadSavedSettings`
|
|
339
|
-
* boot-time hydration helpers;
|
|
340
|
-
* - `persistSettings` writer used by the in-app settings toggles
|
|
358
|
+
* - `loadSavedSettings` boot-time hydration helper and the
|
|
359
|
+
* `persistSettings` writer used by the in-app settings toggles
|
|
341
360
|
* (`setIsCompact`, `setAlternateRowColours`, etc.);
|
|
342
|
-
* -
|
|
343
|
-
*
|
|
361
|
+
* - the layout / active-view / filter / active-filter-view
|
|
362
|
+
* load / persist / clear helpers driving the FPM 403 datatable
|
|
363
|
+
* views;
|
|
364
|
+
* - the `isSavedTableSettings` schema-validation typeguard (exported
|
|
365
|
+
* alongside the sub-context for unit testing).
|
|
344
366
|
*
|
|
345
367
|
* The settings fields themselves (`isCompact`, `singleClickEditing`,
|
|
346
368
|
* `alternateRowColours`, etc.) stay on `TableContext` because each
|
|
347
369
|
* drives reactive UI; only the localStorage round-trip lives here.
|
|
348
|
-
* Delegating getters / setters / methods on `TableContext` cover the
|
|
349
|
-
* full surface (`columnPresets`, `selectedPreset`, `saveColumnPreset`,
|
|
350
|
-
* `setSelectedPreset`, `setIsCompact`, etc.).
|
|
351
370
|
*/
|
|
352
|
-
readonly _preferences: PreferencesState
|
|
371
|
+
readonly _preferences: PreferencesState;
|
|
372
|
+
/**
|
|
373
|
+
* Datatable view-selection sub-context (FPM 403):
|
|
374
|
+
*
|
|
375
|
+
* - `activeView` - which view the live table belongs to (the
|
|
376
|
+
* code-defined Default layout, or a named saved `DatatableView`);
|
|
377
|
+
* - `isDirty` - whether the live layout has diverged from the active
|
|
378
|
+
* view's saved baseline;
|
|
379
|
+
* - the saved views per kind - `'layout'` and `'filter'` - fetched
|
|
380
|
+
* through the injected `remoteLayouts` adapter;
|
|
381
|
+
* - `dropdownLabel(kind)` - the `$derived` label the toolbar
|
|
382
|
+
* view-picker renders.
|
|
383
|
+
*
|
|
384
|
+
* `ViewState` tracks the `'layout'` and `'filter'` kinds as two fully
|
|
385
|
+
* independent slices: applying or dirtying one never touches the
|
|
386
|
+
* other. It is a pure state holder - the apply / capture / baseline
|
|
387
|
+
* tracking / adapter calls all live on this class (`_applyLayout` /
|
|
388
|
+
* `_captureLayout` / `_applyFilter` / `_captureFilter`,
|
|
389
|
+
* `_viewBaseline` / `_filterBaseline`, the `applyDatatableView` /
|
|
390
|
+
* `resetToDefault` / `saveCurrentAsNewView` / `saveActiveView` /
|
|
391
|
+
* `refreshSavedViews` methods below), mirroring how `SelectionState`
|
|
392
|
+
* keeps its effects on the parent. The dirty comparisons run in the
|
|
393
|
+
* two debounced auto-persist `$effect`s in the constructor.
|
|
394
|
+
*/
|
|
395
|
+
readonly _viewState: ViewState;
|
|
396
|
+
/**
|
|
397
|
+
* Baseline `JSONTableLayout` the dirty comparison is measured
|
|
398
|
+
* against: the saved state of whatever view `_viewState.activeView`
|
|
399
|
+
* points at. Set to the Default snapshot once `setupDefaultColumnDefs`
|
|
400
|
+
* completes, and re-pointed at a saved view's `body.layout` whenever
|
|
401
|
+
* one is applied. `undefined` only in the brief window before the
|
|
402
|
+
* boot chain captures the Default snapshot.
|
|
403
|
+
*/
|
|
404
|
+
private _viewBaseline;
|
|
405
|
+
/**
|
|
406
|
+
* The Default-layout snapshot, captured once right after
|
|
407
|
+
* `setupDefaultColumnDefs` (before the working copy is applied). Kept
|
|
408
|
+
* separately from `_viewBaseline` so `resetToDefault` can restore the
|
|
409
|
+
* factory layout regardless of which saved view was active.
|
|
410
|
+
*/
|
|
411
|
+
private _defaultLayoutSnapshot;
|
|
412
|
+
/**
|
|
413
|
+
* Baseline `JSONTableFilter` the *filter* dirty comparison is
|
|
414
|
+
* measured against: the saved state of whatever filter view
|
|
415
|
+
* `_viewState.activeView('filter')` points at. Set to the Default
|
|
416
|
+
* filter snapshot once the boot chain runs, and re-pointed at a saved
|
|
417
|
+
* view's `body.filter` whenever one is applied. The filter
|
|
418
|
+
* counterpart of `_viewBaseline`; kept entirely separate so layout
|
|
419
|
+
* and filter dirtiness never cross-contaminate.
|
|
420
|
+
*/
|
|
421
|
+
private _filterBaseline;
|
|
422
|
+
/**
|
|
423
|
+
* The Default-filter snapshot, captured once during the boot chain
|
|
424
|
+
* (the empty / initial filter state, before the working copy is
|
|
425
|
+
* applied). Kept separately from `_filterBaseline` so a future
|
|
426
|
+
* filter-reset can restore the initial filter state regardless of
|
|
427
|
+
* which saved filter view was active. The filter counterpart of
|
|
428
|
+
* `_defaultLayoutSnapshot`.
|
|
429
|
+
*/
|
|
430
|
+
private _defaultFilterSnapshot;
|
|
353
431
|
/**
|
|
354
432
|
* Selection + highlighting + key-cache sub-context:
|
|
355
433
|
*
|
|
@@ -603,24 +681,6 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
603
681
|
readonly setCopyWithHeaders: (value: boolean) => void;
|
|
604
682
|
/** Toggles CSV vs TSV copy-to-clipboard separator and persists. */
|
|
605
683
|
readonly setCommaSeparatedCopy: (value: boolean) => void;
|
|
606
|
-
/**
|
|
607
|
-
* Applies the preset to the live column layout, forwards the
|
|
608
|
-
* preset's `sortingState` to the data-repository updater, and
|
|
609
|
-
* persists the selected name. Delegates to
|
|
610
|
-
* `_preferences.setSelectedPreset`.
|
|
611
|
-
*
|
|
612
|
-
* The "no sorting state found" debug warning is emitted here (not
|
|
613
|
-
* inside the sub-context) so the public surface stays byte-identical
|
|
614
|
-
* - `_preferences.applySortingState` already no-ops when
|
|
615
|
-
* `paginationRepo.updateSorting` is absent.
|
|
616
|
-
*/
|
|
617
|
-
readonly setSelectedPreset: (preset: ColumnDefSet<T>) => void;
|
|
618
|
-
/**
|
|
619
|
-
* Adds or replaces a saved preset for the current column layout and
|
|
620
|
-
* persists the full preset list to localStorage. Delegates to
|
|
621
|
-
* `_preferences.saveColumnPreset`.
|
|
622
|
-
*/
|
|
623
|
-
readonly saveColumnPreset: (name: string) => void;
|
|
624
684
|
/**
|
|
625
685
|
* Delegates to `_focus.setFocusEnd`. This listener should be added
|
|
626
686
|
* and removed based on `isMousingDown`.
|
|
@@ -656,6 +716,226 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
656
716
|
* No-op when no snapshot is stored.
|
|
657
717
|
*/
|
|
658
718
|
private _hydrateLayout;
|
|
719
|
+
/**
|
|
720
|
+
* Boot-time hydration for the FPM 403 view-state machine. Reads the
|
|
721
|
+
* persisted `JSONActiveView` envelope and restores the active-view
|
|
722
|
+
* selection on top of whatever `_hydrateLayout` produced:
|
|
723
|
+
*
|
|
724
|
+
* - no slot / Default ref: the active view stays Default and the
|
|
725
|
+
* baseline stays the Default snapshot (already set by the caller);
|
|
726
|
+
* - a saved-view ref: `activeView` is re-pointed at it, and the
|
|
727
|
+
* baseline is repointed at the matching view's `body.layout` IF the
|
|
728
|
+
* saved-views list has already loaded. The list is fetched
|
|
729
|
+
* fire-and-forget, so it usually has NOT loaded yet at boot - in
|
|
730
|
+
* that case the persisted ref is restored as-is and `refreshSavedViews`
|
|
731
|
+
* reconciles the baseline once the network resolves.
|
|
732
|
+
*
|
|
733
|
+
* The persisted `dirty` flag is restored verbatim via `markDirty`;
|
|
734
|
+
* the live working copy that `_hydrateLayout` applied is the source
|
|
735
|
+
* of truth for the layout contents.
|
|
736
|
+
*
|
|
737
|
+
* Runs before the `_layoutHydrated` gate opens so the auto-persist
|
|
738
|
+
* effect does not clobber the restored selection.
|
|
739
|
+
*/
|
|
740
|
+
private _hydrateActiveView;
|
|
741
|
+
/**
|
|
742
|
+
* Re-point `_viewBaseline` at the active view's saved layout. For a
|
|
743
|
+
* Default active view the baseline is the Default snapshot; for a
|
|
744
|
+
* saved active view it is the matching `savedLayouts` entry's
|
|
745
|
+
* `body.layout` (when that entry is known - if the saved-views list
|
|
746
|
+
* has not loaded yet the baseline is left unchanged and is reconciled
|
|
747
|
+
* later by `refreshSavedViews`).
|
|
748
|
+
*
|
|
749
|
+
* Does NOT recompute the dirty flag - the next auto-persist tick does
|
|
750
|
+
* that against the updated baseline.
|
|
751
|
+
*/
|
|
752
|
+
private _reconcileBaselineForActiveView;
|
|
753
|
+
/**
|
|
754
|
+
* Persist the current layout `{ active, dirty }` selection as a
|
|
755
|
+
* `JSONActiveView` envelope. Called (debounced) from the layout
|
|
756
|
+
* auto-persist `$effect` alongside the working-copy layout write.
|
|
757
|
+
*/
|
|
758
|
+
private _persistActiveView;
|
|
759
|
+
/**
|
|
760
|
+
* Snapshot the live filter state - the per-column filter values and
|
|
761
|
+
* per-column filter modes - into the persistable `JSONTableFilter`
|
|
762
|
+
* shape. The filter counterpart of `_captureLayout`.
|
|
763
|
+
*
|
|
764
|
+
* Reads the repository's `filtering` array (`{ id, value }` entries)
|
|
765
|
+
* and `filterModes` map; reading both makes the filter auto-persist
|
|
766
|
+
* `$effect` re-subscribe whenever either changes. The `SvelteMap` of
|
|
767
|
+
* modes is flattened to a plain `Record<string,string>` (a `Map` does
|
|
768
|
+
* not survive `JSON.stringify`). Entries and mode keys are sorted so
|
|
769
|
+
* the captured object is deterministic and a stable `JSON.stringify`
|
|
770
|
+
* comparison drives the dirty flag.
|
|
771
|
+
*
|
|
772
|
+
* Sort order and pagination are deliberately excluded - a saved
|
|
773
|
+
* filter is values + modes only.
|
|
774
|
+
*
|
|
775
|
+
* `filtering` and `filterModes` are mandatory on the `IDataRepository`
|
|
776
|
+
* contract and present on every repo kind (local, built-in remote,
|
|
777
|
+
* custom remote), so no method is missing here; `Array.isArray` /
|
|
778
|
+
* `keys()` guard only against a genuinely malformed value.
|
|
779
|
+
*/
|
|
780
|
+
private _captureFilter;
|
|
781
|
+
/**
|
|
782
|
+
* Apply a persisted `JSONTableFilter` to the live filter state. The
|
|
783
|
+
* filter counterpart of `_applyLayout`.
|
|
784
|
+
*
|
|
785
|
+
* 1. `resetFilters()` clears every active filter value first, so the
|
|
786
|
+
* applied filter fully replaces (rather than merges into) whatever
|
|
787
|
+
* was live;
|
|
788
|
+
* 2. each `{ id, value }` whose `id` still maps to a live column is
|
|
789
|
+
* re-applied via `filterBy` - stale ids (a column removed since
|
|
790
|
+
* the filter was saved) are dropped, mirroring how `_applyLayout`
|
|
791
|
+
* drops unknown ids;
|
|
792
|
+
* 3. each mode whose `id` still maps to a live column AND whose mode
|
|
793
|
+
* string is a recognised `StringFilterMode` / `NumberDateFilterMode`
|
|
794
|
+
* value is re-applied via `setFilterMode`; unknown modes are
|
|
795
|
+
* dropped rather than forwarded.
|
|
796
|
+
*
|
|
797
|
+
* Modes are applied before values so a value-bearing mode (e.g.
|
|
798
|
+
* "Empty") sees the column's mode already set. Defensive: a repo
|
|
799
|
+
* missing `resetFilters` / `filterBy` / `setFilterMode` no-ops the
|
|
800
|
+
* corresponding step rather than crashing.
|
|
801
|
+
*/
|
|
802
|
+
private _applyFilter;
|
|
803
|
+
/**
|
|
804
|
+
* Boot-time hydration. Reads the auto-saved live-filter snapshot and
|
|
805
|
+
* applies it, restoring the user's last per-column filter values /
|
|
806
|
+
* modes. No-op when no snapshot is stored. The filter counterpart of
|
|
807
|
+
* `_hydrateLayout`.
|
|
808
|
+
*/
|
|
809
|
+
private _hydrateFilter;
|
|
810
|
+
/**
|
|
811
|
+
* Boot-time hydration for the FPM 403 filter view-state machine.
|
|
812
|
+
* Reads the persisted *filter* `JSONActiveView` envelope and restores
|
|
813
|
+
* the filter active-view selection on top of whatever `_hydrateFilter`
|
|
814
|
+
* produced. The filter counterpart of `_hydrateActiveView`; runs
|
|
815
|
+
* independently and never touches the layout slice.
|
|
816
|
+
*
|
|
817
|
+
* Runs before the `_layoutHydrated` gate opens so the filter
|
|
818
|
+
* auto-persist effect does not clobber the restored selection.
|
|
819
|
+
*/
|
|
820
|
+
private _hydrateActiveFilterView;
|
|
821
|
+
/**
|
|
822
|
+
* Re-point `_filterBaseline` at the active filter view's saved
|
|
823
|
+
* filter. The filter counterpart of `_reconcileBaselineForActiveView`:
|
|
824
|
+
* for a Default active filter view the baseline is the Default filter
|
|
825
|
+
* snapshot; for a saved one it is the matching saved-filter entry's
|
|
826
|
+
* `body.filter` (when that entry is known).
|
|
827
|
+
*
|
|
828
|
+
* Does NOT recompute the dirty flag - the next filter auto-persist
|
|
829
|
+
* tick does that against the updated baseline.
|
|
830
|
+
*/
|
|
831
|
+
private _reconcileBaselineForActiveFilterView;
|
|
832
|
+
/**
|
|
833
|
+
* Persist the current filter `{ active, dirty }` selection as a
|
|
834
|
+
* `JSONActiveView` envelope into the `active-filter-view` slot.
|
|
835
|
+
* Called (debounced) from the filter auto-persist `$effect` alongside
|
|
836
|
+
* the working-copy filter write. The filter counterpart of
|
|
837
|
+
* `_persistActiveView`.
|
|
838
|
+
*/
|
|
839
|
+
private _persistActiveFilterView;
|
|
840
|
+
/**
|
|
841
|
+
* Apply a saved `DatatableView` to the live table and mark it as the
|
|
842
|
+
* active view of its kind. Branches on `view.body.kind`:
|
|
843
|
+
*
|
|
844
|
+
* - `'layout'`: apply `view.body.layout` via `_applyLayout`, set the
|
|
845
|
+
* *layout* active view to `{ kind:'saved', id, name }`, re-point the
|
|
846
|
+
* *layout* baseline at that layout, clear the *layout* dirty flag.
|
|
847
|
+
* The filter state, columns' filter values and the filter dirty
|
|
848
|
+
* flag are left untouched.
|
|
849
|
+
* - `'filter'`: apply `view.body.filter` via `_applyFilter`, set the
|
|
850
|
+
* *filter* active view, re-point the *filter* baseline at that
|
|
851
|
+
* filter, clear the *filter* dirty flag. The column layout and the
|
|
852
|
+
* layout dirty flag are left untouched.
|
|
853
|
+
*
|
|
854
|
+
* Applying one kind never mutates the other kind's state - the layout
|
|
855
|
+
* and filter view machines are fully independent.
|
|
856
|
+
*
|
|
857
|
+
* Bound as a class property so the toolbar view-picker (built later)
|
|
858
|
+
* can pass the reference around without re-binding `this`.
|
|
859
|
+
*/
|
|
860
|
+
readonly applyDatatableView: (view: DatatableView) => void;
|
|
861
|
+
/**
|
|
862
|
+
* Reset the live table for `kind` back to its code-defined Default:
|
|
863
|
+
* apply the captured Default snapshot, set that kind's `activeView`
|
|
864
|
+
* back to Default, re-point that kind's baseline at the Default
|
|
865
|
+
* snapshot, and clear that kind's dirty flag.
|
|
866
|
+
*
|
|
867
|
+
* - `'layout'`: restores `_defaultLayoutSnapshot` via `_applyLayout`,
|
|
868
|
+
* touching only the layout slice;
|
|
869
|
+
* - `'filter'`: restores `_defaultFilterSnapshot` via `_applyFilter`,
|
|
870
|
+
* touching only the filter slice.
|
|
871
|
+
*
|
|
872
|
+
* Resetting one kind never mutates the other - it honours the same
|
|
873
|
+
* layout/filter independence guarantee as `applyDatatableView`.
|
|
874
|
+
*
|
|
875
|
+
* `kind` defaults to `'layout'` so the A2/A3 layout call sites that
|
|
876
|
+
* call `resetToDefault()` with no argument keep working unchanged.
|
|
877
|
+
*
|
|
878
|
+
* No-op (with a dev log) when the relevant Default snapshot has not
|
|
879
|
+
* been captured yet (i.e. before the boot chain completes).
|
|
880
|
+
*
|
|
881
|
+
* Bound as a class property so the toolbar view-picker and the Table
|
|
882
|
+
* Configuration modal can pass the reference around without
|
|
883
|
+
* re-binding `this`.
|
|
884
|
+
*/
|
|
885
|
+
readonly resetToDefault: (kind?: DatatableViewKind) => void;
|
|
886
|
+
/**
|
|
887
|
+
* Save the live state of `kind` as a brand-new saved view through the
|
|
888
|
+
* injected `remoteLayouts` adapter:
|
|
889
|
+
*
|
|
890
|
+
* 1. build a `CreateDatatableViewRequest` whose `body` is, by `kind`,
|
|
891
|
+
* either `{ kind:'layout', layout: _captureLayout() }` or
|
|
892
|
+
* `{ kind:'filter', filter: _captureFilter() }`, plus the
|
|
893
|
+
* host-supplied `datatableUuid` and the owning user;
|
|
894
|
+
* 2. `await remoteLayouts.createView(...)`;
|
|
895
|
+
* 3. push the returned `DatatableView` into the matching kind's
|
|
896
|
+
* saved-views list;
|
|
897
|
+
* 4. apply it via `applyDatatableView`, which re-points that kind's
|
|
898
|
+
* baseline and clears that kind's dirty flag.
|
|
899
|
+
*
|
|
900
|
+
* Only the named kind's state is touched. No-op (dev-logged via
|
|
901
|
+
* `devCatch`) when remote saved views are disabled (`datatableUuid` /
|
|
902
|
+
* `remoteLayouts` absent) or no owning user id is available - scoria
|
|
903
|
+
* stays backend-agnostic, so it never fabricates these. An adapter
|
|
904
|
+
* rejection is routed to `devCatch` and never breaks the table.
|
|
905
|
+
*/
|
|
906
|
+
readonly saveCurrentAsNewView: (name: string, kind: DatatableViewKind) => Promise<void>;
|
|
907
|
+
/**
|
|
908
|
+
* Overwrite the currently-active saved view of `kind` with the live
|
|
909
|
+
* state of that kind through the injected `remoteLayouts` adapter:
|
|
910
|
+
*
|
|
911
|
+
* 1. require that kind's `activeView` to be `kind: 'saved'` (Default
|
|
912
|
+
* cannot be saved over - the caller uses `saveCurrentAsNewView`
|
|
913
|
+
* instead);
|
|
914
|
+
* 2. build an `UpdateDatatableViewRequest` whose `body` is the
|
|
915
|
+
* captured live layout or filter, by `kind`;
|
|
916
|
+
* 3. `await remoteLayouts.updateView(...)`;
|
|
917
|
+
* 4. refresh the matching entry in that kind's saved-views list,
|
|
918
|
+
* re-select it, re-point that kind's baseline, clear that kind's
|
|
919
|
+
* dirty flag.
|
|
920
|
+
*
|
|
921
|
+
* Only the named kind's state is touched. No-op (dev-logged) when
|
|
922
|
+
* that kind's active view is Default or remote saved views are
|
|
923
|
+
* disabled. An adapter rejection is routed to `devCatch`.
|
|
924
|
+
*/
|
|
925
|
+
readonly saveActiveView: (kind: DatatableViewKind) => Promise<void>;
|
|
926
|
+
/**
|
|
927
|
+
* Fetch the saved views for this datatable through the injected
|
|
928
|
+
* `remoteLayouts` adapter and publish them into `_viewState`, split by
|
|
929
|
+
* `kind`: `kind: 'layout'` views into the layout saved-views list and
|
|
930
|
+
* `kind: 'filter'` views into the filter saved-views list. After the
|
|
931
|
+
* lists land, reconcile both `_viewBaseline` and `_filterBaseline`
|
|
932
|
+
* against the now-known body of any persisted saved-view ref.
|
|
933
|
+
*
|
|
934
|
+
* No-op when remote saved views are disabled (`datatableUuid` /
|
|
935
|
+
* `remoteLayouts` absent). An adapter rejection is routed to
|
|
936
|
+
* `devCatch` and never breaks the table.
|
|
937
|
+
*/
|
|
938
|
+
readonly refreshSavedViews: () => Promise<void>;
|
|
659
939
|
/**
|
|
660
940
|
* Drop the persisted live-layout snapshot for this table. The next
|
|
661
941
|
* mount falls back to the default column layout. Exposed so a host
|
|
@@ -696,6 +976,5 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
696
976
|
private _getUserDefaults;
|
|
697
977
|
private _setNewPinningState;
|
|
698
978
|
readonly getToggleSortingHandler: (def: ColumnDef<T>) => () => void;
|
|
699
|
-
private reassignDefsToPresets;
|
|
700
979
|
}
|
|
701
980
|
export declare function isSearchable<T extends object, FilterValueType, CD extends ColumnDef<T, FilterValueType>>(def: CD): def is CD & HasCustomFilterFunction;
|