@lilydesignsystem/angular-data-grid 0.0.0-stage → 0.10.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/README.md +97 -2
- package/fesm2022/lilydesignsystem-angular-data-grid.mjs +3598 -0
- package/fesm2022/lilydesignsystem-angular-data-grid.mjs.map +1 -0
- package/package.json +47 -3
- package/types/lilydesignsystem-angular-data-grid.d.ts +1056 -0
- package/types/lilydesignsystem-angular-data-grid.d.ts.map +1 -0
|
@@ -0,0 +1,1056 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { TemplateRef } from "@angular/core";
|
|
3
|
+
type ExportFormat = "csv" | "tsv" | "xlsx";
|
|
4
|
+
/**
|
|
5
|
+
* A live formula and the result it last computed. In an .xlsx the cell keeps the formula with the result cached
|
|
6
|
+
* (a spreadsheet user keeps the live formula); CSV and TSV carry only the result.
|
|
7
|
+
*/
|
|
8
|
+
type ExportFormula = {
|
|
9
|
+
formula: string;
|
|
10
|
+
result: unknown;
|
|
11
|
+
};
|
|
12
|
+
/** Whether a cell value is an {@link ExportFormula}. */
|
|
13
|
+
export declare function isExportFormula(value: unknown): value is ExportFormula;
|
|
14
|
+
/** A header row and rows of cell values. A cell is a string, number, boolean, `Date`, an {@link ExportFormula}, or empty. */
|
|
15
|
+
type ExportTable = {
|
|
16
|
+
headers: string[];
|
|
17
|
+
rows: unknown[][];
|
|
18
|
+
};
|
|
19
|
+
type DelimitedOptions = {
|
|
20
|
+
/** Field separator. Default `","` (use `"\t"` for TSV). */
|
|
21
|
+
delimiter?: string;
|
|
22
|
+
/** Write the header row. Default true. */
|
|
23
|
+
header?: boolean;
|
|
24
|
+
/** Prefix a UTF-8 byte-order mark so Excel opens the file as UTF-8. Default false. */
|
|
25
|
+
bom?: boolean;
|
|
26
|
+
/** Defuse spreadsheet formulas: a string starting with `=`, `+`, `-`, `@`, tab or CR gets a leading `'`. Default true. */
|
|
27
|
+
safe?: boolean;
|
|
28
|
+
/** Line ending. Default `"\r\n"` (RFC 4180). */
|
|
29
|
+
eol?: string;
|
|
30
|
+
};
|
|
31
|
+
type XlsxOptions = {
|
|
32
|
+
/** Worksheet name (31 characters at most; `[]:*?/\` are replaced). Default `"Sheet1"`. */
|
|
33
|
+
sheetName?: string;
|
|
34
|
+
/** Write the header row, in bold. Default true. */
|
|
35
|
+
header?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export declare const MIME_TYPES: Record<ExportFormat, string>;
|
|
38
|
+
/** One cell as text. Numbers and booleans are never treated as formulas; only strings are defused. */
|
|
39
|
+
export declare function cellText(value: unknown, safe?: boolean): string;
|
|
40
|
+
/** CSV/TSV text for a table. Fields containing the delimiter, a quote or a line break are quoted. */
|
|
41
|
+
export declare function toDelimited(table: ExportTable, options?: DelimitedOptions): string;
|
|
42
|
+
export declare function toCsv(table: ExportTable, options?: Omit<DelimitedOptions, "delimiter">): string;
|
|
43
|
+
export declare function toTsv(table: ExportTable, options?: Omit<DelimitedOptions, "delimiter">): string;
|
|
44
|
+
/** Column index (0-based) to a spreadsheet column name: 0 → A, 25 → Z, 26 → AA. */
|
|
45
|
+
export declare function columnName(index: number): string;
|
|
46
|
+
/** An .xlsx workbook with one worksheet, as bytes. */
|
|
47
|
+
export declare function toXlsx(table: ExportTable, options?: XlsxOptions): Uint8Array;
|
|
48
|
+
export declare function crc32(bytes: Uint8Array): number;
|
|
49
|
+
/** A ZIP archive holding `entries` uncompressed. */
|
|
50
|
+
export declare function zipStore(entries: {
|
|
51
|
+
name: string;
|
|
52
|
+
data: Uint8Array;
|
|
53
|
+
}[]): Uint8Array;
|
|
54
|
+
/** The file for `table` in `format`, as a `Blob`. CSV and TSV carry a UTF-8 byte-order mark so Excel reads them as UTF-8. */
|
|
55
|
+
export declare function exportBlob(table: ExportTable, format: ExportFormat, options?: {
|
|
56
|
+
sheetName?: string;
|
|
57
|
+
header?: boolean;
|
|
58
|
+
}): Blob;
|
|
59
|
+
/** A filename with the format's extension, without doubling one the name already has. */
|
|
60
|
+
export declare function exportFilename(base: string, format: ExportFormat): string;
|
|
61
|
+
/** Saves a blob through a temporary link. Does nothing outside a browser. */
|
|
62
|
+
export declare function downloadBlob(blob: Blob, filename: string): void;
|
|
63
|
+
/** The table as tab-separated text with its header row, ready to paste into a spreadsheet (no byte-order mark, formula text defused). */
|
|
64
|
+
export declare function toClipboardText(table: ExportTable): string;
|
|
65
|
+
/**
|
|
66
|
+
* Write `text` to the clipboard: the async Clipboard API where there is one, otherwise a hidden, selected `<textarea>` and
|
|
67
|
+
* `document.execCommand("copy")`. Resolves true when something was copied, false when neither path worked (no permission, no
|
|
68
|
+
* secure context, no DOM). Never throws.
|
|
69
|
+
*/
|
|
70
|
+
export declare function copyToClipboard(text: string): Promise<boolean>;
|
|
71
|
+
type DataGridCellType = "text" | "number" | "link" | "date" | "time" | "time-zone" | "select" | "radio" | "person" | "file" | "rollup" | "formula";
|
|
72
|
+
/** A time of day and the zone it is stated in (an IANA zone id, or a bare offset such as `+01:00`). */
|
|
73
|
+
type DataGridZonedTime = {
|
|
74
|
+
time: string;
|
|
75
|
+
timeZone: string;
|
|
76
|
+
};
|
|
77
|
+
/** One person: the name is always shown as text; the avatar is the consumer's. */
|
|
78
|
+
type DataGridPerson = {
|
|
79
|
+
id: string;
|
|
80
|
+
name?: string;
|
|
81
|
+
email?: string;
|
|
82
|
+
avatarUrl?: string;
|
|
83
|
+
};
|
|
84
|
+
/** One file's metadata. The bytes live elsewhere; the grid never uploads. */
|
|
85
|
+
type DataGridFile = {
|
|
86
|
+
id: string;
|
|
87
|
+
name: string;
|
|
88
|
+
size?: number;
|
|
89
|
+
type?: string;
|
|
90
|
+
href?: string;
|
|
91
|
+
};
|
|
92
|
+
/** What a rollup reduces its related values with. */
|
|
93
|
+
type DataGridAggregate = "count" | "countUnique" | "sum" | "avg" | "median" | "min" | "max" | "range" | "percentTrue" | "percentEmpty";
|
|
94
|
+
/** What a formula engine hands back: a value, or an error message shown as text. */
|
|
95
|
+
type DataGridFormulaResult = {
|
|
96
|
+
value: unknown;
|
|
97
|
+
} | {
|
|
98
|
+
error: string;
|
|
99
|
+
};
|
|
100
|
+
/** What a formula engine is given. `rows` is every row, for references to other rows. */
|
|
101
|
+
type DataGridFormulaContext = {
|
|
102
|
+
row: Record<string, unknown>;
|
|
103
|
+
rows: Record<string, unknown>[];
|
|
104
|
+
columnId: string;
|
|
105
|
+
};
|
|
106
|
+
/** An option of a `select` or `radio` column. The label is displayed; the id is stored. */
|
|
107
|
+
type DataGridOption = {
|
|
108
|
+
id: string;
|
|
109
|
+
label: string;
|
|
110
|
+
disabled?: boolean;
|
|
111
|
+
group?: string;
|
|
112
|
+
[key: string]: unknown;
|
|
113
|
+
};
|
|
114
|
+
/** A link value: an address, or an address with a label. */
|
|
115
|
+
type DataGridLink = {
|
|
116
|
+
href: string;
|
|
117
|
+
label?: string;
|
|
118
|
+
external?: boolean;
|
|
119
|
+
};
|
|
120
|
+
/** The column facets a type can fill in. Structural so this module does not import the grid. */
|
|
121
|
+
type TypedColumn = {
|
|
122
|
+
id: string;
|
|
123
|
+
type?: DataGridCellType;
|
|
124
|
+
locale?: string;
|
|
125
|
+
options?: DataGridOption[];
|
|
126
|
+
sortBy?: "label" | "order";
|
|
127
|
+
exportAs?: "label" | "id" | "email";
|
|
128
|
+
numberFormat?: Intl.NumberFormatOptions;
|
|
129
|
+
dateFormat?: Intl.DateTimeFormatOptions;
|
|
130
|
+
timeFormat?: Intl.DateTimeFormatOptions;
|
|
131
|
+
accessor?: (row: Record<string, unknown>) => unknown;
|
|
132
|
+
format?: (value: unknown, row: Record<string, unknown>) => string;
|
|
133
|
+
compare?: (a: unknown, b: unknown) => number;
|
|
134
|
+
filterText?: (value: unknown, row: Record<string, unknown>) => string;
|
|
135
|
+
exportValue?: (row: Record<string, unknown>) => unknown;
|
|
136
|
+
align?: "start" | "center" | "end";
|
|
137
|
+
editor?: string;
|
|
138
|
+
parse?: (draft: string, row: Record<string, unknown>) => unknown;
|
|
139
|
+
editable?: boolean;
|
|
140
|
+
/** `time-zone`: the zones the editor offers, as `{ id, label }`. */
|
|
141
|
+
timeZones?: DataGridOption[];
|
|
142
|
+
/** `time-zone`: the date (ISO) used to order zoned times and to name a zone. Never computed here. */
|
|
143
|
+
referenceDate?: string;
|
|
144
|
+
/** `rollup`: how the related values are reduced. */
|
|
145
|
+
aggregate?: DataGridAggregate;
|
|
146
|
+
/** `rollup`: anything the named aggregates do not cover. */
|
|
147
|
+
reduce?: (values: unknown[], row: Record<string, unknown>) => unknown;
|
|
148
|
+
/** `rollup`: reads the related values. Defaults to the row's own array at the column id. */
|
|
149
|
+
relation?: (row: Record<string, unknown>) => unknown[];
|
|
150
|
+
/** `rollup` and `formula`: the type of the result, so it formats and sorts like one. */
|
|
151
|
+
resultType?: "number" | "date" | "text";
|
|
152
|
+
/** `formula`: evaluates an expression. Lily ships no engine and never evaluates a string itself. */
|
|
153
|
+
evaluate?: (expression: string, context: DataGridFormulaContext) => DataGridFormulaResult;
|
|
154
|
+
/** `person`: how many people show before "+N". */
|
|
155
|
+
maxPeople?: number;
|
|
156
|
+
/** `file`: formats a size in bytes for display. */
|
|
157
|
+
formatSize?: (bytes: number) => string;
|
|
158
|
+
/** Set by `resolveColumn` for a `formula`: the expression the row holds (the editor shows this, not the result). */
|
|
159
|
+
source?: (row: Record<string, unknown>) => unknown;
|
|
160
|
+
/** Set by `resolveColumn` for a `formula`: the error message for a row, or undefined. */
|
|
161
|
+
errorOf?: (row: Record<string, unknown>) => string | undefined;
|
|
162
|
+
};
|
|
163
|
+
/** An address safe to put in an `href`: http(s), mailto, tel, or a relative one. Anything else (`javascript:`, `data:`) is null. */
|
|
164
|
+
export declare function safeHref(href: unknown): string | null;
|
|
165
|
+
/** A link value as `{ href, label?, external? }`; a plain string is the address. */
|
|
166
|
+
export declare function linkParts(value: unknown): DataGridLink | null;
|
|
167
|
+
export declare function linkLabel(value: unknown): string;
|
|
168
|
+
/** A civil date `YYYY-MM-DD` that exists on the calendar. */
|
|
169
|
+
export declare function isCivilDate(text: unknown): text is string;
|
|
170
|
+
/** A civil time `HH:mm` or `HH:mm:ss`, 24-hour. */
|
|
171
|
+
export declare function isCivilTime(text: unknown): text is string;
|
|
172
|
+
/** A civil date as a `Date` at UTC midnight, or null. Typed, so an export writes a real spreadsheet date. */
|
|
173
|
+
export declare function civilDateToDate(text: unknown): Date | null;
|
|
174
|
+
/** An IANA zone id the platform knows, or a bare offset such as `+01:00`. */
|
|
175
|
+
export declare function isValidTimeZone(timeZone: unknown): timeZone is string;
|
|
176
|
+
/** A zoned time: `{ time: "HH:mm[:ss]", timeZone }` with a real time and a known zone. */
|
|
177
|
+
export declare function isZonedTime(value: unknown): value is DataGridZonedTime;
|
|
178
|
+
/**
|
|
179
|
+
* A zoned time as a number for ordering. With a `referenceDate` (ISO, supplied by the consumer: never computed here)
|
|
180
|
+
* it is the UTC minute of that instant, so equal instants compare equal; without one it is the stated local time and
|
|
181
|
+
* the zone is ignored.
|
|
182
|
+
*/
|
|
183
|
+
export declare function zonedMinutes(value: unknown, referenceDate?: string): number | null;
|
|
184
|
+
/** A zoned time as the UTC time of day (`HH:mm`) at a reference date. Null without a valid reference date or value. */
|
|
185
|
+
export declare function zonedUtcTime(value: unknown, referenceDate?: string): string | null;
|
|
186
|
+
/** The people in a value: one object or an array, each with an id. */
|
|
187
|
+
export declare function peopleOf(value: unknown): DataGridPerson[];
|
|
188
|
+
/** A person's text: the name, or the id when there is none (never blank). */
|
|
189
|
+
export declare const personName: (person: DataGridPerson) => string;
|
|
190
|
+
/** The files in a value: an array of `{ id, name, … }`. */
|
|
191
|
+
export declare function filesOf(value: unknown): DataGridFile[];
|
|
192
|
+
/** Reduces related values to one result. An empty set is empty (null), not 0, except `count`. */
|
|
193
|
+
export declare function aggregateValues(kind: DataGridAggregate, values: unknown[]): unknown;
|
|
194
|
+
/** Whether a (parsed) value is unacceptable for the column's type; the grid refuses the edit. Empty is always acceptable. */
|
|
195
|
+
export declare function isInvalidForType(column: TypedColumn, value: unknown): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* The column with its type's defaults filled in under its own props. A column with no `type` is returned as is.
|
|
198
|
+
* `rows` is every row: a `formula` hands it to the consumer's engine for references to other rows. A rollup's and a
|
|
199
|
+
* formula's results are computed once per row each time the columns are resolved (`rows` or `columns` changed),
|
|
200
|
+
* never per comparison or keystroke.
|
|
201
|
+
*/
|
|
202
|
+
export declare function resolveColumn<T extends TypedColumn>(column: T, gridLocale?: string, rows?: Record<string, unknown>[]): T;
|
|
203
|
+
type DataGridSortDirection = "ascending" | "descending" | "none";
|
|
204
|
+
type DataGridSort = {
|
|
205
|
+
columnId: string;
|
|
206
|
+
direction: DataGridSortDirection;
|
|
207
|
+
};
|
|
208
|
+
type DataGridSelectionMode = "none" | "single" | "multiple";
|
|
209
|
+
type DataGridRow = Record<string, unknown>;
|
|
210
|
+
/** What `exportHandler` and the `exportFile` output receive, before the file is saved. */
|
|
211
|
+
type DataGridExport = {
|
|
212
|
+
format: ExportFormat;
|
|
213
|
+
/** The file name, with its extension. */
|
|
214
|
+
filename: string;
|
|
215
|
+
/** How many data rows (the header is not counted). */
|
|
216
|
+
rowCount: number;
|
|
217
|
+
/** The file. */
|
|
218
|
+
blob: Blob;
|
|
219
|
+
};
|
|
220
|
+
/** What a column's `cell` template receives (as `$implicit`). */
|
|
221
|
+
type DataGridCellContext = {
|
|
222
|
+
value: unknown;
|
|
223
|
+
formatted: string;
|
|
224
|
+
row: DataGridRow;
|
|
225
|
+
column: DataGridColumn;
|
|
226
|
+
};
|
|
227
|
+
/** What the `cellEdit` output carries after a cell edit is committed. */
|
|
228
|
+
type DataGridCellEdit = {
|
|
229
|
+
rowId: string;
|
|
230
|
+
row: DataGridRow;
|
|
231
|
+
columnId: string;
|
|
232
|
+
/** The parsed new value (a number for the `"number"` editor, the text otherwise). */
|
|
233
|
+
value: unknown;
|
|
234
|
+
/** The cell's value before the edit. */
|
|
235
|
+
previous: unknown;
|
|
236
|
+
};
|
|
237
|
+
/** What a person editor template receives (as `$implicit`). */
|
|
238
|
+
type DataGridPersonEditorContext = {
|
|
239
|
+
value: unknown;
|
|
240
|
+
commit: (value: unknown) => void;
|
|
241
|
+
cancel: () => void;
|
|
242
|
+
};
|
|
243
|
+
type DataGridColumn = {
|
|
244
|
+
/** Stable column identifier; also the default property read from each row. */
|
|
245
|
+
id: string;
|
|
246
|
+
/** Accessible + visible column header text. */
|
|
247
|
+
header: string;
|
|
248
|
+
/** Reads this column's raw value from a row. Defaults to `row[id]`. */
|
|
249
|
+
accessor?: (row: DataGridRow) => unknown;
|
|
250
|
+
/** Formats a raw value for display. Defaults to `String(value)` (`""` for null/undefined). */
|
|
251
|
+
format?: (value: unknown, row: DataGridRow) => string;
|
|
252
|
+
/** Column participates in sorting. */
|
|
253
|
+
sortable?: boolean;
|
|
254
|
+
/** Orders two raw values when sorting. `null`/`undefined` always sort last, before `compare` is called. */
|
|
255
|
+
compare?: (a: unknown, b: unknown) => number;
|
|
256
|
+
/** Column participates in the text filter. Default true. */
|
|
257
|
+
filterable?: boolean;
|
|
258
|
+
/** Column can be resized (pointer + keyboard). */
|
|
259
|
+
resizable?: boolean;
|
|
260
|
+
/** Column can be reordered: Alt+ArrowLeft/Right on its focused header, or dragging the header onto another. */
|
|
261
|
+
movable?: boolean;
|
|
262
|
+
/** Pins the column: its header and cells get `data-pinned="start"` / `"end"` for the consumer's sticky CSS. */
|
|
263
|
+
pinned?: "start" | "end";
|
|
264
|
+
/** Set `false` to leave the column out of an export. Default true. */
|
|
265
|
+
exportable?: boolean;
|
|
266
|
+
/** The value this column exports for a row. */
|
|
267
|
+
exportValue?: (row: DataGridRow) => unknown;
|
|
268
|
+
/** Column can be hidden via the column-visibility control. */
|
|
269
|
+
hidable?: boolean;
|
|
270
|
+
/** Initial pixel width, meaningful only when `resizable`. */
|
|
271
|
+
width?: number;
|
|
272
|
+
/** Custom cell content: a template receiving the cell context as `$implicit`. */
|
|
273
|
+
cell?: TemplateRef<{
|
|
274
|
+
$implicit: DataGridCellContext;
|
|
275
|
+
}>;
|
|
276
|
+
/** The header's content in place of the `header` text. `header` stays the accessible name. */
|
|
277
|
+
headerCell?: TemplateRef<{
|
|
278
|
+
$implicit: DataGridColumn;
|
|
279
|
+
}>;
|
|
280
|
+
/** Cells can be edited in place: F2 or Enter on a focused cell, a double click, or the button `labels.editCell` gates. */
|
|
281
|
+
editable?: boolean;
|
|
282
|
+
/** The editor's control. Default `"text"`; a `type` sets its own. */
|
|
283
|
+
editor?: "text" | "number" | "link" | "date" | "time" | "time-zone" | "select" | "radio" | "person" | "formula";
|
|
284
|
+
/** The kind of value in this column: a bundle of defaults for `format`, `compare`, `filterText`, `exportValue`, `align` and `editor`. */
|
|
285
|
+
type?: DataGridCellType;
|
|
286
|
+
/** BCP 47 locale for this column's formatting and collation. */
|
|
287
|
+
/** Shown instead of nothing when this column's value is missing (`null`, `undefined` or `""`). Overrides the grid's `emptyValue`. A missing value always carries `data-empty` on its cell. */
|
|
288
|
+
emptyValue?: string;
|
|
289
|
+
locale?: string;
|
|
290
|
+
/** `select` and `radio`: the choices. */
|
|
291
|
+
options?: DataGridOption[];
|
|
292
|
+
/** `time-zone`: the zones the editor's select offers. */
|
|
293
|
+
timeZones?: DataGridOption[];
|
|
294
|
+
/** `time-zone`: the date (ISO) that orders zoned times and names a zone. Never computed by the grid. */
|
|
295
|
+
referenceDate?: string;
|
|
296
|
+
/** `time-zone`: an export adds a second column holding the UTC time of day at `referenceDate`. */
|
|
297
|
+
exportUtc?: boolean;
|
|
298
|
+
/** `rollup`: how the related values are reduced. */
|
|
299
|
+
aggregate?: "count" | "countUnique" | "sum" | "avg" | "median" | "min" | "max" | "range" | "percentTrue" | "percentEmpty";
|
|
300
|
+
/** `rollup`: a reduction the named aggregates do not cover. */
|
|
301
|
+
reduce?: (values: unknown[], row: DataGridRow) => unknown;
|
|
302
|
+
/** `rollup`: reads the related values. */
|
|
303
|
+
relation?: (row: DataGridRow) => unknown[];
|
|
304
|
+
/** `rollup` and `formula`: the result's type. */
|
|
305
|
+
resultType?: "number" | "date" | "text";
|
|
306
|
+
/** `formula`: evaluates an expression. Lily ships no engine and never evaluates a string itself. */
|
|
307
|
+
evaluate?: (expression: string, context: {
|
|
308
|
+
row: DataGridRow;
|
|
309
|
+
rows: DataGridRow[];
|
|
310
|
+
columnId: string;
|
|
311
|
+
}) => {
|
|
312
|
+
value: unknown;
|
|
313
|
+
} | {
|
|
314
|
+
error: string;
|
|
315
|
+
};
|
|
316
|
+
/** `person`: how many people show before "+N". */
|
|
317
|
+
maxPeople?: number;
|
|
318
|
+
/** `person`: an avatar beside the name. Decorative. */
|
|
319
|
+
avatar?: TemplateRef<{
|
|
320
|
+
$implicit: DataGridPerson;
|
|
321
|
+
}>;
|
|
322
|
+
/** `person`: the editor template (`$implicit`: `{ value, commit, cancel }`). Without it a person cell is read-only. */
|
|
323
|
+
personEditor?: TemplateRef<{
|
|
324
|
+
$implicit: DataGridPersonEditorContext;
|
|
325
|
+
}>;
|
|
326
|
+
/** `file`: formats a size in bytes. */
|
|
327
|
+
formatSize?: (bytes: number) => string;
|
|
328
|
+
/** `file`: the `accept` of the file input. */
|
|
329
|
+
accept?: string;
|
|
330
|
+
/** `file`: whether the input takes several files. Default true. */
|
|
331
|
+
multiple?: boolean;
|
|
332
|
+
/** `select`: sort by option label (default) or by option order. */
|
|
333
|
+
sortBy?: "label" | "order";
|
|
334
|
+
/** `select`/`radio`: export the option's `"label"` or `"id"`. `person`: `"email"`. */
|
|
335
|
+
exportAs?: "label" | "id" | "email";
|
|
336
|
+
/** `number`: options for `Intl.NumberFormat`. */
|
|
337
|
+
numberFormat?: Intl.NumberFormatOptions;
|
|
338
|
+
/** `date`: options for `Intl.DateTimeFormat`. */
|
|
339
|
+
dateFormat?: Intl.DateTimeFormatOptions;
|
|
340
|
+
/** `time`: options for `Intl.DateTimeFormat`. */
|
|
341
|
+
timeFormat?: Intl.DateTimeFormatOptions;
|
|
342
|
+
/** The text the grid's filter matches for a value. */
|
|
343
|
+
filterText?: (value: unknown, row: DataGridRow) => string;
|
|
344
|
+
/** Turns the editor's text into the committed value. */
|
|
345
|
+
parse?: (draft: string, row: DataGridRow) => unknown;
|
|
346
|
+
/** Refuses a value: return a message and the cell stays in edit mode with `aria-invalid`. */
|
|
347
|
+
validate?: (value: unknown, row: DataGridRow) => string | undefined;
|
|
348
|
+
/** Set for a `formula` column: reads the expression a row holds. */
|
|
349
|
+
source?: (row: DataGridRow) => unknown;
|
|
350
|
+
/** Set for a `formula` column: the error message for a row, if any. */
|
|
351
|
+
errorOf?: (row: DataGridRow) => string | undefined;
|
|
352
|
+
/** Body cells of this column are `<th scope="row" role="rowheader">`. */
|
|
353
|
+
rowHeader?: boolean;
|
|
354
|
+
/** Horizontal alignment of the column's cells. */
|
|
355
|
+
align?: "start" | "center" | "end";
|
|
356
|
+
/** Extra class on each body cell of this column. */
|
|
357
|
+
cellClass?: string | ((ctx: DataGridCellContext) => string);
|
|
358
|
+
/** Extra attributes on each body cell of this column. */
|
|
359
|
+
cellAttrs?: (ctx: DataGridCellContext) => Record<string, string>;
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Every field is optional, but its presence gates the control it names — no baked-in English fallback.
|
|
363
|
+
* See the Svelte canonical's spec/index.md §5.
|
|
364
|
+
*/
|
|
365
|
+
type DataGridLabels = {
|
|
366
|
+
search?: string;
|
|
367
|
+
/** Accessible name of the select that limits the search to one column. Gates the select (needs `searchAllFields` too). */
|
|
368
|
+
searchField?: string;
|
|
369
|
+
/** The select's first option: search every column. */
|
|
370
|
+
searchAllFields?: string;
|
|
371
|
+
/** Accessible name of the pager. When given, the pager is a labelled `<nav>` landmark (the headless `PaginationNav`); without it the pager is a plain `<div>`. */
|
|
372
|
+
pagination?: string;
|
|
373
|
+
/** Visible text of the copy button, which puts the export (header row first, tab-separated) on the clipboard for pasting into a spreadsheet. Gates the button. */
|
|
374
|
+
copy?: string;
|
|
375
|
+
/** Announced after a copy: (how many rows). */
|
|
376
|
+
copyAnnouncement?: (rowCount: number) => string;
|
|
377
|
+
/** Announced when the clipboard could not be written. */
|
|
378
|
+
copyFailed?: string;
|
|
379
|
+
/** Announced after Ctrl/Cmd+Z puts an earlier value back: (column header, the restored text). */
|
|
380
|
+
undoAnnouncement?: (header: string, text: string) => string;
|
|
381
|
+
/** Announced after Ctrl/Cmd+Shift+Z (or Ctrl+Y) re-applies an edit: (column header, the text). */
|
|
382
|
+
redoAnnouncement?: (header: string, text: string) => string;
|
|
383
|
+
columnVisibility?: string;
|
|
384
|
+
columnVisibilityOption?: (header: string) => string;
|
|
385
|
+
resizeHandle?: (header: string) => string;
|
|
386
|
+
selectAll?: string;
|
|
387
|
+
selectionColumn?: string;
|
|
388
|
+
selectRow?: (rowLabel: string) => string;
|
|
389
|
+
previousPage?: string;
|
|
390
|
+
nextPage?: string;
|
|
391
|
+
pageStatus?: (page: number, pageCount: number, rowCount: number) => string;
|
|
392
|
+
pageAnnouncement?: (page: number, pageCount: number) => string;
|
|
393
|
+
sortAnnouncement?: (header: string, direction: DataGridSortDirection) => string;
|
|
394
|
+
filterAnnouncement?: (matchCount: number, totalCount: number) => string;
|
|
395
|
+
selectionAnnouncement?: (selectedCount: number) => string;
|
|
396
|
+
columnMoveAnnouncement?: (header: string, position: number, count: number) => string;
|
|
397
|
+
editCell?: (header: string, rowLabel: string) => string;
|
|
398
|
+
cellEditor?: (header: string) => string;
|
|
399
|
+
editAnnouncement?: (header: string, value: string) => string;
|
|
400
|
+
export?: string;
|
|
401
|
+
exportCsv?: string;
|
|
402
|
+
exportTsv?: string;
|
|
403
|
+
exportExcel?: string;
|
|
404
|
+
exportAnnouncement?: (format: ExportFormat, rowCount: number, filename: string) => string;
|
|
405
|
+
invalidValue?: (header: string, type: string) => string;
|
|
406
|
+
opensInNewTab?: (text: string) => string;
|
|
407
|
+
radioGroup?: (header: string, rowLabel: string) => string;
|
|
408
|
+
timeZone?: (header: string) => string;
|
|
409
|
+
exportUtcHeader?: (header: string) => string;
|
|
410
|
+
morePeople?: (count: number) => string;
|
|
411
|
+
removeFile?: (name: string) => string;
|
|
412
|
+
fileInput?: (header: string, rowLabel: string) => string;
|
|
413
|
+
formulaEditor?: (header: string) => string;
|
|
414
|
+
rollupDescription?: (header: string) => string;
|
|
415
|
+
editCancelAnnouncement?: (header: string) => string;
|
|
416
|
+
editError?: (header: string, message: string) => string;
|
|
417
|
+
};
|
|
418
|
+
/** What a footer template receives (as `$implicit`). */
|
|
419
|
+
type DataGridFooterContext = {
|
|
420
|
+
columns: DataGridColumn[];
|
|
421
|
+
rows: DataGridRow[];
|
|
422
|
+
};
|
|
423
|
+
type DataGridEntry = {
|
|
424
|
+
row: DataGridRow;
|
|
425
|
+
id: string;
|
|
426
|
+
};
|
|
427
|
+
type Editing = {
|
|
428
|
+
rowId: string;
|
|
429
|
+
columnId: string;
|
|
430
|
+
draft: string;
|
|
431
|
+
zone?: string;
|
|
432
|
+
error?: string;
|
|
433
|
+
invalid?: boolean;
|
|
434
|
+
};
|
|
435
|
+
type RenderItem = {
|
|
436
|
+
kind: "row";
|
|
437
|
+
index: number;
|
|
438
|
+
} | {
|
|
439
|
+
kind: "spacer";
|
|
440
|
+
rows: number;
|
|
441
|
+
key: string;
|
|
442
|
+
};
|
|
443
|
+
/** Stable per-instance id prefix; SSR-safe (no Math.random / Date.now). */
|
|
444
|
+
export declare function nextDataGridId(): string;
|
|
445
|
+
/** Sets a record of attributes on its host element (Angular cannot spread a dictionary in a template). */
|
|
446
|
+
export declare class DataGridAttrs {
|
|
447
|
+
readonly lilyDataGridAttrs: import("@angular/core/types/core").InputSignal<Record<string, string> | undefined>;
|
|
448
|
+
private readonly host;
|
|
449
|
+
private applied;
|
|
450
|
+
constructor();
|
|
451
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DataGridAttrs, never>;
|
|
452
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DataGridAttrs, "[lilyDataGridAttrs]", never, {
|
|
453
|
+
"lilyDataGridAttrs": {
|
|
454
|
+
"alias": "lilyDataGridAttrs";
|
|
455
|
+
"required": false;
|
|
456
|
+
"isSignal": true;
|
|
457
|
+
};
|
|
458
|
+
}, {}, never, never, true, never>;
|
|
459
|
+
}
|
|
460
|
+
export declare class DataGrid {
|
|
461
|
+
/** Accessible name for the grid, passed through to DataTable. */
|
|
462
|
+
readonly label: import("@angular/core/types/core").InputSignal<string>;
|
|
463
|
+
/** Optional visible caption. */
|
|
464
|
+
readonly caption: import("@angular/core/types/core").InputSignal<string | undefined>;
|
|
465
|
+
/** Column definitions. */
|
|
466
|
+
readonly columns: import("@angular/core/types/core").InputSignal<DataGridColumn[]>;
|
|
467
|
+
/** Row data. */
|
|
468
|
+
readonly rows: import("@angular/core/types/core").InputSignal<DataGridRow[]>;
|
|
469
|
+
/** BCP 47 locale for the typed columns' formatting and collation. Never defaulted: with none, values show as stored. */
|
|
470
|
+
readonly locale: import("@angular/core/types/core").InputSignal<string | undefined>;
|
|
471
|
+
/** What a cell shows when its value is missing (`null`, `undefined` or `""`), for example `"—"`. A column's own `emptyValue` wins. No default: Lily ships no text. The cell always carries `data-empty`, and an export is unaffected. */
|
|
472
|
+
readonly emptyValue: import("@angular/core/types/core").InputSignal<string | undefined>;
|
|
473
|
+
/** In development, log (once per grid) the labels the grid's features call for but `labels` leaves out. Default `true`; it never logs in production. */
|
|
474
|
+
readonly warnMissingLabels: import("@angular/core/types/core").InputSignal<boolean>;
|
|
475
|
+
/** Where missing values sort: `"last"` (default, in both directions) or `"first"`. */
|
|
476
|
+
readonly nulls: import("@angular/core/types/core").InputSignal<"first" | "last">;
|
|
477
|
+
/** Make every column movable (Alt+Arrow on its header, or drag it) unless its own `movable` is `false`. Default `false`. */
|
|
478
|
+
readonly movableColumns: import("@angular/core/types/core").InputSignal<boolean>;
|
|
479
|
+
/** Hides rows for which it returns false (a status or date-range filter). Combines with the text filter; both must pass. */
|
|
480
|
+
readonly rowFilter: import("@angular/core/types/core").InputSignal<((row: DataGridRow) => boolean) | undefined>;
|
|
481
|
+
/** Derives a stable id per row. Defaults to the row's index in `rows`. */
|
|
482
|
+
readonly rowId: import("@angular/core/types/core").InputSignal<(row: DataGridRow, index: number) => string>;
|
|
483
|
+
/** Row selection mode. */
|
|
484
|
+
readonly selectionMode: import("@angular/core/types/core").InputSignal<DataGridSelectionMode>;
|
|
485
|
+
/** Rows per page. Unset disables pagination. */
|
|
486
|
+
readonly pageSize: import("@angular/core/types/core").InputSignal<number | undefined>;
|
|
487
|
+
/** If set, persist column widths / hidden columns / sort to localStorage. */
|
|
488
|
+
readonly storageKey: import("@angular/core/types/core").InputSignal<string | undefined>;
|
|
489
|
+
/** User-facing strings. */
|
|
490
|
+
readonly labels: import("@angular/core/types/core").InputSignal<DataGridLabels>;
|
|
491
|
+
/** `"grid"` (default): roving-tabindex grid. `"table"`: a plain table with ordinary tab stops. */
|
|
492
|
+
readonly mode: import("@angular/core/types/core").InputSignal<"table" | "grid">;
|
|
493
|
+
/** Extra class on each body row. */
|
|
494
|
+
readonly rowClass: import("@angular/core/types/core").InputSignal<((row: DataGridRow) => string) | undefined>;
|
|
495
|
+
/** Extra attributes on each body row. */
|
|
496
|
+
readonly rowAttrs: import("@angular/core/types/core").InputSignal<((row: DataGridRow) => Record<string, string>) | undefined>;
|
|
497
|
+
/** Enter on a body cell with no widget, and a click outside any widget, emit `rowActivate` — only when this is true (Angular outputs cannot be tested for a listener). */
|
|
498
|
+
readonly activateRows: import("@angular/core/types/core").InputSignal<boolean>;
|
|
499
|
+
/** Shown in one row spanning every column when no row is to be shown. */
|
|
500
|
+
readonly empty: import("@angular/core/types/core").InputSignal<TemplateRef<void> | undefined>;
|
|
501
|
+
/** Rendered inside a `<tfoot>`: a template receiving `{ columns, rows }` as `$implicit`. */
|
|
502
|
+
readonly footer: import("@angular/core/types/core").InputSignal<TemplateRef<{
|
|
503
|
+
$implicit: DataGridFooterContext;
|
|
504
|
+
}> | undefined>;
|
|
505
|
+
/** Sets `aria-busy` on the table. */
|
|
506
|
+
readonly busy: import("@angular/core/types/core").InputSignal<boolean>;
|
|
507
|
+
/** Wrap the table in a scrollable `data-grid-scroll` region. Default true. */
|
|
508
|
+
readonly scroll: import("@angular/core/types/core").InputSignal<boolean>;
|
|
509
|
+
/** The file name without its extension. Default `"data-grid"`. */
|
|
510
|
+
readonly exportFilename: import("@angular/core/types/core").InputSignal<string>;
|
|
511
|
+
/** What an export holds: `"view"` (default) or `"selected"`. */
|
|
512
|
+
readonly exportScope: import("@angular/core/types/core").InputSignal<"view" | "selected">;
|
|
513
|
+
/** `.xlsx` only: a `formula` column keeps the live expression with the result cached. */
|
|
514
|
+
readonly exportFormulas: import("@angular/core/types/core").InputSignal<boolean>;
|
|
515
|
+
/** Called with the file before it is saved. Return `false` to keep the grid from saving it. */
|
|
516
|
+
readonly exportHandler: import("@angular/core/types/core").InputSignal<((file: DataGridExport) => boolean | void) | undefined>;
|
|
517
|
+
/** Called before a copy puts text on the clipboard. Return `false` to take over (nothing is copied). The `copy` output fires first. */
|
|
518
|
+
readonly copyHandler: import("@angular/core/types/core").InputSignal<((copy: {
|
|
519
|
+
text: string;
|
|
520
|
+
rowCount: number;
|
|
521
|
+
}) => boolean | void) | undefined>;
|
|
522
|
+
/** Renders only the rows in view, in a scroll region of `height` px (needs `scroll`). */
|
|
523
|
+
readonly virtualize: import("@angular/core/types/core").InputSignal<{
|
|
524
|
+
rowHeight: number;
|
|
525
|
+
height: number;
|
|
526
|
+
overscan?: number;
|
|
527
|
+
} | undefined>;
|
|
528
|
+
/** Extra CSS class on the root. */
|
|
529
|
+
readonly className: import("@angular/core/types/core").InputSignal<string>;
|
|
530
|
+
/** Selected row ids. Two-way bindable: `[(selected)]`. */
|
|
531
|
+
readonly selected: import("@angular/core/types/core").ModelSignal<string[]>;
|
|
532
|
+
/** Text filter. Two-way bindable: `[(filter)]`. */
|
|
533
|
+
readonly filter: import("@angular/core/types/core").ModelSignal<string>;
|
|
534
|
+
/** Limits the text filter to one column: a column id, or `""` for every filterable column. Two-way bindable: `[(filterField)]`. */
|
|
535
|
+
readonly filterField: import("@angular/core/types/core").ModelSignal<string>;
|
|
536
|
+
/** Further sort keys after `sort`, for ties: Shift+click on another sortable header adds it. Two-way bindable: `[(thenBy)]`. */
|
|
537
|
+
readonly thenBy: import("@angular/core/types/core").ModelSignal<DataGridSort[]>;
|
|
538
|
+
/** Current sort. Two-way bindable: `[(sort)]`. */
|
|
539
|
+
readonly sort: import("@angular/core/types/core").ModelSignal<DataGridSort>;
|
|
540
|
+
/** Column ids in display order. Two-way bindable: `[(columnOrder)]`; columns it does not name follow in their `columns` order. */
|
|
541
|
+
readonly columnOrder: import("@angular/core/types/core").ModelSignal<string[]>;
|
|
542
|
+
/** Current 1-indexed page. Two-way bindable: `[(page)]`. */
|
|
543
|
+
readonly page: import("@angular/core/types/core").ModelSignal<number>;
|
|
544
|
+
readonly cellEdit: import("@angular/core/types/_api-chunk").OutputEmitterRef<DataGridCellEdit>;
|
|
545
|
+
readonly filesSelected: import("@angular/core/types/_api-chunk").OutputEmitterRef<{
|
|
546
|
+
rowId: string;
|
|
547
|
+
row: DataGridRow;
|
|
548
|
+
columnId: string;
|
|
549
|
+
files: File[];
|
|
550
|
+
}>;
|
|
551
|
+
readonly fileRemove: import("@angular/core/types/_api-chunk").OutputEmitterRef<{
|
|
552
|
+
rowId: string;
|
|
553
|
+
row: DataGridRow;
|
|
554
|
+
columnId: string;
|
|
555
|
+
fileId: string;
|
|
556
|
+
}>;
|
|
557
|
+
readonly rowActivate: import("@angular/core/types/_api-chunk").OutputEmitterRef<{
|
|
558
|
+
row: DataGridRow;
|
|
559
|
+
id: string;
|
|
560
|
+
}>;
|
|
561
|
+
readonly exportFile: import("@angular/core/types/_api-chunk").OutputEmitterRef<DataGridExport>;
|
|
562
|
+
readonly copy: import("@angular/core/types/_api-chunk").OutputEmitterRef<{
|
|
563
|
+
text: string;
|
|
564
|
+
rowCount: number;
|
|
565
|
+
}>;
|
|
566
|
+
protected readonly gridId: string;
|
|
567
|
+
protected readonly minColumnWidth = 40;
|
|
568
|
+
private readonly rootRef;
|
|
569
|
+
private readonly scrollRef;
|
|
570
|
+
private readonly injector;
|
|
571
|
+
protected readonly statusMessage: import("@angular/core/types/_chrome_dev_tools_performance-chunk").WritableSignal<string>;
|
|
572
|
+
protected readonly hiddenColumnIds: import("@angular/core/types/_chrome_dev_tools_performance-chunk").WritableSignal<ReadonlySet<string>>;
|
|
573
|
+
private readonly columnWidths;
|
|
574
|
+
private readonly focusedRow;
|
|
575
|
+
private readonly focusedCol;
|
|
576
|
+
private lastSelectedIndex;
|
|
577
|
+
protected readonly editingState: import("@angular/core/types/_chrome_dev_tools_performance-chunk").WritableSignal<Editing | null>;
|
|
578
|
+
private readonly scrollTop;
|
|
579
|
+
private draggingColumnId;
|
|
580
|
+
/** Each column with its type's defaults filled in under its own props. */
|
|
581
|
+
protected readonly resolvedColumns: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<DataGridColumn[]>;
|
|
582
|
+
protected readonly isGrid: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<boolean>;
|
|
583
|
+
protected readonly hasSelection: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<boolean>;
|
|
584
|
+
protected readonly colOffset: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<0 | 1>;
|
|
585
|
+
/** Columns in display order: those named in `columnOrder` first, the rest after in their own order. */
|
|
586
|
+
private readonly orderedColumns;
|
|
587
|
+
protected readonly visibleColumns: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<DataGridColumn[]>;
|
|
588
|
+
protected readonly hidableColumns: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<DataGridColumn[]>;
|
|
589
|
+
private readonly entries;
|
|
590
|
+
/** Each cell's value and formatted text, read once per row object and column (reset when the columns change). */
|
|
591
|
+
private readonly cellCache;
|
|
592
|
+
protected cellFor(column: DataGridColumn, row: DataGridRow): DataGridCellContext;
|
|
593
|
+
/** A missing value: `null`, `undefined` or an empty string. */
|
|
594
|
+
protected readonly isMissing: (value: unknown) => boolean;
|
|
595
|
+
/** A column the user can move: its own `movable`, else the grid's `movableColumns`. */
|
|
596
|
+
protected isMovable(column: DataGridColumn): boolean;
|
|
597
|
+
protected readonly filterableColumns: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<DataGridColumn[]>;
|
|
598
|
+
/** One folded (lower-case, no diacritics) text per filterable cell, built once per rows/columns change. */
|
|
599
|
+
private readonly searchIndex;
|
|
600
|
+
private readonly filteredEntries;
|
|
601
|
+
/** The sort keys in order: the primary, then `thenBy`, each with a real column and a direction. */
|
|
602
|
+
private readonly sortKeys;
|
|
603
|
+
protected readonly sortedEntries: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<DataGridEntry[]>;
|
|
604
|
+
protected readonly pageCount: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<number>;
|
|
605
|
+
protected readonly clampedPage: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<number>;
|
|
606
|
+
protected readonly pageStart: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<number>;
|
|
607
|
+
protected readonly pageEntries: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<DataGridEntry[]>;
|
|
608
|
+
protected readonly lastCol: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<number>;
|
|
609
|
+
protected readonly activeRow: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<number>;
|
|
610
|
+
protected readonly activeCol: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<number>;
|
|
611
|
+
protected readonly indexed: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<boolean>;
|
|
612
|
+
private readonly rowCount;
|
|
613
|
+
protected readonly renderItems: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<RenderItem[]>;
|
|
614
|
+
protected readonly scrollStyle: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<string | null>;
|
|
615
|
+
private readonly selectedSet;
|
|
616
|
+
protected readonly allSelected: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<boolean>;
|
|
617
|
+
protected readonly someSelected: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<boolean>;
|
|
618
|
+
protected readonly footerContext: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<DataGridFooterContext>;
|
|
619
|
+
protected readonly exportColumns: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<DataGridColumn[]>;
|
|
620
|
+
protected readonly exportEntries: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<DataGridEntry[]>;
|
|
621
|
+
protected readonly hasExportButtons: import("@angular/core/types/_chrome_dev_tools_performance-chunk").Signal<boolean>;
|
|
622
|
+
constructor();
|
|
623
|
+
private announce;
|
|
624
|
+
protected ariaSortFor(column: DataGridColumn): DataGridSortDirection | null;
|
|
625
|
+
/** 1 for the primary key, 2… for `thenBy`, only while more than one key is in force. */
|
|
626
|
+
protected sortOrderFor(column: DataGridColumn): number | null;
|
|
627
|
+
protected toggleSort(column: DataGridColumn, additive?: boolean): void;
|
|
628
|
+
protected setFilter(value: string): void;
|
|
629
|
+
/** Escape in the search field clears it. */
|
|
630
|
+
protected onFilterKeydown(event: Event): void;
|
|
631
|
+
protected onFilterFieldChange(event: Event): void;
|
|
632
|
+
protected isSelected(id: string): boolean;
|
|
633
|
+
private setSelected;
|
|
634
|
+
protected onRowSelectClick(index: number, event: Event): void;
|
|
635
|
+
/** `index` is the row's position in the sorted entries, not on the current page. */
|
|
636
|
+
private toggleRow;
|
|
637
|
+
protected toggleSelectAll(): void;
|
|
638
|
+
protected widthFor(column: DataGridColumn): number | undefined;
|
|
639
|
+
/** Inline style of a column's cells: its width, and its alignment where one is set. */
|
|
640
|
+
protected cellStyle(column: DataGridColumn): string | null;
|
|
641
|
+
private setWidth;
|
|
642
|
+
protected onResizeKeydown(column: DataGridColumn, event: Event): void;
|
|
643
|
+
protected onResizePointerDown(column: DataGridColumn, event: Event): void;
|
|
644
|
+
protected toggleColumnVisibility(columnId: string): void;
|
|
645
|
+
protected goToPage(next: number): void;
|
|
646
|
+
/** Move `columnId` to sit at `toVisibleIndex` among the visible columns. Returns whether it moved. */
|
|
647
|
+
private moveColumn;
|
|
648
|
+
protected onHeaderDragStart(column: DataGridColumn, event: Event): void;
|
|
649
|
+
protected onHeaderDragOver(event: Event): void;
|
|
650
|
+
protected onHeaderDrop(targetId: string, event: Event): void;
|
|
651
|
+
protected onScroll(event: Event): void;
|
|
652
|
+
/** Bring a body row into the scroll region. */
|
|
653
|
+
private revealRow;
|
|
654
|
+
private focusActiveCell;
|
|
655
|
+
private moveFocus;
|
|
656
|
+
/** One cell for an export: typed values stay typed, everything else is the text the grid shows. */
|
|
657
|
+
private exportCell;
|
|
658
|
+
private hasUtcColumn;
|
|
659
|
+
private buildExportTable;
|
|
660
|
+
/** Copy the export (what a download would hold) to the clipboard as tab-separated text. `copyHandler` may return false to take over. */
|
|
661
|
+
protected runCopy(): Promise<void>;
|
|
662
|
+
protected runExport(format: ExportFormat): void;
|
|
663
|
+
/** Files dropped on an editable file cell: the same report as the file input. The grid uploads nothing. */
|
|
664
|
+
protected onFileDragOver(column: DataGridColumn, event: Event): void;
|
|
665
|
+
protected onFileDrop(entry: DataGridEntry, column: DataGridColumn, event: Event): void;
|
|
666
|
+
protected onFileInput(entry: DataGridEntry, column: DataGridColumn, event: Event): void;
|
|
667
|
+
/** A cell the person can edit through the grid's edit model (not a rollup, a file cell with its own widgets, or a person cell with no editor). */
|
|
668
|
+
protected isEditable(column: DataGridColumn): boolean;
|
|
669
|
+
protected isEditingCell(entry: DataGridEntry, column: DataGridColumn): boolean;
|
|
670
|
+
protected startEdit(entry: DataGridEntry, column: DataGridColumn): void;
|
|
671
|
+
private parseDraft;
|
|
672
|
+
/** Two link values with the same address and label are the same edit. */
|
|
673
|
+
/** Accepted cell edits, for Ctrl/Cmd+Z. The consumer owns the data, so an undo is reported through the `cellEdit` output like any edit. */
|
|
674
|
+
private history;
|
|
675
|
+
/** Put an earlier cell value back, or re-apply it, through `cellEdit`. */
|
|
676
|
+
private stepHistory;
|
|
677
|
+
private isStructurallyEqual;
|
|
678
|
+
/** Validate and report one new value for a cell. Returns false (and keeps editing, if the editor is open) when it is refused. */
|
|
679
|
+
protected commitValue(entry: DataGridEntry, column: DataGridColumn, value: unknown): boolean;
|
|
680
|
+
private commitEdit;
|
|
681
|
+
private cancelEdit;
|
|
682
|
+
protected onEditorKeydown(event: Event): void;
|
|
683
|
+
protected onEditorBlur(): void;
|
|
684
|
+
/** Focus leaving the time-zone editor's pair (not moving between its two controls) commits. */
|
|
685
|
+
protected onZonedFocusout(event: Event): void;
|
|
686
|
+
protected setDraft(event: Event): void;
|
|
687
|
+
protected setZone(event: Event): void;
|
|
688
|
+
protected personEditorContext(entry: DataGridEntry, column: DataGridColumn, ctx: DataGridCellContext): DataGridPersonEditorContext;
|
|
689
|
+
private activateFocusedCell;
|
|
690
|
+
/** The widgets a consumer put in a body cell (never the grid's own controls). */
|
|
691
|
+
private widgetsIn;
|
|
692
|
+
private setWidgetTabindex;
|
|
693
|
+
private normaliseWidgets;
|
|
694
|
+
/** Focus the first widget of a cell; its widgets are tab stops while focus stays inside it. */
|
|
695
|
+
private enterCell;
|
|
696
|
+
private leaveCell;
|
|
697
|
+
/** Pointer or programmatic focus on a cell moves the roving position to it. */
|
|
698
|
+
protected onGridFocusin(event: Event): void;
|
|
699
|
+
protected onGridFocusout(event: Event): void;
|
|
700
|
+
/** A click on a body cell, outside any widget, activates its row. */
|
|
701
|
+
protected onGridClick(event: Event): void;
|
|
702
|
+
/** A double click on an editable body cell starts editing it. */
|
|
703
|
+
protected onGridDblclick(event: Event): void;
|
|
704
|
+
private typeahead;
|
|
705
|
+
protected onGridKeydown(event: Event): void;
|
|
706
|
+
private restoreView;
|
|
707
|
+
protected rowLabelOf(entry: DataGridEntry): string;
|
|
708
|
+
protected cellClassOf(column: DataGridColumn, ctx: DataGridCellContext): string;
|
|
709
|
+
protected peopleIn(value: unknown): DataGridPerson[];
|
|
710
|
+
protected shownPeople(column: DataGridColumn, value: unknown): DataGridPerson[];
|
|
711
|
+
protected nameOf(person: DataGridPerson): string;
|
|
712
|
+
protected filesIn(value: unknown): DataGridFile[];
|
|
713
|
+
protected linkIn(value: unknown): DataGridLink | null;
|
|
714
|
+
protected hrefOf(href: string | undefined): string | null;
|
|
715
|
+
protected stringOf(value: unknown): string;
|
|
716
|
+
protected ungroupedOptions(column: DataGridColumn): DataGridOption[];
|
|
717
|
+
protected groupsOf(column: DataGridColumn): string[];
|
|
718
|
+
protected optionsInGroup(column: DataGridColumn, group: string): DataGridOption[];
|
|
719
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DataGrid, never>;
|
|
720
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DataGrid, "lily-data-grid", never, {
|
|
721
|
+
"label": {
|
|
722
|
+
"alias": "label";
|
|
723
|
+
"required": true;
|
|
724
|
+
"isSignal": true;
|
|
725
|
+
};
|
|
726
|
+
"caption": {
|
|
727
|
+
"alias": "caption";
|
|
728
|
+
"required": false;
|
|
729
|
+
"isSignal": true;
|
|
730
|
+
};
|
|
731
|
+
"columns": {
|
|
732
|
+
"alias": "columns";
|
|
733
|
+
"required": true;
|
|
734
|
+
"isSignal": true;
|
|
735
|
+
};
|
|
736
|
+
"rows": {
|
|
737
|
+
"alias": "rows";
|
|
738
|
+
"required": true;
|
|
739
|
+
"isSignal": true;
|
|
740
|
+
};
|
|
741
|
+
"locale": {
|
|
742
|
+
"alias": "locale";
|
|
743
|
+
"required": false;
|
|
744
|
+
"isSignal": true;
|
|
745
|
+
};
|
|
746
|
+
"emptyValue": {
|
|
747
|
+
"alias": "emptyValue";
|
|
748
|
+
"required": false;
|
|
749
|
+
"isSignal": true;
|
|
750
|
+
};
|
|
751
|
+
"warnMissingLabels": {
|
|
752
|
+
"alias": "warnMissingLabels";
|
|
753
|
+
"required": false;
|
|
754
|
+
"isSignal": true;
|
|
755
|
+
};
|
|
756
|
+
"nulls": {
|
|
757
|
+
"alias": "nulls";
|
|
758
|
+
"required": false;
|
|
759
|
+
"isSignal": true;
|
|
760
|
+
};
|
|
761
|
+
"movableColumns": {
|
|
762
|
+
"alias": "movableColumns";
|
|
763
|
+
"required": false;
|
|
764
|
+
"isSignal": true;
|
|
765
|
+
};
|
|
766
|
+
"rowFilter": {
|
|
767
|
+
"alias": "rowFilter";
|
|
768
|
+
"required": false;
|
|
769
|
+
"isSignal": true;
|
|
770
|
+
};
|
|
771
|
+
"rowId": {
|
|
772
|
+
"alias": "rowId";
|
|
773
|
+
"required": false;
|
|
774
|
+
"isSignal": true;
|
|
775
|
+
};
|
|
776
|
+
"selectionMode": {
|
|
777
|
+
"alias": "selectionMode";
|
|
778
|
+
"required": false;
|
|
779
|
+
"isSignal": true;
|
|
780
|
+
};
|
|
781
|
+
"pageSize": {
|
|
782
|
+
"alias": "pageSize";
|
|
783
|
+
"required": false;
|
|
784
|
+
"isSignal": true;
|
|
785
|
+
};
|
|
786
|
+
"storageKey": {
|
|
787
|
+
"alias": "storageKey";
|
|
788
|
+
"required": false;
|
|
789
|
+
"isSignal": true;
|
|
790
|
+
};
|
|
791
|
+
"labels": {
|
|
792
|
+
"alias": "labels";
|
|
793
|
+
"required": false;
|
|
794
|
+
"isSignal": true;
|
|
795
|
+
};
|
|
796
|
+
"mode": {
|
|
797
|
+
"alias": "mode";
|
|
798
|
+
"required": false;
|
|
799
|
+
"isSignal": true;
|
|
800
|
+
};
|
|
801
|
+
"rowClass": {
|
|
802
|
+
"alias": "rowClass";
|
|
803
|
+
"required": false;
|
|
804
|
+
"isSignal": true;
|
|
805
|
+
};
|
|
806
|
+
"rowAttrs": {
|
|
807
|
+
"alias": "rowAttrs";
|
|
808
|
+
"required": false;
|
|
809
|
+
"isSignal": true;
|
|
810
|
+
};
|
|
811
|
+
"activateRows": {
|
|
812
|
+
"alias": "activateRows";
|
|
813
|
+
"required": false;
|
|
814
|
+
"isSignal": true;
|
|
815
|
+
};
|
|
816
|
+
"empty": {
|
|
817
|
+
"alias": "empty";
|
|
818
|
+
"required": false;
|
|
819
|
+
"isSignal": true;
|
|
820
|
+
};
|
|
821
|
+
"footer": {
|
|
822
|
+
"alias": "footer";
|
|
823
|
+
"required": false;
|
|
824
|
+
"isSignal": true;
|
|
825
|
+
};
|
|
826
|
+
"busy": {
|
|
827
|
+
"alias": "busy";
|
|
828
|
+
"required": false;
|
|
829
|
+
"isSignal": true;
|
|
830
|
+
};
|
|
831
|
+
"scroll": {
|
|
832
|
+
"alias": "scroll";
|
|
833
|
+
"required": false;
|
|
834
|
+
"isSignal": true;
|
|
835
|
+
};
|
|
836
|
+
"exportFilename": {
|
|
837
|
+
"alias": "exportFilename";
|
|
838
|
+
"required": false;
|
|
839
|
+
"isSignal": true;
|
|
840
|
+
};
|
|
841
|
+
"exportScope": {
|
|
842
|
+
"alias": "exportScope";
|
|
843
|
+
"required": false;
|
|
844
|
+
"isSignal": true;
|
|
845
|
+
};
|
|
846
|
+
"exportFormulas": {
|
|
847
|
+
"alias": "exportFormulas";
|
|
848
|
+
"required": false;
|
|
849
|
+
"isSignal": true;
|
|
850
|
+
};
|
|
851
|
+
"exportHandler": {
|
|
852
|
+
"alias": "exportHandler";
|
|
853
|
+
"required": false;
|
|
854
|
+
"isSignal": true;
|
|
855
|
+
};
|
|
856
|
+
"copyHandler": {
|
|
857
|
+
"alias": "copyHandler";
|
|
858
|
+
"required": false;
|
|
859
|
+
"isSignal": true;
|
|
860
|
+
};
|
|
861
|
+
"virtualize": {
|
|
862
|
+
"alias": "virtualize";
|
|
863
|
+
"required": false;
|
|
864
|
+
"isSignal": true;
|
|
865
|
+
};
|
|
866
|
+
"className": {
|
|
867
|
+
"alias": "className";
|
|
868
|
+
"required": false;
|
|
869
|
+
"isSignal": true;
|
|
870
|
+
};
|
|
871
|
+
"selected": {
|
|
872
|
+
"alias": "selected";
|
|
873
|
+
"required": false;
|
|
874
|
+
"isSignal": true;
|
|
875
|
+
};
|
|
876
|
+
"filter": {
|
|
877
|
+
"alias": "filter";
|
|
878
|
+
"required": false;
|
|
879
|
+
"isSignal": true;
|
|
880
|
+
};
|
|
881
|
+
"filterField": {
|
|
882
|
+
"alias": "filterField";
|
|
883
|
+
"required": false;
|
|
884
|
+
"isSignal": true;
|
|
885
|
+
};
|
|
886
|
+
"thenBy": {
|
|
887
|
+
"alias": "thenBy";
|
|
888
|
+
"required": false;
|
|
889
|
+
"isSignal": true;
|
|
890
|
+
};
|
|
891
|
+
"sort": {
|
|
892
|
+
"alias": "sort";
|
|
893
|
+
"required": false;
|
|
894
|
+
"isSignal": true;
|
|
895
|
+
};
|
|
896
|
+
"columnOrder": {
|
|
897
|
+
"alias": "columnOrder";
|
|
898
|
+
"required": false;
|
|
899
|
+
"isSignal": true;
|
|
900
|
+
};
|
|
901
|
+
"page": {
|
|
902
|
+
"alias": "page";
|
|
903
|
+
"required": false;
|
|
904
|
+
"isSignal": true;
|
|
905
|
+
};
|
|
906
|
+
}, {
|
|
907
|
+
"selected": "selectedChange";
|
|
908
|
+
"filter": "filterChange";
|
|
909
|
+
"filterField": "filterFieldChange";
|
|
910
|
+
"thenBy": "thenByChange";
|
|
911
|
+
"sort": "sortChange";
|
|
912
|
+
"columnOrder": "columnOrderChange";
|
|
913
|
+
"page": "pageChange";
|
|
914
|
+
"cellEdit": "cellEdit";
|
|
915
|
+
"filesSelected": "filesSelected";
|
|
916
|
+
"fileRemove": "fileRemove";
|
|
917
|
+
"rowActivate": "rowActivate";
|
|
918
|
+
"exportFile": "exportFile";
|
|
919
|
+
"copy": "copy";
|
|
920
|
+
}, never, never, true, never>;
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Search matching shared by the data grid, kanban board, Gantt chart and calendar: pure, so it is unit-tested without a browser.
|
|
924
|
+
*
|
|
925
|
+
* A query is split on whitespace into terms; every term must appear (AND), in any order, ignoring case and diacritics
|
|
926
|
+
* ("cafe" finds "Café"). An empty query matches everything.
|
|
927
|
+
*/
|
|
928
|
+
/** Lower-case and strip combining marks, so matching ignores case and diacritics. */
|
|
929
|
+
export declare function foldText(text: string): string;
|
|
930
|
+
/** The terms of a query, folded; empty when the query is blank. */
|
|
931
|
+
export declare function searchTerms(query: string): string[];
|
|
932
|
+
/** True when every term of `query` appears in `text`. */
|
|
933
|
+
export declare function matchesSearch(text: string, query: string): boolean;
|
|
934
|
+
type SearchSegment = {
|
|
935
|
+
text: string;
|
|
936
|
+
match: boolean;
|
|
937
|
+
};
|
|
938
|
+
/**
|
|
939
|
+
* `text` cut into runs, marking the parts any term matches (for `<mark>`). Folding can change a string's length (a precomposed "é"
|
|
940
|
+
* is one character, its folded form too, but a ligature may not be), so matching works on a per-character fold and falls back to
|
|
941
|
+
* one unmarked segment if the two ever disagree.
|
|
942
|
+
*/
|
|
943
|
+
export declare function highlightSegments(text: string, query: string): SearchSegment[];
|
|
944
|
+
export declare const TYPEAHEAD_RESET_MS = 700;
|
|
945
|
+
type TypeaheadState = {
|
|
946
|
+
prefix: string;
|
|
947
|
+
at: number;
|
|
948
|
+
};
|
|
949
|
+
/** Whether a key press is a type-ahead character: one printable character, no Ctrl, Alt or Meta. */
|
|
950
|
+
export declare function isTypeaheadKey(event: {
|
|
951
|
+
key: string;
|
|
952
|
+
ctrlKey?: boolean;
|
|
953
|
+
altKey?: boolean;
|
|
954
|
+
metaKey?: boolean;
|
|
955
|
+
}): boolean;
|
|
956
|
+
/** The prefix after `key` is pressed at time `now`: it grows while presses are within `resetMs` of each other, else starts over. */
|
|
957
|
+
export declare function nextTypeaheadState(previous: TypeaheadState, key: string, now: number, resetMs?: number): TypeaheadState;
|
|
958
|
+
/**
|
|
959
|
+
* The index of the row to move to, or -1. Searches from the row after `from` and wraps. A prefix of one repeated letter ("ss") is
|
|
960
|
+
* treated as that single letter, so pressing it again steps through the rows starting with it.
|
|
961
|
+
*/
|
|
962
|
+
export declare function findTypeaheadMatch(labels: readonly string[], from: number, prefix: string): number;
|
|
963
|
+
/**
|
|
964
|
+
* Undo / redo for typed-field edits: pure, so it is unit-tested without a browser. The components own nothing but the stacks:
|
|
965
|
+
* the consumer owns the data, so an undo is reported the same way an edit is — through `onFieldEdit`, with the earlier value.
|
|
966
|
+
*/
|
|
967
|
+
/** One accepted edit: which record and field, the value it took and the value it replaced. */
|
|
968
|
+
type EditRecord = {
|
|
969
|
+
ownerId: string;
|
|
970
|
+
fieldId: string;
|
|
971
|
+
value: unknown;
|
|
972
|
+
previous: unknown;
|
|
973
|
+
};
|
|
974
|
+
type EditHistory = {
|
|
975
|
+
undo: readonly EditRecord[];
|
|
976
|
+
redo: readonly EditRecord[];
|
|
977
|
+
};
|
|
978
|
+
export declare const EMPTY_HISTORY: EditHistory;
|
|
979
|
+
/** Most steps kept; the oldest fall off. */
|
|
980
|
+
export declare const HISTORY_LIMIT = 100;
|
|
981
|
+
/** A new edit goes on the undo stack and ends any redo chain. */
|
|
982
|
+
export declare function recordEdit(history: EditHistory, record: EditRecord, limit?: number): EditHistory;
|
|
983
|
+
/** Step back: the record to reverse (apply `previous`), and the history with it moved to the redo stack. */
|
|
984
|
+
export declare function undoEdit(history: EditHistory): {
|
|
985
|
+
history: EditHistory;
|
|
986
|
+
record: EditRecord | undefined;
|
|
987
|
+
};
|
|
988
|
+
/** Step forward: the record to re-apply (apply `value`), and the history with it moved back to the undo stack. */
|
|
989
|
+
export declare function redoEdit(history: EditHistory): {
|
|
990
|
+
history: EditHistory;
|
|
991
|
+
record: EditRecord | undefined;
|
|
992
|
+
};
|
|
993
|
+
/** Whether a key press is Undo (Ctrl/Cmd+Z) or Redo (Ctrl/Cmd+Shift+Z, or Ctrl+Y), or neither. */
|
|
994
|
+
export declare function historyKey(event: {
|
|
995
|
+
key: string;
|
|
996
|
+
ctrlKey?: boolean;
|
|
997
|
+
metaKey?: boolean;
|
|
998
|
+
shiftKey?: boolean;
|
|
999
|
+
altKey?: boolean;
|
|
1000
|
+
}): "undo" | "redo" | null;
|
|
1001
|
+
/**
|
|
1002
|
+
* Which `labels` a grid needs, by what it renders — so an app can check that it has supplied every string for its locale, and a
|
|
1003
|
+
* grid can say, in development, which control it is about to leave unnamed. Lily ships no English: a missing label is a control with
|
|
1004
|
+
* no name, or an announcement that is never made, never English text. Pure, so it is unit-tested on its own.
|
|
1005
|
+
*/
|
|
1006
|
+
/** What the grid is showing, as far as labels are concerned. */
|
|
1007
|
+
type LabelFeatures = {
|
|
1008
|
+
/** `selectionMode` is not `none`. */
|
|
1009
|
+
selection?: boolean;
|
|
1010
|
+
/** `pageSize` is set. */
|
|
1011
|
+
pagination?: boolean;
|
|
1012
|
+
/** Some column is `hidable`. */
|
|
1013
|
+
hidableColumns?: boolean;
|
|
1014
|
+
/** Some column is `resizable`. */
|
|
1015
|
+
resizableColumns?: boolean;
|
|
1016
|
+
/** Some column is editable (`onCellEdit` is set). */
|
|
1017
|
+
editing?: boolean;
|
|
1018
|
+
/** Some column is `sortable`. */
|
|
1019
|
+
sorting?: boolean;
|
|
1020
|
+
/** The search field is wanted (the field itself is gated by `labels.search`). */
|
|
1021
|
+
search?: boolean;
|
|
1022
|
+
/** Export or copy buttons are wanted. */
|
|
1023
|
+
exporting?: boolean;
|
|
1024
|
+
};
|
|
1025
|
+
/** Labels that **name a control**: without one the control is unnamed to a screen reader (or not rendered at all). */
|
|
1026
|
+
export declare const CONTROL_LABELS: {
|
|
1027
|
+
readonly selection: readonly ["selectAll", "selectionColumn", "selectRow"];
|
|
1028
|
+
readonly pagination: readonly ["previousPage", "nextPage", "pageStatus"];
|
|
1029
|
+
readonly hidableColumns: readonly ["columnVisibility", "columnVisibilityOption"];
|
|
1030
|
+
readonly resizableColumns: readonly ["resizeHandle"];
|
|
1031
|
+
readonly editing: readonly ["editCell", "cellEditor"];
|
|
1032
|
+
readonly search: readonly ["search"];
|
|
1033
|
+
readonly exporting: readonly ["export"];
|
|
1034
|
+
};
|
|
1035
|
+
/** Labels that make an **announcement** through the live region: without one the change is silent. */
|
|
1036
|
+
export declare const ANNOUNCEMENT_LABELS: {
|
|
1037
|
+
readonly sorting: readonly ["sortAnnouncement"];
|
|
1038
|
+
readonly search: readonly ["filterAnnouncement"];
|
|
1039
|
+
readonly selection: readonly ["selectionAnnouncement"];
|
|
1040
|
+
readonly pagination: readonly ["pageAnnouncement"];
|
|
1041
|
+
readonly editing: readonly ["editAnnouncement", "editCancelAnnouncement", "editError", "undoAnnouncement", "redoAnnouncement"];
|
|
1042
|
+
readonly exporting: readonly ["exportAnnouncement", "copyAnnouncement", "copyFailed"];
|
|
1043
|
+
};
|
|
1044
|
+
type LabelKind = "control" | "announcement";
|
|
1045
|
+
/** Every label key the features in use call for, with its kind. */
|
|
1046
|
+
export declare function requiredLabels(features: LabelFeatures): {
|
|
1047
|
+
key: string;
|
|
1048
|
+
kind: LabelKind;
|
|
1049
|
+
}[];
|
|
1050
|
+
/** The required labels that are absent (`undefined`, `null` or an empty string) from `labels`. */
|
|
1051
|
+
export declare function missingLabels(features: LabelFeatures, labels: Record<string, unknown> | undefined): {
|
|
1052
|
+
key: string;
|
|
1053
|
+
kind: LabelKind;
|
|
1054
|
+
}[];
|
|
1055
|
+
export type { DataGridAggregate, DataGridCellContext, DataGridCellEdit, DataGridCellType, DataGridColumn, DataGridEntry, DataGridExport, DataGridFile, DataGridFooterContext, DataGridFormulaContext, DataGridFormulaResult, DataGridLabels, DataGridLink, DataGridOption, DataGridPerson, DataGridPersonEditorContext, DataGridRow, DataGridSelectionMode, DataGridSort, DataGridSortDirection, DataGridZonedTime, DelimitedOptions, EditHistory, EditRecord, ExportFormat, ExportFormula, ExportTable, LabelFeatures, LabelKind, SearchSegment, TypeaheadState, XlsxOptions };
|
|
1056
|
+
//# sourceMappingURL=lilydesignsystem-angular-data-grid.d.ts.map
|