@thkl/agrid 0.1.10 → 0.1.11
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 +81 -2
- package/fesm2022/thkl-agrid.mjs +1031 -218
- package/fesm2022/thkl-agrid.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thkl-agrid.d.ts +336 -15
- package/types/thkl-agrid.d.ts.map +1 -1
package/package.json
CHANGED
package/types/thkl-agrid.d.ts
CHANGED
|
@@ -147,8 +147,23 @@ declare class AgridControl {
|
|
|
147
147
|
private readonly _totalRows;
|
|
148
148
|
private readonly _aggregates;
|
|
149
149
|
private readonly _sortOrder;
|
|
150
|
+
private readonly _loading;
|
|
151
|
+
private readonly _readonly;
|
|
152
|
+
private readonly _autoAddRows;
|
|
150
153
|
/** @param state Optional initial state, e.g. deserialized from storage. */
|
|
151
154
|
constructor(state?: Partial<AgridControlState>);
|
|
155
|
+
/** Whether the grid displays its loading overlay. This transient state is not serialized. */
|
|
156
|
+
readonly loading: Signal<boolean>;
|
|
157
|
+
/** Show or hide the grid loading overlay. */
|
|
158
|
+
setLoading(value: boolean): void;
|
|
159
|
+
/** Whether all grid editing and mutation UI is disabled. This transient state is not serialized. */
|
|
160
|
+
readonly readonly: Signal<boolean>;
|
|
161
|
+
/** Enable or disable readonly mode at runtime. */
|
|
162
|
+
setReadonly(value: boolean): void;
|
|
163
|
+
/** Whether navigation beyond the final row automatically inserts a row. Not serialized. */
|
|
164
|
+
readonly autoAddRows: Signal<boolean>;
|
|
165
|
+
/** Enable or disable automatic row insertion at runtime. */
|
|
166
|
+
setAutoAddRows(value: boolean): void;
|
|
152
167
|
/**
|
|
153
168
|
* When `true`, the control column shows a drag handle and rows can be
|
|
154
169
|
* reordered by dragging. Requires `showControlColumn` to be enabled on the grid.
|
|
@@ -353,6 +368,12 @@ declare class AgridControl {
|
|
|
353
368
|
hasActiveFilter(field: string): boolean;
|
|
354
369
|
/** Return `true` when the quick filter or ANY column has an active filter or sort. */
|
|
355
370
|
hasAnyActiveFilter(): boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Replace the live serializable state from a plain object.
|
|
373
|
+
* Missing properties reset to their defaults, making a loaded snapshot deterministic.
|
|
374
|
+
* Transient loading, readonly, auto-add, selection, and edit-history state are preserved.
|
|
375
|
+
*/
|
|
376
|
+
loadState(state: Partial<AgridControlState>): void;
|
|
356
377
|
/** Serialize current state to a plain object suitable for JSON storage. */
|
|
357
378
|
toJSON(): AgridControlState;
|
|
358
379
|
/** Restore an `AgridControl` from a previously serialized state. */
|
|
@@ -446,7 +467,83 @@ declare class AgridDataSource<T extends object = any> {
|
|
|
446
467
|
/** Current number of rows (non-reactive snapshot). */
|
|
447
468
|
get length(): number;
|
|
448
469
|
private updateRows;
|
|
449
|
-
|
|
470
|
+
/** Replace the backing row array without copying. Intended for specialized datasource models. */
|
|
471
|
+
protected setRows(rows: T[]): void;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/** Sort entry sent to a server-side row datasource. */
|
|
475
|
+
interface AgridServerSideSort {
|
|
476
|
+
field: string;
|
|
477
|
+
direction: 'asc' | 'desc';
|
|
478
|
+
}
|
|
479
|
+
/** Immutable request for one half-open row block (`startRow <= row < endRow`). */
|
|
480
|
+
interface AgridServerSideRequest {
|
|
481
|
+
startRow: number;
|
|
482
|
+
endRow: number;
|
|
483
|
+
filters: Readonly<Record<string, ColumnFilter>>;
|
|
484
|
+
sort: readonly AgridServerSideSort[];
|
|
485
|
+
quickFilter: string;
|
|
486
|
+
}
|
|
487
|
+
/** Rows returned by a server-side datasource. Supply `rowCount` when the total is known. */
|
|
488
|
+
interface AgridServerSideResult<T extends object> {
|
|
489
|
+
rows: T[];
|
|
490
|
+
rowCount?: number;
|
|
491
|
+
}
|
|
492
|
+
/** Fetches blocks for {@link AgridServerSideRowModel}. */
|
|
493
|
+
interface AgridServerSideDatasource<T extends object> {
|
|
494
|
+
getRows(request: AgridServerSideRequest): Promise<AgridServerSideResult<T>>;
|
|
495
|
+
}
|
|
496
|
+
/** Configuration for the lazy, block-cached server-side row model. */
|
|
497
|
+
interface AgridServerSideRowModelConfig<T extends object> {
|
|
498
|
+
datasource: AgridServerSideDatasource<T>;
|
|
499
|
+
/** Number of rows requested per block. @default 100 */
|
|
500
|
+
blockSize?: number;
|
|
501
|
+
/** Maximum loaded blocks retained in memory. @default 10 */
|
|
502
|
+
maxBlocksInCache?: number;
|
|
503
|
+
/** Known initial total. Omit when the server determines it from the first request. */
|
|
504
|
+
initialRowCount?: number;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Sparse datasource that lazy-loads row blocks while retaining global datasource indices.
|
|
508
|
+
* Attach it to an `AgridProvider` through `serverSideRowModel`.
|
|
509
|
+
*/
|
|
510
|
+
declare class AgridServerSideRowModel<T extends object = any> extends AgridDataSource<T> {
|
|
511
|
+
readonly blockSize: number;
|
|
512
|
+
readonly maxBlocksInCache: number;
|
|
513
|
+
private readonly remote;
|
|
514
|
+
private slots;
|
|
515
|
+
private readonly loadedBlocks;
|
|
516
|
+
private readonly loadingBlocks;
|
|
517
|
+
private query;
|
|
518
|
+
private queryKey;
|
|
519
|
+
private generation;
|
|
520
|
+
private accessSequence;
|
|
521
|
+
private knownRowCount;
|
|
522
|
+
private readonly _loading;
|
|
523
|
+
private readonly _error;
|
|
524
|
+
private readonly _rowCount;
|
|
525
|
+
/** Whether at least one block request is in flight. */
|
|
526
|
+
readonly loading: Signal<boolean>;
|
|
527
|
+
/** Most recent load error, cleared by the next successful request or refresh. */
|
|
528
|
+
readonly error: Signal<unknown | null>;
|
|
529
|
+
/** Current logical row count represented by the virtual scrollbar. */
|
|
530
|
+
readonly rowCount: Signal<number>;
|
|
531
|
+
constructor(config: AgridServerSideRowModelConfig<T>);
|
|
532
|
+
/** Update server query state. A changed query invalidates cached blocks and starts at row zero. */
|
|
533
|
+
setQuery(control: AgridControl | null, sortFields: readonly string[]): boolean;
|
|
534
|
+
/** Invalidate all cached blocks while preserving a known total row count. */
|
|
535
|
+
refresh(): void;
|
|
536
|
+
/** Ensure every block intersecting the requested half-open range is loaded. */
|
|
537
|
+
ensureRange(startRow: number, endRow: number): void;
|
|
538
|
+
/** Whether a logical datasource row has not been loaded yet. */
|
|
539
|
+
isPlaceholder(index: number): boolean;
|
|
540
|
+
private reset;
|
|
541
|
+
private loadBlock;
|
|
542
|
+
private applyBlock;
|
|
543
|
+
private evictBlocks;
|
|
544
|
+
private resize;
|
|
545
|
+
private replaceSlots;
|
|
546
|
+
private createPlaceholders;
|
|
450
547
|
}
|
|
451
548
|
|
|
452
549
|
/** Built-in locale identifiers supplied by the grid. */
|
|
@@ -458,6 +555,7 @@ interface AgridLocaleText {
|
|
|
458
555
|
aggregate: string;
|
|
459
556
|
aggregateAvg: string;
|
|
460
557
|
aggregateCount: string;
|
|
558
|
+
aggregateCustom: string;
|
|
461
559
|
aggregateMax: string;
|
|
462
560
|
aggregateMin: string;
|
|
463
561
|
aggregateSum: string;
|
|
@@ -511,6 +609,11 @@ interface AgridLocaleText {
|
|
|
511
609
|
next: string;
|
|
512
610
|
noRows: string;
|
|
513
611
|
pagination: string;
|
|
612
|
+
pivot: string;
|
|
613
|
+
pivotDescription: string;
|
|
614
|
+
pivotRows: string;
|
|
615
|
+
pivotColumns: string;
|
|
616
|
+
pivotValues: string;
|
|
514
617
|
pinColumn: string;
|
|
515
618
|
pinColumnRight: string;
|
|
516
619
|
unpinColumnRight: string;
|
|
@@ -535,20 +638,50 @@ type AgridLocaleTextOverrides = Partial<AgridLocaleText>;
|
|
|
535
638
|
/** Built-in English and German grid translations. */
|
|
536
639
|
declare const AGRID_LOCALE_TEXT: Record<AgridLocaleKey, AgridLocaleText>;
|
|
537
640
|
|
|
641
|
+
/** JSON-safe pivot subset used by persisted grid settings. */
|
|
642
|
+
interface AgridPivotSettings {
|
|
643
|
+
rowField: string;
|
|
644
|
+
columnField: string;
|
|
645
|
+
valueField: string;
|
|
646
|
+
aggregate: 'sum' | 'avg' | 'min' | 'max' | 'count';
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Versioned, JSON-safe snapshot that can be stored in local storage or a backend.
|
|
650
|
+
* Functions, datasource rows, selection, loading state, and edit history are intentionally absent.
|
|
651
|
+
*/
|
|
652
|
+
interface AgridSettings {
|
|
653
|
+
version: 1;
|
|
654
|
+
control: AgridControlState;
|
|
655
|
+
pivotConfig: AgridPivotSettings | null;
|
|
656
|
+
}
|
|
538
657
|
/** Configuration used to create an {@link AgridProvider}. */
|
|
539
658
|
interface AgridProviderConfig<T extends object = any> extends Partial<AGridOptions> {
|
|
540
659
|
/** Row data source. A new empty data source is created when omitted. */
|
|
541
660
|
datasource?: AgridDataSource<T>;
|
|
661
|
+
/**
|
|
662
|
+
* Lazy block-based server-side row model. When supplied it becomes the provider datasource and
|
|
663
|
+
* filtering, sorting, and quick filtering are included in block requests automatically.
|
|
664
|
+
*/
|
|
665
|
+
serverSideRowModel?: AgridServerSideRowModel<T>;
|
|
542
666
|
/** Stateful grid control. A default control is created when omitted. */
|
|
543
667
|
control?: AgridControl;
|
|
544
668
|
/** Initial column definitions in display order. */
|
|
545
669
|
columns?: ColDef<T>[];
|
|
670
|
+
/**
|
|
671
|
+
* Derive a read-only client-side pivot table from the datasource.
|
|
672
|
+
* The first release supports one row field, one column field, and one value field.
|
|
673
|
+
* Enable `showSidebar` to let users change this configuration from the grid's Pivot tab.
|
|
674
|
+
*/
|
|
675
|
+
pivotConfig?: AgridPivotConfig<T>;
|
|
546
676
|
/** Labels used by columns with a matching `group` identifier. */
|
|
547
677
|
headerGroups?: HeaderGroup[];
|
|
548
678
|
/**
|
|
549
679
|
* Render rows as a hierarchical tree. When set, rows are nested by the configured
|
|
550
680
|
* parent/child accessors and an expand/collapse twisty is shown on `treeField`.
|
|
551
|
-
*
|
|
681
|
+
*
|
|
682
|
+
* Set `aggregateTreeNodes` in this configuration to display each aggregate column's
|
|
683
|
+
* descendant-leaf rollup on expandable nodes. Tree mode is mutually exclusive with grouping
|
|
684
|
+
* and pagination.
|
|
552
685
|
*/
|
|
553
686
|
treeConfig?: AgridTreeConfig<T>;
|
|
554
687
|
/** Row height in pixels. Must be fixed for CDK virtual scroll. @default 32 */
|
|
@@ -571,7 +704,8 @@ interface AgridProviderConfig<T extends object = any> extends Partial<AGridOptio
|
|
|
571
704
|
autoOpenDetail?: boolean;
|
|
572
705
|
/**
|
|
573
706
|
* Emit filter and sort changes for server processing instead of applying them locally.
|
|
574
|
-
* The
|
|
707
|
+
* The distinct-value picker is hidden unless the column supplies an explicit `values` list.
|
|
708
|
+
* @default false
|
|
575
709
|
*/
|
|
576
710
|
serverSideFiltering?: boolean;
|
|
577
711
|
/** Delay before emitting server-side text filter changes. Set to `0` to disable. @default 300 */
|
|
@@ -686,10 +820,19 @@ interface AgridProviderConfig<T extends object = any> extends Partial<AGridOptio
|
|
|
686
820
|
declare class AgridProvider<T extends object = any> {
|
|
687
821
|
/** Mutable row data consumed by the grid. */
|
|
688
822
|
datasource: AgridDataSource<T>;
|
|
823
|
+
/** Lazy server-side model, or `null` for the regular client-side datasource. */
|
|
824
|
+
serverSideRowModel: AgridServerSideRowModel<T> | null;
|
|
689
825
|
/** Runtime UI state and imperative grid controls. */
|
|
690
826
|
control: AgridControl;
|
|
691
827
|
/** Reactive column definitions in display order. */
|
|
692
828
|
readonly columns: WritableSignal<ColDef<T>[]>;
|
|
829
|
+
private readonly _pivotConfig;
|
|
830
|
+
/**
|
|
831
|
+
* Client-side pivot configuration, or `null` for the normal row view.
|
|
832
|
+
* Assigning a new configuration reactively rebuilds the derived pivot rows and columns.
|
|
833
|
+
*/
|
|
834
|
+
get pivotConfig(): AgridPivotConfig<T> | null;
|
|
835
|
+
set pivotConfig(config: AgridPivotConfig<T> | null);
|
|
693
836
|
/** Header-group labels referenced by column definitions. */
|
|
694
837
|
headerGroups: HeaderGroup[];
|
|
695
838
|
/** Tree configuration, or `null` when the grid is not in tree mode. */
|
|
@@ -734,7 +877,7 @@ declare class AgridProvider<T extends object = any> {
|
|
|
734
877
|
menuBarItems: AgridMenuBarItem<T>[];
|
|
735
878
|
/** Enabled sorting mode. */
|
|
736
879
|
sortOption: 'single' | 'multi' | 'none';
|
|
737
|
-
/**
|
|
880
|
+
/** @deprecated Use `control.autoAddRows` and `control.setAutoAddRows()` instead. */
|
|
738
881
|
readonly autoAddRows: WritableSignal<boolean>;
|
|
739
882
|
/** Enabled row-selection mode. */
|
|
740
883
|
rowSelection: 'single' | 'multi' | 'none';
|
|
@@ -771,18 +914,47 @@ declare class AgridProvider<T extends object = any> {
|
|
|
771
914
|
}) => string;
|
|
772
915
|
/** Fixed height in pixels of an expanded detail panel row. */
|
|
773
916
|
detailRowHeight: number;
|
|
774
|
-
/**
|
|
917
|
+
/** @deprecated Use `control.loading` and `control.setLoading()` instead. */
|
|
775
918
|
readonly loading: WritableSignal<boolean>;
|
|
776
|
-
/**
|
|
919
|
+
/** @deprecated Use `control.readonly` and `control.setReadonly()` instead. */
|
|
777
920
|
readonly readonlyGrid: WritableSignal<boolean>;
|
|
778
921
|
/** Creates a provider from the supplied data, state, columns, and display options. */
|
|
779
922
|
constructor(config?: AgridProviderConfig<T>);
|
|
780
923
|
/** Returns the current reactive row array. */
|
|
781
924
|
getGridData(): T[];
|
|
925
|
+
/**
|
|
926
|
+
* Return a detached, JSON-safe snapshot of persistent grid and pivot settings.
|
|
927
|
+
* Custom pivot aggregate functions cannot be serialized and produce an explicit error.
|
|
928
|
+
*/
|
|
929
|
+
saveSettings(): AgridSettings;
|
|
930
|
+
/**
|
|
931
|
+
* Apply a previously saved snapshot to this live provider.
|
|
932
|
+
* Existing component instances update immediately because both control and pivot state are
|
|
933
|
+
* signal-backed. Unknown versions and pivot fields fail early with actionable errors.
|
|
934
|
+
*/
|
|
935
|
+
loadSettings(settings: AgridSettings): void;
|
|
782
936
|
}
|
|
783
937
|
|
|
784
938
|
/** String-valued property names available on a row type. */
|
|
785
939
|
type AgridField<T extends object> = Extract<keyof T, string>;
|
|
940
|
+
/** Aggregate functions shared by footers, groups, tree rollups, and pivot values. */
|
|
941
|
+
type AgridAggregate = 'sum' | 'avg' | 'min' | 'max' | 'count' | ((values: unknown[]) => unknown);
|
|
942
|
+
/**
|
|
943
|
+
* Client-side pivot-table configuration.
|
|
944
|
+
*
|
|
945
|
+
* The initial pivot implementation supports one row dimension, one column dimension, and one
|
|
946
|
+
* value field. The resulting table is derived from the datasource and is always read-only.
|
|
947
|
+
*/
|
|
948
|
+
interface AgridPivotConfig<T extends object = any> {
|
|
949
|
+
/** Source field whose distinct values become pivot rows. */
|
|
950
|
+
rowField: AgridField<T>;
|
|
951
|
+
/** Source field whose distinct values become generated pivot columns. */
|
|
952
|
+
columnField: AgridField<T>;
|
|
953
|
+
/** Source field aggregated at each row/column intersection. */
|
|
954
|
+
valueField: AgridField<T>;
|
|
955
|
+
/** Aggregate applied to each intersection. Defaults to `'sum'`. */
|
|
956
|
+
aggregate?: AgridAggregate;
|
|
957
|
+
}
|
|
786
958
|
/** Behavior after pressing Enter while an inline cell editor is active. */
|
|
787
959
|
type AgridEnterEditAction = 'nothing' | 'nextColumn' | 'nextRow';
|
|
788
960
|
/** Parameters passed to a row-aware cell readonly resolver. */
|
|
@@ -796,6 +968,31 @@ interface CellReadonlyParams<T extends object = any, K extends AgridField<T> = A
|
|
|
796
968
|
/** Zero-based index of the row in the datasource. */
|
|
797
969
|
originalIndex: number;
|
|
798
970
|
}
|
|
971
|
+
/** Parameters passed to a row-aware cell formatting resolver. */
|
|
972
|
+
type CellFormatParams<T extends object = any, K extends AgridField<T> = AgridField<T>> = CellReadonlyParams<T, K>;
|
|
973
|
+
/** Supported visual overrides returned by {@link ColDefBase.cellFormat}. */
|
|
974
|
+
interface CellFormat {
|
|
975
|
+
/** CSS background color, such as `'#fff4cc'` or `'var(--warning-bg)'`. */
|
|
976
|
+
backgroundColor?: string;
|
|
977
|
+
/** CSS border color. The cell's existing right and bottom borders use this color. */
|
|
978
|
+
borderColor?: string;
|
|
979
|
+
/** CSS text color. */
|
|
980
|
+
color?: string;
|
|
981
|
+
/** CSS `font` shorthand. Individual font properties below can override parts of it. */
|
|
982
|
+
font?: string;
|
|
983
|
+
/** CSS font family. */
|
|
984
|
+
fontFamily?: string;
|
|
985
|
+
/** CSS font size, including its unit (for example `'0.875rem'`). */
|
|
986
|
+
fontSize?: string;
|
|
987
|
+
/** CSS font style. */
|
|
988
|
+
fontStyle?: 'normal' | 'italic' | 'oblique' | string;
|
|
989
|
+
/** CSS font weight. */
|
|
990
|
+
fontWeight?: string | number;
|
|
991
|
+
/** CSS text decoration. */
|
|
992
|
+
textDecoration?: string;
|
|
993
|
+
/** CSS horizontal text alignment. */
|
|
994
|
+
textAlign?: 'left' | 'right' | 'center' | 'justify' | string;
|
|
995
|
+
}
|
|
799
996
|
/** Global options shared by grid providers. */
|
|
800
997
|
interface AGridOptions {
|
|
801
998
|
/**
|
|
@@ -855,6 +1052,8 @@ interface AgridMenuBarMenuItem<T extends object = any> {
|
|
|
855
1052
|
active?: AgridMenuBarState<T>;
|
|
856
1053
|
/** Whether the command is disabled. Defaults to `false`. */
|
|
857
1054
|
disabled?: AgridMenuBarState<T>;
|
|
1055
|
+
/** Additional classes */
|
|
1056
|
+
class?: string;
|
|
858
1057
|
}
|
|
859
1058
|
/** Top-level menu-bar button with optional additional dropdown commands. */
|
|
860
1059
|
interface AgridMenuBarItem<T extends object = any> extends AgridMenuBarMenuItem<T> {
|
|
@@ -926,6 +1125,22 @@ interface ColDefBase<T extends object, K extends AgridField<T>> {
|
|
|
926
1125
|
* ```
|
|
927
1126
|
*/
|
|
928
1127
|
cellReadonly?: (params: CellReadonlyParams<T, K>) => boolean;
|
|
1128
|
+
/**
|
|
1129
|
+
* Return visual overrides for this specific cell at runtime.
|
|
1130
|
+
* Runs with the current row, value, column definition, and original datasource index.
|
|
1131
|
+
* Return `null` or `undefined` to use the grid's normal styling.
|
|
1132
|
+
*
|
|
1133
|
+
* @example
|
|
1134
|
+
* ```ts
|
|
1135
|
+
* {
|
|
1136
|
+
* field: 'balance',
|
|
1137
|
+
* cellFormat: ({ value }) => value < 0
|
|
1138
|
+
* ? { backgroundColor: '#fee2e2', color: '#991b1b', fontWeight: 600 }
|
|
1139
|
+
* : undefined,
|
|
1140
|
+
* }
|
|
1141
|
+
* ```
|
|
1142
|
+
*/
|
|
1143
|
+
cellFormat?: (params: CellFormatParams<T, K>) => CellFormat | null | undefined;
|
|
929
1144
|
/**
|
|
930
1145
|
* Fixed list of allowed values shown in a `<select>` dropdown when editing.
|
|
931
1146
|
*
|
|
@@ -996,7 +1211,7 @@ interface ColDefBase<T extends object, K extends AgridField<T>> {
|
|
|
996
1211
|
* { field: 'score', aggregate: values => values.filter(v => Number(v) > 90).length }
|
|
997
1212
|
* ```
|
|
998
1213
|
*/
|
|
999
|
-
aggregate?:
|
|
1214
|
+
aggregate?: AgridAggregate;
|
|
1000
1215
|
/**
|
|
1001
1216
|
* Return one or more CSS class names to apply to every cell in this column based on the
|
|
1002
1217
|
* cell's value and row data. Useful for conditional highlighting without a custom renderer.
|
|
@@ -1082,6 +1297,9 @@ interface GroupAction {
|
|
|
1082
1297
|
type GridItem<T extends object = Record<string, unknown>> = {
|
|
1083
1298
|
row: T;
|
|
1084
1299
|
originalIndex: number;
|
|
1300
|
+
} | {
|
|
1301
|
+
loading: true;
|
|
1302
|
+
originalIndex: number;
|
|
1085
1303
|
} | null | 'ghost' | {
|
|
1086
1304
|
groupLabel: string;
|
|
1087
1305
|
count: number;
|
|
@@ -1102,6 +1320,13 @@ interface PathTreeNodeItem {
|
|
|
1102
1320
|
expandable: true;
|
|
1103
1321
|
/** Whether the branch's descendants are currently visible. */
|
|
1104
1322
|
expanded: boolean;
|
|
1323
|
+
/**
|
|
1324
|
+
* Field-to-value rollups computed from all datasource leaves below this generated branch.
|
|
1325
|
+
* Present only when the grid enables {@link AgridTreeConfig.aggregateTreeNodes}; standalone
|
|
1326
|
+
* trees do not compute column aggregates.
|
|
1327
|
+
* @internal
|
|
1328
|
+
*/
|
|
1329
|
+
aggregates?: Record<string, unknown>;
|
|
1105
1330
|
}
|
|
1106
1331
|
/**
|
|
1107
1332
|
* A master/detail panel row rendered immediately beneath its expanded parent data row.
|
|
@@ -1136,6 +1361,12 @@ interface TreeRowItem<T extends object = Record<string, unknown>> {
|
|
|
1136
1361
|
expanded: boolean;
|
|
1137
1362
|
/** Optional display-only label for the tree cell, used by path-based trees. */
|
|
1138
1363
|
treeLabel?: string;
|
|
1364
|
+
/**
|
|
1365
|
+
* Field-to-value rollups computed from this node's descendant leaves. Parent rows are excluded
|
|
1366
|
+
* so a stored subtotal is not counted again. Present only for expandable rows when enabled.
|
|
1367
|
+
* @internal
|
|
1368
|
+
*/
|
|
1369
|
+
aggregates?: Record<string, unknown>;
|
|
1139
1370
|
}
|
|
1140
1371
|
/**
|
|
1141
1372
|
* Host-supplied configuration that turns the grid into a tree.
|
|
@@ -1169,6 +1400,35 @@ interface AgridTreeConfigBase<T extends object> {
|
|
|
1169
1400
|
* Defaults to `true`. (Applied by the projection layer, not by {@link GridItem} flattening.)
|
|
1170
1401
|
*/
|
|
1171
1402
|
keepAncestorsOnFilter?: boolean;
|
|
1403
|
+
/**
|
|
1404
|
+
* Display aggregate-column rollups on expandable nodes in `AgridComponent` tree mode.
|
|
1405
|
+
*
|
|
1406
|
+
* Parent/id trees aggregate descendant leaves and deliberately exclude intermediate parent
|
|
1407
|
+
* values to avoid counting stored subtotals twice. Generated path branches aggregate every
|
|
1408
|
+
* datasource leaf below that branch. Expansion does not affect the result, while active filters
|
|
1409
|
+
* limit the contributing leaves. Aggregate cells on datasource-backed parents are display-only.
|
|
1410
|
+
*
|
|
1411
|
+
* The function comes from {@link ColDef.aggregate} or a runtime
|
|
1412
|
+
* `AgridControl.setAggregate()` override. The standalone `AgridTreeComponent` has no columns and
|
|
1413
|
+
* therefore ignores this option.
|
|
1414
|
+
*
|
|
1415
|
+
* @default false
|
|
1416
|
+
* @example
|
|
1417
|
+
* ```ts
|
|
1418
|
+
* const columns = [
|
|
1419
|
+
* { field: 'name', header: 'Name' },
|
|
1420
|
+
* { field: 'amount', header: 'Amount', aggregate: 'sum' },
|
|
1421
|
+
* ];
|
|
1422
|
+
*
|
|
1423
|
+
* const treeConfig = {
|
|
1424
|
+
* getId: row => row.id,
|
|
1425
|
+
* getParentId: row => row.parentId,
|
|
1426
|
+
* treeField: 'name',
|
|
1427
|
+
* aggregateTreeNodes: true,
|
|
1428
|
+
* };
|
|
1429
|
+
* ```
|
|
1430
|
+
*/
|
|
1431
|
+
aggregateTreeNodes?: boolean;
|
|
1172
1432
|
}
|
|
1173
1433
|
/** Tree configuration for rows that already expose stable id and parent-id values. */
|
|
1174
1434
|
interface AgridParentTreeConfig<T extends object = any> extends AgridTreeConfigBase<T> {
|
|
@@ -1568,6 +1828,8 @@ declare class AgridTreeController {
|
|
|
1568
1828
|
collapseAll(): void;
|
|
1569
1829
|
}
|
|
1570
1830
|
|
|
1831
|
+
/** Tabs available from the grid's vertical sidebar strip. @internal */
|
|
1832
|
+
type AgridSidebarTab = 'columns' | 'detail' | 'pivot';
|
|
1571
1833
|
/** Field edit emitted by the sidebar detail form. @internal */
|
|
1572
1834
|
interface AgridSidebarEdit {
|
|
1573
1835
|
/** Data field being edited. */
|
|
@@ -1607,6 +1869,9 @@ interface AgridSidebarDetailField {
|
|
|
1607
1869
|
* | Key | Action |
|
|
1608
1870
|
* |-----|--------|
|
|
1609
1871
|
* | Arrow keys | Move selection |
|
|
1872
|
+
* | Page Up / Page Down | Move by one visible viewport page |
|
|
1873
|
+
* | Home / End | Move to the first / last cell in the current row |
|
|
1874
|
+
* | Ctrl/Cmd+Home / Ctrl/Cmd+End | Move to the first / last cell in the grid |
|
|
1610
1875
|
* | Tab / Shift+Tab | Move right / left (wraps rows) |
|
|
1611
1876
|
* | Enter | Enter edit mode |
|
|
1612
1877
|
* | Ctrl/Cmd+Enter | Toggle an expandable tree node |
|
|
@@ -1641,6 +1906,8 @@ declare class AgridComponent<T extends object = any> {
|
|
|
1641
1906
|
readonly cellMenuItems: Signal<(CellContextMenuItem<T> | null)[]>;
|
|
1642
1907
|
readonly headerGroups: Signal<_thkl_agrid.HeaderGroup[]>;
|
|
1643
1908
|
readonly treeConfig: Signal<_thkl_agrid.AgridTreeConfig<T> | null>;
|
|
1909
|
+
/** Whether the provider is rendering a derived client-side pivot table. */
|
|
1910
|
+
readonly pivotMode: Signal<boolean>;
|
|
1644
1911
|
readonly zebraStripes: Signal<boolean>;
|
|
1645
1912
|
readonly showChangedCellIndicator: Signal<boolean>;
|
|
1646
1913
|
readonly confirmRowDelete: Signal<boolean>;
|
|
@@ -1655,6 +1922,8 @@ declare class AgridComponent<T extends object = any> {
|
|
|
1655
1922
|
}) => string) | undefined>;
|
|
1656
1923
|
/** Host callback designating pinned rows, or `undefined`. */
|
|
1657
1924
|
readonly pinRowFn: Signal<((row: Record<string, unknown>, index: number) => "top" | "bottom" | undefined) | undefined>;
|
|
1925
|
+
readonly pivotRowColumnField: Signal<Extract<keyof T, string> | undefined>;
|
|
1926
|
+
readonly pivotHeaderLabel: Signal<string | undefined>;
|
|
1658
1927
|
/**
|
|
1659
1928
|
* Effective pin resolver fed to the projection: a runtime UI override wins (including an explicit
|
|
1660
1929
|
* `null` unpin), otherwise the provider `pinRow` predicate decides. Returns `undefined` when
|
|
@@ -1665,10 +1934,17 @@ declare class AgridComponent<T extends object = any> {
|
|
|
1665
1934
|
readonly masterDetail: Signal<boolean>;
|
|
1666
1935
|
/** Fixed detail-panel height in pixels. */
|
|
1667
1936
|
readonly detailRowHeight: Signal<number>;
|
|
1668
|
-
/**
|
|
1937
|
+
/** Read-only pivot rows and generated columns, or `null` in the normal datasource view. */
|
|
1938
|
+
private readonly pivotResult;
|
|
1939
|
+
/** Reactive row projection linked into a stable datasource instance for pivot mode. */
|
|
1940
|
+
private readonly pivotRows;
|
|
1941
|
+
private readonly pivotDataSource;
|
|
1942
|
+
/** Column definitions from the active provider or generated by the active pivot. */
|
|
1669
1943
|
readonly colDefs: Signal<ColDefBase<any, string>[]>;
|
|
1670
|
-
/** Signal-based
|
|
1944
|
+
/** Signal-based source rows or a derived, read-only pivot datasource. */
|
|
1671
1945
|
readonly dataSource: Signal<AgridDataSource<any>>;
|
|
1946
|
+
/** Active lazy server-side row model, when configured on the provider. */
|
|
1947
|
+
readonly serverSideRowModel: Signal<_thkl_agrid.AgridServerSideRowModel<T> | null>;
|
|
1672
1948
|
private readonly treeParentIds;
|
|
1673
1949
|
/** Grid UI state container from the active provider. */
|
|
1674
1950
|
readonly control: Signal<AgridControl | null>;
|
|
@@ -1698,6 +1974,8 @@ declare class AgridComponent<T extends object = any> {
|
|
|
1698
1974
|
rowClick: _angular_core.OutputEmitterRef<RowClickEvent<T>>;
|
|
1699
1975
|
/** Emitted when the user single-clicks a generated path-tree branch node. */
|
|
1700
1976
|
treeNodeClick: _angular_core.OutputEmitterRef<TreeNodeClickEvent>;
|
|
1977
|
+
/** Emitted after sidebar changes produce a new persistable grid settings snapshot. */
|
|
1978
|
+
settingsChange: _angular_core.OutputEmitterRef<AgridSettings>;
|
|
1701
1979
|
/** Emitted when the user double-clicks a generated path-tree branch node. */
|
|
1702
1980
|
treeNodeDoubleClicked: _angular_core.OutputEmitterRef<TreeNodeClickEvent>;
|
|
1703
1981
|
/**
|
|
@@ -1763,7 +2041,15 @@ declare class AgridComponent<T extends object = any> {
|
|
|
1763
2041
|
/** Toggle the sidebar open/closed. */
|
|
1764
2042
|
toggleSidebar(): void;
|
|
1765
2043
|
/** @internal */
|
|
1766
|
-
onSidebarStripClick(tab:
|
|
2044
|
+
onSidebarStripClick(tab: AgridSidebarTab): void;
|
|
2045
|
+
/** @internal Replace the active pivot configuration from the sidebar controls. */
|
|
2046
|
+
onSidebarPivotChange(config: AgridPivotConfig): void;
|
|
2047
|
+
/** Return a detached, JSON-safe snapshot suitable for persistence by the host application. */
|
|
2048
|
+
saveSettings(): AgridSettings;
|
|
2049
|
+
/** Apply a saved settings snapshot to this live grid. */
|
|
2050
|
+
loadSettings(settings: AgridSettings): void;
|
|
2051
|
+
/** Emit when the active state is JSON-safe; custom function aggregates remain host-owned. */
|
|
2052
|
+
private emitSettingsChange;
|
|
1767
2053
|
/** @internal */
|
|
1768
2054
|
onSidebarDetailEdit(event: AgridSidebarEdit): void;
|
|
1769
2055
|
/** @internal Commit an edit made via the detail panel. */
|
|
@@ -1898,6 +2184,7 @@ declare class AgridComponent<T extends object = any> {
|
|
|
1898
2184
|
private readonly destroyRef;
|
|
1899
2185
|
private readonly _hostEl;
|
|
1900
2186
|
private readonly browser;
|
|
2187
|
+
private viewReady;
|
|
1901
2188
|
private readonly rangeController;
|
|
1902
2189
|
private readonly columnSizing;
|
|
1903
2190
|
private readonly columnMenuController;
|
|
@@ -1935,9 +2222,11 @@ declare class AgridComponent<T extends object = any> {
|
|
|
1935
2222
|
readonly sidebarOpen: _angular_core.WritableSignal<boolean>;
|
|
1936
2223
|
/** @internal Per-field sidebar validation messages. */
|
|
1937
2224
|
readonly sidebarValidationErrors: _angular_core.WritableSignal<Record<string, string>>;
|
|
1938
|
-
readonly sidebarTab: _angular_core.WritableSignal<
|
|
2225
|
+
readonly sidebarTab: _angular_core.WritableSignal<AgridSidebarTab>;
|
|
1939
2226
|
readonly sidebarRow: Signal<Record<string, unknown> | null>;
|
|
1940
2227
|
readonly sidebarHiddenColumns: Signal<ReadonlySet<string>>;
|
|
2228
|
+
/** Original provider columns used as pivot field choices. */
|
|
2229
|
+
readonly sidebarPivotColumns: Signal<ColDefBase<any, string>[]>;
|
|
1941
2230
|
private readonly clipboardHandler;
|
|
1942
2231
|
readonly dragHandler: AgridDragHandler;
|
|
1943
2232
|
private readonly columnReorder;
|
|
@@ -1980,6 +2269,11 @@ declare class AgridComponent<T extends object = any> {
|
|
|
1980
2269
|
row: Record<string, unknown>;
|
|
1981
2270
|
originalIndex: number;
|
|
1982
2271
|
};
|
|
2272
|
+
/** @internal Whether this virtual row is waiting for a server-side block. */
|
|
2273
|
+
isLoadingRow(item: GridItem): item is {
|
|
2274
|
+
loading: true;
|
|
2275
|
+
originalIndex: number;
|
|
2276
|
+
};
|
|
1983
2277
|
/** @internal */
|
|
1984
2278
|
isGroupHeaderItem(item: GridItem): item is {
|
|
1985
2279
|
groupLabel: string;
|
|
@@ -2023,8 +2317,20 @@ declare class AgridComponent<T extends object = any> {
|
|
|
2023
2317
|
treeRowExpandable(item: GridItem): boolean;
|
|
2024
2318
|
/** @internal Whether a tree row is currently expanded. */
|
|
2025
2319
|
treeRowExpanded(item: GridItem): boolean;
|
|
2026
|
-
/**
|
|
2320
|
+
/**
|
|
2321
|
+
* @internal Resolve the non-persistent value shown by a tree cell.
|
|
2322
|
+
*
|
|
2323
|
+
* A formatted path-leaf label wins in the tree column. In every other aggregate column, an
|
|
2324
|
+
* expandable parent shows its descendant rollup instead of its stored value. Returning `null`
|
|
2325
|
+
* delegates to the normal cell formatter. The source row is never mutated.
|
|
2326
|
+
*/
|
|
2027
2327
|
treeCellDisplayOverride(item: GridItem, col: ColDef): string | null;
|
|
2328
|
+
/**
|
|
2329
|
+
* @internal True when a datasource-backed tree parent cell displays a computed rollup.
|
|
2330
|
+
* The template uses this to prevent editing a display-only value into the source parent row.
|
|
2331
|
+
* Generated path branches are not cell components and render their aggregates separately.
|
|
2332
|
+
*/
|
|
2333
|
+
isTreeAggregateCell(item: GridItem, col: ColDef): boolean;
|
|
2028
2334
|
/** @internal Whether the configured info action is visible for this cell. */
|
|
2029
2335
|
showCellInfoIcon(col: ColDef, row: Record<string, unknown>): boolean;
|
|
2030
2336
|
/** @internal Emits the typed cell information action. */
|
|
@@ -2263,6 +2569,7 @@ declare class AgridComponent<T extends object = any> {
|
|
|
2263
2569
|
onSidebarToggleColumnGroup(fields: string[], visible: boolean): void;
|
|
2264
2570
|
/** @internal Mirrors vertical scrolling from the main viewport into both pinned panes. */
|
|
2265
2571
|
onBodyScroll(): void;
|
|
2572
|
+
private ensureServerRowsVisible;
|
|
2266
2573
|
/** @internal Keeps the row-delete prompt visible while columns scroll horizontally. */
|
|
2267
2574
|
onHorizontalScroll(): void;
|
|
2268
2575
|
/** @internal */
|
|
@@ -2299,7 +2606,7 @@ declare class AgridComponent<T extends object = any> {
|
|
|
2299
2606
|
getColumnWidth(col: ColDef): number;
|
|
2300
2607
|
private getColumnWidthToken;
|
|
2301
2608
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AgridComponent<any>, never>;
|
|
2302
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgridComponent<any>, "agrid", never, { "provider": { "alias": "provider"; "required": false; "isSignal": true; }; }, { "cellEdit": "cellEdit"; "recordEdit": "recordEdit"; "rowRemoved": "rowRemoved"; "prepareAddRecord": "prepareAddRecord"; "rowReorder": "rowReorder"; "rowSelect": "rowSelect"; "rowDoubleClicked": "rowDoubleClicked"; "rowClick": "rowClick"; "treeNodeClick": "treeNodeClick"; "treeNodeDoubleClicked": "treeNodeDoubleClicked"; "rowChanged": "rowChanged"; "pageChange": "pageChange"; "filterChange": "filterChange"; "sortChange": "sortChange"; "quickFilterChange": "quickFilterChange"; "validationFailed": "validationFailed"; "cellInfo": "cellInfo"; "menuBarAction": "menuBarAction"; }, never, never, true, never>;
|
|
2609
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgridComponent<any>, "agrid", never, { "provider": { "alias": "provider"; "required": false; "isSignal": true; }; }, { "cellEdit": "cellEdit"; "recordEdit": "recordEdit"; "rowRemoved": "rowRemoved"; "prepareAddRecord": "prepareAddRecord"; "rowReorder": "rowReorder"; "rowSelect": "rowSelect"; "rowDoubleClicked": "rowDoubleClicked"; "rowClick": "rowClick"; "treeNodeClick": "treeNodeClick"; "settingsChange": "settingsChange"; "treeNodeDoubleClicked": "treeNodeDoubleClicked"; "rowChanged": "rowChanged"; "pageChange": "pageChange"; "filterChange": "filterChange"; "sortChange": "sortChange"; "quickFilterChange": "quickFilterChange"; "validationFailed": "validationFailed"; "cellInfo": "cellInfo"; "menuBarAction": "menuBarAction"; }, never, never, true, never>;
|
|
2303
2610
|
}
|
|
2304
2611
|
|
|
2305
2612
|
/** Identifier supported by the standalone page selector. */
|
|
@@ -2355,7 +2662,12 @@ declare class AgridPageSelectorComponent<TId extends AgridPageId = AgridPageId>
|
|
|
2355
2662
|
|
|
2356
2663
|
/** Configuration accepted by {@link AgridTreeProvider}. */
|
|
2357
2664
|
interface AgridTreeProviderConfig<T extends object> {
|
|
2665
|
+
/** Flat datasource whose rows are linked by parent ids or path segments. */
|
|
2358
2666
|
datasource: AgridDataSource<T>;
|
|
2667
|
+
/**
|
|
2668
|
+
* Hierarchy, identity, labeling, filtering, and initial-expansion configuration.
|
|
2669
|
+
* `aggregateTreeNodes` is ignored because the standalone tree has no grid columns.
|
|
2670
|
+
*/
|
|
2359
2671
|
treeConfig: AgridTreeConfig<T>;
|
|
2360
2672
|
/** Label for parent-linked rows. Defaults to the configured `treeField` value. */
|
|
2361
2673
|
getLabel?: (row: T) => string;
|
|
@@ -2372,14 +2684,23 @@ interface AgridTreeProviderConfig<T extends object> {
|
|
|
2372
2684
|
}
|
|
2373
2685
|
/** Provider-style configuration and datasource container for `<agrid-tree>`. */
|
|
2374
2686
|
declare class AgridTreeProvider<T extends object = any> {
|
|
2687
|
+
/** Rows projected into the standalone tree. */
|
|
2375
2688
|
readonly datasource: AgridDataSource<T>;
|
|
2689
|
+
/** Shared hierarchy configuration; column-specific aggregation is not used here. */
|
|
2376
2690
|
readonly treeConfig: AgridTreeConfig<T>;
|
|
2691
|
+
/** Optional host label resolver for parent-linked datasource rows. */
|
|
2377
2692
|
readonly getLabel?: (row: T) => string;
|
|
2693
|
+
/** Optional host resolver for secondary node text. */
|
|
2378
2694
|
readonly getDescription?: (row: T) => string | undefined;
|
|
2695
|
+
/** Effective node selection behavior. */
|
|
2379
2696
|
readonly selection: AgridTreeSelectionMode;
|
|
2697
|
+
/** Effective fixed node height in pixels. */
|
|
2380
2698
|
readonly rowHeight: number;
|
|
2699
|
+
/** Effective accessible name applied to the tree root. */
|
|
2381
2700
|
readonly ariaLabel: string;
|
|
2701
|
+
/** Effective empty-state message. */
|
|
2382
2702
|
readonly emptyText: string;
|
|
2703
|
+
/** Normalize optional standalone-tree settings and retain the reactive datasource. */
|
|
2383
2704
|
constructor(config: AgridTreeProviderConfig<T>);
|
|
2384
2705
|
}
|
|
2385
2706
|
|
|
@@ -2429,6 +2750,6 @@ declare class AgridTreeComponent<T extends object = any> {
|
|
|
2429
2750
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AgridTreeComponent<any>, "agrid-tree", never, { "provider": { "alias": "provider"; "required": true; "isSignal": true; }; }, { "nodeClick": "nodeClick"; "nodeDoubleClicked": "nodeDoubleClicked"; "selectionChange": "selectionChange"; }, never, never, true, never>;
|
|
2430
2751
|
}
|
|
2431
2752
|
|
|
2432
|
-
export { AGRID_LOCALE_TEXT, AgridComponent, AgridControl, AgridDataSource, AgridPageSelectorComponent, AgridProvider, AgridTreeComponent, AgridTreeProvider, ColDefAutoSize };
|
|
2433
|
-
export type { AgridControlState, AgridEnterEditAction, AgridField, AgridLocaleKey, AgridLocaleText, AgridLocaleTextOverrides, AgridMenuBarContext, AgridMenuBarItem, AgridMenuBarMenuItem, AgridMenuBarState, AgridPageId, AgridPageItem, AgridParentTreeConfig, AgridPathSegmentParams, AgridPathTreeConfig, AgridProviderConfig, AgridTreeConfig, AgridTreeNodeEvent, AgridTreeProviderConfig, AgridTreeSelectionEvent, AgridTreeSelectionMode, CellContextMenuItem, CellInfoEvent, CellPosition, CellReadonlyParams, ColDef, ColumnFilter, DetailRowItem, FilterChangeEvent, FilterOperator, GridEditEvent, GroupAction, HeaderGroup, HistoryEntry, HistoryItem, InputMaskParams, NewRecord, PageChangeEvent, PathTreeNodeItem, RecordEditEvent, RowClickEvent, RowRemovedEvent, RowReorderEvent, RowSelectEvent, RowUpdateEvent, SortChangeEvent, TreeNodeClickEvent, TreeRowItem, ValidationFailedEvent, ValueOption };
|
|
2753
|
+
export { AGRID_LOCALE_TEXT, AgridComponent, AgridControl, AgridDataSource, AgridPageSelectorComponent, AgridProvider, AgridServerSideRowModel, AgridTreeComponent, AgridTreeProvider, ColDefAutoSize };
|
|
2754
|
+
export type { AgridAggregate, AgridControlState, AgridEnterEditAction, AgridField, AgridLocaleKey, AgridLocaleText, AgridLocaleTextOverrides, AgridMenuBarContext, AgridMenuBarItem, AgridMenuBarMenuItem, AgridMenuBarState, AgridPageId, AgridPageItem, AgridParentTreeConfig, AgridPathSegmentParams, AgridPathTreeConfig, AgridPivotConfig, AgridPivotSettings, AgridProviderConfig, AgridServerSideDatasource, AgridServerSideRequest, AgridServerSideResult, AgridServerSideRowModelConfig, AgridServerSideSort, AgridSettings, AgridTreeConfig, AgridTreeNodeEvent, AgridTreeProviderConfig, AgridTreeSelectionEvent, AgridTreeSelectionMode, CellContextMenuItem, CellFormat, CellFormatParams, CellInfoEvent, CellPosition, CellReadonlyParams, ColDef, ColumnFilter, DetailRowItem, FilterChangeEvent, FilterOperator, GridEditEvent, GroupAction, HeaderGroup, HistoryEntry, HistoryItem, InputMaskParams, NewRecord, PageChangeEvent, PathTreeNodeItem, RecordEditEvent, RowClickEvent, RowRemovedEvent, RowReorderEvent, RowSelectEvent, RowUpdateEvent, SortChangeEvent, TreeNodeClickEvent, TreeRowItem, ValidationFailedEvent, ValueOption };
|
|
2434
2755
|
//# sourceMappingURL=thkl-agrid.d.ts.map
|