@freegridjs/core 1.1.0 → 1.7.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/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { G as GridOptions, a as GridApi, E as ExportOptions, R as Row, D as Datasource, L as LocalePack } from './types-BDvXVuCe.js';
2
- export { A as AdvancedFilter, b as AdvancedFilterCondition, c as Aggregator, C as CellEvent, d as CellParams, e as ChartHandle, f as ChartOptions, g as ColumnDef, h as ColumnState, i as ColumnType, j as CombinedFilterModel, k as ContextMenuItem, l as ContextMenuParams, m as CustomEditor, n as DateFilterModel, o as DateOp, p as EditorParams, q as EditorSpec, F as FilterModel, r as FilterOp, s as FilterType, t as GridEvents, u as GridRange, I as InvalidCell, K as KeyAction, M as Messages, N as NumberFilterModel, v as NumberOp, P as PivotConfig, w as PrintOptions, x as Region, y as RowDragOptions, z as RowDropParams, B as RowDropPosition, H as RowTransaction, S as SavedGridState, J as SavedStatePart, O as ScrollPosition, Q as SelectOption, T as ServerParams, U as SetFilterModel, V as SortDir, W as SortItem, X as SpanParams, Y as SummaryCell, Z as SummaryOptions, _ as SummaryRowDef, $ as TextFilterModel, a0 as TextOp, a1 as TransactionResult, a2 as XlsxCell, a3 as XlsxSheet, a4 as readXlsx, a5 as writeXlsx } from './types-BDvXVuCe.js';
1
+ import { G as GridOptions, a as GridApi, E as ExportOptions, R as Row, D as Datasource, b as RowTransaction, L as LocalePack } from './types-DPOWDM8R.js';
2
+ export { A as AdvancedFilter, c as AdvancedFilterCondition, d as Aggregator, e as AssistantAction, f as AssistantColumn, g as AssistantOptions, h as AssistantRequest, i as AssistantResult, C as CellEvent, j as CellParams, k as CellStyle, l as ChartHandle, m as ChartOptions, n as ColumnDef, o as ColumnState, p as ColumnType, q as CombinedFilterModel, r as ConditionalFormat, s as ConditionalFormatType, t as ConditionalOp, u as ContextMenuItem, v as ContextMenuParams, w as CustomEditor, x as DateFilterModel, y as DateOp, z as EditorParams, B as EditorSpec, F as FilterModel, H as FilterOp, I as FilterType, J as GridEvents, K as GridRange, M as InvalidCell, N as JsonExportOptions, O as KeyAction, P as Messages, Q as NumberFilterModel, S as NumberOp, T as PdfOptions, U as PivotConfig, V as PrintOptions, W as Region, X as RowDragOptions, Y as RowDropParams, Z as RowDropPosition, _ as SavedGridState, $ as SavedStatePart, a0 as ScrollPosition, a1 as SelectOption, a2 as ServerParams, a3 as SetFilterModel, a4 as SortDir, a5 as SortItem, a6 as SpanParams, a7 as SummaryCell, a8 as SummaryOptions, a9 as SummaryRowDef, aa as TextFilterModel, ab as TextOp, ac as TransactionResult, ad as XlsxCell, ae as XlsxSheet, af as readXlsx, ag as writeXlsx } from './types-DPOWDM8R.js';
3
3
  export { default as en } from './locales/en.js';
4
4
 
5
5
  declare function createGrid(host: HTMLElement, options: GridOptions): GridApi;
6
6
 
7
7
  /** FreeGrid version (kept in sync with releases.json by scripts/release.mjs). */
8
- declare const version = "1.1.0";
8
+ declare const version = "1.7.0";
9
9
 
10
10
  interface LicenseInfo {
11
11
  /** Licensed domains (plus their www. host); `*.example.com` also covers every subdomain. */
@@ -14,19 +14,22 @@ interface LicenseInfo {
14
14
  /** Last valid day, YYYY-MM-DD. */
15
15
  expires: string;
16
16
  issued: string;
17
+ /** Perpetual keys: the major version they cover (bought on 1.x → every 1.x release). Absent: every version while valid. */
18
+ major?: number;
17
19
  }
18
20
  type LicenseResult = {
19
21
  ok: true;
20
22
  info: LicenseInfo;
21
23
  } | {
22
24
  ok: false;
23
- reason: 'format' | 'signature' | 'expired' | 'domain' | 'unsupported';
25
+ reason: 'format' | 'signature' | 'expired' | 'domain' | 'version' | 'unsupported';
24
26
  info?: LicenseInfo;
25
27
  };
26
- /** Check a key's signature, expiry and domain. */
28
+ /** Check a key's signature, expiry, domain and (perpetual keys) the major version. */
27
29
  declare function verifyLicense(key: string, host: string, opts?: {
28
30
  publicKey?: JsonWebKey;
29
31
  now?: Date;
32
+ version?: string;
30
33
  }): Promise<LicenseResult>;
31
34
  /** Set the license key once for every grid on the page. */
32
35
  declare function setLicenseKey(key: string): void;
@@ -84,6 +87,79 @@ declare function loadData(grid: GridApi, url: string, options?: RestOptions & {
84
87
  /** Spring Security CSRF header from <meta name="_csrf"> and <meta name="_csrf_header">; empty when absent. */
85
88
  declare function csrfHeaders(doc?: Document): Record<string, string>;
86
89
 
90
+ type LiveStatus = 'connecting' | 'open' | 'paused' | 'closed' | 'error';
91
+ interface LiveOptions {
92
+ /** ws:// or wss:// opens a WebSocket; any other URL an EventSource (server-sent events). */
93
+ url?: string;
94
+ /** Or poll: called every `interval` ms; its result is handled like a message. */
95
+ poll?: () => unknown | Promise<unknown>;
96
+ /** Polling interval in ms (default 2000). */
97
+ interval?: number;
98
+ /** Turn a message into a transaction. Default: JSON text; an array of rows is an upsert; { rows } replaces the data. */
99
+ parse?: (message: unknown) => RowTransaction | Row[] | {
100
+ rows: Row[];
101
+ } | null | undefined;
102
+ /** Reconnect with a growing delay after the connection drops (default true). */
103
+ reconnect?: boolean;
104
+ /** Longest wait between reconnects in ms (default 30000). */
105
+ maxDelay?: number;
106
+ /** Apply right away instead of batching (applyTransactionAsync) — default false. */
107
+ immediate?: boolean;
108
+ /** WebSocket subprotocols. */
109
+ protocols?: string | string[];
110
+ /** EventSource: send cookies to another origin. */
111
+ withCredentials?: boolean;
112
+ /** EventSource event name to listen to (default 'message'). */
113
+ event?: string;
114
+ onStatus?: (status: LiveStatus) => void;
115
+ /** A message that could not be read. */
116
+ onError?: (error: unknown) => void;
117
+ }
118
+ interface LiveConnection {
119
+ readonly status: LiveStatus;
120
+ /** Hold updates (they are kept and applied on resume). */
121
+ pause(): void;
122
+ resume(): void;
123
+ close(): void;
124
+ /** Send a text message (WebSocket only). */
125
+ send(data: string): boolean;
126
+ }
127
+ /** The default reading of a message. */
128
+ declare function messageToTransaction(message: unknown): RowTransaction | {
129
+ rows: Row[];
130
+ } | null;
131
+ /**
132
+ * Keep a grid up to date from a WebSocket, server-sent events or polling.
133
+ * Messages: an array of rows (updated by id, added when new), { add, update, remove, upsert }, or { rows } for all rows.
134
+ * The grid needs getRowId.
135
+ */
136
+ declare function connectLive(api: GridApi, options: LiveOptions): LiveConnection;
137
+
138
+ /**
139
+ * Remembers the last value given for an option. Framework wrappers use it so that a parent writing
140
+ * `groupBy={['country']}` inline (a new array on every render) applies it only when its content changes.
141
+ */
142
+ declare function changeTracker(initial: unknown): (next: unknown) => boolean;
143
+
144
+ /** Add a function formulas can call, e.g. registerFormulaFunction('VAT', ([n]) => Number(n) * 0.1). */
145
+ declare function registerFormulaFunction(name: string, fn: (args: unknown[]) => unknown): void;
146
+ /** Names of every function formulas can call. */
147
+ declare function formulaFunctions(): string[];
148
+ /** What a formula can see beyond its own row; the grid provides one per column set. */
149
+ interface FormulaScope {
150
+ /** Every data row in source order. */
151
+ rows(): Row[];
152
+ /** Changes whenever any value may have changed. */
153
+ version(): number;
154
+ /** Formula of a computed column (columns with `formula` and no field), by column id. */
155
+ computed(name: string): string | undefined;
156
+ }
157
+ /**
158
+ * Value of `formula` (starting with '=') for `row`, or an error code like '#REF!'.
159
+ * `memo` holds the fields already worked out in this evaluation, so a=b+b, b=c+c, … stays linear.
160
+ */
161
+ declare function evaluateFormula(formula: string, row: Row, seen?: Set<string>, depth?: number, memo?: Map<string, unknown>, scope?: FormulaScope | null): unknown;
162
+
87
163
  /** Dependency-free SVG charts: grouped or stacked bars, lines, areas, pies and donuts, bar + line combos and scatter plots. */
88
164
  type ChartType = 'bar' | 'stackedBar' | 'line' | 'area' | 'pie' | 'donut' | 'combo' | 'scatter';
89
165
  interface ChartSpec {
@@ -103,4 +179,4 @@ declare function renderChart(el: HTMLElement, spec: ChartSpec): void;
103
179
  declare function registerLocale(pack: LocalePack): void;
104
180
  declare function resolveLocale(input?: string | Partial<LocalePack>, navLangs?: readonly string[]): LocalePack;
105
181
 
106
- export { type ChartSpec, type ChartType, Datasource, ExportOptions, GridApi, GridOptions, type LicenseInfo, LocalePack, type RestOptions, Row, type WorkbookSheet, buildWorkbook, createGrid, csrfHeaders, exportWorkbook, loadData, parseCsv, registerLocale, renderChart, resolveLocale, restDatasource, saveChanges, setLicenseKey, verifyLicense, version };
182
+ export { type ChartSpec, type ChartType, Datasource, ExportOptions, GridApi, GridOptions, type LicenseInfo, type LiveConnection, type LiveOptions, type LiveStatus, LocalePack, type RestOptions, Row, RowTransaction, type WorkbookSheet, buildWorkbook, changeTracker, connectLive, createGrid, csrfHeaders, evaluateFormula, exportWorkbook, formulaFunctions, loadData, messageToTransaction, parseCsv, registerFormulaFunction, registerLocale, renderChart, resolveLocale, restDatasource, saveChanges, setLicenseKey, verifyLicense, version };