@framesquared/grid 0.1.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/LICENSE +21 -0
- package/dist/index.d.ts +640 -0
- package/dist/index.js +1868 -0
- package/dist/index.js.map +1 -0
- package/package.json +28 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 John Carbone
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
import { Panel, PanelConfig } from '@framesquared/ui';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @framesquared/grid – Column types
|
|
5
|
+
*
|
|
6
|
+
* Column (base), NumberColumn, DateColumn, BooleanColumn,
|
|
7
|
+
* CheckColumn, ActionColumn, RowNumbererColumn.
|
|
8
|
+
*/
|
|
9
|
+
interface ColumnConfig {
|
|
10
|
+
text?: string;
|
|
11
|
+
dataIndex?: string;
|
|
12
|
+
width?: number;
|
|
13
|
+
flex?: number;
|
|
14
|
+
minWidth?: number;
|
|
15
|
+
maxWidth?: number;
|
|
16
|
+
sortable?: boolean;
|
|
17
|
+
hideable?: boolean;
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
align?: 'left' | 'center' | 'right';
|
|
20
|
+
renderer?: (value: unknown, metaData: any, record: any, rowIndex: number, colIndex: number) => string;
|
|
21
|
+
menuDisabled?: boolean;
|
|
22
|
+
resizable?: boolean;
|
|
23
|
+
draggable?: boolean;
|
|
24
|
+
tdCls?: string;
|
|
25
|
+
xtype?: string;
|
|
26
|
+
format?: string;
|
|
27
|
+
trueText?: string;
|
|
28
|
+
falseText?: string;
|
|
29
|
+
actions?: ActionConfig[];
|
|
30
|
+
}
|
|
31
|
+
interface ActionConfig {
|
|
32
|
+
iconCls?: string;
|
|
33
|
+
tooltip?: string;
|
|
34
|
+
handler?: (record: any, rowIndex: number) => void;
|
|
35
|
+
}
|
|
36
|
+
declare class Column {
|
|
37
|
+
readonly text: string;
|
|
38
|
+
readonly dataIndex: string;
|
|
39
|
+
readonly width: number;
|
|
40
|
+
readonly flex: number;
|
|
41
|
+
readonly minWidth: number;
|
|
42
|
+
readonly maxWidth: number;
|
|
43
|
+
readonly sortable: boolean;
|
|
44
|
+
readonly hidden: boolean;
|
|
45
|
+
readonly align: string;
|
|
46
|
+
readonly config: ColumnConfig;
|
|
47
|
+
private _renderer;
|
|
48
|
+
constructor(config?: ColumnConfig);
|
|
49
|
+
getCellValue(record: any): unknown;
|
|
50
|
+
renderCell(value: unknown, metaData: any, record: any, rowIndex: number, colIndex: number): string;
|
|
51
|
+
formatValue(value: unknown): string;
|
|
52
|
+
/** Create the TD content — override in special columns. */
|
|
53
|
+
renderCellHtml(value: unknown, _metaData: any, record: any, rowIndex: number, colIndex: number): string;
|
|
54
|
+
}
|
|
55
|
+
declare class NumberColumn extends Column {
|
|
56
|
+
private _format;
|
|
57
|
+
constructor(config?: ColumnConfig);
|
|
58
|
+
formatValue(value: unknown): string;
|
|
59
|
+
}
|
|
60
|
+
declare class DateColumn extends Column {
|
|
61
|
+
private _format;
|
|
62
|
+
constructor(config?: ColumnConfig);
|
|
63
|
+
formatValue(value: unknown): string;
|
|
64
|
+
}
|
|
65
|
+
declare class BooleanColumn extends Column {
|
|
66
|
+
private _trueText;
|
|
67
|
+
private _falseText;
|
|
68
|
+
constructor(config?: ColumnConfig);
|
|
69
|
+
formatValue(value: unknown): string;
|
|
70
|
+
}
|
|
71
|
+
declare class CheckColumn extends Column {
|
|
72
|
+
constructor(config?: ColumnConfig);
|
|
73
|
+
renderCellHtml(value: unknown, _metaData: any, _record: any, _rowIndex: number, _colIndex: number): string;
|
|
74
|
+
}
|
|
75
|
+
declare class ActionColumn extends Column {
|
|
76
|
+
private _actions;
|
|
77
|
+
constructor(config?: ColumnConfig);
|
|
78
|
+
get actions(): ActionConfig[];
|
|
79
|
+
renderCellHtml(_value: unknown, _metaData: any, _record: any, rowIndex: number, _colIndex: number): string;
|
|
80
|
+
}
|
|
81
|
+
declare class RowNumbererColumn extends Column {
|
|
82
|
+
constructor(config?: ColumnConfig);
|
|
83
|
+
renderCellHtml(_value: unknown, _metaData: any, _record: any, rowIndex: number, _colIndex: number): string;
|
|
84
|
+
}
|
|
85
|
+
declare function createColumn(config: ColumnConfig): Column;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @framesquared/grid – HeaderContainer
|
|
89
|
+
*
|
|
90
|
+
* Renders and manages the <thead> <tr> of column headers.
|
|
91
|
+
* Applies width, hidden state, and sort indicator classes.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
interface HeaderContainerConfig {
|
|
95
|
+
columns: Column[];
|
|
96
|
+
}
|
|
97
|
+
declare class HeaderContainer {
|
|
98
|
+
private columns;
|
|
99
|
+
private headerRow;
|
|
100
|
+
private thElements;
|
|
101
|
+
constructor(config: HeaderContainerConfig);
|
|
102
|
+
render(): HTMLTableRowElement;
|
|
103
|
+
getColumns(): Column[];
|
|
104
|
+
getThElements(): HTMLTableCellElement[];
|
|
105
|
+
setColumnHidden(index: number, hidden: boolean): void;
|
|
106
|
+
setSortIndicator(index: number, direction: 'ASC' | 'DESC' | null): void;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @framesquared/grid – GridStore
|
|
111
|
+
*
|
|
112
|
+
* Interface that defines the store contract Grid components require.
|
|
113
|
+
* The real `@framesquared/data` Store satisfies this interface natively.
|
|
114
|
+
* Custom stores can implement this interface for compatibility.
|
|
115
|
+
*
|
|
116
|
+
* @since 0.1.0
|
|
117
|
+
*/
|
|
118
|
+
interface GridRecord {
|
|
119
|
+
/** Get a field value by name. */
|
|
120
|
+
get(field: string): unknown;
|
|
121
|
+
/** Set a field value by name. */
|
|
122
|
+
set?(field: string, value: unknown): void;
|
|
123
|
+
/** Get the record's ID. */
|
|
124
|
+
getId?(): unknown;
|
|
125
|
+
/** Get all data as a plain object. */
|
|
126
|
+
getData?(): Record<string, unknown>;
|
|
127
|
+
}
|
|
128
|
+
interface GridStore {
|
|
129
|
+
/** Return all (filtered) records. */
|
|
130
|
+
getRange(start?: number, end?: number): GridRecord[];
|
|
131
|
+
/** Return record at index. */
|
|
132
|
+
getAt(index: number): GridRecord | undefined;
|
|
133
|
+
/** Return the count of (filtered) records. */
|
|
134
|
+
getCount(): number;
|
|
135
|
+
/** Return total (unfiltered) count. */
|
|
136
|
+
getTotalCount?(): number;
|
|
137
|
+
/** Sort by field name and direction. */
|
|
138
|
+
sort(field: string, direction?: 'ASC' | 'DESC'): void;
|
|
139
|
+
/** Subscribe to store events. */
|
|
140
|
+
on(event: string, fn: Function, ...args: any[]): any;
|
|
141
|
+
/** Iterate all records. */
|
|
142
|
+
each?(fn: (record: GridRecord, index: number) => boolean | void): void;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @framesquared/grid – GridView
|
|
147
|
+
*
|
|
148
|
+
* Renders the grid body using a <table> with <thead> and <tbody>.
|
|
149
|
+
* Manages row rendering, striping, cell content, and item events.
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
interface GridViewConfig {
|
|
153
|
+
store: GridStore;
|
|
154
|
+
columns: Column[];
|
|
155
|
+
emptyText?: string;
|
|
156
|
+
}
|
|
157
|
+
declare class GridView {
|
|
158
|
+
private store;
|
|
159
|
+
private columns;
|
|
160
|
+
private emptyText;
|
|
161
|
+
private tableEl;
|
|
162
|
+
private tbodyEl;
|
|
163
|
+
private theadEl;
|
|
164
|
+
headerContainer: HeaderContainer;
|
|
165
|
+
/** Event listeners set by Grid */
|
|
166
|
+
onItemClick?: (record: GridRecord, rowIndex: number, event: Event) => void;
|
|
167
|
+
onItemDblClick?: (record: GridRecord, rowIndex: number, event: Event) => void;
|
|
168
|
+
/** Set by RowSelectionModel so selection classes survive refresh() */
|
|
169
|
+
isSelected?: (record: GridRecord) => boolean;
|
|
170
|
+
constructor(config: GridViewConfig);
|
|
171
|
+
render(): HTMLTableElement;
|
|
172
|
+
refresh(): void;
|
|
173
|
+
private renderRows;
|
|
174
|
+
private createRow;
|
|
175
|
+
setColumnHidden(index: number, hidden: boolean): void;
|
|
176
|
+
getTable(): HTMLTableElement | null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @framesquared/grid – Grid
|
|
181
|
+
*
|
|
182
|
+
* The main grid panel. Extends Panel to display tabular data from
|
|
183
|
+
* a Store with configurable columns, sorting, column visibility,
|
|
184
|
+
* row striping, and item events.
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
interface GridConfig extends PanelConfig {
|
|
188
|
+
store?: GridStore;
|
|
189
|
+
columns?: ColumnConfig[];
|
|
190
|
+
sortableColumns?: boolean;
|
|
191
|
+
enableColumnHide?: boolean;
|
|
192
|
+
enableColumnResize?: boolean;
|
|
193
|
+
emptyText?: string;
|
|
194
|
+
scroll?: 'both' | 'horizontal' | 'vertical' | 'none';
|
|
195
|
+
}
|
|
196
|
+
declare class Grid extends Panel {
|
|
197
|
+
static $className: string;
|
|
198
|
+
_store: GridStore | null;
|
|
199
|
+
private _columns;
|
|
200
|
+
private _gridView;
|
|
201
|
+
private _sortableColumns;
|
|
202
|
+
private _sortDirection;
|
|
203
|
+
private _sortColumnIndex;
|
|
204
|
+
constructor(config?: GridConfig);
|
|
205
|
+
protected initialize(): void;
|
|
206
|
+
protected afterRender(): void;
|
|
207
|
+
private setupSortableHeaders;
|
|
208
|
+
private onHeaderClick;
|
|
209
|
+
hideColumn(index: number): void;
|
|
210
|
+
showColumn(index: number): void;
|
|
211
|
+
private onStoreDataChanged;
|
|
212
|
+
getStore(): GridStore | null;
|
|
213
|
+
getColumns(): Column[];
|
|
214
|
+
getView(): GridView | null;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @framesquared/grid – Grouping feature
|
|
219
|
+
*
|
|
220
|
+
* Groups rows by a field value. Renders group header rows with
|
|
221
|
+
* expand/collapse behavior.
|
|
222
|
+
*/
|
|
223
|
+
interface GroupingConfig {
|
|
224
|
+
groupField: string;
|
|
225
|
+
startCollapsed?: boolean;
|
|
226
|
+
groupHeaderTpl?: (groupValue: string, records: any[]) => string;
|
|
227
|
+
}
|
|
228
|
+
declare class Grouping {
|
|
229
|
+
private grid;
|
|
230
|
+
private groupField;
|
|
231
|
+
private startCollapsed;
|
|
232
|
+
private collapsedGroups;
|
|
233
|
+
private groupHeaderTpl;
|
|
234
|
+
constructor(config: GroupingConfig);
|
|
235
|
+
init(grid: any): void;
|
|
236
|
+
collapse(groupValue: string): void;
|
|
237
|
+
expand(groupValue: string): void;
|
|
238
|
+
isCollapsed(groupValue: string): boolean;
|
|
239
|
+
private rebuildGroupedView;
|
|
240
|
+
private groupRecords;
|
|
241
|
+
private setGroupRowsVisible;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @framesquared/grid – Summary feature
|
|
246
|
+
*
|
|
247
|
+
* Adds a summary row at the bottom of the grid with aggregate
|
|
248
|
+
* calculations per column (sum, count, average, min, max, custom).
|
|
249
|
+
*/
|
|
250
|
+
type SummaryType = 'sum' | 'count' | 'average' | 'min' | 'max' | ((records: any[]) => unknown);
|
|
251
|
+
interface SummaryConfig {
|
|
252
|
+
summaryTypes: Record<string, SummaryType>;
|
|
253
|
+
}
|
|
254
|
+
declare class Summary {
|
|
255
|
+
private grid;
|
|
256
|
+
private summaryTypes;
|
|
257
|
+
constructor(config: SummaryConfig);
|
|
258
|
+
init(grid: any): void;
|
|
259
|
+
private renderSummary;
|
|
260
|
+
protected buildSummaryRow(records: any[], columns: any[]): HTMLTableRowElement;
|
|
261
|
+
protected calculate(records: any[], field: string, type: SummaryType): unknown;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @framesquared/grid – GroupingSummary feature
|
|
266
|
+
*
|
|
267
|
+
* Combines grouping with per-group summary rows. Each group gets
|
|
268
|
+
* a header and a summary row at the bottom.
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
interface GroupingSummaryConfig {
|
|
272
|
+
groupField: string;
|
|
273
|
+
summaryTypes: Record<string, SummaryType>;
|
|
274
|
+
startCollapsed?: boolean;
|
|
275
|
+
}
|
|
276
|
+
declare class GroupingSummary {
|
|
277
|
+
private grid;
|
|
278
|
+
private groupField;
|
|
279
|
+
private summaryTypes;
|
|
280
|
+
constructor(config: GroupingSummaryConfig);
|
|
281
|
+
init(grid: any): void;
|
|
282
|
+
private rebuild;
|
|
283
|
+
private groupRecords;
|
|
284
|
+
private calculate;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @framesquared/grid – RowBody feature
|
|
289
|
+
*
|
|
290
|
+
* Adds an expandable body row below each data row with
|
|
291
|
+
* custom content generated by getAdditionalData.
|
|
292
|
+
*/
|
|
293
|
+
interface RowBodyConfig {
|
|
294
|
+
getAdditionalData: (data: any, rowIndex: number, record: any) => {
|
|
295
|
+
rowBody: string;
|
|
296
|
+
rowBodyCls?: string;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
declare class RowBody {
|
|
300
|
+
private grid;
|
|
301
|
+
private getAdditionalData;
|
|
302
|
+
constructor(config: RowBodyConfig);
|
|
303
|
+
init(grid: any): void;
|
|
304
|
+
private addRowBodies;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @framesquared/grid – CellEditing plugin
|
|
309
|
+
*
|
|
310
|
+
* Double-click a cell to start inline editing. The cell content
|
|
311
|
+
* is replaced with an input field. Enter completes; Escape cancels.
|
|
312
|
+
*/
|
|
313
|
+
declare class CellEditing {
|
|
314
|
+
private grid;
|
|
315
|
+
private activeEditor;
|
|
316
|
+
private activeInput;
|
|
317
|
+
private activeRecord;
|
|
318
|
+
private activeColumn;
|
|
319
|
+
private activeCell;
|
|
320
|
+
private originalValue;
|
|
321
|
+
init(grid: any): void;
|
|
322
|
+
private attachCellListeners;
|
|
323
|
+
private startEdit;
|
|
324
|
+
completeEdit(): void;
|
|
325
|
+
cancelEdit(): void;
|
|
326
|
+
private cleanup;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* @framesquared/grid – RowEditing plugin
|
|
331
|
+
*
|
|
332
|
+
* Row-level editing: shows input fields for all editable columns
|
|
333
|
+
* in the selected row. Update saves all; Cancel reverts.
|
|
334
|
+
*/
|
|
335
|
+
declare class RowEditing {
|
|
336
|
+
private grid;
|
|
337
|
+
private activeRowIndex;
|
|
338
|
+
private editorRow;
|
|
339
|
+
private inputs;
|
|
340
|
+
private originalValues;
|
|
341
|
+
init(grid: any): void;
|
|
342
|
+
startEdit(rowIndex: number): void;
|
|
343
|
+
completeEdit(): void;
|
|
344
|
+
cancelEdit(): void;
|
|
345
|
+
private teardown;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @framesquared/grid – RowExpander plugin
|
|
350
|
+
*
|
|
351
|
+
* Adds an expand button to each row. Clicking toggles a body
|
|
352
|
+
* row below with custom content.
|
|
353
|
+
*/
|
|
354
|
+
interface RowExpanderConfig {
|
|
355
|
+
rowBodyTpl: (record: any) => string;
|
|
356
|
+
singleExpand?: boolean;
|
|
357
|
+
}
|
|
358
|
+
declare class RowExpander {
|
|
359
|
+
private grid;
|
|
360
|
+
private rowBodyTpl;
|
|
361
|
+
private singleExpand;
|
|
362
|
+
private expandedRows;
|
|
363
|
+
constructor(config: RowExpanderConfig);
|
|
364
|
+
init(grid: any): void;
|
|
365
|
+
private addExpanders;
|
|
366
|
+
private toggle;
|
|
367
|
+
private expandRow;
|
|
368
|
+
private collapseRow;
|
|
369
|
+
private collapseAll;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* @framesquared/grid – Clipboard plugin
|
|
374
|
+
*
|
|
375
|
+
* Copies grid data to the clipboard in TSV (tab-separated) format
|
|
376
|
+
* for spreadsheet compatibility.
|
|
377
|
+
*/
|
|
378
|
+
declare class GridClipboard {
|
|
379
|
+
private grid;
|
|
380
|
+
init(grid: any): void;
|
|
381
|
+
getGridText(): string;
|
|
382
|
+
doCopy(): Promise<void>;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* @framesquared/grid – DragDrop plugin
|
|
387
|
+
*
|
|
388
|
+
* Enables row reordering via drag and drop. Adds draggable
|
|
389
|
+
* attributes to rows and provides a moveRow method.
|
|
390
|
+
*/
|
|
391
|
+
declare class GridDragDrop {
|
|
392
|
+
private grid;
|
|
393
|
+
init(grid: any): void;
|
|
394
|
+
private setupDrag;
|
|
395
|
+
moveRow(fromIndex: number, toIndex: number): void;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* @framesquared/grid – RowSelectionModel
|
|
400
|
+
*
|
|
401
|
+
* Row-level selection model supporting SINGLE, SIMPLE, and MULTI modes.
|
|
402
|
+
* Optional checkbox column for visual selection.
|
|
403
|
+
*
|
|
404
|
+
* Works with any Grid that implements getStore()/getView() and any Store
|
|
405
|
+
* that implements the GridStore interface.
|
|
406
|
+
*/
|
|
407
|
+
|
|
408
|
+
interface RowSelectionModelConfig {
|
|
409
|
+
mode?: 'SINGLE' | 'SIMPLE' | 'MULTI';
|
|
410
|
+
checkboxSelect?: boolean;
|
|
411
|
+
}
|
|
412
|
+
interface SelectableGrid {
|
|
413
|
+
getStore(): GridStore | null;
|
|
414
|
+
getView(): GridView | null;
|
|
415
|
+
}
|
|
416
|
+
declare class RowSelectionModel {
|
|
417
|
+
private grid;
|
|
418
|
+
private mode;
|
|
419
|
+
private checkboxSelect;
|
|
420
|
+
private selected;
|
|
421
|
+
private listeners;
|
|
422
|
+
constructor(config?: RowSelectionModelConfig);
|
|
423
|
+
on(event: string, fn: Function): void;
|
|
424
|
+
private fire;
|
|
425
|
+
init(grid: SelectableGrid): void;
|
|
426
|
+
select(record: GridRecord, keepExisting?: boolean): void;
|
|
427
|
+
deselect(record: GridRecord): void;
|
|
428
|
+
selectRange(start: GridRecord, end: GridRecord): void;
|
|
429
|
+
selectAll(): void;
|
|
430
|
+
deselectAll(): void;
|
|
431
|
+
getSelection(): GridRecord[];
|
|
432
|
+
isSelected(record: GridRecord): boolean;
|
|
433
|
+
getCount(): number;
|
|
434
|
+
private doSelect;
|
|
435
|
+
private doDeselect;
|
|
436
|
+
private updateRowClass;
|
|
437
|
+
private attachRowListeners;
|
|
438
|
+
private addCheckboxColumn;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* @framesquared/grid – CellSelectionModel
|
|
443
|
+
*
|
|
444
|
+
* Selects individual cells. Supports navigation via arrow keys
|
|
445
|
+
* and Tab/Shift+Tab. Selected cell gets x-grid-cell-selected class.
|
|
446
|
+
*/
|
|
447
|
+
|
|
448
|
+
interface CellPosition {
|
|
449
|
+
row: number;
|
|
450
|
+
column: number;
|
|
451
|
+
}
|
|
452
|
+
interface CellSelectableGrid extends SelectableGrid {
|
|
453
|
+
getColumns(): Column[];
|
|
454
|
+
el: HTMLElement | null;
|
|
455
|
+
}
|
|
456
|
+
declare class CellSelectionModel {
|
|
457
|
+
private grid;
|
|
458
|
+
private position;
|
|
459
|
+
private listeners;
|
|
460
|
+
private maxRow;
|
|
461
|
+
private maxCol;
|
|
462
|
+
on(event: string, fn: Function): void;
|
|
463
|
+
private fire;
|
|
464
|
+
init(grid: CellSelectableGrid): void;
|
|
465
|
+
getCurrentPosition(): CellPosition | null;
|
|
466
|
+
private selectCell;
|
|
467
|
+
private clearSelection;
|
|
468
|
+
private getCellElement;
|
|
469
|
+
private attachListeners;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* @framesquared/grid – SpreadsheetSelectionModel
|
|
474
|
+
*
|
|
475
|
+
* Spreadsheet-like selection: click selects a cell, Shift+click
|
|
476
|
+
* extends to a range. Selected cells get x-grid-cell-selected class.
|
|
477
|
+
*/
|
|
478
|
+
interface SelectionRange {
|
|
479
|
+
startRow: number;
|
|
480
|
+
startCol: number;
|
|
481
|
+
endRow: number;
|
|
482
|
+
endCol: number;
|
|
483
|
+
}
|
|
484
|
+
declare class SpreadsheetSelectionModel {
|
|
485
|
+
private grid;
|
|
486
|
+
private range;
|
|
487
|
+
private listeners;
|
|
488
|
+
on(event: string, fn: Function): void;
|
|
489
|
+
private fire;
|
|
490
|
+
init(grid: any): void;
|
|
491
|
+
getSelectedRange(): SelectionRange | null;
|
|
492
|
+
private attachListeners;
|
|
493
|
+
private highlightRange;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* @framesquared/grid – Lockable
|
|
498
|
+
*
|
|
499
|
+
* Splits a grid into locked (frozen left) and normal (scrollable right)
|
|
500
|
+
* panels. Columns with config.locked=true go into the locked panel.
|
|
501
|
+
* Locked panel does not scroll horizontally.
|
|
502
|
+
*/
|
|
503
|
+
declare class Lockable {
|
|
504
|
+
private grid;
|
|
505
|
+
init(grid: any): void;
|
|
506
|
+
private rebuild;
|
|
507
|
+
private buildTable;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* @framesquared/grid – GridState
|
|
512
|
+
*
|
|
513
|
+
* Saves and restores grid column state (widths, hidden, order)
|
|
514
|
+
* and sort state to localStorage.
|
|
515
|
+
*/
|
|
516
|
+
interface GridStateConfig {
|
|
517
|
+
stateId: string;
|
|
518
|
+
}
|
|
519
|
+
declare class GridState {
|
|
520
|
+
private grid;
|
|
521
|
+
private stateId;
|
|
522
|
+
constructor(config: GridStateConfig);
|
|
523
|
+
init(grid: any): void;
|
|
524
|
+
private get storageKey();
|
|
525
|
+
save(): void;
|
|
526
|
+
restore(): void;
|
|
527
|
+
clear(): void;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* @framesquared/grid – TreeStore
|
|
532
|
+
*
|
|
533
|
+
* Manages hierarchical data. Each node has text, children, id,
|
|
534
|
+
* leaf/expanded state, and optional checked state. Provides
|
|
535
|
+
* traversal, path resolution, and mutation helpers.
|
|
536
|
+
*/
|
|
537
|
+
interface TreeNodeConfig {
|
|
538
|
+
id?: string;
|
|
539
|
+
text: string;
|
|
540
|
+
leaf?: boolean;
|
|
541
|
+
expanded?: boolean;
|
|
542
|
+
checked?: boolean;
|
|
543
|
+
children?: TreeNodeConfig[];
|
|
544
|
+
[key: string]: unknown;
|
|
545
|
+
}
|
|
546
|
+
interface TreeNode {
|
|
547
|
+
id: string;
|
|
548
|
+
text: string;
|
|
549
|
+
leaf: boolean;
|
|
550
|
+
expanded: boolean;
|
|
551
|
+
checked: boolean;
|
|
552
|
+
children: TreeNode[];
|
|
553
|
+
parent: TreeNode | null;
|
|
554
|
+
depth: number;
|
|
555
|
+
data: Record<string, unknown>;
|
|
556
|
+
}
|
|
557
|
+
interface TreeStoreConfig {
|
|
558
|
+
root: TreeNodeConfig;
|
|
559
|
+
}
|
|
560
|
+
declare class TreeStore {
|
|
561
|
+
private root;
|
|
562
|
+
private nodeMap;
|
|
563
|
+
constructor(config: TreeStoreConfig);
|
|
564
|
+
private buildMap;
|
|
565
|
+
getRoot(): TreeNode;
|
|
566
|
+
getNodeById(id: string): TreeNode | null;
|
|
567
|
+
/**
|
|
568
|
+
* Returns visible nodes in display order (respecting expanded state).
|
|
569
|
+
* If rootVisible is true, the root is included.
|
|
570
|
+
*/
|
|
571
|
+
getVisibleNodes(rootVisible?: boolean): TreeNode[];
|
|
572
|
+
appendChild(parent: TreeNode, childCfg: TreeNodeConfig): TreeNode;
|
|
573
|
+
removeNode(id: string): boolean;
|
|
574
|
+
private removeFromMap;
|
|
575
|
+
getPath(node: TreeNode): string;
|
|
576
|
+
findByPath(path: string): TreeNode | null;
|
|
577
|
+
/** Expand all ancestors of a node so it becomes visible. */
|
|
578
|
+
expandToNode(node: TreeNode): void;
|
|
579
|
+
/** Set expanded=true on all non-leaf nodes. */
|
|
580
|
+
expandAll(node?: TreeNode): void;
|
|
581
|
+
/** Set expanded=false on all nodes. */
|
|
582
|
+
collapseAll(node?: TreeNode): void;
|
|
583
|
+
/** Cascade checked state to all descendants. */
|
|
584
|
+
cascadeCheck(node: TreeNode, checked: boolean): void;
|
|
585
|
+
/** Get all checked nodes. */
|
|
586
|
+
getChecked(node?: TreeNode): TreeNode[];
|
|
587
|
+
getRange(): any[];
|
|
588
|
+
getCount(): number;
|
|
589
|
+
getAt(i: number): any;
|
|
590
|
+
get(field: string): unknown;
|
|
591
|
+
on(_evt: string, _fn: Function): void;
|
|
592
|
+
sort(): void;
|
|
593
|
+
isLoading(): boolean;
|
|
594
|
+
getTotalCount(): number;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* @framesquared/grid – TreePanel
|
|
599
|
+
*
|
|
600
|
+
* Displays hierarchical data from a TreeStore. Each node is
|
|
601
|
+
* rendered with depth-based indentation, expand/collapse icons,
|
|
602
|
+
* folder/leaf icons, and optional checkboxes with cascade behavior.
|
|
603
|
+
*/
|
|
604
|
+
|
|
605
|
+
interface TreePanelConfig extends PanelConfig {
|
|
606
|
+
store?: TreeStore;
|
|
607
|
+
rootVisible?: boolean;
|
|
608
|
+
singleExpand?: boolean;
|
|
609
|
+
useArrows?: boolean;
|
|
610
|
+
lines?: boolean;
|
|
611
|
+
animate?: boolean;
|
|
612
|
+
checkable?: boolean;
|
|
613
|
+
cascadeCheck?: boolean;
|
|
614
|
+
}
|
|
615
|
+
declare class TreePanel extends Panel {
|
|
616
|
+
static $className: string;
|
|
617
|
+
private _treeStore;
|
|
618
|
+
private _rootVisible;
|
|
619
|
+
private _singleExpand;
|
|
620
|
+
private _checkable;
|
|
621
|
+
private _cascadeCheck;
|
|
622
|
+
private _treeBody;
|
|
623
|
+
private _checkedSet;
|
|
624
|
+
constructor(config?: TreePanelConfig);
|
|
625
|
+
protected initialize(): void;
|
|
626
|
+
protected afterRender(): void;
|
|
627
|
+
refresh(): void;
|
|
628
|
+
private renderTree;
|
|
629
|
+
private createNodeElement;
|
|
630
|
+
private toggleNode;
|
|
631
|
+
private expandNode;
|
|
632
|
+
private collapseNode;
|
|
633
|
+
expandAll(): void;
|
|
634
|
+
collapseAll(): void;
|
|
635
|
+
expandPath(path: string): Promise<void>;
|
|
636
|
+
getChecked(): TreeNode[];
|
|
637
|
+
getStore(): TreeStore;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export { ActionColumn, type ActionConfig, BooleanColumn, CellEditing, type CellPosition, CellSelectionModel, CheckColumn, Column, type ColumnConfig, DateColumn, Grid, GridClipboard, type GridConfig, GridDragDrop, type GridRecord, GridState, type GridStateConfig, type GridStore, GridView, type GridViewConfig, Grouping, type GroupingConfig, GroupingSummary, type GroupingSummaryConfig, HeaderContainer, Lockable, NumberColumn, RowBody, type RowBodyConfig, RowEditing, RowExpander, type RowExpanderConfig, RowNumbererColumn, RowSelectionModel, type RowSelectionModelConfig, type SelectableGrid, type SelectionRange, SpreadsheetSelectionModel, Summary, type SummaryConfig, type SummaryType, type TreeNode, type TreeNodeConfig, TreePanel, type TreePanelConfig, TreeStore, type TreeStoreConfig, createColumn };
|