@toclocoinc/lattice-grid 1.55.0 → 1.56.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/README.md +1 -1
- package/docs/API.html +280 -34
- package/docs/api-detail.html +276 -6
- package/lattice-grid.d.ts +247 -15
- package/lattice-grid.esm.min.js +1358 -573
- package/lattice-grid.min.cjs +1358 -573
- package/lattice-grid.min.js +1358 -573
- package/modules/ai.esm.min.js +4 -4
- package/modules/ai.min.cjs +4 -4
- package/modules/ai.min.js +4 -4
- package/modules/angular.esm.min.js +2 -2
- package/modules/angular.min.cjs +2 -2
- package/modules/angular.min.js +2 -2
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/charts.esm.min.js +15 -10
- package/modules/charts.min.cjs +15 -10
- package/modules/charts.min.js +15 -10
- package/modules/data-router.esm.min.js +37 -4
- package/modules/data-router.min.cjs +37 -4
- package/modules/data-router.min.js +37 -4
- package/modules/devtools.esm.min.js +2 -2
- package/modules/devtools.min.cjs +2 -2
- package/modules/devtools.min.js +2 -2
- package/modules/dhtmlx-compat.esm.min.js +4 -4
- package/modules/dhtmlx-compat.min.cjs +4 -4
- package/modules/dhtmlx-compat.min.js +4 -4
- package/modules/gantt.esm.min.js +4 -4
- package/modules/gantt.min.cjs +4 -4
- package/modules/gantt.min.js +4 -4
- package/modules/htmx.esm.min.js +1358 -573
- package/modules/htmx.min.cjs +1358 -573
- package/modules/htmx.min.js +1358 -573
- package/modules/kanban.esm.min.js +4 -4
- package/modules/kanban.min.cjs +4 -4
- package/modules/kanban.min.js +4 -4
- package/modules/kpi.esm.min.js +44 -7
- package/modules/kpi.min.cjs +44 -7
- package/modules/kpi.min.js +44 -7
- package/modules/layout.esm.min.js +4 -4
- package/modules/layout.min.cjs +4 -4
- package/modules/layout.min.js +4 -4
- package/modules/mock-socket.esm.min.js +2 -2
- package/modules/mock-socket.min.cjs +2 -2
- package/modules/mock-socket.min.js +2 -2
- package/modules/react.esm.min.js +2 -2
- package/modules/react.min.cjs +2 -2
- package/modules/react.min.js +2 -2
- package/modules/svelte.esm.min.js +2 -2
- package/modules/svelte.min.cjs +2 -2
- package/modules/svelte.min.js +2 -2
- package/modules/tabs.esm.min.js +4 -4
- package/modules/tabs.min.cjs +4 -4
- package/modules/tabs.min.js +4 -4
- package/modules/vue.esm.min.js +2 -2
- package/modules/vue.min.cjs +2 -2
- package/modules/vue.min.js +2 -2
- package/modules/webcomponent.esm.min.js +1358 -573
- package/modules/webcomponent.min.cjs +1358 -573
- package/modules/webcomponent.min.js +1358 -573
- package/package.json +3 -2
package/lattice-grid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.56.0, type declarations
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -626,7 +626,10 @@ export interface ColumnHeaderSpec {
|
|
|
626
626
|
render?: string | RendererCtor;
|
|
627
627
|
/** Props passed to `render` as `params.props`. */
|
|
628
628
|
props?: Record<string, unknown>;
|
|
629
|
-
/**
|
|
629
|
+
/**
|
|
630
|
+
* A class, or classes, added to the heading cell. A string may hold several
|
|
631
|
+
* space-separated tokens (`'a b'`), each applied individually.
|
|
632
|
+
*/
|
|
630
633
|
class?: string | string[];
|
|
631
634
|
tooltip?: string;
|
|
632
635
|
align?: Align;
|
|
@@ -1354,8 +1357,9 @@ export interface DerivedSourceConfig {
|
|
|
1354
1357
|
* change on the parent re-derives the whole thing. `correlation` additionally
|
|
1355
1358
|
* scans the rows once *per pair*, so N columns cost N·(N−1)/2 passes. Use
|
|
1356
1359
|
* `refresh` (`'idle'` is the default; `'manual'` or a debounce in ms for an
|
|
1357
|
-
* expensive analysis over a live feed
|
|
1358
|
-
*
|
|
1360
|
+
* expensive analysis over a live feed; under `'manual'` the host re-derives
|
|
1361
|
+
* by calling `rows.load()` on the derived grid) — see `docs/api-detail.html`
|
|
1362
|
+
* for the measured figures.
|
|
1359
1363
|
*
|
|
1360
1364
|
* Every row carries `n`, the rows the figure covered, because a derived
|
|
1361
1365
|
* statistic travels into an export or a chart without its grid and "r = 0.98
|
|
@@ -1368,7 +1372,15 @@ export interface DerivedSourceConfig {
|
|
|
1368
1372
|
*/
|
|
1369
1373
|
statistics?: DerivedStatistics;
|
|
1370
1374
|
|
|
1371
|
-
/**
|
|
1375
|
+
/**
|
|
1376
|
+
* When to re-derive. `idle` by default: coalesced to a frame. A number
|
|
1377
|
+
* debounces by that many milliseconds; `live` re-derives on every change.
|
|
1378
|
+
* `manual` never re-derives on its own: the host triggers it by calling
|
|
1379
|
+
* `rows.load()`, with no argument, on the derived grid - from a Refresh
|
|
1380
|
+
* button, say. Each call re-reads `from` there and then and replaces the
|
|
1381
|
+
* rows; a derived grid takes its rows from `from`, so anything passed to
|
|
1382
|
+
* `load` is not used. Executed example: `docs/api-detail.html#derived-manual-refresh`.
|
|
1383
|
+
*/
|
|
1372
1384
|
refresh?: 'live' | 'idle' | 'manual' | number;
|
|
1373
1385
|
|
|
1374
1386
|
/**
|
|
@@ -1566,9 +1578,20 @@ export interface DetailConfig {
|
|
|
1566
1578
|
}
|
|
1567
1579
|
|
|
1568
1580
|
export interface SelectionConfig {
|
|
1581
|
+
/** `'none'` also turns off `ranges` and `fillHandle` unless either is set explicitly alongside it. */
|
|
1569
1582
|
mode?: 'none' | 'single' | 'multiple';
|
|
1570
1583
|
checkbox?: boolean;
|
|
1571
1584
|
headerCheckbox?: boolean;
|
|
1585
|
+
/**
|
|
1586
|
+
* Only the `checkbox` column may change row selection — a click anywhere
|
|
1587
|
+
* else in the row, and Space with focus anywhere but the checkbox, leave
|
|
1588
|
+
* selection untouched. Range and cell selection are unaffected either way.
|
|
1589
|
+
* For a host whose row click is bound to its own action (opening a record):
|
|
1590
|
+
* without this, that click also selects the row, so a later bulk action can
|
|
1591
|
+
* reach rows nobody chose. Off by default. `mode: 'none'` already refuses
|
|
1592
|
+
* every selection path regardless of this flag.
|
|
1593
|
+
*/
|
|
1594
|
+
checkboxOnly?: boolean;
|
|
1572
1595
|
groupSelectsChildren?: boolean;
|
|
1573
1596
|
groupSelectsFiltered?: boolean;
|
|
1574
1597
|
ranges?: boolean;
|
|
@@ -1703,8 +1726,13 @@ export interface GridConfig {
|
|
|
1703
1726
|
* What identifies a row. Everything that survives a refresh (selection,
|
|
1704
1727
|
* expansion, and edits in flight) is keyed on it, so it must be stable and
|
|
1705
1728
|
* unique. A derived grid defaults to its own derived key.
|
|
1729
|
+
*
|
|
1730
|
+
* Three shapes: a field name (`'id'`, dot paths allowed); an array of field
|
|
1731
|
+
* names, joined into one composite key (`['tenantId', 'circuitId']`); or a
|
|
1732
|
+
* function of the row (`row => \`${row.tenantId}#${row.circuitId}\``),
|
|
1733
|
+
* itself allowed to return an array to the same effect.
|
|
1706
1734
|
*/
|
|
1707
|
-
rowKey?: string | ((row: unknown) => string);
|
|
1735
|
+
rowKey?: string | string[] | ((row: unknown) => string | string[]);
|
|
1708
1736
|
/** Where rows come from: memory, paged, remote, stream or derived. */
|
|
1709
1737
|
source?: SourceConfig;
|
|
1710
1738
|
/** How rows are ingested into the column store. */
|
|
@@ -1735,7 +1763,11 @@ export interface GridConfig {
|
|
|
1735
1763
|
tree?: TreeConfig;
|
|
1736
1764
|
/** The expandable panel beneath a row. */
|
|
1737
1765
|
detail?: DetailConfig;
|
|
1738
|
-
/**
|
|
1766
|
+
/**
|
|
1767
|
+
* What the user may select, and how selection behaves across groups.
|
|
1768
|
+
* The `'none'` shorthand is `{ mode: 'none' }` and behaves identically: no
|
|
1769
|
+
* row selection, and no cell ranges or fill handle either.
|
|
1770
|
+
*/
|
|
1739
1771
|
selection?: SelectionConfig | 'single' | 'multiple' | 'none';
|
|
1740
1772
|
/** Editing, and how a change is committed and validated. */
|
|
1741
1773
|
edit?: EditConfig | boolean;
|
|
@@ -2158,7 +2190,12 @@ export interface GridConfig {
|
|
|
2158
2190
|
* measured; it is about whether the ceiling applies.
|
|
2159
2191
|
*/
|
|
2160
2192
|
autoHeight?: boolean | 'visible';
|
|
2161
|
-
/**
|
|
2193
|
+
/**
|
|
2194
|
+
* Sort, filters, grouping, widths and the rest, restored at construction.
|
|
2195
|
+
* Takes precedence over a saved view flagged `isDefault`: when both are
|
|
2196
|
+
* present, this wins outright and the default view is never applied — the
|
|
2197
|
+
* active view id stays `null`.
|
|
2198
|
+
*/
|
|
2162
2199
|
state?: GridState;
|
|
2163
2200
|
/** Your licence key. Without one the grid renders in full and watermarks off localhost. */
|
|
2164
2201
|
licence?: string;
|
|
@@ -2664,6 +2701,15 @@ export interface GridState {
|
|
|
2664
2701
|
/** The banded-header tree, when the grid has one (BACKLOG-0000739). */
|
|
2665
2702
|
columnGroups?: ColumnGroupState[];
|
|
2666
2703
|
filters?: FilterSet;
|
|
2704
|
+
/**
|
|
2705
|
+
* The `where` predicates that were in force, as names only (BACKLOG-0001202).
|
|
2706
|
+
* A predicate is host code: it cannot be serialised into a view or restored
|
|
2707
|
+
* from one. `apply` reconciles these against what the host has registered and
|
|
2708
|
+
* reports every name it cannot honour rather than restoring a view that
|
|
2709
|
+
* silently shows more rows than the one that was saved. Absent when none is
|
|
2710
|
+
* registered.
|
|
2711
|
+
*/
|
|
2712
|
+
where?: string[];
|
|
2667
2713
|
quick?: string;
|
|
2668
2714
|
sort?: SortEntry[];
|
|
2669
2715
|
group?: string[];
|
|
@@ -2692,6 +2738,27 @@ export interface StateApplyReport {
|
|
|
2692
2738
|
skipped: { key: string; reason: string }[];
|
|
2693
2739
|
}
|
|
2694
2740
|
|
|
2741
|
+
/**
|
|
2742
|
+
* Every top-level section of a {@link GridState} bar `version` — the
|
|
2743
|
+
* vocabulary `state.apply`'s `skip` list, `StateApplyReport.applied` and
|
|
2744
|
+
* `StateChangedEvent.sections` all speak, derived from `GridState` itself so a
|
|
2745
|
+
* new section cannot appear in one and be missing from the others.
|
|
2746
|
+
*/
|
|
2747
|
+
export type StateSection = Exclude<keyof GridState, 'version'>;
|
|
2748
|
+
|
|
2749
|
+
/**
|
|
2750
|
+
* What caused a `state:changed` (BACKLOG-0001182).
|
|
2751
|
+
*
|
|
2752
|
+
* `'user'` is a change to one part of the view — a sort, a filter, a column
|
|
2753
|
+
* moved, resized, pinned or hidden, a grouping, a page — whether it arrived as
|
|
2754
|
+
* a gesture or as the equivalent API call. `'apply'` is `state.apply()`,
|
|
2755
|
+
* including the restore an undo performs and a `config.state` seed at
|
|
2756
|
+
* construction. `'reset'` is `state.reset()`, and is the one a persistence
|
|
2757
|
+
* layer skips: saving the reset arrangement writes the default straight back
|
|
2758
|
+
* over the view the user had just abandoned.
|
|
2759
|
+
*/
|
|
2760
|
+
export type StateChangeCause = 'user' | 'apply' | 'reset';
|
|
2761
|
+
|
|
2695
2762
|
// ---------------------------------------------------------------------------
|
|
2696
2763
|
// Conditional formatting (spec 8.12)
|
|
2697
2764
|
// ---------------------------------------------------------------------------
|
|
@@ -4191,6 +4258,43 @@ export interface BeforeEvent extends GridEvent {
|
|
|
4191
4258
|
reason: string | null;
|
|
4192
4259
|
}
|
|
4193
4260
|
|
|
4261
|
+
/**
|
|
4262
|
+
* The `state:changed` event (BACKLOG-0001182).
|
|
4263
|
+
*
|
|
4264
|
+
* Fires once per logical state change, whether it began as a user gesture or
|
|
4265
|
+
* as a programmatic call, so view persistence is built on this one event
|
|
4266
|
+
* rather than on the ten individual ones — `reset()` raises those too, which
|
|
4267
|
+
* made a debounced save write the reset arrangement back.
|
|
4268
|
+
*
|
|
4269
|
+
* **Exactly one event per change.** A change that internally routes through
|
|
4270
|
+
* `state.apply()` — applying a saved view, an undo, a reset — announces itself
|
|
4271
|
+
* once, carrying the outermost cause rather than the inner mechanism's.
|
|
4272
|
+
*
|
|
4273
|
+
* **One known gap** (BACKLOG-0001235): a host predicate registered through
|
|
4274
|
+
* `filters.where(name, fn)` changes the `where` section and the rows on screen
|
|
4275
|
+
* without raising this event, so a persistence layer does not yet see it.
|
|
4276
|
+
*/
|
|
4277
|
+
export interface StateChangedEvent extends GridEvent {
|
|
4278
|
+
/** Why the state changed. `'reset'` is the one a save should ignore. */
|
|
4279
|
+
cause: StateChangeCause;
|
|
4280
|
+
/**
|
|
4281
|
+
* Which sections moved, sorted and de-duplicated. For `'apply'` and
|
|
4282
|
+
* `'reset'` these are the sections the report applied; for `'user'`, the
|
|
4283
|
+
* sections the change touches.
|
|
4284
|
+
*/
|
|
4285
|
+
sections: StateSection[];
|
|
4286
|
+
/**
|
|
4287
|
+
* The state that was applied — present for `'apply'` and `'reset'`, null for
|
|
4288
|
+
* `'user'`. A full capture on every gesture would put an unsanitised copy of
|
|
4289
|
+
* the state, hidden column ids and widths included, on the bus for every
|
|
4290
|
+
* listener; a host calls `grid.state.get()` when it decides to write, which
|
|
4291
|
+
* is permission-sanitised.
|
|
4292
|
+
*/
|
|
4293
|
+
state: GridState | null;
|
|
4294
|
+
/** What an apply could not restore; null for `'user'`. */
|
|
4295
|
+
report: StateApplyReport | null;
|
|
4296
|
+
}
|
|
4297
|
+
|
|
4194
4298
|
export type EventHandler = (e: GridEvent) => void;
|
|
4195
4299
|
export type Unsubscribe = () => void;
|
|
4196
4300
|
|
|
@@ -4489,17 +4593,84 @@ export interface CellRange {
|
|
|
4489
4593
|
columns: string[];
|
|
4490
4594
|
}
|
|
4491
4595
|
|
|
4596
|
+
/**
|
|
4597
|
+
* How a `where` predicate is re-evaluated, whether `filters.clear()` may remove
|
|
4598
|
+
* it, and what the source may be told about it (BACKLOG-0001202).
|
|
4599
|
+
*/
|
|
4600
|
+
export interface WhereOptions {
|
|
4601
|
+
/**
|
|
4602
|
+
* The columns the predicate reads, in the same spirit as `value.deps` on a
|
|
4603
|
+
* computed column (§8.4.2). Declared, the verdict is cached per row and
|
|
4604
|
+
* re-run only when one of these columns changes on that row. Omitted, the
|
|
4605
|
+
* predicate is treated as reading the whole row and is called on every pass —
|
|
4606
|
+
* never stale, and never skipped either.
|
|
4607
|
+
*/
|
|
4608
|
+
deps?: string[];
|
|
4609
|
+
/**
|
|
4610
|
+
* Survive `filters.clear()`. For a predicate that is not the user's filter —
|
|
4611
|
+
* row-level permissions, tenant scoping — where a "clear filters" button must
|
|
4612
|
+
* never widen what the user can see.
|
|
4613
|
+
*/
|
|
4614
|
+
pinned?: boolean;
|
|
4615
|
+
/**
|
|
4616
|
+
* A declarative twin of the predicate, pushed to the source while the function
|
|
4617
|
+
* stays as the residual. On a pushdown engine this narrows the fetch instead
|
|
4618
|
+
* of filtering a page client-side. It must be implied by the predicate: the
|
|
4619
|
+
* grid ANDs both, so a twin wider than the function costs only time, while one
|
|
4620
|
+
* narrower than it hides rows the function would have kept.
|
|
4621
|
+
*/
|
|
4622
|
+
condition?: FilterSet;
|
|
4623
|
+
}
|
|
4624
|
+
|
|
4492
4625
|
export interface FiltersApi {
|
|
4493
4626
|
/** The quick filter's text and match mode, for restoring a control. */
|
|
4494
4627
|
quickState(): { text: string; mode: string };
|
|
4495
4628
|
get(): FilterSet;
|
|
4496
4629
|
set(filters: FilterSet): void;
|
|
4630
|
+
/**
|
|
4631
|
+
* Drop the condition tree, the quick filter, and every `where` predicate that
|
|
4632
|
+
* was not registered `{ pinned: true }`.
|
|
4633
|
+
*/
|
|
4497
4634
|
clear(): void;
|
|
4498
4635
|
quick(text: string): void;
|
|
4636
|
+
/** The names of the `where` predicates in force, in registration order. */
|
|
4637
|
+
where(): string[];
|
|
4638
|
+
/**
|
|
4639
|
+
* Register, replace or remove a named row predicate composed with the filter
|
|
4640
|
+
* set (BACKLOG-0001202).
|
|
4641
|
+
*
|
|
4642
|
+
* Registering *is* activating: there is no companion "a predicate is present"
|
|
4643
|
+
* flag to keep in sync, which is the failure mode this replaces. Several may
|
|
4644
|
+
* be in force at once under their own names, ANDed with each other and with
|
|
4645
|
+
* the declarative set, and removing one leaves the rest alone. The predicate
|
|
4646
|
+
* is handed the **data row**.
|
|
4647
|
+
*
|
|
4648
|
+
* grid.filters.where('visibleToMe', row => row.owner === me);
|
|
4649
|
+
* grid.filters.where('rateKnown', row => rates.has(row.ccy),
|
|
4650
|
+
* { deps: ['ccy'], pinned: true });
|
|
4651
|
+
* grid.filters.where('visibleToMe', null); // remove
|
|
4652
|
+
*
|
|
4653
|
+
* Only the names reach `filters.get()` and `state.get()`; the functions never
|
|
4654
|
+
* do.
|
|
4655
|
+
* @param name the name to register under
|
|
4656
|
+
* @param predicate the predicate, or null to remove it
|
|
4657
|
+
* @param opts re-evaluation, pinning, and the pushed-down twin
|
|
4658
|
+
*/
|
|
4659
|
+
where(name: string, predicate: ((row: any) => boolean) | null, opts?: WhereOptions): void;
|
|
4660
|
+
/**
|
|
4661
|
+
* Re-run `where` predicates whose inputs changed where the grid could not see
|
|
4662
|
+
* it — a rate table that arrived late, a permission set that refreshed. The
|
|
4663
|
+
* out-of-band half of re-evaluation; `deps` is the half the grid observes for
|
|
4664
|
+
* itself. Together they replace the manual "filter again" call.
|
|
4665
|
+
* @param name the predicate to re-run; every one when omitted
|
|
4666
|
+
* @returns whether anything was re-run
|
|
4667
|
+
*/
|
|
4668
|
+
reapply(name?: string): boolean;
|
|
4499
4669
|
}
|
|
4500
4670
|
|
|
4501
4671
|
export interface SortApi {
|
|
4502
4672
|
get(): SortEntry[];
|
|
4673
|
+
/** Replace the sort model; an entry naming no known column is dropped with a warning. */
|
|
4503
4674
|
set(entries: SortEntry[]): void;
|
|
4504
4675
|
clear(): void;
|
|
4505
4676
|
}
|
|
@@ -4743,6 +4914,11 @@ export interface SavedView {
|
|
|
4743
4914
|
name: string;
|
|
4744
4915
|
description: string;
|
|
4745
4916
|
shared: boolean;
|
|
4917
|
+
/**
|
|
4918
|
+
* Applied on load when no `config.state` is given. `config.state` wins
|
|
4919
|
+
* outright over this flag: with both present, the default view is never
|
|
4920
|
+
* applied and the active view id stays `null`.
|
|
4921
|
+
*/
|
|
4746
4922
|
isDefault: boolean;
|
|
4747
4923
|
/** Supplied in `config.views.saved`: listed apart, and not renamable or deletable. */
|
|
4748
4924
|
builtin: boolean;
|
|
@@ -5375,7 +5551,11 @@ export interface FindApi {
|
|
|
5375
5551
|
export interface StateApi {
|
|
5376
5552
|
get(): GridState;
|
|
5377
5553
|
apply(state: GridState, opts?: { skip?: (keyof GridState)[] }): StateApplyReport;
|
|
5378
|
-
/**
|
|
5554
|
+
/**
|
|
5555
|
+
* The grid as configured, without `config.state` — captured once, before
|
|
5556
|
+
* that seed is applied, so a view opened through `config.state` is never
|
|
5557
|
+
* itself mistaken for the default `reset()` returns to.
|
|
5558
|
+
*/
|
|
5379
5559
|
baseline(): GridState | null;
|
|
5380
5560
|
/** Put the grid back the way it started, as one undoable step. */
|
|
5381
5561
|
reset(): StateApplyReport | null;
|
|
@@ -7938,7 +8118,15 @@ declare module 'lattice-grid/modules/webcomponent' {
|
|
|
7938
8118
|
* is disconnected.
|
|
7939
8119
|
*/
|
|
7940
8120
|
export function defineLatticeGrid(tag?: string): void;
|
|
7941
|
-
|
|
8121
|
+
/**
|
|
8122
|
+
* Build the `<lattice-grid>` element class. The one argument is the grid
|
|
8123
|
+
* factory the element creates its grid with — `createGrid`-shaped, and
|
|
8124
|
+
* defaulting to it — injectable for tests. Returns the class, or `null`
|
|
8125
|
+
* where `HTMLElement` is undefined (a Node import, a server-side pass).
|
|
8126
|
+
*/
|
|
8127
|
+
export function createLatticeGridElement(
|
|
8128
|
+
factory?: (element: Element, config: GridConfig) => Grid,
|
|
8129
|
+
): typeof HTMLElement | null;
|
|
7942
8130
|
export const TAG_NAME: string;
|
|
7943
8131
|
export const EVENT_PREFIX: string;
|
|
7944
8132
|
export const ATTRIBUTE_CONFIG: Readonly<Record<string, unknown>>;
|
|
@@ -7960,7 +8148,14 @@ declare module 'lattice-grid/modules/htmx' {
|
|
|
7960
8148
|
*/
|
|
7961
8149
|
export function createGrid(element: Element, config: GridConfig): Grid;
|
|
7962
8150
|
export function autoInit(root?: ParentNode): Grid[];
|
|
7963
|
-
|
|
8151
|
+
/**
|
|
8152
|
+
* Wire the htmx lifecycle events on a document: grids are built in each
|
|
8153
|
+
* swapped-in fragment, released before htmx detaches one, and their view
|
|
8154
|
+
* state carried across history navigation. Called once on import against
|
|
8155
|
+
* the global `document`; call it again only for another document. Returns
|
|
8156
|
+
* the function that removes every listener it installed.
|
|
8157
|
+
*/
|
|
8158
|
+
export function attach(doc?: Document): () => void;
|
|
7964
8159
|
export function initWithin(root: ParentNode): Grid[];
|
|
7965
8160
|
export function destroyWithin(root: ParentNode): void;
|
|
7966
8161
|
export function gridElementsWithin(root: ParentNode): Element[];
|
|
@@ -7968,9 +8163,41 @@ declare module 'lattice-grid/modules/htmx' {
|
|
|
7968
8163
|
export function readTable(table: Element): { columns: Column[]; rows: unknown[] };
|
|
7969
8164
|
export function rowsFromFragment(fragment: ParentNode): unknown[];
|
|
7970
8165
|
export function rowsFromJson(text: string): unknown[];
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
8166
|
+
/**
|
|
8167
|
+
* Parse a response into rows by its content type: JSON through
|
|
8168
|
+
* `rowsFromJson`, anything else through `rowsFromFragment` against the
|
|
8169
|
+
* columns given. The fragment arrives already parsed; this never touches
|
|
8170
|
+
* `DOMParser` or `innerHTML`. Returns the rows and, when the body carried
|
|
8171
|
+
* one, the total.
|
|
8172
|
+
*/
|
|
8173
|
+
export function ingestResponse(
|
|
8174
|
+
response: { contentType: string; text?: string; fragment?: ParentNode },
|
|
8175
|
+
columns: { field: string }[],
|
|
8176
|
+
): { rows: unknown[]; total: number | undefined };
|
|
8177
|
+
/**
|
|
8178
|
+
* Drive server-side sort and filter through htmx. `trigger` is the element
|
|
8179
|
+
* carrying the htmx request attributes (`hx-get`, `hx-target`,
|
|
8180
|
+
* `hx-trigger="lattice:query-changed"`); the grid's query parameters are
|
|
8181
|
+
* merged into that element's request and its response ingested. Returns the
|
|
8182
|
+
* function that detaches everything this attached.
|
|
8183
|
+
*/
|
|
8184
|
+
export function driveServerMode(
|
|
8185
|
+
grid: Grid,
|
|
8186
|
+
trigger: Element,
|
|
8187
|
+
opts?: { columns?: { field: string }[] },
|
|
8188
|
+
): () => void;
|
|
8189
|
+
/**
|
|
8190
|
+
* Load rows in chunks as the user nears the end of what is loaded.
|
|
8191
|
+
* `sentinelEl` is the element carrying `hx-get` and
|
|
8192
|
+
* `hx-trigger="revealed, lattice:scroll-near-end"`; `threshold` is how many
|
|
8193
|
+
* rows from the end counts as near (default 20). Returns the function that
|
|
8194
|
+
* detaches everything this attached.
|
|
8195
|
+
*/
|
|
8196
|
+
export function driveInfiniteScroll(
|
|
8197
|
+
grid: Grid,
|
|
8198
|
+
sentinelEl: Element,
|
|
8199
|
+
opts?: { columns?: { field: string }[]; threshold?: number },
|
|
8200
|
+
): () => void;
|
|
7974
8201
|
export function driveOobUpdates(grid: Grid, opts?: object): () => void;
|
|
7975
8202
|
export function serialiseState(grid: Grid): string;
|
|
7976
8203
|
export function restoreState(grid: Grid, state: string): void;
|
|
@@ -8034,7 +8261,12 @@ declare module 'lattice-grid/modules/devtools' {
|
|
|
8034
8261
|
destroy(): void;
|
|
8035
8262
|
};
|
|
8036
8263
|
export function expose(grid: Grid, name?: string): void;
|
|
8037
|
-
|
|
8264
|
+
/**
|
|
8265
|
+
* Whether the console entry point is compiled in. A build that replaces the
|
|
8266
|
+
* activation token with `false` removes the global entirely; in every other
|
|
8267
|
+
* build this is `true`.
|
|
8268
|
+
*/
|
|
8269
|
+
export const CONSOLE_ACTIVATION: boolean;
|
|
8038
8270
|
export default createDevtools;
|
|
8039
8271
|
}
|
|
8040
8272
|
|