@toclocoinc/lattice-grid 1.12.2 → 1.13.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 +56 -13
- package/docs/API.html +221 -10
- package/docs/CHART-CODES.md +1 -1
- package/docs/api-detail.html +488 -40
- package/lattice-grid.d.ts +185 -7
- package/lattice-grid.esm.min.js +684 -46
- package/lattice-grid.min.cjs +667 -46
- package/lattice-grid.min.js +667 -46
- package/modules/charts.esm.min.js +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/dhtmlx-compat.esm.min.js +667 -46
- package/modules/htmx.esm.min.js +650 -46
- package/modules/htmx.min.cjs +650 -46
- package/modules/htmx.min.js +650 -46
- package/modules/react.esm.min.js +1 -1
- package/modules/svelte.esm.min.js +1 -1
- package/modules/vue.esm.min.js +1 -1
- package/modules/webcomponent.esm.min.js +667 -46
- package/package.json +1 -1
package/lattice-grid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.
|
|
2
|
+
* Lattice Grid 1.13.0, type declarations
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -507,7 +507,7 @@ export interface ColumnFilterSpec {
|
|
|
507
507
|
|
|
508
508
|
export interface ColumnLayoutSpec {
|
|
509
509
|
/**
|
|
510
|
-
* A pixel width, or a percentage of the grid's inner width as a string
|
|
510
|
+
* A pixel width, or a percentage of the grid's inner width as a string,
|
|
511
511
|
* `'25%'`.
|
|
512
512
|
*
|
|
513
513
|
* A percentage is a share of the *whole* grid. `flex` divides only the space
|
|
@@ -1097,7 +1097,7 @@ export interface GridConfig {
|
|
|
1097
1097
|
*
|
|
1098
1098
|
* The panel opens immediately and fills in when the record arrives; a failure
|
|
1099
1099
|
* offers a retry inside the panel. Save collects the changed fields, writes
|
|
1100
|
-
* the ones that map to columns, and emits `form:saved` with the lot
|
|
1100
|
+
* the ones that map to columns, and emits `form:saved` with the lot,
|
|
1101
1101
|
* persisting is yours.
|
|
1102
1102
|
*
|
|
1103
1103
|
* `trigger: false` leaves opening to `grid.form.open(key)`.
|
|
@@ -1236,7 +1236,7 @@ export interface GridConfig {
|
|
|
1236
1236
|
/**
|
|
1237
1237
|
* Size rows to their content rather than to the density token.
|
|
1238
1238
|
*
|
|
1239
|
-
* Only rows that are actually rendered are ever measured, in both settings
|
|
1239
|
+
* Only rows that are actually rendered are ever measured, in both settings:
|
|
1240
1240
|
* the grid does not lay out rows you cannot see. The difference is what
|
|
1241
1241
|
* happens on a large grid: `true` gives up above ten thousand rows and falls
|
|
1242
1242
|
* back to fixed heights, because a cumulative offset array being patched as
|
|
@@ -1561,7 +1561,7 @@ export interface GridConfig {
|
|
|
1561
1561
|
pivot?: {
|
|
1562
1562
|
enabled?: boolean;
|
|
1563
1563
|
/**
|
|
1564
|
-
* Add a column group totalling every value column across all pivot values
|
|
1564
|
+
* Add a column group totalling every value column across all pivot values,
|
|
1565
1565
|
* the grand total beside the pivoted ones. `'before'` places it at the near
|
|
1566
1566
|
* edge, `'after'` at the far edge. Omitted or `false` adds none.
|
|
1567
1567
|
*/
|
|
@@ -1721,6 +1721,53 @@ export interface CapabilityInterval {
|
|
|
1721
1721
|
confidence: number;
|
|
1722
1722
|
}
|
|
1723
1723
|
|
|
1724
|
+
/** What a pushdown adapter can answer. Everything is off unless declared. */
|
|
1725
|
+
export interface PushdownCapabilities {
|
|
1726
|
+
/** `false`, a single field and term, a flat conjunction, or a full tree. */
|
|
1727
|
+
filter?: false | 'term' | 'flat' | 'tree';
|
|
1728
|
+
/** Which comparison operators the engine understands. */
|
|
1729
|
+
operators?: string[];
|
|
1730
|
+
/** `false`, one column only, or many. */
|
|
1731
|
+
sort?: false | 'single' | 'multi';
|
|
1732
|
+
/** Whether a free-text search across columns can be pushed. */
|
|
1733
|
+
quick?: boolean;
|
|
1734
|
+
/** Whether the engine can return a window rather than the whole result. */
|
|
1735
|
+
range?: boolean;
|
|
1736
|
+
/** Whether it can report the count of matching rows. */
|
|
1737
|
+
total?: boolean;
|
|
1738
|
+
/** Whether it can group and aggregate. */
|
|
1739
|
+
group?: boolean;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
/** An engine the grid can query, and what it is able to answer. */
|
|
1743
|
+
export interface PushdownAdapter {
|
|
1744
|
+
/** Used in diagnostics and in the message when work cannot be pushed. */
|
|
1745
|
+
name?: string;
|
|
1746
|
+
capabilities?: PushdownCapabilities;
|
|
1747
|
+
/** Run the part of the query the adapter declared it could handle. */
|
|
1748
|
+
execute(query: RemoteRequest, request?: RemoteRequest):
|
|
1749
|
+
Promise<{ rows: unknown[]; total?: number }>;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
/** How one request was divided between the engine and the grid. */
|
|
1753
|
+
export interface PushdownPlan {
|
|
1754
|
+
/** The query the adapter was given. */
|
|
1755
|
+
pushed: RemoteRequest;
|
|
1756
|
+
/** What the grid applied afterwards. */
|
|
1757
|
+
residual: { filters: object | null; sort: SortEntry[] | null; quick: string };
|
|
1758
|
+
/** Whether the whole result had to be fetched rather than a window. */
|
|
1759
|
+
needsAll: boolean;
|
|
1760
|
+
/** Which parts could not be pushed: `filter`, `sort`, `quick`. */
|
|
1761
|
+
unpushed: string[];
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
export interface PushdownSourceConfig {
|
|
1765
|
+
adapter: PushdownAdapter;
|
|
1766
|
+
/** The compute barrel, for applying whatever the engine could not. */
|
|
1767
|
+
compute?: object;
|
|
1768
|
+
pageSize?: number;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1724
1771
|
export interface StatisticsApi {
|
|
1725
1772
|
/** One shadow value for one row, by the column it shadows and the kind. */
|
|
1726
1773
|
shadow(colId: string, kind: ShadowKind, rowKey: string, scope?: 'all' | 'filtered'): unknown;
|
|
@@ -1773,7 +1820,7 @@ export interface StatisticsApi {
|
|
|
1773
1820
|
where?: (value: unknown, row: Row) => boolean;
|
|
1774
1821
|
}): ConfidenceInterval | ProportionInterval | null;
|
|
1775
1822
|
/**
|
|
1776
|
-
* How a column varies along an ordering. `by` is required and never guessed
|
|
1823
|
+
* How a column varies along an ordering. `by` is required and never guessed:
|
|
1777
1824
|
* kernels see rows in the order they arrived, which is not the grid's sort.
|
|
1778
1825
|
*/
|
|
1779
1826
|
series(colId: string, opts: { by: string; periodsPerYear?: number }): SeriesStats | null;
|
|
@@ -3191,6 +3238,137 @@ export function deltaOf(value: number | null, baseline: number | null):
|
|
|
3191
3238
|
{ direction: 'up' | 'down' | 'flat'; change: number | null; percent: number | null };
|
|
3192
3239
|
export function toneOf(direction: string, goodWhen: string): 'good' | 'bad' | 'flat';
|
|
3193
3240
|
|
|
3241
|
+
/**
|
|
3242
|
+
* Build a source configuration from a pushdown adapter. The result is an
|
|
3243
|
+
* ordinary remote source, so block caching, abort on supersede and group-level
|
|
3244
|
+
* fetching all apply unchanged.
|
|
3245
|
+
*/
|
|
3246
|
+
export function createPushdownSource(
|
|
3247
|
+
config: PushdownSourceConfig,
|
|
3248
|
+
): SourceConfig & { lastPlan(): PushdownPlan | null };
|
|
3249
|
+
|
|
3250
|
+
/**
|
|
3251
|
+
* The capability set an adapter that declares nothing is treated as having:
|
|
3252
|
+
* everything off. Such an adapter still works, and the grid does all the work.
|
|
3253
|
+
*/
|
|
3254
|
+
export const NO_CAPABILITIES: Readonly<Required<PushdownCapabilities>>;
|
|
3255
|
+
|
|
3256
|
+
/**
|
|
3257
|
+
* Resolve what an adapter says it can do against the defaults, giving a
|
|
3258
|
+
* complete capability set with no absent keys to test for.
|
|
3259
|
+
*/
|
|
3260
|
+
export function capabilitiesOf(declared?: PushdownCapabilities): Required<PushdownCapabilities>;
|
|
3261
|
+
|
|
3262
|
+
/**
|
|
3263
|
+
* Split a filter tree into the half the engine takes and the half left over.
|
|
3264
|
+
*
|
|
3265
|
+
* The two halves are not symmetric. An `and` group narrows with each condition,
|
|
3266
|
+
* so the supported conjuncts can be pushed and the rest kept back: the engine
|
|
3267
|
+
* returns a superset and the grid narrows it. An `or` group widens with each
|
|
3268
|
+
* branch, so pushing only the supported branches would return fewer rows than
|
|
3269
|
+
* the filter allows and the grid could not recover what was never fetched. A
|
|
3270
|
+
* disjunction that is not fully supported therefore stays whole on the client.
|
|
3271
|
+
*/
|
|
3272
|
+
export function splitFilters(
|
|
3273
|
+
filters: object | null,
|
|
3274
|
+
caps: Required<PushdownCapabilities>,
|
|
3275
|
+
): { pushed: object | null; residual: object | null };
|
|
3276
|
+
|
|
3277
|
+
/**
|
|
3278
|
+
* Plan one request against what the adapter can do, giving the query to send
|
|
3279
|
+
* and the work to finish afterwards.
|
|
3280
|
+
*
|
|
3281
|
+
* When anything is left over, `needsAll` is set and the source asks for the
|
|
3282
|
+
* whole result rather than a window. Filtering a window on the client is not a
|
|
3283
|
+
* slower route to the right answer, it is a fast route to a wrong one: the rows
|
|
3284
|
+
* that belong on page one may sit on page nine, and the total is whatever the
|
|
3285
|
+
* engine happened to count.
|
|
3286
|
+
*/
|
|
3287
|
+
export function planQuery(
|
|
3288
|
+
request: RemoteRequest,
|
|
3289
|
+
caps: Required<PushdownCapabilities>,
|
|
3290
|
+
): PushdownPlan;
|
|
3291
|
+
|
|
3292
|
+
/**
|
|
3293
|
+
* Apply whatever the engine could not, over the rows it returned. This runs
|
|
3294
|
+
* through the grid's own filter and sort kernels rather than a second
|
|
3295
|
+
* implementation, so a residual predicate means exactly what the same predicate
|
|
3296
|
+
* means anywhere else in the grid.
|
|
3297
|
+
*/
|
|
3298
|
+
export function applyResidual(
|
|
3299
|
+
rows: unknown[],
|
|
3300
|
+
residual: PushdownPlan['residual'],
|
|
3301
|
+
compute: object,
|
|
3302
|
+
): unknown[];
|
|
3303
|
+
|
|
3304
|
+
/** An adapter for any OData v4 endpoint. */
|
|
3305
|
+
export function odataAdapter(options: {
|
|
3306
|
+
url: string; fetch?: typeof fetch; headers?: Record<string, string>;
|
|
3307
|
+
count?: boolean; search?: boolean;
|
|
3308
|
+
}): PushdownAdapter & { urlFor(query: RemoteRequest): string };
|
|
3309
|
+
|
|
3310
|
+
/**
|
|
3311
|
+
* An adapter for an ordinary REST endpoint. Parameter names are yours; declare
|
|
3312
|
+
* `operators` only for comparisons the endpoint genuinely applies.
|
|
3313
|
+
*/
|
|
3314
|
+
export function restAdapter(options: {
|
|
3315
|
+
url: string; fetch?: typeof fetch; headers?: Record<string, string>;
|
|
3316
|
+
params?: Partial<Record<'offset' | 'limit' | 'sort' | 'order' | 'filter' | 'search', string>>;
|
|
3317
|
+
capabilities?: PushdownCapabilities; operators?: string[];
|
|
3318
|
+
encodeFilter?: (filters: object) => string;
|
|
3319
|
+
rows?: (body: unknown) => unknown[]; total?: (body: unknown, rows: unknown[]) => number;
|
|
3320
|
+
}): PushdownAdapter & { urlFor(query: RemoteRequest): string };
|
|
3321
|
+
|
|
3322
|
+
/**
|
|
3323
|
+
* An adapter over a DuckDB connection, in the browser through
|
|
3324
|
+
* `@duckdb/duckdb-wasm` or on a server through any DuckDB client.
|
|
3325
|
+
*
|
|
3326
|
+
* The engine is the caller's: this takes a live connection and imports nothing,
|
|
3327
|
+
* so a grid can drive a full analytical engine without the package carrying
|
|
3328
|
+
* one. `from` is any FROM expression, so `read_parquet('s3://bucket/*.parquet')`
|
|
3329
|
+
* is as valid as a table name.
|
|
3330
|
+
*
|
|
3331
|
+
* Values are bound through prepared statements. A connection without `prepare`
|
|
3332
|
+
* is used only for unfiltered queries, because interpolating a user's filter
|
|
3333
|
+
* into SQL is the one thing worse than not filtering.
|
|
3334
|
+
*/
|
|
3335
|
+
export function duckdbAdapter(options: {
|
|
3336
|
+
/** A live connection exposing `query`, and ideally `prepare`. */
|
|
3337
|
+
connection: object;
|
|
3338
|
+
/** A table, a view, or any FROM expression. */
|
|
3339
|
+
from: string;
|
|
3340
|
+
/** Columns to select. Everything by default. */
|
|
3341
|
+
fields?: string[];
|
|
3342
|
+
}): PushdownAdapter & { sqlFor(query: RemoteRequest): { sql: string; params: unknown[] } };
|
|
3343
|
+
|
|
3344
|
+
/**
|
|
3345
|
+
* An adapter for a DemandFlow entity, speaking `POST /v1/query`.
|
|
3346
|
+
*
|
|
3347
|
+
* `comboKey` is the *name* of the key attribute to match on, which is
|
|
3348
|
+
* `'comboKey'` for a standard hierarchy; `query` is the prefix matched against
|
|
3349
|
+
* it, where `'SUB'` alone means every record of the entity in the tenant.
|
|
3350
|
+
*
|
|
3351
|
+
* Every request also sends a `countOnly` line, because `limit` caps rows
|
|
3352
|
+
* scanned rather than matched: a filtered query returns an arbitrary subset and
|
|
3353
|
+
* the count is the only thing that reveals it.
|
|
3354
|
+
*/
|
|
3355
|
+
export function dfqlAdapter(options: {
|
|
3356
|
+
entity: string;
|
|
3357
|
+
/** A personal access token. Never commit one. */
|
|
3358
|
+
token: string;
|
|
3359
|
+
/** The API base. `https://rest.demandflow.com` by default. */
|
|
3360
|
+
url?: string;
|
|
3361
|
+
/** The key attribute to match on: `comboKey`, `comboKey2` or `comboKey3`. */
|
|
3362
|
+
comboKey?: string;
|
|
3363
|
+
/** The prefix to match against it. `SUB` by default. */
|
|
3364
|
+
query?: string;
|
|
3365
|
+
/** Fields to project, which saves bandwidth but not query cost. */
|
|
3366
|
+
load?: string[];
|
|
3367
|
+
limit?: number;
|
|
3368
|
+
fetch?: typeof fetch;
|
|
3369
|
+
headers?: Record<string, string>;
|
|
3370
|
+
}): PushdownAdapter & { linesFor(query: RemoteRequest): object[] };
|
|
3371
|
+
|
|
3194
3372
|
export function createGrid(element: HTMLElement, config?: GridConfig): Grid;
|
|
3195
3373
|
export function createHeadlessGrid(config?: GridConfig): Grid;
|
|
3196
3374
|
export function registerModules(modules: GridModule[], opts?: { licence?: string }): void;
|
|
@@ -3594,7 +3772,7 @@ declare module 'lattice-grid/modules/webcomponent' {
|
|
|
3594
3772
|
|
|
3595
3773
|
declare module 'lattice-grid/modules/htmx' {
|
|
3596
3774
|
/**
|
|
3597
|
-
* The htmx integration, which re-exports the base API alongside its own
|
|
3775
|
+
* The htmx integration, which re-exports the base API alongside its own,
|
|
3598
3776
|
* a page using it imports this and never the base package as well.
|
|
3599
3777
|
*/
|
|
3600
3778
|
export function createGrid(element: Element, config: GridConfig): Grid;
|