@freegridjs/core 0.1.0 → 0.7.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/LICENSE +72 -21
- package/README.md +18 -5
- package/dist/cdn/freegrid.css +178 -1
- package/dist/cdn/freegrid.esm.js +8 -1
- package/dist/cdn/freegrid.min.js +8 -1
- package/dist/index.d.ts +75 -3
- package/dist/index.js +4597 -376
- package/dist/locales/de.d.ts +1 -1
- package/dist/locales/de.js +53 -0
- package/dist/locales/en.d.ts +1 -1
- package/dist/locales/en.js +53 -0
- package/dist/locales/es.d.ts +1 -1
- package/dist/locales/es.js +53 -0
- package/dist/locales/fr.d.ts +1 -1
- package/dist/locales/fr.js +53 -0
- package/dist/locales/ja.d.ts +1 -1
- package/dist/locales/ja.js +53 -0
- package/dist/locales/ko.d.ts +1 -1
- package/dist/locales/ko.js +53 -0
- package/dist/locales/zh-CN.d.ts +1 -1
- package/dist/locales/zh-CN.js +53 -0
- package/dist/styles.css +178 -1
- package/dist/types-CusLVNhk.d.ts +604 -0
- package/package.json +3 -3
- package/dist/types-vxZQWo_S.d.ts +0 -226
package/dist/types-vxZQWo_S.d.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
type Row = Record<string, any>;
|
|
2
|
-
type Region = 'left' | 'center' | 'right';
|
|
3
|
-
type ColumnType = 'text' | 'number' | 'date' | 'boolean';
|
|
4
|
-
type FilterType = 'text' | 'number' | 'date' | 'set';
|
|
5
|
-
type SortDir = 'asc' | 'desc';
|
|
6
|
-
type TextOp = 'contains' | 'equals' | 'notEquals' | 'startsWith' | 'endsWith' | 'blank' | 'notBlank';
|
|
7
|
-
type NumberOp = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'blank' | 'notBlank';
|
|
8
|
-
type DateOp = 'equals' | 'before' | 'after' | 'between' | 'blank' | 'notBlank';
|
|
9
|
-
type FilterOp = TextOp | NumberOp | DateOp;
|
|
10
|
-
interface TextFilterModel {
|
|
11
|
-
type: 'text';
|
|
12
|
-
op: TextOp;
|
|
13
|
-
value?: string;
|
|
14
|
-
}
|
|
15
|
-
interface NumberFilterModel {
|
|
16
|
-
type: 'number';
|
|
17
|
-
op: NumberOp;
|
|
18
|
-
value?: number;
|
|
19
|
-
valueTo?: number;
|
|
20
|
-
}
|
|
21
|
-
/** Dates are compared as local `YYYY-MM-DD` keys. */
|
|
22
|
-
interface DateFilterModel {
|
|
23
|
-
type: 'date';
|
|
24
|
-
op: DateOp;
|
|
25
|
-
value?: string;
|
|
26
|
-
valueTo?: string;
|
|
27
|
-
}
|
|
28
|
-
/** Rows pass when their value is one of `values`. */
|
|
29
|
-
interface SetFilterModel {
|
|
30
|
-
type: 'set';
|
|
31
|
-
values: unknown[];
|
|
32
|
-
}
|
|
33
|
-
type FilterModel = TextFilterModel | NumberFilterModel | DateFilterModel | SetFilterModel;
|
|
34
|
-
interface SortItem {
|
|
35
|
-
colId: string;
|
|
36
|
-
dir: SortDir;
|
|
37
|
-
}
|
|
38
|
-
interface CellParams {
|
|
39
|
-
value: unknown;
|
|
40
|
-
formatted: string;
|
|
41
|
-
row: Row;
|
|
42
|
-
rowIndex: number;
|
|
43
|
-
column: ColumnDef;
|
|
44
|
-
}
|
|
45
|
-
interface ColumnDef {
|
|
46
|
-
/** Column id; defaults to `field`. Required when `field` is absent. */
|
|
47
|
-
id?: string;
|
|
48
|
-
field?: string;
|
|
49
|
-
header?: string;
|
|
50
|
-
width?: number;
|
|
51
|
-
minWidth?: number;
|
|
52
|
-
maxWidth?: number;
|
|
53
|
-
/** Share leftover width proportionally. A user resize turns it into a fixed width. */
|
|
54
|
-
flex?: number;
|
|
55
|
-
pinned?: 'left' | 'right';
|
|
56
|
-
hide?: boolean;
|
|
57
|
-
type?: ColumnType;
|
|
58
|
-
/** number: '#,##0.00' | 'integer' | 'percent' | 'currency:USD' | Intl options; date: 'date' | 'datetime' | 'time' | 'short' | 'medium' | 'long' | Intl options */
|
|
59
|
-
format?: string | Intl.NumberFormatOptions | Intl.DateTimeFormatOptions;
|
|
60
|
-
align?: 'left' | 'center' | 'right';
|
|
61
|
-
sortable?: boolean;
|
|
62
|
-
resizable?: boolean;
|
|
63
|
-
filter?: FilterType | false;
|
|
64
|
-
comparator?: (a: unknown, b: unknown, rowA: Row, rowB: Row) => number;
|
|
65
|
-
valueGetter?: (row: Row) => unknown;
|
|
66
|
-
/** Return a string (inserted as HTML — escape untrusted data) or an element. */
|
|
67
|
-
renderer?: (params: CellParams) => string | HTMLElement;
|
|
68
|
-
cellClass?: string | ((params: CellParams) => string | undefined);
|
|
69
|
-
children?: ColumnDef[];
|
|
70
|
-
/** Set false to keep this column out of the column chooser / side bar. */
|
|
71
|
-
chooser?: boolean;
|
|
72
|
-
/** Users cannot hide this column from the UI (API still can). */
|
|
73
|
-
lockVisible?: boolean;
|
|
74
|
-
}
|
|
75
|
-
interface ColumnState {
|
|
76
|
-
colId: string;
|
|
77
|
-
width: number;
|
|
78
|
-
hide: boolean;
|
|
79
|
-
pinned: 'left' | 'right' | null;
|
|
80
|
-
}
|
|
81
|
-
interface Messages {
|
|
82
|
-
noRows: string;
|
|
83
|
-
filter: string;
|
|
84
|
-
apply: string;
|
|
85
|
-
reset: string;
|
|
86
|
-
selectAll: string;
|
|
87
|
-
search: string;
|
|
88
|
-
blanks: string;
|
|
89
|
-
value: string;
|
|
90
|
-
valueTo: string;
|
|
91
|
-
sortAsc: string;
|
|
92
|
-
sortDesc: string;
|
|
93
|
-
clearSort: string;
|
|
94
|
-
pinLeft: string;
|
|
95
|
-
pinRight: string;
|
|
96
|
-
unpin: string;
|
|
97
|
-
columnMenu: string;
|
|
98
|
-
selectRow: string;
|
|
99
|
-
selectAllRows: string;
|
|
100
|
-
chooseColumns: string;
|
|
101
|
-
columns: string;
|
|
102
|
-
autosizeThis: string;
|
|
103
|
-
autosizeAll: string;
|
|
104
|
-
resetColumns: string;
|
|
105
|
-
hideColumn: string;
|
|
106
|
-
close: string;
|
|
107
|
-
ops: Record<FilterOp, string>;
|
|
108
|
-
}
|
|
109
|
-
interface LocalePack extends Messages {
|
|
110
|
-
/** BCP 47 tag, also used for Intl formatting and collation. */
|
|
111
|
-
code: string;
|
|
112
|
-
}
|
|
113
|
-
type Aggregator = 'sum' | 'avg' | 'min' | 'max' | 'count' | ((values: unknown[], rows: Row[]) => unknown);
|
|
114
|
-
interface SummaryCell {
|
|
115
|
-
agg: Aggregator;
|
|
116
|
-
/** Text shown before the value, e.g. "Avg". */
|
|
117
|
-
prefix?: string;
|
|
118
|
-
/** Overrides the column format for this cell. */
|
|
119
|
-
format?: ColumnDef['format'];
|
|
120
|
-
}
|
|
121
|
-
interface SummaryRowDef {
|
|
122
|
-
/** Shown in the first displayed column that has no aggregator in this row. */
|
|
123
|
-
label?: string;
|
|
124
|
-
columns: Record<string, Aggregator | SummaryCell>;
|
|
125
|
-
}
|
|
126
|
-
interface SummaryOptions {
|
|
127
|
-
/** Default 'bottom'. */
|
|
128
|
-
position?: 'top' | 'bottom';
|
|
129
|
-
/** true (default): fixed outside the scroll area. false: scrolls with the rows. */
|
|
130
|
-
pinned?: boolean;
|
|
131
|
-
/** Rows to aggregate. Default 'filtered'. */
|
|
132
|
-
scope?: 'filtered' | 'all' | 'selected';
|
|
133
|
-
rows: SummaryRowDef[];
|
|
134
|
-
}
|
|
135
|
-
interface GridOptions {
|
|
136
|
-
columns: ColumnDef[];
|
|
137
|
-
data?: Row[];
|
|
138
|
-
rowHeight?: number;
|
|
139
|
-
headerHeight?: number;
|
|
140
|
-
rowSelection?: 'single' | 'multiple';
|
|
141
|
-
getRowId?: (row: Row) => string;
|
|
142
|
-
theme?: string;
|
|
143
|
-
locale?: string | Partial<LocalePack>;
|
|
144
|
-
/** Font size in px (default 13). Row/header heights follow it unless set explicitly. */
|
|
145
|
-
fontSize?: number;
|
|
146
|
-
/** CSS font-family list (default: the theme's system font stack). */
|
|
147
|
-
fontFamily?: string;
|
|
148
|
-
/** Dock a Columns panel on the right. `{ open: true }` starts expanded. */
|
|
149
|
-
sideBar?: boolean | {
|
|
150
|
-
open?: boolean;
|
|
151
|
-
};
|
|
152
|
-
/** Summary rows (totals, averages, …). */
|
|
153
|
-
summary?: SummaryOptions;
|
|
154
|
-
}
|
|
155
|
-
interface CellEvent {
|
|
156
|
-
row: Row;
|
|
157
|
-
rowIndex: number;
|
|
158
|
-
colId: string;
|
|
159
|
-
value: unknown;
|
|
160
|
-
event: MouseEvent;
|
|
161
|
-
}
|
|
162
|
-
interface GridEvents {
|
|
163
|
-
cellClick: CellEvent;
|
|
164
|
-
cellDoubleClick: CellEvent;
|
|
165
|
-
selectionChange: {
|
|
166
|
-
selected: Row[];
|
|
167
|
-
};
|
|
168
|
-
sortChange: {
|
|
169
|
-
sort: SortItem[];
|
|
170
|
-
};
|
|
171
|
-
filterChange: {
|
|
172
|
-
filters: Record<string, FilterModel>;
|
|
173
|
-
};
|
|
174
|
-
columnResize: {
|
|
175
|
-
colId: string;
|
|
176
|
-
width: number;
|
|
177
|
-
};
|
|
178
|
-
columnMove: {
|
|
179
|
-
colId: string;
|
|
180
|
-
toIndex: number;
|
|
181
|
-
};
|
|
182
|
-
focusChange: {
|
|
183
|
-
rowIndex: number;
|
|
184
|
-
colId: string;
|
|
185
|
-
};
|
|
186
|
-
columnVisible: {
|
|
187
|
-
colId: string;
|
|
188
|
-
visible: boolean;
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
interface GridApi {
|
|
192
|
-
setData(rows: Row[]): void;
|
|
193
|
-
getData(): Row[];
|
|
194
|
-
setColumns(columns: ColumnDef[]): void;
|
|
195
|
-
getColumnState(): ColumnState[];
|
|
196
|
-
applyColumnState(state: ColumnState[]): void;
|
|
197
|
-
setSort(sort: SortItem[]): void;
|
|
198
|
-
getSort(): SortItem[];
|
|
199
|
-
setFilter(colId: string, model: FilterModel | null): void;
|
|
200
|
-
getFilterModel(): Record<string, FilterModel>;
|
|
201
|
-
setQuickFilter(text: string): void;
|
|
202
|
-
getSelectedRows(): Row[];
|
|
203
|
-
selectAll(): void;
|
|
204
|
-
deselectAll(): void;
|
|
205
|
-
getDisplayedRowCount(): number;
|
|
206
|
-
scrollToRow(index: number): void;
|
|
207
|
-
setTheme(theme: string): void;
|
|
208
|
-
setLocale(locale: string | Partial<LocalePack>): void;
|
|
209
|
-
setFont(font: {
|
|
210
|
-
size?: number;
|
|
211
|
-
family?: string | null;
|
|
212
|
-
}): void;
|
|
213
|
-
setColumnVisible(colId: string, visible: boolean): void;
|
|
214
|
-
autoSizeColumns(colIds?: string[]): void;
|
|
215
|
-
resetColumnState(): void;
|
|
216
|
-
openColumnChooser(): void;
|
|
217
|
-
closeColumnChooser(): void;
|
|
218
|
-
toggleSideBar(open?: boolean): void;
|
|
219
|
-
setSummary(summary: SummaryOptions | null): void;
|
|
220
|
-
/** Raw aggregate values per summary row, keyed by column id. */
|
|
221
|
-
getSummaryValues(): Record<string, unknown>[];
|
|
222
|
-
on<K extends keyof GridEvents>(type: K, fn: (payload: GridEvents[K]) => void): () => void;
|
|
223
|
-
destroy(): void;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export type { Aggregator as A, CellEvent as C, DateFilterModel as D, FilterModel as F, GridOptions as G, LocalePack as L, Messages as M, NumberFilterModel as N, Region as R, SetFilterModel as S, TextFilterModel as T, GridApi as a, CellParams as b, ColumnDef as c, ColumnState as d, ColumnType as e, DateOp as f, FilterOp as g, FilterType as h, GridEvents as i, NumberOp as j, Row as k, SortDir as l, SortItem as m, SummaryCell as n, SummaryOptions as o, SummaryRowDef as p, TextOp as q };
|