@platforma-sdk/model 1.76.5 → 1.77.4
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/dist/columns/column_collection_builder.cjs +6 -3
- package/dist/columns/column_collection_builder.cjs.map +1 -1
- package/dist/columns/column_collection_builder.js +6 -3
- package/dist/columns/column_collection_builder.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.d.ts +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.js.map +1 -1
- package/dist/components/PlDataTable/index.d.ts +1 -1
- package/dist/components/PlDataTable/state-migration.cjs +32 -1
- package/dist/components/PlDataTable/state-migration.cjs.map +1 -1
- package/dist/components/PlDataTable/state-migration.d.ts +4 -3
- package/dist/components/PlDataTable/state-migration.d.ts.map +1 -1
- package/dist/components/PlDataTable/state-migration.js +33 -2
- package/dist/components/PlDataTable/state-migration.js.map +1 -1
- package/dist/components/PlDataTable/typesV6.d.ts +26 -84
- package/dist/components/PlDataTable/typesV6.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV7.d.ts +98 -0
- package/dist/components/PlDataTable/typesV7.d.ts.map +1 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/package.json +8 -8
- package/src/columns/column_collection_builder.ts +12 -3
- package/src/components/PlDataTable/createPlDataTable/createPTableDefV2.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/createPTableDefV3.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV2.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV3.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/index.ts +1 -1
- package/src/components/PlDataTable/createPlDataTableSheet.ts +1 -1
- package/src/components/PlDataTable/index.ts +1 -1
- package/src/components/PlDataTable/state-migration.ts +71 -13
- package/src/components/PlDataTable/typesV6.ts +16 -138
- package/src/components/PlDataTable/typesV7.ts +151 -0
|
@@ -7,7 +7,11 @@ import type {
|
|
|
7
7
|
PTableRecordFilter,
|
|
8
8
|
PTableSorting,
|
|
9
9
|
} from "@milaboratories/pl-model-common";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
canonicalizeJson,
|
|
12
|
+
getPTableColumnId,
|
|
13
|
+
parseJsonSafely,
|
|
14
|
+
} from "@milaboratories/pl-model-common";
|
|
11
15
|
import { distillFilterSpec } from "../../filters";
|
|
12
16
|
import type { PlDataTableFilterState, PlTableFilter } from "./typesV4";
|
|
13
17
|
import type {
|
|
@@ -16,7 +20,14 @@ import type {
|
|
|
16
20
|
PlDataTableSheetState,
|
|
17
21
|
PlDataTableStateV2CacheEntry,
|
|
18
22
|
PlDataTableStateV2Normalized,
|
|
23
|
+
PlTableColumnIdJson,
|
|
19
24
|
PTableParamsV2,
|
|
25
|
+
} from "./typesV7";
|
|
26
|
+
import type {
|
|
27
|
+
PlDataTableGridStateV6,
|
|
28
|
+
PlDataTableStateV2V6,
|
|
29
|
+
PlDataTableStateV2V6CacheEntry,
|
|
30
|
+
PlDataTableV6ColIdJson,
|
|
20
31
|
} from "./typesV6";
|
|
21
32
|
import type {
|
|
22
33
|
PlDataTableGridStateV5,
|
|
@@ -106,7 +117,7 @@ export type PlDataTableStateV2 =
|
|
|
106
117
|
version: 4;
|
|
107
118
|
stateCache: {
|
|
108
119
|
sourceId: string;
|
|
109
|
-
gridState:
|
|
120
|
+
gridState: PlDataTableGridStateV6;
|
|
110
121
|
sheetsState: PlDataTableSheetState[];
|
|
111
122
|
filtersState: PlDataTableFilterState[];
|
|
112
123
|
}[];
|
|
@@ -130,6 +141,9 @@ export type PlDataTableStateV2 =
|
|
|
130
141
|
}[];
|
|
131
142
|
pTableParams: PTableParamsV2;
|
|
132
143
|
}
|
|
144
|
+
// v6 stored colIds as canonicalized full `PTableColumnSpec` (including
|
|
145
|
+
// annotations + `pl7.app/trace`). v7 strips down to `PTableColumnId`.
|
|
146
|
+
| PlDataTableStateV2V6
|
|
133
147
|
// Normalized state
|
|
134
148
|
| PlDataTableStateV2Normalized;
|
|
135
149
|
|
|
@@ -172,13 +186,15 @@ export function upgradePlDataTableStateV2(
|
|
|
172
186
|
if (state.version === 5) {
|
|
173
187
|
state = migrateV5toV6(state);
|
|
174
188
|
}
|
|
189
|
+
// v6 -> v7: shrink colIds from full PTableColumnSpec to PTableColumnId.
|
|
190
|
+
if (state.version === 6) {
|
|
191
|
+
state = migrateV6toV7(state);
|
|
192
|
+
}
|
|
175
193
|
return state;
|
|
176
194
|
}
|
|
177
195
|
|
|
178
196
|
/** Migrate v5 to v6: unwrap `{source, labeled}` colIds in gridState. */
|
|
179
|
-
function migrateV5toV6(
|
|
180
|
-
state: Extract<PlDataTableStateV2, { version: 5 }>,
|
|
181
|
-
): PlDataTableStateV2Normalized {
|
|
197
|
+
function migrateV5toV6(state: Extract<PlDataTableStateV2, { version: 5 }>): PlDataTableStateV2V6 {
|
|
182
198
|
// pTableParams reset: v5 stored DiscoveredPColumnId-based hiddenColIds with
|
|
183
199
|
// empty-array fields (e.g. `{column, path: [], columnQualifications: [], ...}`).
|
|
184
200
|
// v6 distills empty fields, so the same logical column serialises differently
|
|
@@ -204,9 +220,8 @@ function unwrapV5ColId(json: string): string {
|
|
|
204
220
|
: json;
|
|
205
221
|
}
|
|
206
222
|
|
|
207
|
-
function unwrapV5GridState(gridState: PlDataTableGridStateV5):
|
|
208
|
-
const unwrapAs = (json: PlDataTableV5ColIdJson) =>
|
|
209
|
-
unwrapV5ColId(json) as CanonicalizedJson<PTableColumnSpec>;
|
|
223
|
+
function unwrapV5GridState(gridState: PlDataTableGridStateV5): PlDataTableGridStateV6 {
|
|
224
|
+
const unwrapAs = (json: PlDataTableV5ColIdJson) => unwrapV5ColId(json) as PlDataTableV6ColIdJson;
|
|
210
225
|
return {
|
|
211
226
|
columnOrder: gridState.columnOrder
|
|
212
227
|
? { orderedColIds: gridState.columnOrder.orderedColIds.map(unwrapAs) }
|
|
@@ -225,14 +240,57 @@ function unwrapV5GridState(gridState: PlDataTableGridStateV5): PlDataTableGridSt
|
|
|
225
240
|
};
|
|
226
241
|
}
|
|
227
242
|
|
|
243
|
+
/** Migrate v6 to v7: rewrite each colId from a full PTableColumnSpec to its
|
|
244
|
+
* compact PTableColumnId (drops annotations/spec body, ~16× smaller per column). */
|
|
245
|
+
function migrateV6toV7(state: PlDataTableStateV2V6): PlDataTableStateV2Normalized {
|
|
246
|
+
return {
|
|
247
|
+
version: 7,
|
|
248
|
+
stateCache: state.stateCache.map(
|
|
249
|
+
(entry): PlDataTableStateV2CacheEntry => ({
|
|
250
|
+
...entry,
|
|
251
|
+
gridState: shrinkV6GridState(entry.gridState),
|
|
252
|
+
}),
|
|
253
|
+
),
|
|
254
|
+
pTableParams: state.pTableParams,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** Convert a v6 fat colId (canonicalized PTableColumnSpec) to a v7 compact colId
|
|
259
|
+
* (canonicalized PTableColumnId). The row-number sentinel is a string literal,
|
|
260
|
+
* not a spec — pass it through unchanged. */
|
|
261
|
+
function shrinkV6ColId(json: PlDataTableV6ColIdJson): PlTableColumnIdJson {
|
|
262
|
+
const parsed: unknown = parseJsonSafely(json);
|
|
263
|
+
if (!isNil(parsed) && typeof parsed === "object" && "type" in parsed && "id" in parsed) {
|
|
264
|
+
return canonicalizeJson(getPTableColumnId(parsed as PTableColumnSpec));
|
|
265
|
+
}
|
|
266
|
+
return json as unknown as PlTableColumnIdJson;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function shrinkV6GridState(gridState: PlDataTableGridStateV6): PlDataTableGridStateCore {
|
|
270
|
+
return {
|
|
271
|
+
columnOrder: gridState.columnOrder
|
|
272
|
+
? { orderedColIds: gridState.columnOrder.orderedColIds.map(shrinkV6ColId) }
|
|
273
|
+
: undefined,
|
|
274
|
+
sort: gridState.sort
|
|
275
|
+
? {
|
|
276
|
+
sortModel: gridState.sort.sortModel.map((s) => ({
|
|
277
|
+
colId: shrinkV6ColId(s.colId),
|
|
278
|
+
sort: s.sort,
|
|
279
|
+
})),
|
|
280
|
+
}
|
|
281
|
+
: undefined,
|
|
282
|
+
columnVisibility: gridState.columnVisibility
|
|
283
|
+
? { hiddenColIds: gridState.columnVisibility.hiddenColIds.map(shrinkV6ColId) }
|
|
284
|
+
: undefined,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
228
288
|
/** Migrate v4 state to v6: convert per-column filters to tree-based format (skips v5). */
|
|
229
|
-
function migrateV4toV6(
|
|
230
|
-
state: Extract<PlDataTableStateV2, { version: 4 }>,
|
|
231
|
-
): PlDataTableStateV2Normalized {
|
|
289
|
+
function migrateV4toV6(state: Extract<PlDataTableStateV2, { version: 4 }>): PlDataTableStateV2V6 {
|
|
232
290
|
let idCounter = 0;
|
|
233
291
|
const nextId = () => ++idCounter;
|
|
234
292
|
|
|
235
|
-
const migratedCache:
|
|
293
|
+
const migratedCache: PlDataTableStateV2V6CacheEntry[] = state.stateCache.map((entry) => {
|
|
236
294
|
const leaves: PlDataTableFiltersWithMeta["filters"] = [];
|
|
237
295
|
for (const f of entry.filtersState) {
|
|
238
296
|
if (f.filter !== null && !f.filter.disabled) {
|
|
@@ -358,7 +416,7 @@ export function createDefaultPTableParams(): PTableParamsV2 {
|
|
|
358
416
|
|
|
359
417
|
export function createPlDataTableStateV2(): PlDataTableStateV2Normalized {
|
|
360
418
|
return {
|
|
361
|
-
version:
|
|
419
|
+
version: 7,
|
|
362
420
|
stateCache: [],
|
|
363
421
|
pTableParams: createDefaultPTableParams(),
|
|
364
422
|
};
|
|
@@ -1,152 +1,30 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
AxisSpec,
|
|
4
|
-
CanonicalizedJson,
|
|
5
|
-
ListOptionBase,
|
|
6
|
-
PTableColumnSpec,
|
|
7
|
-
PTableSorting,
|
|
8
|
-
PColumnIdAndSpec,
|
|
9
|
-
PTableHandle,
|
|
10
|
-
RootFilterSpec,
|
|
11
|
-
PTableColumnId,
|
|
12
|
-
PFrameHandle,
|
|
13
|
-
} from "@milaboratories/pl-model-common";
|
|
14
|
-
import type { FilterSpecLeaf } from "../../filters";
|
|
15
|
-
import { Nil } from "@milaboratories/helpers";
|
|
1
|
+
import type { CanonicalizedJson, PTableColumnSpec } from "@milaboratories/pl-model-common";
|
|
2
|
+
import type { PlDataTableFiltersWithMeta, PlDataTableSheetState, PTableParamsV2 } from "./typesV7";
|
|
16
3
|
|
|
17
|
-
|
|
4
|
+
/**
|
|
5
|
+
* v6 colId scheme: bare canonicalized `PTableColumnSpec` (full spec including
|
|
6
|
+
* all annotations and `pl7.app/trace`). v7 dropped the spec body and now uses
|
|
7
|
+
* `CanonicalizedJson<PTableColumnId>` — orders of magnitude smaller.
|
|
8
|
+
*/
|
|
9
|
+
export type PlDataTableV6ColIdJson = CanonicalizedJson<PTableColumnSpec>;
|
|
18
10
|
|
|
19
|
-
export type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
orderedColIds: PlTableColumnIdJson[];
|
|
24
|
-
};
|
|
25
|
-
/** Includes current sort columns and direction */
|
|
26
|
-
sort?: {
|
|
27
|
-
/** Sorted columns and directions in order */
|
|
28
|
-
sortModel: {
|
|
29
|
-
/** Column Id to apply the sort to. */
|
|
30
|
-
colId: PlTableColumnIdJson;
|
|
31
|
-
/** Sort direction */
|
|
32
|
-
sort: "asc" | "desc";
|
|
33
|
-
}[];
|
|
34
|
-
};
|
|
35
|
-
/** Includes column visibility */
|
|
36
|
-
columnVisibility?: {
|
|
37
|
-
/** All colIds which were hidden */
|
|
38
|
-
hiddenColIds: PlTableColumnIdJson[];
|
|
39
|
-
};
|
|
11
|
+
export type PlDataTableGridStateV6 = {
|
|
12
|
+
columnOrder?: { orderedColIds: PlDataTableV6ColIdJson[] };
|
|
13
|
+
sort?: { sortModel: { colId: PlDataTableV6ColIdJson; sort: "asc" | "desc" }[] };
|
|
14
|
+
columnVisibility?: { hiddenColIds: PlDataTableV6ColIdJson[] };
|
|
40
15
|
};
|
|
41
16
|
|
|
42
|
-
export type
|
|
43
|
-
/** spec of the axis to use */
|
|
44
|
-
axis: AxisSpec;
|
|
45
|
-
/** options to show in the filter dropdown */
|
|
46
|
-
options: ListOptionBase<string | number>[];
|
|
47
|
-
/** default (selected) value */
|
|
48
|
-
defaultValue?: string | number;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type PlDataTableSheetState = {
|
|
52
|
-
/** id of the axis */
|
|
53
|
-
axisId: AxisId;
|
|
54
|
-
/** selected value */
|
|
55
|
-
value: string | number;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/** Tree-based filter state compatible with PlAdvancedFilter's RootFilter */
|
|
59
|
-
export type PlDataTableFilterMeta = {
|
|
60
|
-
id: number;
|
|
61
|
-
source?: "table-filter" | "table-search";
|
|
62
|
-
isExpanded?: boolean;
|
|
63
|
-
isSuppressed?: boolean;
|
|
64
|
-
};
|
|
65
|
-
export type PlDataTableFilterSpecLeaf = FilterSpecLeaf<CanonicalizedJson<PTableColumnId>>;
|
|
66
|
-
export type PlDataTableFilters = RootFilterSpec<PlDataTableFilterSpecLeaf>;
|
|
67
|
-
export type PlDataTableFiltersWithMeta = RootFilterSpec<
|
|
68
|
-
PlDataTableFilterSpecLeaf,
|
|
69
|
-
PlDataTableFilterMeta
|
|
70
|
-
>;
|
|
71
|
-
|
|
72
|
-
export type PlDataTableStateV2CacheEntry = {
|
|
73
|
-
/** DataSource identifier for state management */
|
|
17
|
+
export type PlDataTableStateV2V6CacheEntry = {
|
|
74
18
|
sourceId: string;
|
|
75
|
-
|
|
76
|
-
gridState: PlDataTableGridStateCore;
|
|
77
|
-
/** Sheets state */
|
|
19
|
+
gridState: PlDataTableGridStateV6;
|
|
78
20
|
sheetsState: PlDataTableSheetState[];
|
|
79
|
-
/** User filters state (tree-based, compatible with PlAdvancedFilter) */
|
|
80
21
|
filtersState: null | PlDataTableFiltersWithMeta;
|
|
81
|
-
/** Default filters state from model (snapshot of defaults) */
|
|
82
22
|
defaultFiltersState: null | PlDataTableFiltersWithMeta;
|
|
83
|
-
/** Fast search string */
|
|
84
23
|
searchString?: string;
|
|
85
24
|
};
|
|
86
25
|
|
|
87
|
-
export type
|
|
88
|
-
| {
|
|
89
|
-
sourceId: null;
|
|
90
|
-
hiddenColIds: null;
|
|
91
|
-
sorting: [];
|
|
92
|
-
filters: null;
|
|
93
|
-
defaultFilters: null;
|
|
94
|
-
}
|
|
95
|
-
| {
|
|
96
|
-
sourceId: string;
|
|
97
|
-
hiddenColIds: null | PTableColumnId[];
|
|
98
|
-
sorting: PTableSorting[];
|
|
99
|
-
filters: null | PlDataTableFilters;
|
|
100
|
-
defaultFilters: null | PlDataTableFilters;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export type PlDataTableStateV2Normalized = {
|
|
104
|
-
/** Version for upgrades */
|
|
26
|
+
export type PlDataTableStateV2V6 = {
|
|
105
27
|
version: 6;
|
|
106
|
-
|
|
107
|
-
stateCache: PlDataTableStateV2CacheEntry[];
|
|
108
|
-
/** PTable params derived from the cache state for the current sourceId */
|
|
28
|
+
stateCache: PlDataTableStateV2V6CacheEntry[];
|
|
109
29
|
pTableParams: PTableParamsV2;
|
|
110
30
|
};
|
|
111
|
-
|
|
112
|
-
/** PlAgDataTable model */
|
|
113
|
-
export type PlDataTableModel = {
|
|
114
|
-
/** DataSource identifier for state management */
|
|
115
|
-
sourceId: null | string;
|
|
116
|
-
/** p-table including all columns, used to show the full specification of the table */
|
|
117
|
-
fullTableHandle?: PTableHandle;
|
|
118
|
-
/** p-frame handle */
|
|
119
|
-
fullPframeHandle?: PFrameHandle;
|
|
120
|
-
/** p-table including only visible columns, used to get the data */
|
|
121
|
-
visibleTableHandle?: PTableHandle;
|
|
122
|
-
/** Default filters from model options, surfaced for UI display */
|
|
123
|
-
defaultFilters?: Nil | PlDataTableFilters;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export type CreatePlDataTableOps = {
|
|
127
|
-
/** Filters for columns and non-partitioned axes */
|
|
128
|
-
filters?: PlDataTableFilters;
|
|
129
|
-
|
|
130
|
-
/** Sorting to columns hidden from user */
|
|
131
|
-
sorting?: PTableSorting[];
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Selects columns for which will be inner-joined to the table.
|
|
135
|
-
*
|
|
136
|
-
* Default behaviour: all columns are considered to be core
|
|
137
|
-
*/
|
|
138
|
-
coreColumnPredicate?: (spec: PColumnIdAndSpec) => boolean;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Determines how core columns should be joined together:
|
|
142
|
-
* inner - so user will only see records present in all core columns
|
|
143
|
-
* full - so user will only see records present in any of the core columns
|
|
144
|
-
*
|
|
145
|
-
* All non-core columns will be left joined to the table produced by the core
|
|
146
|
-
* columns, in other words records form the pool of non-core columns will only
|
|
147
|
-
* make their way into the final table if core table contains corresponding key.
|
|
148
|
-
*
|
|
149
|
-
* Default: 'full'
|
|
150
|
-
*/
|
|
151
|
-
coreJoinType?: "inner" | "full";
|
|
152
|
-
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AxisId,
|
|
3
|
+
AxisSpec,
|
|
4
|
+
CanonicalizedJson,
|
|
5
|
+
ListOptionBase,
|
|
6
|
+
PTableSorting,
|
|
7
|
+
PColumnIdAndSpec,
|
|
8
|
+
PTableHandle,
|
|
9
|
+
RootFilterSpec,
|
|
10
|
+
PTableColumnId,
|
|
11
|
+
PFrameHandle,
|
|
12
|
+
} from "@milaboratories/pl-model-common";
|
|
13
|
+
import type { FilterSpecLeaf } from "../../filters";
|
|
14
|
+
import { Nil } from "@milaboratories/helpers";
|
|
15
|
+
|
|
16
|
+
export type PlTableColumnIdJson = CanonicalizedJson<PTableColumnId>;
|
|
17
|
+
|
|
18
|
+
export type PlDataTableGridStateCore = {
|
|
19
|
+
/** Includes column ordering */
|
|
20
|
+
columnOrder?: {
|
|
21
|
+
/** All colIds in order */
|
|
22
|
+
orderedColIds: PlTableColumnIdJson[];
|
|
23
|
+
};
|
|
24
|
+
/** Includes current sort columns and direction */
|
|
25
|
+
sort?: {
|
|
26
|
+
/** Sorted columns and directions in order */
|
|
27
|
+
sortModel: {
|
|
28
|
+
/** Column Id to apply the sort to. */
|
|
29
|
+
colId: PlTableColumnIdJson;
|
|
30
|
+
/** Sort direction */
|
|
31
|
+
sort: "asc" | "desc";
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
/** Includes column visibility */
|
|
35
|
+
columnVisibility?: {
|
|
36
|
+
/** All colIds which were hidden */
|
|
37
|
+
hiddenColIds: PlTableColumnIdJson[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type PlDataTableSheet = {
|
|
42
|
+
/** spec of the axis to use */
|
|
43
|
+
axis: AxisSpec;
|
|
44
|
+
/** options to show in the filter dropdown */
|
|
45
|
+
options: ListOptionBase<string | number>[];
|
|
46
|
+
/** default (selected) value */
|
|
47
|
+
defaultValue?: string | number;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type PlDataTableSheetState = {
|
|
51
|
+
/** id of the axis */
|
|
52
|
+
axisId: AxisId;
|
|
53
|
+
/** selected value */
|
|
54
|
+
value: string | number;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** Tree-based filter state compatible with PlAdvancedFilter's RootFilter */
|
|
58
|
+
export type PlDataTableFilterMeta = {
|
|
59
|
+
id: number;
|
|
60
|
+
source?: "table-filter" | "table-search";
|
|
61
|
+
isExpanded?: boolean;
|
|
62
|
+
isSuppressed?: boolean;
|
|
63
|
+
};
|
|
64
|
+
export type PlDataTableFilterSpecLeaf = FilterSpecLeaf<CanonicalizedJson<PTableColumnId>>;
|
|
65
|
+
export type PlDataTableFilters = RootFilterSpec<PlDataTableFilterSpecLeaf>;
|
|
66
|
+
export type PlDataTableFiltersWithMeta = RootFilterSpec<
|
|
67
|
+
PlDataTableFilterSpecLeaf,
|
|
68
|
+
PlDataTableFilterMeta
|
|
69
|
+
>;
|
|
70
|
+
|
|
71
|
+
export type PlDataTableStateV2CacheEntry = {
|
|
72
|
+
/** DataSource identifier for state management */
|
|
73
|
+
sourceId: string;
|
|
74
|
+
/** Internal ag-grid state */
|
|
75
|
+
gridState: PlDataTableGridStateCore;
|
|
76
|
+
/** Sheets state */
|
|
77
|
+
sheetsState: PlDataTableSheetState[];
|
|
78
|
+
/** User filters state (tree-based, compatible with PlAdvancedFilter) */
|
|
79
|
+
filtersState: null | PlDataTableFiltersWithMeta;
|
|
80
|
+
/** Default filters state from model (snapshot of defaults) */
|
|
81
|
+
defaultFiltersState: null | PlDataTableFiltersWithMeta;
|
|
82
|
+
/** Fast search string */
|
|
83
|
+
searchString?: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type PTableParamsV2 =
|
|
87
|
+
| {
|
|
88
|
+
sourceId: null;
|
|
89
|
+
hiddenColIds: null;
|
|
90
|
+
sorting: [];
|
|
91
|
+
filters: null;
|
|
92
|
+
defaultFilters: null;
|
|
93
|
+
}
|
|
94
|
+
| {
|
|
95
|
+
sourceId: string;
|
|
96
|
+
hiddenColIds: null | PTableColumnId[];
|
|
97
|
+
sorting: PTableSorting[];
|
|
98
|
+
filters: null | PlDataTableFilters;
|
|
99
|
+
defaultFilters: null | PlDataTableFilters;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type PlDataTableStateV2Normalized = {
|
|
103
|
+
/** Version for upgrades */
|
|
104
|
+
version: 7;
|
|
105
|
+
/** Internal states, LRU cache for 5 sourceId-s */
|
|
106
|
+
stateCache: PlDataTableStateV2CacheEntry[];
|
|
107
|
+
/** PTable params derived from the cache state for the current sourceId */
|
|
108
|
+
pTableParams: PTableParamsV2;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** PlAgDataTable model */
|
|
112
|
+
export type PlDataTableModel = {
|
|
113
|
+
/** DataSource identifier for state management */
|
|
114
|
+
sourceId: null | string;
|
|
115
|
+
/** p-table including all columns, used to show the full specification of the table */
|
|
116
|
+
fullTableHandle?: PTableHandle;
|
|
117
|
+
/** p-frame handle */
|
|
118
|
+
fullPframeHandle?: PFrameHandle;
|
|
119
|
+
/** p-table including only visible columns, used to get the data */
|
|
120
|
+
visibleTableHandle?: PTableHandle;
|
|
121
|
+
/** Default filters from model options, surfaced for UI display */
|
|
122
|
+
defaultFilters?: Nil | PlDataTableFilters;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export type CreatePlDataTableOps = {
|
|
126
|
+
/** Filters for columns and non-partitioned axes */
|
|
127
|
+
filters?: PlDataTableFilters;
|
|
128
|
+
|
|
129
|
+
/** Sorting to columns hidden from user */
|
|
130
|
+
sorting?: PTableSorting[];
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Selects columns for which will be inner-joined to the table.
|
|
134
|
+
*
|
|
135
|
+
* Default behaviour: all columns are considered to be core
|
|
136
|
+
*/
|
|
137
|
+
coreColumnPredicate?: (spec: PColumnIdAndSpec) => boolean;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Determines how core columns should be joined together:
|
|
141
|
+
* inner - so user will only see records present in all core columns
|
|
142
|
+
* full - so user will only see records present in any of the core columns
|
|
143
|
+
*
|
|
144
|
+
* All non-core columns will be left joined to the table produced by the core
|
|
145
|
+
* columns, in other words records form the pool of non-core columns will only
|
|
146
|
+
* make their way into the final table if core table contains corresponding key.
|
|
147
|
+
*
|
|
148
|
+
* Default: 'full'
|
|
149
|
+
*/
|
|
150
|
+
coreJoinType?: "inner" | "full";
|
|
151
|
+
};
|