@toclocoinc/lattice-grid 1.9.0 → 1.10.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 +6 -5
- package/docs/API.html +202 -5
- package/docs/api-detail.html +1 -1
- package/lattice-grid.d.ts +255 -4
- package/lattice-grid.esm.min.js +789 -116
- package/lattice-grid.min.cjs +784 -116
- package/lattice-grid.min.css +1 -1
- package/lattice-grid.min.js +784 -116
- package/modules/charts.esm.min.js +91 -30
- package/modules/devtools.esm.min.js +1 -1
- package/modules/dhtmlx-compat.esm.min.js +784 -116
- package/modules/htmx.esm.min.js +490 -51
- package/modules/htmx.min.cjs +490 -51
- package/modules/htmx.min.js +490 -51
- 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 +784 -116
- 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.10.0 — type declarations
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
@@ -41,6 +41,11 @@ export type TypeName =
|
|
|
41
41
|
| 'voltage' | 'current' | 'resistance' | 'capacitance' | 'inductance'
|
|
42
42
|
| 'charge' | 'conductance' | 'fluxDensity' | 'luminousFlux' | 'illuminance'
|
|
43
43
|
| 'substance' | 'absorbedDose' | 'equivalentDose' | 'radioactivity' | 'frequency'
|
|
44
|
+
| 'luminousIntensity' | 'doseRate'
|
|
45
|
+
// Units — rate, ratio and process
|
|
46
|
+
| 'rpm' | 'angularVelocity' | 'ppm' | 'ppb' | 'basisPoints'
|
|
47
|
+
| 'molarity' | 'massFlow' | 'tonnesPerHour'
|
|
48
|
+
| 'viscosity' | 'kinematicViscosity' | 'thermalConductivity' | 'specificHeat'
|
|
44
49
|
// Temperature, which is affine rather than multiplicative
|
|
45
50
|
| 'celsius' | 'fahrenheit' | 'kelvin'
|
|
46
51
|
| (string & {});
|
|
@@ -388,8 +393,8 @@ export type RendererName =
|
|
|
388
393
|
export type EditorName =
|
|
389
394
|
| 'checkbox' | 'code' | 'colour' | 'date' | 'datetime' | 'duration' | 'iconPicker'
|
|
390
395
|
| 'ipaddress' | 'multiSelect' | 'number' | 'objectPicker' | 'password' | 'radix'
|
|
391
|
-
| 'rating' | 'segmented' | 'select' | 'slider' | '
|
|
392
|
-
| 'treeSelect' | 'unit' | (string & {});
|
|
396
|
+
| 'rating' | 'segmented' | 'select' | 'slider' | 'temperature' | 'text' | 'textarea'
|
|
397
|
+
| 'time' | 'treeSelect' | 'unit' | (string & {});
|
|
393
398
|
|
|
394
399
|
export interface EditorParams extends CellParams {
|
|
395
400
|
stop(cancel?: boolean): void;
|
|
@@ -752,8 +757,62 @@ export interface StreamSourceConfig {
|
|
|
752
757
|
coalesceMs?: number;
|
|
753
758
|
}
|
|
754
759
|
|
|
760
|
+
/** One reduced column of a derived grid. */
|
|
761
|
+
export interface DerivedSelect {
|
|
762
|
+
/** The column to reduce, as a field name or a dotted path. Omit for `count`. */
|
|
763
|
+
of?: string;
|
|
764
|
+
/** A key of `TOTAL_FNS` — `sum`, `avg`, `median`, `p95`, `distinct` and the rest. */
|
|
765
|
+
fn?: TotalName;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* A grid whose rows are derived from another grid: aggregated, unnested,
|
|
770
|
+
* filtered, ranked or profiled. Read-only — write to the source instead.
|
|
771
|
+
*/
|
|
772
|
+
export interface DerivedSourceConfig {
|
|
773
|
+
mode: 'derived';
|
|
774
|
+
/**
|
|
775
|
+
* A derived grid keys on `__key`, which the source writes onto every row it
|
|
776
|
+
* produces — the group value, the profiled column, or the source row's own
|
|
777
|
+
* key when nothing is grouped. `config.rowKey` defaults to it, so it need not
|
|
778
|
+
* be set; an explicit `rowKey` still wins.
|
|
779
|
+
*/
|
|
780
|
+
/** The grid to read. */
|
|
781
|
+
from: Grid;
|
|
782
|
+
/** Which of its rows to read. `filtered` by default. */
|
|
783
|
+
follow?: 'filtered' | 'all' | 'selected' | 'grouped';
|
|
784
|
+
|
|
785
|
+
/** An array property to expand, one row per element, before anything else. */
|
|
786
|
+
unnest?: string;
|
|
787
|
+
/** A row predicate, applied before grouping. */
|
|
788
|
+
where?: (row: unknown) => boolean;
|
|
789
|
+
/** Round a date column down to a period, and group on that. */
|
|
790
|
+
bucket?: { of: string; by: 'day' | 'week' | 'month' | 'quarter' | 'year' };
|
|
791
|
+
/** The dimension, or dimensions, to group by. Omit to pass rows through. */
|
|
792
|
+
groupBy?: string | string[];
|
|
793
|
+
/** The reduced columns, by output id. */
|
|
794
|
+
select?: Record<string, DerivedSelect>;
|
|
795
|
+
/** How to order the derived rows before limiting them. */
|
|
796
|
+
sort?: { col: string; dir?: 'asc' | 'desc' }[];
|
|
797
|
+
/** Keep at most this many rows. */
|
|
798
|
+
limit?: number;
|
|
799
|
+
/** Apply `limit` within each distinct value of this column, not overall. */
|
|
800
|
+
limitPer?: string;
|
|
801
|
+
/** Keep rows until their running share of the total reaches `upTo`, 0 to 1. */
|
|
802
|
+
cumulative?: { of: string; upTo: number };
|
|
803
|
+
|
|
804
|
+
/** One row per column, with the statistics as columns. Replaces the pipeline. */
|
|
805
|
+
profile?: string | string[];
|
|
806
|
+
/** With `profile`, emit one row per statistic instead of one per column. */
|
|
807
|
+
orient?: 'columns' | 'metrics';
|
|
808
|
+
|
|
809
|
+
/** When to re-derive. `idle` by default — coalesced to a frame. */
|
|
810
|
+
refresh?: 'live' | 'idle' | 'manual' | number;
|
|
811
|
+
}
|
|
812
|
+
|
|
755
813
|
export type SourceConfig =
|
|
756
|
-
| MemorySourceConfig | PagedSourceConfig | RemoteSourceConfig | StreamSourceConfig
|
|
814
|
+
| MemorySourceConfig | PagedSourceConfig | RemoteSourceConfig | StreamSourceConfig
|
|
815
|
+
| DerivedSourceConfig;
|
|
757
816
|
|
|
758
817
|
// ---------------------------------------------------------------------------
|
|
759
818
|
// Grid configuration (spec 18.1)
|
|
@@ -1028,6 +1087,26 @@ export interface GridConfig {
|
|
|
1028
1087
|
*/
|
|
1029
1088
|
showColumnFunctions?: boolean;
|
|
1030
1089
|
rowHeight?: number | ((row: Row) => number);
|
|
1090
|
+
/**
|
|
1091
|
+
* A caption for the grid, drawn above the column headings.
|
|
1092
|
+
*
|
|
1093
|
+
* Inside the grid rather than an element the host places above it: a title
|
|
1094
|
+
* outside does not scroll with the grid, is not in the region a screen reader
|
|
1095
|
+
* announces, and is left behind by image capture and print.
|
|
1096
|
+
*/
|
|
1097
|
+
title?: string;
|
|
1098
|
+
/**
|
|
1099
|
+
* Draw the column headings at all.
|
|
1100
|
+
*
|
|
1101
|
+
* `true` by default. `false` removes the row, and removes it from the
|
|
1102
|
+
* accessibility tree rather than only from view — a heading a screen reader
|
|
1103
|
+
* still announces is invisible, not hidden. What a small dashboard tile
|
|
1104
|
+
* wants when its `title` already says what the panel is.
|
|
1105
|
+
*
|
|
1106
|
+
* Distinct from `showColumnFunctions`, which keeps the headings and drops
|
|
1107
|
+
* only the sort, filter and menu controls inside them.
|
|
1108
|
+
*/
|
|
1109
|
+
showHeader?: boolean;
|
|
1031
1110
|
headerHeight?: number;
|
|
1032
1111
|
overscan?: number;
|
|
1033
1112
|
/**
|
|
@@ -2753,10 +2832,176 @@ export interface Grid {
|
|
|
2753
2832
|
// Entry points
|
|
2754
2833
|
// ---------------------------------------------------------------------------
|
|
2755
2834
|
|
|
2835
|
+
/** One unit descriptor: a symbol and how many base quantities it is worth. */
|
|
2836
|
+
export interface UnitDescriptor {
|
|
2837
|
+
symbol: string;
|
|
2838
|
+
factor: number;
|
|
2839
|
+
aliases: readonly string[];
|
|
2840
|
+
binary: boolean;
|
|
2841
|
+
prefix: string | null;
|
|
2842
|
+
auto: boolean;
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
/** How a column stores, parses and renders a quantity. */
|
|
2846
|
+
export interface UnitConfig {
|
|
2847
|
+
system?: string;
|
|
2848
|
+
unit?: string;
|
|
2849
|
+
binary?: boolean;
|
|
2850
|
+
decimals?: number;
|
|
2851
|
+
minDecimals?: number;
|
|
2852
|
+
maxDecimals?: number;
|
|
2853
|
+
display?: string;
|
|
2854
|
+
locale?: string;
|
|
2855
|
+
group?: boolean;
|
|
2856
|
+
space?: string;
|
|
2857
|
+
placement?: 'suffix' | 'prefix';
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
export function defineUnit(
|
|
2861
|
+
symbol: string,
|
|
2862
|
+
factor: number,
|
|
2863
|
+
aliases?: readonly string[],
|
|
2864
|
+
opts?: { binary?: boolean; prefix?: string; auto?: boolean },
|
|
2865
|
+
): UnitDescriptor;
|
|
2866
|
+
/** Registers a system of your own. Throws rather than shadowing an existing name. */
|
|
2867
|
+
export function registerUnitSystem(name: string, units: readonly UnitDescriptor[]): string;
|
|
2868
|
+
export function createUnitType(config?: UnitConfig): DataType;
|
|
2869
|
+
export function parseUnit(text: string | number, opts?: UnitConfig): number | null;
|
|
2870
|
+
export function formatUnit(value: number | null | undefined, opts?: UnitConfig): string;
|
|
2871
|
+
export const UNIT_SYSTEMS: Record<string, readonly UnitDescriptor[]>;
|
|
2872
|
+
|
|
2873
|
+
/** How a statistic block finds the number it reports. */
|
|
2874
|
+
export interface StatValueSpec {
|
|
2875
|
+
/** The column to reduce, as a field name or a dotted path. Omit for `count`. */
|
|
2876
|
+
of?: string;
|
|
2877
|
+
/** A key of `TOTAL_FNS` — `sum`, `avg`, `median`, `p95`, `gini` and the rest. */
|
|
2878
|
+
fn?: TotalName;
|
|
2879
|
+
/**
|
|
2880
|
+
* Report this column from the row holding the extreme, rather than the
|
|
2881
|
+
* extreme itself: `{ of: 'sales', fn: 'max', show: 'rep' }` is the *name* of
|
|
2882
|
+
* the best rep. Needs `min` or `max` — no single row holds an average.
|
|
2883
|
+
*/
|
|
2884
|
+
show?: string;
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
/**
|
|
2888
|
+
* A statistic block: a label, a value, its change, and what it is compared with.
|
|
2889
|
+
*
|
|
2890
|
+
* Reads the grid, so it cannot disagree with the table beneath it, and formats
|
|
2891
|
+
* through the column's own type, so the tile and the table cannot drift.
|
|
2892
|
+
*/
|
|
2893
|
+
export interface StatConfig extends StatValueSpec {
|
|
2894
|
+
grid?: Grid;
|
|
2895
|
+
/** An element, or a CSS selector resolved against the grid's document. */
|
|
2896
|
+
container: HTMLElement | string;
|
|
2897
|
+
title?: string;
|
|
2898
|
+
/** A literal value, a spec to reduce, or a function of the grid. */
|
|
2899
|
+
value?: unknown | StatValueSpec | ((grid: Grid) => unknown);
|
|
2900
|
+
/** Text under the value, or a function of it. */
|
|
2901
|
+
footer?: string | ((value: unknown, grid: Grid) => string);
|
|
2902
|
+
/** What the value is compared against, for the change indicator. */
|
|
2903
|
+
baseline?: number | ((grid: Grid) => number);
|
|
2904
|
+
/** Whether a rise is good news. `up` by default. */
|
|
2905
|
+
goodWhen?: 'up' | 'down' | 'neither';
|
|
2906
|
+
/** Which rows feed the value. `filtered` by default. */
|
|
2907
|
+
scope?: 'filtered' | 'all' | 'selected';
|
|
2908
|
+
/** `false` stops the tile following the grid; `refresh()` still works. */
|
|
2909
|
+
live?: boolean;
|
|
2910
|
+
/** Override the formatting the column's type would apply. */
|
|
2911
|
+
format?: (value: unknown, grid: Grid) => string;
|
|
2912
|
+
/** Shown when there is no value. `—` by default. */
|
|
2913
|
+
empty?: string;
|
|
2914
|
+
/** Fraction digits for a value whose reduction changed the unit. 2 by default. */
|
|
2915
|
+
decimals?: number;
|
|
2916
|
+
/** Extra class names for the tile's root. */
|
|
2917
|
+
class?: string;
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
/** The handle `createStat` returns. */
|
|
2921
|
+
export interface Stat {
|
|
2922
|
+
element(): HTMLElement | null;
|
|
2923
|
+
value(): unknown;
|
|
2924
|
+
refresh(): void;
|
|
2925
|
+
destroy(): void;
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
export function createStat(config: StatConfig): Stat;
|
|
2929
|
+
export function deltaOf(value: number | null, baseline: number | null):
|
|
2930
|
+
{ direction: 'up' | 'down' | 'flat'; change: number | null; percent: number | null };
|
|
2931
|
+
export function toneOf(direction: string, goodWhen: string): 'good' | 'bad' | 'flat';
|
|
2932
|
+
|
|
2756
2933
|
export function createGrid(element: HTMLElement, config?: GridConfig): Grid;
|
|
2757
2934
|
export function createHeadlessGrid(config?: GridConfig): Grid;
|
|
2758
2935
|
export function registerModules(modules: GridModule[], opts?: { licence?: string }): void;
|
|
2759
2936
|
export function setLicence(licence: string): LicenceInfo;
|
|
2937
|
+
|
|
2938
|
+
/**
|
|
2939
|
+
* American spellings of the licence functions, exported alongside the British
|
|
2940
|
+
* ones because a host that writes `license` everywhere else should not have to
|
|
2941
|
+
* remember which spelling this one API uses.
|
|
2942
|
+
*/
|
|
2943
|
+
export const setLicense: typeof setLicence;
|
|
2944
|
+
export function licenceInfo(): LicenceInfo;
|
|
2945
|
+
export const licenseInfo: typeof licenceInfo;
|
|
2946
|
+
export function licenceState(): LicenceInfo;
|
|
2947
|
+
export const licenseState: typeof licenceState;
|
|
2948
|
+
|
|
2949
|
+
/**
|
|
2950
|
+
* Compile a formatting rule list into a style function.
|
|
2951
|
+
*
|
|
2952
|
+
* `stats` supplies the column summary the distribution operators need — the
|
|
2953
|
+
* top decile, the outliers, two deviations from the mean. Without it those
|
|
2954
|
+
* rules cannot be answered and are skipped.
|
|
2955
|
+
*/
|
|
2956
|
+
export function compileRules(
|
|
2957
|
+
rules: FormattingRule[],
|
|
2958
|
+
stats?: object | null,
|
|
2959
|
+
): (p: CellParams) => CellStyle | null;
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* Browser-storage backing for saved views.
|
|
2963
|
+
*
|
|
2964
|
+
* Returns null where no usable storage exists — a private window, or a browser
|
|
2965
|
+
* with site data blocked — so a caller can fall back rather than throw.
|
|
2966
|
+
*/
|
|
2967
|
+
export function createLocalViewStorage(opts?: {
|
|
2968
|
+
key?: string;
|
|
2969
|
+
storage?: { getItem: Function; setItem: Function };
|
|
2970
|
+
}): { read(): object[] | null; write(views: object[]): void } | null;
|
|
2971
|
+
|
|
2972
|
+
/** Build a data type for hexadecimal, binary or octal values. */
|
|
2973
|
+
export function createRadixType(config?: object | string): DataType;
|
|
2974
|
+
|
|
2975
|
+
/** Build a column store from row objects, off the main thread where available. */
|
|
2976
|
+
export function ingest(
|
|
2977
|
+
rows: unknown[],
|
|
2978
|
+
plan?: object,
|
|
2979
|
+
opts?: object,
|
|
2980
|
+
): Promise<{ store: object; schema: object[]; decisions: object[] }>;
|
|
2981
|
+
/** The synchronous form of {@link ingest}. */
|
|
2982
|
+
export function ingestSync(
|
|
2983
|
+
rows: unknown[],
|
|
2984
|
+
plan?: object,
|
|
2985
|
+
opts?: object,
|
|
2986
|
+
): { store: object; schema: object[]; decisions: object[] };
|
|
2987
|
+
|
|
2988
|
+
/** Mount one tool panel into an element of your own, outside the grid's rail. */
|
|
2989
|
+
export function mountPanel(opts: {
|
|
2990
|
+
grid: Grid;
|
|
2991
|
+
panel: string | Function;
|
|
2992
|
+
container: Element;
|
|
2993
|
+
}): { element: HTMLElement; refresh(): void; destroy(): void };
|
|
2994
|
+
|
|
2995
|
+
/** The column names a compiled formula reads, deduplicated. */
|
|
2996
|
+
export function referencesOf(node: object): string[];
|
|
2997
|
+
|
|
2998
|
+
/** The right-click menu, for a host that drives it directly. */
|
|
2999
|
+
export class ContextMenu {
|
|
3000
|
+
constructor(opts?: object);
|
|
3001
|
+
open(p: object): void;
|
|
3002
|
+
close(): void;
|
|
3003
|
+
destroy(): void;
|
|
3004
|
+
}
|
|
2760
3005
|
export function version(): string;
|
|
2761
3006
|
|
|
2762
3007
|
export const LatticeGrid: {
|
|
@@ -2765,6 +3010,12 @@ export const LatticeGrid: {
|
|
|
2765
3010
|
registerModules: typeof registerModules;
|
|
2766
3011
|
setLicence: typeof setLicence;
|
|
2767
3012
|
version: typeof version;
|
|
3013
|
+
createUnitType: typeof createUnitType;
|
|
3014
|
+
registerUnitSystem: typeof registerUnitSystem;
|
|
3015
|
+
defineUnit: typeof defineUnit;
|
|
3016
|
+
parseUnit: typeof parseUnit;
|
|
3017
|
+
formatUnit: typeof formatUnit;
|
|
3018
|
+
UNIT_SYSTEMS: typeof UNIT_SYSTEMS;
|
|
2768
3019
|
};
|
|
2769
3020
|
|
|
2770
3021
|
export default LatticeGrid;
|