@one-grid-core/angular 0.2.1 → 0.4.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 +55 -9
- package/esm2022/lib/components/one-grid/one-grid.component.mjs +244 -11
- package/esm2022/lib/components/one-grid-body/one-grid-body.component.mjs +446 -34
- package/esm2022/lib/components/one-grid-cell-currency/one-grid-cell-currency.component.mjs +6 -5
- package/esm2022/lib/components/one-grid-cell-group-renderer/one-grid-cell-group-renderer.component.mjs +3 -3
- package/esm2022/lib/components/one-grid-cell-option-menu/one-grid-cell-option-menu.component.mjs +3 -3
- package/esm2022/lib/components/one-grid-checkbox/one-grid-checkbox.component.mjs +7 -18
- package/esm2022/lib/components/one-grid-checkbox-header/one-grid-checkbox-header.component.mjs +6 -6
- package/esm2022/lib/components/one-grid-header/one-grid-header.component.mjs +221 -17
- package/esm2022/lib/components/one-grid-header-menu/one-grid-header-menu.component.mjs +137 -0
- package/esm2022/lib/components/one-grid-pagination/one-grid-pagination.component.mjs +6 -5
- package/esm2022/lib/components/one-grid-row-action/one-grid-row-action.component.mjs +4 -4
- package/esm2022/lib/components/one-grid-row-drag-handle/one-grid-row-drag-handle.component.mjs +5 -3
- package/esm2022/lib/components/one-grid-status/one-grid-status.component.mjs +4 -4
- package/esm2022/lib/core/directives/one-cell-input-validator.directive.mjs +3 -3
- package/esm2022/lib/core/directives/one-cell-renderer-component.directive.mjs +3 -3
- package/esm2022/lib/core/directives/one-cell-text-expand.directive.mjs +3 -3
- package/esm2022/lib/core/icons/one-grid-icons.mjs +38 -0
- package/esm2022/lib/core/instants/one-grid-api.class.mjs +296 -3
- package/esm2022/lib/core/models/one-column-def-types.model.mjs +1 -1
- package/esm2022/lib/core/models/one-event-types.model.mjs +1 -1
- package/esm2022/lib/core/models/one-filter.model.mjs +1 -1
- package/esm2022/lib/core/pipes/aria-sort.pipe.mjs +31 -0
- package/esm2022/lib/core/pipes/cell-action-button-enable.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/cell-editable.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/cell-invalid.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/cell-key.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/cell-level-padding.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/cell-selected.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/cell-state-renderer.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/column-sort-state.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/header-checkbox-checked.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/header-checkbox-disabled.pipe.mjs +3 -3
- package/esm2022/lib/core/pipes/header-checkbox-indeterminate.pipe.mjs +3 -3
- package/esm2022/lib/core/services/og-column.service.mjs +153 -30
- package/esm2022/lib/core/services/one-grid-cell.service.mjs +16 -14
- package/esm2022/lib/helpers/one-cell.helper.mjs +30 -1
- package/esm2022/lib/helpers/one-column-def.helper.mjs +16 -1
- package/esm2022/lib/helpers/one-csv.helper.mjs +58 -0
- package/esm2022/lib/helpers/one-filter.helper.mjs +11 -1
- package/esm2022/lib/helpers/one-row-grouping.helper.mjs +103 -0
- package/esm2022/lib/index.mjs +3 -1
- package/esm2022/lib/one-grid.module.mjs +24 -114
- package/fesm2022/one-grid-core-angular.mjs +2328 -851
- package/fesm2022/one-grid-core-angular.mjs.map +1 -1
- package/lib/components/one-grid/one-grid.component.d.ts +101 -4
- package/lib/components/one-grid-body/one-grid-body.component.d.ts +83 -2
- package/lib/components/one-grid-cell-currency/one-grid-cell-currency.component.d.ts +1 -1
- package/lib/components/one-grid-cell-group-renderer/one-grid-cell-group-renderer.component.d.ts +1 -1
- package/lib/components/one-grid-cell-option-menu/one-grid-cell-option-menu.component.d.ts +1 -1
- package/lib/components/one-grid-checkbox/one-grid-checkbox.component.d.ts +1 -1
- package/lib/components/one-grid-checkbox-header/one-grid-checkbox-header.component.d.ts +1 -1
- package/lib/components/one-grid-header/one-grid-header.component.d.ts +69 -4
- package/lib/components/one-grid-header-menu/one-grid-header-menu.component.d.ts +52 -0
- package/lib/components/one-grid-pagination/one-grid-pagination.component.d.ts +1 -1
- package/lib/components/one-grid-row-action/one-grid-row-action.component.d.ts +1 -1
- package/lib/components/one-grid-row-drag-handle/one-grid-row-drag-handle.component.d.ts +1 -1
- package/lib/components/one-grid-status/one-grid-status.component.d.ts +1 -1
- package/lib/core/directives/one-cell-input-validator.directive.d.ts +1 -1
- package/lib/core/directives/one-cell-renderer-component.directive.d.ts +1 -1
- package/lib/core/directives/one-cell-text-expand.directive.d.ts +1 -1
- package/lib/core/icons/one-grid-icons.d.ts +35 -0
- package/lib/core/instants/one-grid-api.class.d.ts +115 -1
- package/lib/core/models/one-column-def-types.model.d.ts +77 -2
- package/lib/core/models/one-event-types.model.d.ts +19 -0
- package/lib/core/models/one-filter.model.d.ts +8 -1
- package/lib/core/pipes/aria-sort.pipe.d.ts +15 -0
- package/lib/core/pipes/cell-action-button-enable.pipe.d.ts +1 -1
- package/lib/core/pipes/cell-editable.pipe.d.ts +1 -1
- package/lib/core/pipes/cell-invalid.pipe.d.ts +1 -1
- package/lib/core/pipes/cell-key.pipe.d.ts +1 -1
- package/lib/core/pipes/cell-level-padding.pipe.d.ts +1 -1
- package/lib/core/pipes/cell-selected.pipe.d.ts +1 -1
- package/lib/core/pipes/cell-state-renderer.pipe.d.ts +1 -1
- package/lib/core/pipes/column-sort-state.pipe.d.ts +1 -1
- package/lib/core/pipes/header-checkbox-checked.pipe.d.ts +1 -1
- package/lib/core/pipes/header-checkbox-disabled.pipe.d.ts +1 -1
- package/lib/core/pipes/header-checkbox-indeterminate.pipe.d.ts +1 -1
- package/lib/core/services/og-column.service.d.ts +46 -2
- package/lib/core/services/one-grid-cell.service.d.ts +0 -3
- package/lib/helpers/one-cell.helper.d.ts +17 -0
- package/lib/helpers/one-column-def.helper.d.ts +9 -0
- package/lib/helpers/one-csv.helper.d.ts +29 -0
- package/lib/helpers/one-row-grouping.helper.d.ts +35 -0
- package/lib/index.d.ts +2 -0
- package/lib/one-grid.module.d.ts +15 -37
- package/package.json +1 -1
- package/scss/_one-grid.scss +127 -0
- package/esm2022/lib/core/pipes/cell-action-button-visible.pipe.mjs +0 -17
- package/esm2022/lib/core/pipes/cell-field-value-empty.pipe.mjs +0 -26
- package/esm2022/lib/core/pipes/cell-field-value.pipe.mjs +0 -25
- package/esm2022/lib/core/pipes/cell-field.pipe.mjs +0 -20
- package/esm2022/lib/core/pipes/cell-number-value.pipe.mjs +0 -19
- package/esm2022/lib/core/pipes/cell-state-group-renderer.pipe.mjs +0 -21
- package/esm2022/lib/core/pipes/cell-value-getter.pipe.mjs +0 -23
- package/lib/core/pipes/cell-action-button-visible.pipe.d.ts +0 -9
- package/lib/core/pipes/cell-field-value-empty.pipe.d.ts +0 -7
- package/lib/core/pipes/cell-field-value.pipe.d.ts +0 -7
- package/lib/core/pipes/cell-field.pipe.d.ts +0 -7
- package/lib/core/pipes/cell-number-value.pipe.d.ts +0 -7
- package/lib/core/pipes/cell-state-group-renderer.pipe.d.ts +0 -9
- package/lib/core/pipes/cell-value-getter.pipe.d.ts +0 -9
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Provider } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* The Lucide icons the grid draws, and only those.
|
|
4
|
+
*
|
|
5
|
+
* Every component that renders a `<lucide-icon>` picks this set itself, so the
|
|
6
|
+
* icons travel with the component. That matters now the components are
|
|
7
|
+
* standalone: a consumer importing `OneGridComponent` directly never touches
|
|
8
|
+
* `OneGridModule`, and previously got a runtime error — "The 'chevron-first'
|
|
9
|
+
* icon has not been provided by any available icon providers" — the moment the
|
|
10
|
+
* pagination bar rendered.
|
|
11
|
+
*
|
|
12
|
+
* Eight icons rather than `LucideAngularModule.pick(icons)`, which registered
|
|
13
|
+
* the entire Lucide set. Nothing else in the grid uses one, and the rest were
|
|
14
|
+
* dead weight in every consumer's bundle.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ONE_GRID_ICONS: {
|
|
17
|
+
readonly ArrowDownUp: import("lucide-angular").LucideIconData;
|
|
18
|
+
readonly ArrowDownZA: import("lucide-angular").LucideIconData;
|
|
19
|
+
readonly ArrowUpAZ: import("lucide-angular").LucideIconData;
|
|
20
|
+
readonly ChevronFirst: import("lucide-angular").LucideIconData;
|
|
21
|
+
readonly ChevronLast: import("lucide-angular").LucideIconData;
|
|
22
|
+
readonly ChevronLeft: import("lucide-angular").LucideIconData;
|
|
23
|
+
readonly ChevronRight: import("lucide-angular").LucideIconData;
|
|
24
|
+
readonly GripVertical: import("lucide-angular").LucideIconData;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Providers that register {@link ONE_GRID_ICONS} for one standalone component.
|
|
28
|
+
*
|
|
29
|
+
* `LucideAngularModule.pick()` cannot be used here: it returns a
|
|
30
|
+
* `ModuleWithProviders`, and a standalone component's `imports` only accepts
|
|
31
|
+
* components, directives, pipes and NgModule classes. This is the same
|
|
32
|
+
* registration `pick` performs, expressed as providers so it can sit on the
|
|
33
|
+
* component instead.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ONE_GRID_ICON_PROVIDERS: Provider[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OneColumnDef } from '../models/one-column-def-types.model';
|
|
1
|
+
import { OneColumnDef, OneColumnStateEntry } from '../models/one-column-def-types.model';
|
|
2
2
|
import { OneRowNode } from "./one-row-node.class";
|
|
3
3
|
import { OneGridInitOptions, OneGridType, OneSortModel } from '../models/one-grid-types.model';
|
|
4
4
|
import { OneGridEventService } from '../services/one-grid-event.service';
|
|
@@ -8,6 +8,8 @@ import { OneFilterModel } from "../models/one-filter.model";
|
|
|
8
8
|
import { OneGridExpansionService } from '../services/one-grid-expansion.service';
|
|
9
9
|
import { OneGetDetailRowDataParams } from "../models/one-master-detail.model";
|
|
10
10
|
import { OneGridRowService } from "../services/one-grid-row.service";
|
|
11
|
+
import { OneCsvExportOptions } from "../../helpers/one-csv.helper";
|
|
12
|
+
import { OneAggColumn } from "../../helpers/one-row-grouping.helper";
|
|
11
13
|
import { OneRowDragSuppressedReason } from "../models/one-row-drag.model";
|
|
12
14
|
import { OneGridCellService } from '../services/one-grid-cell.service';
|
|
13
15
|
import { ColumnChangedEvent, OnePinnedRowSide, RowSelectionMode } from "../models/one-event-types.model";
|
|
@@ -187,6 +189,25 @@ export declare class OneGridApi<T = any> {
|
|
|
187
189
|
* Deselect all nodes (optimized)
|
|
188
190
|
*/
|
|
189
191
|
deselectAll(): void;
|
|
192
|
+
/**
|
|
193
|
+
* Select or deselect one row, honouring the grid's selection mode.
|
|
194
|
+
*
|
|
195
|
+
* The mode rule used to live in the checkbox component, which meant the only
|
|
196
|
+
* way to select a row was to click that checkbox — anything else reaching for
|
|
197
|
+
* `toggleSelection` got multi-select behaviour on a single-select grid. It
|
|
198
|
+
* lives here so every path into selection obeys the same rule.
|
|
199
|
+
*
|
|
200
|
+
* @returns `false` when the grid has no selection mode, so a caller can tell
|
|
201
|
+
* a refused request from an applied one.
|
|
202
|
+
*/
|
|
203
|
+
toggleRowSelection(rowId: string, selected: boolean): boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Select every row between two, inclusive, in display order.
|
|
206
|
+
*
|
|
207
|
+
* What a shift-extended keyboard selection needs. Multi-select only — a
|
|
208
|
+
* single-select grid has no meaningful range.
|
|
209
|
+
*/
|
|
210
|
+
selectRowRange(fromRowId: string, toRowId: string): boolean;
|
|
190
211
|
toggleSelection(rowId: string, selected: boolean): void;
|
|
191
212
|
setSelectedById(rowId: string): void;
|
|
192
213
|
setSelectedByIds(rowIds: string[], selected?: boolean): void;
|
|
@@ -281,7 +302,100 @@ export declare class OneGridApi<T = any> {
|
|
|
281
302
|
getColumnState(): ColumnChangedEvent;
|
|
282
303
|
setColumnDefs(columnDefs: OneColumnDef<T>[]): void;
|
|
283
304
|
updateColumn(id: string, changes: Partial<OneColumnDef<T>>): void;
|
|
305
|
+
/** The visible fields as one comparable key. */
|
|
306
|
+
private visibleColumnFields;
|
|
307
|
+
/** Recompute every node's cell states against the current columns. */
|
|
308
|
+
private regenerateCellStates;
|
|
284
309
|
reorderColumnDefs(fromIndex: number, toIndex: number): void;
|
|
310
|
+
private _rowGroupFields;
|
|
311
|
+
private _aggColumns;
|
|
312
|
+
/** The fields the rows are grouped by, in nesting order. Empty when off. */
|
|
313
|
+
get rowGroupFields(): readonly string[];
|
|
314
|
+
/**
|
|
315
|
+
* Turn row grouping on. Called by `OneGridComponent` when column
|
|
316
|
+
* definitions declare `rowGroup`; the grid then behaves as a tree over
|
|
317
|
+
* synthetic group rows, and `setRowData` / `updateRowData` keep taking the
|
|
318
|
+
* flat rows they always took.
|
|
319
|
+
*/
|
|
320
|
+
setRowGrouping(groupFields: string[], aggregations?: OneAggColumn<T>[]): void;
|
|
321
|
+
private _undoLimit;
|
|
322
|
+
private _undoStack;
|
|
323
|
+
private _redoStack;
|
|
324
|
+
/**
|
|
325
|
+
* Start recording committed cell edits for undo/redo. Called by
|
|
326
|
+
* `OneGridComponent` from `[undoRedoCellEditing]`; the stack keeps the last
|
|
327
|
+
* `limit` edits. Programmatic `setDataValue` writes are not recorded — only
|
|
328
|
+
* commits, the ones that raise `cellValueChanged` without a source.
|
|
329
|
+
*/
|
|
330
|
+
enableUndoRedoCellEditing(limit?: number): void;
|
|
331
|
+
/** Revert the most recent committed edit. Returns whether one was undone. */
|
|
332
|
+
undoCellEditing(): boolean;
|
|
333
|
+
/** Re-apply the most recently undone edit. Returns whether one was redone. */
|
|
334
|
+
redoCellEditing(): boolean;
|
|
335
|
+
getCurrentUndoSize(): number;
|
|
336
|
+
getCurrentRedoSize(): number;
|
|
337
|
+
private replayEdit;
|
|
338
|
+
private _clientPagination;
|
|
339
|
+
private _pageSize;
|
|
340
|
+
private _currentPage;
|
|
341
|
+
/** The paging state, when the grid pages its own rows. */
|
|
342
|
+
get paginationState(): Readonly<{
|
|
343
|
+
enabled: boolean;
|
|
344
|
+
pageSize: number;
|
|
345
|
+
currentPage: number;
|
|
346
|
+
}>;
|
|
347
|
+
/**
|
|
348
|
+
* Turn grid-owned paging on or off. Called by `OneGridComponent` from its
|
|
349
|
+
* `clientSidePagination` input; the display slice is what changes — the
|
|
350
|
+
* full dataset stays behind the API (selection, filters and sorting keep
|
|
351
|
+
* operating on all of it).
|
|
352
|
+
*/
|
|
353
|
+
setClientSidePagination(enabled: boolean, pageSize?: number): void;
|
|
354
|
+
/** Change the page size and return to the first page. */
|
|
355
|
+
setPageSize(pageSize: number): void;
|
|
356
|
+
/** Move to a page (1-based). Clamped to at least 1; the top end clamps when the slice is taken. */
|
|
357
|
+
setCurrentPage(page: number): void;
|
|
358
|
+
/**
|
|
359
|
+
* The slice of rows the current page shows — a passthrough while paging is
|
|
360
|
+
* off. The body routes its render list through here, after reporting the
|
|
361
|
+
* full count, so `rowCountChanged` keeps meaning "rows after filtering"
|
|
362
|
+
* whether or not the grid pages.
|
|
363
|
+
*/
|
|
364
|
+
pageNodes(nodes: readonly OneRowNode<T>[]): OneRowNode<T>[];
|
|
365
|
+
/**
|
|
366
|
+
* Size the flex columns into the given width.
|
|
367
|
+
*
|
|
368
|
+
* Called by the grid body with its own viewport width — on first render, on
|
|
369
|
+
* container resize and after column changes — so `columnDef.flex` works
|
|
370
|
+
* without the host doing anything. Also callable directly with any width.
|
|
371
|
+
* A no-op when no visible column declares `flex` or nothing would change.
|
|
372
|
+
*/
|
|
373
|
+
applyFlexWidths(availableWidth: number): void;
|
|
374
|
+
/**
|
|
375
|
+
* The current grid as CSV: visible columns in display order, visible rows
|
|
376
|
+
* in current sort order, values through the same getter/formatter pipeline
|
|
377
|
+
* the cells render with. Pinned rows and detail grids are not data and are
|
|
378
|
+
* not included.
|
|
379
|
+
*/
|
|
380
|
+
getDataAsCsv(options?: OneCsvExportOptions): string;
|
|
381
|
+
/** Build the CSV and hand it to the browser as a download. */
|
|
382
|
+
exportDataAsCsv(options?: OneCsvExportOptions): void;
|
|
383
|
+
/**
|
|
384
|
+
* Show or hide one column. A hidden column keeps its order, width and pin,
|
|
385
|
+
* so showing it again restores it exactly.
|
|
386
|
+
*/
|
|
387
|
+
setColumnVisible(id: string, visible: boolean): void;
|
|
388
|
+
/**
|
|
389
|
+
* Persistable layout state: one JSON-safe entry per column — hidden ones
|
|
390
|
+
* included — in display order. Feed it back through `applyColumnState`.
|
|
391
|
+
*/
|
|
392
|
+
getColumnStateSnapshot(): OneColumnStateEntry[];
|
|
393
|
+
/**
|
|
394
|
+
* Restore a snapshot from `getColumnStateSnapshot`: order, width, pin and
|
|
395
|
+
* visibility. Ids the grid no longer has are skipped, so a stale snapshot
|
|
396
|
+
* degrades to a partial restore rather than an error.
|
|
397
|
+
*/
|
|
398
|
+
applyColumnState(entries: OneColumnStateEntry[]): void;
|
|
285
399
|
/**
|
|
286
400
|
* Update checkbox selection features
|
|
287
401
|
*/
|
|
@@ -26,7 +26,16 @@ export interface OneCellOptions {
|
|
|
26
26
|
}
|
|
27
27
|
export type OneCellStatus = 0 | 1;
|
|
28
28
|
export type OneCellButtonIconType = 'add' | 'option' | 'language';
|
|
29
|
-
export type OneCellInputType = 'text' | 'number' | 'email' | 'date' | 'time' | 'datetime' | 'datetime-local';
|
|
29
|
+
export type OneCellInputType = 'text' | 'number' | 'email' | 'date' | 'time' | 'datetime' | 'datetime-local' | 'select';
|
|
30
|
+
/**
|
|
31
|
+
* One choice in a `select` cell editor. `value` is committed as-is — it keeps
|
|
32
|
+
* its type, unlike an input editor's string — and `label` is what the option
|
|
33
|
+
* shows.
|
|
34
|
+
*/
|
|
35
|
+
export interface OneCellSelectOption {
|
|
36
|
+
label: string;
|
|
37
|
+
value: any;
|
|
38
|
+
}
|
|
30
39
|
/**
|
|
31
40
|
* What a per-cell presentation callback is handed.
|
|
32
41
|
*
|
|
@@ -71,6 +80,12 @@ export interface OneCellRendererParams<T = any> {
|
|
|
71
80
|
inputType?: OneCellInputType;
|
|
72
81
|
placeholder?: string;
|
|
73
82
|
required?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The choices for a `select` editor (`inputType: 'select'`). Give the
|
|
85
|
+
* current cell value a matching option: the browser preselects the first
|
|
86
|
+
* option otherwise, and closing the editor then commits it.
|
|
87
|
+
*/
|
|
88
|
+
selectOptions?: OneCellSelectOption[];
|
|
74
89
|
detailActiveButtonStatus?: OneCellStatus;
|
|
75
90
|
detailActiveExcludeLevels?: number[];
|
|
76
91
|
gotoDetailButtonStatus?: OneCellStatus;
|
|
@@ -151,6 +166,7 @@ export interface OneColumnDef<T = any> {
|
|
|
151
166
|
_resolvedSortable?: boolean;
|
|
152
167
|
_resolvedResizable?: boolean;
|
|
153
168
|
_resolvedDragable?: boolean;
|
|
169
|
+
_resolvedFilterable?: boolean;
|
|
154
170
|
_resolvedSuppressHeaderMenuButton?: boolean;
|
|
155
171
|
_resolvedHeaderClass?: string | string[];
|
|
156
172
|
_resolvedCellClass?: string | string[];
|
|
@@ -168,6 +184,32 @@ export interface OneColumnDef<T = any> {
|
|
|
168
184
|
* nothing pinned renders exactly as before.
|
|
169
185
|
*/
|
|
170
186
|
pinned?: 'left' | 'right';
|
|
187
|
+
/**
|
|
188
|
+
* Group the rows by this column's value. Several `rowGroup` columns nest,
|
|
189
|
+
* in column-definition order. The grid then runs its tree machinery over
|
|
190
|
+
* synthetic group rows: expand/collapse, the auto group column,
|
|
191
|
+
* `groupDefaultExpanded` — all of it applies. Grouped-by columns are
|
|
192
|
+
* hidden automatically (their value shows on the group row); un-hide via
|
|
193
|
+
* `api.setColumnVisible` if you want both. Client-side rows only, and
|
|
194
|
+
* exclusive with `treeData` and `masterDetail`.
|
|
195
|
+
*/
|
|
196
|
+
rowGroup?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Aggregate this column's leaf values onto every group row when row
|
|
199
|
+
* grouping is active: a built-in name, or a function over the leaves.
|
|
200
|
+
* The result lands in the group row's own `data[field]`, so formatters
|
|
201
|
+
* and renderers apply to it like any cell value.
|
|
202
|
+
*/
|
|
203
|
+
aggFunc?: OneAggFunc<T>;
|
|
204
|
+
/**
|
|
205
|
+
* Remove this column from the rendered grid without forgetting it.
|
|
206
|
+
*
|
|
207
|
+
* A hidden column keeps its place in the column order, its width and its
|
|
208
|
+
* pin, so showing it again restores it exactly. Toggle at runtime with
|
|
209
|
+
* `api.setColumnVisible(id, visible)`. Plain state, not a predicate —
|
|
210
|
+
* visibility is something a host changes, not something a row decides.
|
|
211
|
+
*/
|
|
212
|
+
hide?: boolean;
|
|
171
213
|
/** Distance in px from the pinned edge. Computed by the grid; do not set. */
|
|
172
214
|
_pinnedOffset?: number | null;
|
|
173
215
|
/** True on the innermost pinned column of each side, which carries the divider. */
|
|
@@ -180,7 +222,14 @@ export interface OneColumnDef<T = any> {
|
|
|
180
222
|
updatable?: boolean | ((params: OneCellPresentationParams<T>) => boolean);
|
|
181
223
|
disable?: boolean | ((params: OneCellPresentationParams<T>) => boolean);
|
|
182
224
|
hideActionButton?: boolean | ((params: OneCellPresentationParams<T>) => boolean);
|
|
183
|
-
/**
|
|
225
|
+
/**
|
|
226
|
+
* Give this column an input in the grid's filter row (`[filterRow]`).
|
|
227
|
+
*
|
|
228
|
+
* Header-scoped like `sortable`: resolved once per column, when the
|
|
229
|
+
* columns are registered, against columnDef, field and context — there is
|
|
230
|
+
* no row. Without the filter row this changes nothing; filtering stays
|
|
231
|
+
* available through `api.setFilterModel` either way.
|
|
232
|
+
*/
|
|
184
233
|
filterable?: boolean | ((params: OneCellPresentationParams<T>) => boolean);
|
|
185
234
|
cellRendererComponent?: Type<OneCellRendererComponent>;
|
|
186
235
|
cellRenderer?: (params: OneCellPresentationParams<T>) => string;
|
|
@@ -207,6 +256,32 @@ export interface OneColumnDef<T = any> {
|
|
|
207
256
|
valueSetter?: (value: any, rowIndex: number) => void;
|
|
208
257
|
}
|
|
209
258
|
export type OneCellValidationType = 'disabled' | 'integer' | 'number' | 'code' | 'title' | 'phone' | 'email' | 'description' | 'regex' | 'none';
|
|
259
|
+
/** The built-in aggregation functions for row grouping. */
|
|
260
|
+
export type OneAggFuncName = 'sum' | 'min' | 'max' | 'avg' | 'count' | 'first' | 'last';
|
|
261
|
+
/** What a custom aggregation function receives: one group's leaves. */
|
|
262
|
+
export interface OneAggFuncParams<T = any> {
|
|
263
|
+
/** The leaf values of this column, nulls and undefineds already removed. */
|
|
264
|
+
values: any[];
|
|
265
|
+
/** The leaf rows themselves, for aggregates that need more than one field. */
|
|
266
|
+
rows: T[];
|
|
267
|
+
field: string;
|
|
268
|
+
}
|
|
269
|
+
export type OneAggFunc<T = any> = OneAggFuncName | ((params: OneAggFuncParams<T>) => any);
|
|
270
|
+
/**
|
|
271
|
+
* One column's persistable layout state.
|
|
272
|
+
*
|
|
273
|
+
* `api.getColumnStateSnapshot()` returns one entry per column — hidden ones
|
|
274
|
+
* included — in display order; `api.applyColumnState(entries)` restores them.
|
|
275
|
+
* The snapshot is plain JSON-safe data, so it can be stored as-is.
|
|
276
|
+
*/
|
|
277
|
+
export interface OneColumnStateEntry {
|
|
278
|
+
id: string;
|
|
279
|
+
/** Omitted when the column has no explicit width. */
|
|
280
|
+
width?: number;
|
|
281
|
+
/** `null` means unpinned. Omitting the property keeps the current pin. */
|
|
282
|
+
pinned?: 'left' | 'right' | null;
|
|
283
|
+
hide?: boolean;
|
|
284
|
+
}
|
|
210
285
|
export interface CellSelection {
|
|
211
286
|
rowId: string;
|
|
212
287
|
field: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OneColumnDef, OneGroupColumnDef } from "./one-column-def-types.model";
|
|
2
2
|
import type { OneGridApi } from "../instants/one-grid-api.class";
|
|
3
3
|
import type { OneRowNode } from "../instants/one-row-node.class";
|
|
4
|
+
import type { OneSortModel } from "./one-grid-types.model";
|
|
4
5
|
export interface RowSelectedEvent {
|
|
5
6
|
rowId: string;
|
|
6
7
|
selected: boolean;
|
|
@@ -54,6 +55,23 @@ export interface CellOptionMenuSelectedEvent<T = any> {
|
|
|
54
55
|
}
|
|
55
56
|
export interface SortChangedEvent<T = any> {
|
|
56
57
|
nodes: OneRowNode<T>[];
|
|
58
|
+
/** The model that produced this order. Empty when sorting was cleared. */
|
|
59
|
+
sortModel: readonly OneSortModel<T>[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A cell edit was committed with a value different from the one it started
|
|
63
|
+
* with. Programmatic writes through `node.setDataValue` do not raise this —
|
|
64
|
+
* the caller already holds both values.
|
|
65
|
+
*/
|
|
66
|
+
export interface CellValueChangedEvent<T = any> {
|
|
67
|
+
node: OneRowNode<T>;
|
|
68
|
+
data: T;
|
|
69
|
+
column: OneColumnDef<T>;
|
|
70
|
+
field: string;
|
|
71
|
+
oldValue: any;
|
|
72
|
+
newValue: any;
|
|
73
|
+
/** Absent for a committed edit; set when undo/redo re-applied one. */
|
|
74
|
+
source?: 'undo' | 'redo';
|
|
57
75
|
}
|
|
58
76
|
export interface ColumnResizedEvent {
|
|
59
77
|
columnId: string;
|
|
@@ -95,6 +113,7 @@ export interface EventPayloadMap<T = any> {
|
|
|
95
113
|
sortChanged: SortChangedEvent<T>;
|
|
96
114
|
rowOrderChanged: RowOrderChangedEvent<T>;
|
|
97
115
|
cellStateChanged: CellStateChangedEvent<T>;
|
|
116
|
+
cellValueChanged: CellValueChangedEvent<T>;
|
|
98
117
|
}
|
|
99
118
|
export type OneCheckboxState = 'checked' | 'unchecked' | 'indeterminate';
|
|
100
119
|
export type RowSelectionMode = 'single' | 'multiple' | null;
|
|
@@ -8,8 +8,15 @@ export interface OneFilterModel {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* A single condition inside a filter.
|
|
11
|
+
*
|
|
12
|
+
* Comparison operators (`greaterThan`, `inRange`, …) compare numerically when
|
|
13
|
+
* both sides parse as numbers and lexicographically otherwise, which orders
|
|
14
|
+
* ISO date strings correctly. `blank` matches null, undefined and the empty
|
|
15
|
+
* string — not 0. Unknown operators are ignored rather than failing the row.
|
|
11
16
|
*/
|
|
12
17
|
export interface OneFilterCondition {
|
|
13
|
-
operator: 'equals' | 'contains' | 'startsWith' | 'endsWith' | 'greaterThan' | 'lessThan';
|
|
18
|
+
operator: 'equals' | 'notEqual' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'inRange' | 'blank' | 'notBlank';
|
|
14
19
|
value?: string | number;
|
|
20
|
+
/** Upper bound for `inRange`. Both bounds are inclusive. */
|
|
21
|
+
valueTo?: string | number;
|
|
15
22
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Maps the grid's sort state onto the values `aria-sort` accepts.
|
|
5
|
+
*
|
|
6
|
+
* The attribute takes `ascending` / `descending` / `none`, not the `asc` /
|
|
7
|
+
* `desc` the sort model uses. `none` is only correct on a column that *can* be
|
|
8
|
+
* sorted — on one that cannot, the attribute is omitted entirely, because
|
|
9
|
+
* "not sorted" and "not sortable" are different statements.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AriaSortPipe implements PipeTransform {
|
|
12
|
+
transform(sort: 'asc' | 'desc' | null, sortable: boolean | undefined): string | null;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AriaSortPipe, never>;
|
|
14
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<AriaSortPipe, "ariaSort", true>;
|
|
15
|
+
}
|
|
@@ -4,5 +4,5 @@ import * as i0 from "@angular/core";
|
|
|
4
4
|
export declare class CellActionButtonEnablePipe<T> implements PipeTransform {
|
|
5
5
|
transform(params: OneCellRendererParams<T> | null): boolean;
|
|
6
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<CellActionButtonEnablePipe<any>, never>;
|
|
7
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<CellActionButtonEnablePipe<any>, "cellActionButtonEnable",
|
|
7
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CellActionButtonEnablePipe<any>, "cellActionButtonEnable", true>;
|
|
8
8
|
}
|
|
@@ -5,5 +5,5 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class CellEditablePipe implements PipeTransform {
|
|
6
6
|
transform(cellStates: OneCellStates, column: OneColumnDef, node: OneRowNode, editable: (column: OneColumnDef, node: OneRowNode) => boolean, updatable: (column: OneColumnDef, node: OneRowNode) => boolean, allowedEdit: boolean): boolean;
|
|
7
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<CellEditablePipe, never>;
|
|
8
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<CellEditablePipe, "cellEditable",
|
|
8
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CellEditablePipe, "cellEditable", true>;
|
|
9
9
|
}
|
|
@@ -5,5 +5,5 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class CellInvalidPipe<T> implements PipeTransform {
|
|
6
6
|
transform(cellStates: OneCellStates, value: any, column: OneColumnDef<T>, node: OneRowNode<T>, allowedEdit: boolean, submitted: boolean): boolean;
|
|
7
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<CellInvalidPipe<any>, never>;
|
|
8
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<CellInvalidPipe<any>, "cellInvalid",
|
|
8
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CellInvalidPipe<any>, "cellInvalid", true>;
|
|
9
9
|
}
|
|
@@ -3,5 +3,5 @@ import * as i0 from "@angular/core";
|
|
|
3
3
|
export declare class CellKeyPipe implements PipeTransform {
|
|
4
4
|
transform(rowId?: string | null, field?: string | null): string;
|
|
5
5
|
static ɵfac: i0.ɵɵFactoryDeclaration<CellKeyPipe, never>;
|
|
6
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<CellKeyPipe, "cellKey",
|
|
6
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CellKeyPipe, "cellKey", true>;
|
|
7
7
|
}
|
|
@@ -3,5 +3,5 @@ import * as i0 from "@angular/core";
|
|
|
3
3
|
export declare class CellLevelPaddingPipe implements PipeTransform {
|
|
4
4
|
transform(level: number, factor: number): number;
|
|
5
5
|
static ɵfac: i0.ɵɵFactoryDeclaration<CellLevelPaddingPipe, never>;
|
|
6
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<CellLevelPaddingPipe, "cellLevelPadding",
|
|
6
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CellLevelPaddingPipe, "cellLevelPadding", true>;
|
|
7
7
|
}
|
|
@@ -3,5 +3,5 @@ import * as i0 from "@angular/core";
|
|
|
3
3
|
export declare class CellSelectedPipe implements PipeTransform {
|
|
4
4
|
transform(selectedCells: Set<string>, rowId: string, field: string): boolean;
|
|
5
5
|
static ɵfac: i0.ɵɵFactoryDeclaration<CellSelectedPipe, never>;
|
|
6
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<CellSelectedPipe, "cellSelected",
|
|
6
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CellSelectedPipe, "cellSelected", true>;
|
|
7
7
|
}
|
|
@@ -4,5 +4,5 @@ import * as i0 from "@angular/core";
|
|
|
4
4
|
export declare class CellStateRendererPipe implements PipeTransform {
|
|
5
5
|
transform(cellStates: OneCellStates | null | undefined, field: string): string;
|
|
6
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<CellStateRendererPipe, never>;
|
|
7
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<CellStateRendererPipe, "cellStateRenderer",
|
|
7
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CellStateRendererPipe, "cellStateRenderer", true>;
|
|
8
8
|
}
|
|
@@ -4,5 +4,5 @@ import * as i0 from "@angular/core";
|
|
|
4
4
|
export declare class ColumnSortStatePipe implements PipeTransform {
|
|
5
5
|
transform(field: string, sortModel: readonly OneSortModel[]): 'asc' | 'desc' | null;
|
|
6
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<ColumnSortStatePipe, never>;
|
|
7
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<ColumnSortStatePipe, "columnSortState",
|
|
7
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<ColumnSortStatePipe, "columnSortState", true>;
|
|
8
8
|
}
|
|
@@ -5,5 +5,5 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class HeaderCheckboxCheckedPipe implements PipeTransform {
|
|
6
6
|
transform(rowNodes: OneRowNode[], selectionMode: RowSelectionMode, state: OneCheckboxState): boolean;
|
|
7
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<HeaderCheckboxCheckedPipe, never>;
|
|
8
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<HeaderCheckboxCheckedPipe, "headerCheckboxChecked",
|
|
8
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<HeaderCheckboxCheckedPipe, "headerCheckboxChecked", true>;
|
|
9
9
|
}
|
|
@@ -5,5 +5,5 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class HeaderCheckboxDisabledPipe implements PipeTransform {
|
|
6
6
|
transform(rowNodes: OneRowNode[], selectionMode: RowSelectionMode, allowedEdit: boolean): boolean;
|
|
7
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<HeaderCheckboxDisabledPipe, never>;
|
|
8
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<HeaderCheckboxDisabledPipe, "headerCheckboxDisabled",
|
|
8
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<HeaderCheckboxDisabledPipe, "headerCheckboxDisabled", true>;
|
|
9
9
|
}
|
|
@@ -5,5 +5,5 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class HeaderCheckboxIndeterminatePipe implements PipeTransform {
|
|
6
6
|
transform(rowNodes: OneRowNode[], selectionMode: RowSelectionMode, state: OneCheckboxState): unknown;
|
|
7
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<HeaderCheckboxIndeterminatePipe, never>;
|
|
8
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<HeaderCheckboxIndeterminatePipe, "headerCheckboxIndeterminate",
|
|
8
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<HeaderCheckboxIndeterminatePipe, "headerCheckboxIndeterminate", true>;
|
|
9
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OneCellPresentationParams, OneCellRendererParams, OneColumnDef, OneGroupColumnDef } from '../models/one-column-def-types.model';
|
|
1
|
+
import { OneCellPresentationParams, OneCellRendererParams, OneColumnDef, OneColumnStateEntry, OneGroupColumnDef } from '../models/one-column-def-types.model';
|
|
2
2
|
import { ColumnChangedEvent } from '../models/one-event-types.model';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class OgColumnService {
|
|
@@ -8,12 +8,27 @@ export declare class OgColumnService {
|
|
|
8
8
|
* callbacks do. Set during init; null in a bare service.
|
|
9
9
|
*/
|
|
10
10
|
private context;
|
|
11
|
+
/**
|
|
12
|
+
* Every column, hidden ones included, in display order. `columnDefs$` below
|
|
13
|
+
* carries only the visible subset — it is what the header and body render
|
|
14
|
+
* from, so hiding a column means leaving it out of the emission, and every
|
|
15
|
+
* consumer keeps working with no notion of visibility at all. This list is
|
|
16
|
+
* what remembers a hidden column's place, width and pin for when it returns.
|
|
17
|
+
*/
|
|
18
|
+
private allColumnDefs;
|
|
11
19
|
private columnDefs$;
|
|
12
20
|
private groupColumnDefs$;
|
|
13
21
|
initColumnDefs(defaultColumnDef: OneColumnDef, columnDefs: OneColumnDef[], groupColumnDefs: OneGroupColumnDef[], context?: unknown): void;
|
|
14
22
|
getColumnState(): ColumnChangedEvent;
|
|
15
23
|
setGroupColumnDefs(groupColumnDefs: OneGroupColumnDef[]): void;
|
|
16
24
|
setColumnDefs(columnDefs: OneColumnDef[]): void;
|
|
25
|
+
/**
|
|
26
|
+
* Re-band, re-measure and publish a new column list.
|
|
27
|
+
*
|
|
28
|
+
* Every mutation funnels here so the master list and the visible emission
|
|
29
|
+
* cannot drift apart.
|
|
30
|
+
*/
|
|
31
|
+
private commit;
|
|
17
32
|
/**
|
|
18
33
|
* Move pinned columns to their edge and measure how far in each one sits.
|
|
19
34
|
*
|
|
@@ -26,10 +41,39 @@ export declare class OgColumnService {
|
|
|
26
41
|
* grid that does not use the feature is unaffected.
|
|
27
42
|
*/
|
|
28
43
|
private applyPinning;
|
|
29
|
-
/** Total width of the columns frozen against the given edge. */
|
|
44
|
+
/** Total width of the visible columns frozen against the given edge. */
|
|
30
45
|
getPinnedWidth(side: 'left' | 'right'): number;
|
|
31
46
|
updateColumnDef(id: string, changes: Partial<OneColumnDef>): void;
|
|
47
|
+
/**
|
|
48
|
+
* Reorder columns. The indexes are *visible* positions — they come from the
|
|
49
|
+
* header, which only renders visible columns — so they are mapped onto the
|
|
50
|
+
* master list before splicing. A hidden column between the two keeps its
|
|
51
|
+
* place relative to its neighbours.
|
|
52
|
+
*/
|
|
32
53
|
reorderColumnDefs(fromIndex: number, toIndex: number): void;
|
|
54
|
+
/**
|
|
55
|
+
* Distribute the viewport width left over by fixed columns among the flex
|
|
56
|
+
* ones, in proportion to their `flex` values and clamped to their bounds.
|
|
57
|
+
*
|
|
58
|
+
* @returns Whether any width actually changed — the caller only dispatches
|
|
59
|
+
* (and the body only re-triggers) on a real change, which is what terminates
|
|
60
|
+
* the columnChanged → flex → columnChanged loop.
|
|
61
|
+
*/
|
|
62
|
+
applyFlexWidths(availableWidth: number): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* One JSON-safe entry per column — hidden ones included — in display order.
|
|
65
|
+
*/
|
|
66
|
+
getColumnStateSnapshot(): OneColumnStateEntry[];
|
|
67
|
+
/**
|
|
68
|
+
* Restore a saved snapshot: order, width, pin and visibility.
|
|
69
|
+
*
|
|
70
|
+
* Entries are applied in the order given and become the front of the new
|
|
71
|
+
* column order; columns the snapshot does not mention keep their current
|
|
72
|
+
* relative order behind them, and ids the grid no longer has are skipped —
|
|
73
|
+
* so a stale snapshot degrades to a partial restore instead of an error.
|
|
74
|
+
* Only the properties present on an entry are applied.
|
|
75
|
+
*/
|
|
76
|
+
applyColumnState(entries: OneColumnStateEntry[]): void;
|
|
33
77
|
/**
|
|
34
78
|
* Group Header Columns
|
|
35
79
|
*/
|
|
@@ -3,9 +3,6 @@ import { OneRowNode } from '../instants/one-row-node.class';
|
|
|
3
3
|
import type { OneGridApi } from '../instants/one-grid-api.class';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class OneGridCellService {
|
|
6
|
-
private _cellFieldValueEmpty;
|
|
7
|
-
private _cellValueGetter;
|
|
8
|
-
private _cellFieldValue;
|
|
9
6
|
private _columnDefs;
|
|
10
7
|
private _context;
|
|
11
8
|
private _api;
|
|
@@ -24,3 +24,20 @@ export declare function resolveCellStyle(column: OneColumnDef, row: any): {
|
|
|
24
24
|
* @returns
|
|
25
25
|
*/
|
|
26
26
|
export declare function resolveCellClass(column: OneColumnDef, row: any): string | string[];
|
|
27
|
+
/**
|
|
28
|
+
* The cell's raw field value, with blank treated as absent.
|
|
29
|
+
*
|
|
30
|
+
* Was `CellFieldValuePipe`. It lived as an Angular pipe but was only ever
|
|
31
|
+
* instantiated inside a service — a utility wearing a `@Pipe` decorator, which
|
|
32
|
+
* also cost it a module declaration for a template use that never existed.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readCellValue<T>(data: T, field: string): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Whether a cell has nothing to show.
|
|
37
|
+
*
|
|
38
|
+
* Was `CellFieldValueEmptyPipe`. `field` is optional on `OneColumnDef` — an
|
|
39
|
+
* action-only column legitimately has none — and reading it unguarded used to
|
|
40
|
+
* throw while the grid built cell state, taking the whole grid down. No field
|
|
41
|
+
* means nothing to read, which is empty by definition.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isCellEmpty<T>(data: T, field: string): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OneCellRendererParams, OneColumnDef, OneValueGetterParams } from "../core/models/one-column-def-types.model";
|
|
2
|
+
import type { OneRowNode } from "../core/instants/one-row-node.class";
|
|
2
3
|
/** Width used when a column defines neither `width` nor `minWidth`. */
|
|
3
4
|
export declare const ONE_DEFAULT_COLUMN_WIDTH = 150;
|
|
4
5
|
/**
|
|
@@ -33,3 +34,11 @@ export declare function resolveOneColumDefParams<R>(prop: R | ((params: any) =>
|
|
|
33
34
|
* One Column Params Resolver (Value Getter)
|
|
34
35
|
*/
|
|
35
36
|
export declare function resolveOneValueGetterParams<T, R>(prop: R | ((params: OneValueGetterParams<T>) => R), params: OneValueGetterParams<T>): R;
|
|
37
|
+
/**
|
|
38
|
+
* Run a column's `valueGetter` for one row.
|
|
39
|
+
*
|
|
40
|
+
* Was `CellValueGetterPipe`, which existed only to call this resolver from a
|
|
41
|
+
* service. The pipe added a module declaration and an indirection for a
|
|
42
|
+
* template use that never existed.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveCellValueGetter<T>(data: T, node: OneRowNode, column: OneColumnDef, context: unknown): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { OneRowNode } from "../core/instants/one-row-node.class";
|
|
2
|
+
import type { OneColumnDef } from "../core/models/one-column-def-types.model";
|
|
3
|
+
/** Options for `api.getDataAsCsv` / `api.exportDataAsCsv`. */
|
|
4
|
+
export interface OneCsvExportOptions {
|
|
5
|
+
/** Field separator. Defaults to ','. */
|
|
6
|
+
columnSeparator?: string;
|
|
7
|
+
/** Whether the first line carries the header names. Defaults to true. */
|
|
8
|
+
includeHeaders?: boolean;
|
|
9
|
+
/** Export only the selected rows instead of every visible one. */
|
|
10
|
+
onlySelected?: boolean;
|
|
11
|
+
/** Download name for `exportDataAsCsv`. Defaults to 'export.csv'. */
|
|
12
|
+
fileName?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The columns an export can say anything about: those that read a row —
|
|
16
|
+
* through a field or a valueGetter. Action columns have neither, and the
|
|
17
|
+
* row-number column reads state the data does not hold; both are skipped.
|
|
18
|
+
*/
|
|
19
|
+
export declare function exportableColumns<T>(columns: OneColumnDef<T>[]): OneColumnDef<T>[];
|
|
20
|
+
/**
|
|
21
|
+
* Serialize rows to RFC 4180 CSV.
|
|
22
|
+
*
|
|
23
|
+
* Each cell goes through the same value pipeline the grid renders with:
|
|
24
|
+
* `valueGetter` when declared, the field otherwise, then `valueFormatter` —
|
|
25
|
+
* so the file says what the screen says. Null and undefined export as empty
|
|
26
|
+
* cells, before the formatter, exactly as the grid leaves them to the
|
|
27
|
+
* placeholder.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildCsv<T>(nodes: readonly OneRowNode<T>[], columns: OneColumnDef<T>[], context?: any, options?: OneCsvExportOptions): string;
|