@freegridjs/core 1.1.0 → 1.6.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.6.0";
9
9
 
10
10
  interface LicenseInfo {
11
11
  /** Licensed domains (plus their www. host); `*.example.com` also covers every subdomain. */
@@ -84,6 +84,73 @@ declare function loadData(grid: GridApi, url: string, options?: RestOptions & {
84
84
  /** Spring Security CSRF header from <meta name="_csrf"> and <meta name="_csrf_header">; empty when absent. */
85
85
  declare function csrfHeaders(doc?: Document): Record<string, string>;
86
86
 
87
+ type LiveStatus = 'connecting' | 'open' | 'paused' | 'closed' | 'error';
88
+ interface LiveOptions {
89
+ /** ws:// or wss:// opens a WebSocket; any other URL an EventSource (server-sent events). */
90
+ url?: string;
91
+ /** Or poll: called every `interval` ms; its result is handled like a message. */
92
+ poll?: () => unknown | Promise<unknown>;
93
+ /** Polling interval in ms (default 2000). */
94
+ interval?: number;
95
+ /** Turn a message into a transaction. Default: JSON text; an array of rows is an upsert; { rows } replaces the data. */
96
+ parse?: (message: unknown) => RowTransaction | Row[] | {
97
+ rows: Row[];
98
+ } | null | undefined;
99
+ /** Reconnect with a growing delay after the connection drops (default true). */
100
+ reconnect?: boolean;
101
+ /** Longest wait between reconnects in ms (default 30000). */
102
+ maxDelay?: number;
103
+ /** Apply right away instead of batching (applyTransactionAsync) — default false. */
104
+ immediate?: boolean;
105
+ /** WebSocket subprotocols. */
106
+ protocols?: string | string[];
107
+ /** EventSource: send cookies to another origin. */
108
+ withCredentials?: boolean;
109
+ /** EventSource event name to listen to (default 'message'). */
110
+ event?: string;
111
+ onStatus?: (status: LiveStatus) => void;
112
+ /** A message that could not be read. */
113
+ onError?: (error: unknown) => void;
114
+ }
115
+ interface LiveConnection {
116
+ readonly status: LiveStatus;
117
+ /** Hold updates (they are kept and applied on resume). */
118
+ pause(): void;
119
+ resume(): void;
120
+ close(): void;
121
+ /** Send a text message (WebSocket only). */
122
+ send(data: string): boolean;
123
+ }
124
+ /** The default reading of a message. */
125
+ declare function messageToTransaction(message: unknown): RowTransaction | {
126
+ rows: Row[];
127
+ } | null;
128
+ /**
129
+ * Keep a grid up to date from a WebSocket, server-sent events or polling.
130
+ * Messages: an array of rows (updated by id, added when new), { add, update, remove, upsert }, or { rows } for all rows.
131
+ * The grid needs getRowId.
132
+ */
133
+ declare function connectLive(api: GridApi, options: LiveOptions): LiveConnection;
134
+
135
+ /** Add a function formulas can call, e.g. registerFormulaFunction('VAT', ([n]) => Number(n) * 0.1). */
136
+ declare function registerFormulaFunction(name: string, fn: (args: unknown[]) => unknown): void;
137
+ /** Names of every function formulas can call. */
138
+ declare function formulaFunctions(): string[];
139
+ /** What a formula can see beyond its own row; the grid provides one per column set. */
140
+ interface FormulaScope {
141
+ /** Every data row in source order. */
142
+ rows(): Row[];
143
+ /** Changes whenever any value may have changed. */
144
+ version(): number;
145
+ /** Formula of a computed column (columns with `formula` and no field), by column id. */
146
+ computed(name: string): string | undefined;
147
+ }
148
+ /**
149
+ * Value of `formula` (starting with '=') for `row`, or an error code like '#REF!'.
150
+ * `memo` holds the fields already worked out in this evaluation, so a=b+b, b=c+c, … stays linear.
151
+ */
152
+ declare function evaluateFormula(formula: string, row: Row, seen?: Set<string>, depth?: number, memo?: Map<string, unknown>, scope?: FormulaScope | null): unknown;
153
+
87
154
  /** Dependency-free SVG charts: grouped or stacked bars, lines, areas, pies and donuts, bar + line combos and scatter plots. */
88
155
  type ChartType = 'bar' | 'stackedBar' | 'line' | 'area' | 'pie' | 'donut' | 'combo' | 'scatter';
89
156
  interface ChartSpec {
@@ -103,4 +170,4 @@ declare function renderChart(el: HTMLElement, spec: ChartSpec): void;
103
170
  declare function registerLocale(pack: LocalePack): void;
104
171
  declare function resolveLocale(input?: string | Partial<LocalePack>, navLangs?: readonly string[]): LocalePack;
105
172
 
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 };
173
+ 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, connectLive, createGrid, csrfHeaders, evaluateFormula, exportWorkbook, formulaFunctions, loadData, messageToTransaction, parseCsv, registerFormulaFunction, registerLocale, renderChart, resolveLocale, restDatasource, saveChanges, setLicenseKey, verifyLicense, version };