@freegridjs/core 0.8.1 → 1.0.1

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, L as LocalePack } from './types-e45suTSB.js';
2
- export { A as Aggregator, C as CellEvent, b as CellParams, c as ChartHandle, d as ChartOptions, e as ColumnDef, f as ColumnState, g as ColumnType, h as ContextMenuItem, i as ContextMenuParams, j as CustomEditor, D as Datasource, k as DateFilterModel, l as DateOp, E as EditorParams, m as EditorSpec, n as ExportOptions, F as FilterModel, o as FilterOp, p as FilterType, q as GridEvents, r as GridRange, I as InvalidCell, K as KeyAction, M as Messages, N as NumberFilterModel, s as NumberOp, P as PivotConfig, R as Region, t as Row, u as RowDragOptions, v as RowDropParams, w as RowDropPosition, S as ScrollPosition, x as SelectOption, y as ServerParams, z as SetFilterModel, B as SortDir, H as SortItem, J as SpanParams, O as SummaryCell, Q as SummaryOptions, T as SummaryRowDef, U as TextFilterModel, V as TextOp } from './types-e45suTSB.js';
1
+ import { G as GridOptions, a as GridApi, E as ExportOptions, R as Row, D as Datasource, L as LocalePack } from './types-bFz-Q6ac.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 Region, x as RowDragOptions, y as RowDropParams, z as RowDropPosition, B as RowTransaction, S as SavedGridState, H as SavedStatePart, J as ScrollPosition, O as SelectOption, Q as ServerParams, T as SetFilterModel, U as SortDir, V as SortItem, W as SpanParams, X as SummaryCell, Y as SummaryOptions, Z as SummaryRowDef, _ as TextFilterModel, $ as TextOp, a0 as TransactionResult, a1 as XlsxCell, a2 as XlsxSheet, a3 as readXlsx, a4 as writeXlsx } from './types-bFz-Q6ac.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 = "0.8.1";
8
+ declare const version = "1.0.1";
9
9
 
10
10
  interface LicenseInfo {
11
11
  /** Licensed domains (plus their www. host); `*.example.com` also covers every subdomain. */
@@ -31,44 +31,61 @@ declare function verifyLicense(key: string, host: string, opts?: {
31
31
  /** Set the license key once for every grid on the page. */
32
32
  declare function setLicenseKey(key: string): void;
33
33
 
34
- /** A cell value, optionally with an Excel number format and text styles. Colors are ARGB hex like 'FFDC2626'. */
35
- type XlsxValue = string | number | boolean | Date | null | undefined;
36
- interface XlsxStyle {
37
- fmt?: string;
38
- bold?: boolean;
39
- align?: 'left' | 'center' | 'right';
40
- color?: string;
41
- fill?: string;
42
- /** Header look: bold on a light gray fill. */
43
- header?: boolean;
44
- }
45
- type XlsxCell = XlsxValue | ({
46
- v: XlsxValue;
47
- } & XlsxStyle);
48
- interface XlsxSheet {
49
- name?: string;
50
- rows: XlsxCell[][];
51
- /** Column widths in characters. */
52
- widths?: number[];
53
- /** Ranges like "A1:C1". */
54
- merges?: string[];
55
- /** Rows frozen at the top (also the AutoFilter row when `autoFilter` is set). */
56
- freezeRows?: number;
57
- autoFilter?: boolean;
58
- }
59
- /** Build an .xlsx workbook (stored zip) from rows of values. */
60
- declare function writeXlsx(sheets: XlsxSheet[]): Uint8Array;
61
- interface ReadSheet {
62
- name: string;
63
- rows: XlsxValue[][];
34
+ declare function parseCsv(text: string, sep?: string): string[][];
35
+
36
+ interface WorkbookSheet {
37
+ grid: GridApi;
38
+ sheetName?: string;
39
+ options?: ExportOptions;
64
40
  }
65
- /** Read every sheet of an .xlsx file. Dates come back as Date, numbers as number, booleans as boolean. */
66
- declare function readXlsx(input: ArrayBuffer | Uint8Array): Promise<ReadSheet[]>;
41
+ /** One .xlsx file with a sheet per grid (each with its own columns, rows and options). */
42
+ declare function buildWorkbook(sheets: WorkbookSheet[]): Uint8Array;
43
+ /** Download buildWorkbook(sheets) as `filename`. */
44
+ declare function exportWorkbook(filename: string, sheets: WorkbookSheet[]): void;
67
45
 
68
- declare function parseCsv(text: string, sep?: string): string[][];
46
+ /**
47
+ * Server helpers for REST back ends (Spring Boot, eGovFrame, Express…).
48
+ *
49
+ * Request (POST JSON, or GET query): { start, end, page, size, sort: [{ colId, dir }], filters, quickFilter,
50
+ * advancedFilter?, groupBy?, groupKeys?, ...params }
51
+ * Response: { rows, total } — also { list, totalCount }, { content, totalElements } (Spring Page) or { data, total }.
52
+ */
53
+ interface RestOptions {
54
+ /** 'POST' (default) sends JSON; 'GET' puts the request in the query string. */
55
+ method?: 'GET' | 'POST';
56
+ /** Extra headers (for example csrfHeaders()); a function is called for every request. */
57
+ headers?: Record<string, string> | (() => Record<string, string>);
58
+ /** Default 'same-origin' so session cookies go along. */
59
+ credentials?: RequestCredentials;
60
+ /** Extra fields sent with every request, such as the values of a search form. */
61
+ params?: () => Record<string, unknown>;
62
+ /** Turn the server's JSON into { rows, total } when it uses other names. */
63
+ transform?: (json: unknown) => {
64
+ rows: Row[];
65
+ total?: number;
66
+ };
67
+ }
68
+ /** A datasource that asks your server for each block of rows. */
69
+ declare function restDatasource(url: string, options?: RestOptions): Datasource;
70
+ /**
71
+ * POST { created, updated, deleted } (from getModifiedRows) to `url`. On success the sent changes become the new
72
+ * baseline (commitChanges) and the server's JSON is returned; on failure it throws and the changes stay.
73
+ * Nothing is sent when there are no changes. While a save is in flight, calling again returns that same save;
74
+ * edits made meanwhile stay changes for the next save.
75
+ */
76
+ declare function saveChanges(grid: GridApi, url: string, options?: Omit<RestOptions, 'method' | 'transform'>): Promise<unknown>;
77
+ /**
78
+ * The "search, edit, save" screen: fetch every matching row once (same request as restDatasource, rows 0..maxRows)
79
+ * and put them in the grid with setData, so rows can be added, deleted, sorted and filtered in the browser.
80
+ */
81
+ declare function loadData(grid: GridApi, url: string, options?: RestOptions & {
82
+ maxRows?: number;
83
+ }): Promise<Row[]>;
84
+ /** Spring Security CSRF header from <meta name="_csrf"> and <meta name="_csrf_header">; empty when absent. */
85
+ declare function csrfHeaders(doc?: Document): Record<string, string>;
69
86
 
70
- /** Dependency-free SVG charts: grouped or stacked bars, lines, areas and pies. */
71
- type ChartType = 'bar' | 'stackedBar' | 'line' | 'area' | 'pie';
87
+ /** Dependency-free SVG charts: grouped or stacked bars, lines, areas, pies and donuts, bar + line combos and scatter plots. */
88
+ type ChartType = 'bar' | 'stackedBar' | 'line' | 'area' | 'pie' | 'donut' | 'combo' | 'scatter';
72
89
  interface ChartSpec {
73
90
  type: ChartType;
74
91
  categories: string[];
@@ -86,4 +103,4 @@ declare function renderChart(el: HTMLElement, spec: ChartSpec): void;
86
103
  declare function registerLocale(pack: LocalePack): void;
87
104
  declare function resolveLocale(input?: string | Partial<LocalePack>, navLangs?: readonly string[]): LocalePack;
88
105
 
89
- export { type ChartSpec, type ChartType, GridApi, GridOptions, type LicenseInfo, LocalePack, type XlsxCell, type XlsxSheet, createGrid, parseCsv, readXlsx, registerLocale, renderChart, resolveLocale, setLicenseKey, verifyLicense, version, writeXlsx };
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 };