@one-grid-core/angular 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/esm2022/lib/core/instants/one-grid-api.class.mjs +60 -1
- package/esm2022/lib/core/models/one-grid-types.model.mjs +1 -1
- package/esm2022/lib/core/services/one-grid-row.service.mjs +10 -1
- package/fesm2022/one-grid-core-angular.mjs +68 -0
- package/fesm2022/one-grid-core-angular.mjs.map +1 -1
- package/lib/core/instants/one-grid-api.class.d.ts +13 -1
- package/lib/core/models/one-grid-types.model.d.ts +19 -0
- package/lib/core/services/one-grid-row.service.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OneColumnDef, OneColumnStateEntry } from '../models/one-column-def-types.model';
|
|
2
2
|
import { OneRowNode } from "./one-row-node.class";
|
|
3
|
-
import { OneGridInitOptions, OneGridType, OneSortModel } from '../models/one-grid-types.model';
|
|
3
|
+
import { OneGridInitOptions, OneGridType, OneRowTransaction, OneSortModel } from '../models/one-grid-types.model';
|
|
4
4
|
import { OneGridEventService } from '../services/one-grid-event.service';
|
|
5
5
|
import { OneGridSelectionService } from '../services/one-grid-selection.service';
|
|
6
6
|
import { OneRowValidationErrors, OneValidationResult } from '../models/one-validation.model';
|
|
@@ -89,6 +89,18 @@ export declare class OneGridApi<T = any> {
|
|
|
89
89
|
* and there is nothing left to match against.
|
|
90
90
|
*/
|
|
91
91
|
updateRowData(rowData: T[]): void;
|
|
92
|
+
/**
|
|
93
|
+
* Apply a batch of row changes without the host rebinding the dataset:
|
|
94
|
+
* append rows (at the root, or under a parent by id on tree data), replace
|
|
95
|
+
* rows by id, drop rows at any depth. Selection and expansion survive —
|
|
96
|
+
* this is `updateRowData` fed from the grid's own current rows, so the
|
|
97
|
+
* host keeps no parallel copy to reconcile.
|
|
98
|
+
*
|
|
99
|
+
* Requires a stable `context.componentParent.getRowId`: rows are matched by
|
|
100
|
+
* id, and without an id function there is nothing to match on — the
|
|
101
|
+
* transaction is refused with a warning rather than half-applied.
|
|
102
|
+
*/
|
|
103
|
+
applyTransaction(transaction: OneRowTransaction<T>): void;
|
|
92
104
|
/**
|
|
93
105
|
* The one row-loading path. `setRowData` and `updateRowData` differed only in
|
|
94
106
|
* whether they cleared the state services first, so everything else — build,
|
|
@@ -58,6 +58,25 @@ export interface OneSortModel<T = any> {
|
|
|
58
58
|
colId: keyof T;
|
|
59
59
|
sort: 'asc' | 'desc';
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* One batch of row changes for `api.applyTransaction` — the way to append,
|
|
63
|
+
* patch or drop rows without rebinding the whole dataset from the host.
|
|
64
|
+
*
|
|
65
|
+
* Rows are matched by id, so a transaction requires a
|
|
66
|
+
* `context.componentParent.getRowId`. Selection and expansion survive, the
|
|
67
|
+
* active sort and filters re-apply, and on tree data `remove` reaches any
|
|
68
|
+
* depth while `addToParentId` places added rows under an existing parent.
|
|
69
|
+
*/
|
|
70
|
+
export interface OneRowTransaction<T = any> {
|
|
71
|
+
/** Rows to append — at the root, or under `addToParentId`. */
|
|
72
|
+
add?: T[];
|
|
73
|
+
/** Row id of the parent the added rows go under (tree data only). */
|
|
74
|
+
addToParentId?: string;
|
|
75
|
+
/** Replacement rows, matched to existing rows by id. */
|
|
76
|
+
update?: T[];
|
|
77
|
+
/** Rows (or row ids) to drop, at any depth. */
|
|
78
|
+
remove?: (T | string)[];
|
|
79
|
+
}
|
|
61
80
|
export interface GridRowData {
|
|
62
81
|
rowId: string;
|
|
63
82
|
[key: string]: any;
|
|
@@ -10,6 +10,13 @@ export declare class OneGridRowService {
|
|
|
10
10
|
* Generate Unique Row ID
|
|
11
11
|
*/
|
|
12
12
|
generateRowId(data: any, rowIndex: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* The row's id, or null when it cannot be known — no id function, or one
|
|
15
|
+
* that answers nothing for this row. Unlike `generateRowId` this never
|
|
16
|
+
* mints an id, which is what row matching (transactions) needs: a minted
|
|
17
|
+
* id matches nothing and must not pretend otherwise.
|
|
18
|
+
*/
|
|
19
|
+
resolveRowId(data: any): string | null;
|
|
13
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<OneGridRowService, never>;
|
|
14
21
|
static ɵprov: i0.ɵɵInjectableDeclaration<OneGridRowService>;
|
|
15
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@one-grid-core/angular",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "OneGrid — a feature-rich Angular data grid component with tree data, master/detail, editing, selection, pagination, and virtual scrolling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|