@platforma-sdk/model 1.74.0 → 1.75.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/dist/columns/column_collection_builder.cjs +4 -3
- package/dist/columns/column_collection_builder.cjs.map +1 -1
- package/dist/columns/column_collection_builder.d.ts +5 -5
- package/dist/columns/column_collection_builder.d.ts.map +1 -1
- package/dist/columns/column_collection_builder.js +4 -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 +14 -14
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts +3 -2
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js +16 -16
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.cjs +50 -4
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.js +51 -6
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.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/createPlDataTable/utils.cjs +7 -4
- package/dist/components/PlDataTable/createPlDataTable/utils.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.js +16 -13
- package/dist/components/PlDataTable/createPlDataTable/utils.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 +31 -5
- package/dist/components/PlDataTable/state-migration.cjs.map +1 -1
- package/dist/components/PlDataTable/state-migration.d.ts +13 -1
- package/dist/components/PlDataTable/state-migration.d.ts.map +1 -1
- package/dist/components/PlDataTable/state-migration.js +32 -6
- package/dist/components/PlDataTable/state-migration.js.map +1 -1
- package/dist/components/PlDataTable/typesV5.d.ts +19 -90
- package/dist/components/PlDataTable/typesV5.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV6.d.ts +98 -0
- package/dist/components/PlDataTable/typesV6.d.ts.map +1 -0
- package/dist/components/PlDatasetSelector/enrichment_discovery.cjs +5 -5
- package/dist/components/PlDatasetSelector/enrichment_discovery.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/enrichment_discovery.js +5 -5
- package/dist/components/PlDatasetSelector/enrichment_discovery.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/labels/derive_distinct_labels.cjs +2 -2
- package/dist/labels/derive_distinct_labels.cjs.map +1 -1
- package/dist/labels/derive_distinct_labels.js +2 -2
- package/dist/labels/derive_distinct_labels.js.map +1 -1
- package/dist/labels/derive_distinct_tooltips.cjs +2 -1
- package/dist/labels/derive_distinct_tooltips.cjs.map +1 -1
- package/dist/labels/derive_distinct_tooltips.js +2 -1
- package/dist/labels/derive_distinct_tooltips.js.map +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.test.ts +3 -7
- package/src/columns/column_collection_builder.ts +14 -35
- 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 +36 -21
- package/src/components/PlDataTable/createPlDataTable/discoverColumns.ts +57 -8
- package/src/components/PlDataTable/createPlDataTable/index.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/utils.test.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/utils.ts +9 -8
- package/src/components/PlDataTable/createPlDataTableSheet.ts +1 -1
- package/src/components/PlDataTable/index.ts +1 -2
- package/src/components/PlDataTable/state-migration.ts +71 -8
- package/src/components/PlDataTable/typesV5.ts +14 -153
- package/src/components/PlDataTable/typesV6.ts +152 -0
- package/src/components/PlDatasetSelector/enrichment_discovery.ts +5 -5
- package/src/labels/derive_distinct_labels.ts +2 -2
- package/src/labels/derive_distinct_tooltips.ts +2 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AxisId,
|
|
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";
|
|
16
|
+
|
|
17
|
+
export type PlTableColumnIdJson = CanonicalizedJson<PTableColumnSpec>;
|
|
18
|
+
|
|
19
|
+
export type PlDataTableGridStateCore = {
|
|
20
|
+
/** Includes column ordering */
|
|
21
|
+
columnOrder?: {
|
|
22
|
+
/** All colIds in order */
|
|
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
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type PlDataTableSheet = {
|
|
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 */
|
|
74
|
+
sourceId: string;
|
|
75
|
+
/** Internal ag-grid state */
|
|
76
|
+
gridState: PlDataTableGridStateCore;
|
|
77
|
+
/** Sheets state */
|
|
78
|
+
sheetsState: PlDataTableSheetState[];
|
|
79
|
+
/** User filters state (tree-based, compatible with PlAdvancedFilter) */
|
|
80
|
+
filtersState: null | PlDataTableFiltersWithMeta;
|
|
81
|
+
/** Default filters state from model (snapshot of defaults) */
|
|
82
|
+
defaultFiltersState: null | PlDataTableFiltersWithMeta;
|
|
83
|
+
/** Fast search string */
|
|
84
|
+
searchString?: string;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type PTableParamsV2 =
|
|
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 */
|
|
105
|
+
version: 6;
|
|
106
|
+
/** Internal states, LRU cache for 5 sourceId-s */
|
|
107
|
+
stateCache: PlDataTableStateV2CacheEntry[];
|
|
108
|
+
/** PTable params derived from the cache state for the current sourceId */
|
|
109
|
+
pTableParams: PTableParamsV2;
|
|
110
|
+
};
|
|
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
|
+
};
|
|
@@ -69,10 +69,10 @@ export function findEnrichmentColumns(
|
|
|
69
69
|
});
|
|
70
70
|
const predicate = options?.predicate;
|
|
71
71
|
return variants.filter((v) => {
|
|
72
|
-
if (v.path
|
|
72
|
+
if ((v.path?.length ?? 0) === 0) return false;
|
|
73
73
|
if (predicate !== undefined && !predicate(v.column.spec)) return false;
|
|
74
74
|
if (!isGloballyAddressable(v.column.id)) return false;
|
|
75
|
-
if (v.path
|
|
75
|
+
if (v.path?.some((p) => !isGloballyAddressable(p.linker.id))) return false;
|
|
76
76
|
return true;
|
|
77
77
|
});
|
|
78
78
|
}
|
|
@@ -90,20 +90,20 @@ export function enrichmentVariantsToRefs(
|
|
|
90
90
|
|
|
91
91
|
const entries: Entry[] = variants.map((variant) => ({
|
|
92
92
|
spec: variant.column.spec,
|
|
93
|
-
linkerPath: variant.path
|
|
93
|
+
linkerPath: variant.path?.map((p) => ({ spec: p.linker.spec })),
|
|
94
94
|
qualifications: variant.qualifications,
|
|
95
95
|
}));
|
|
96
96
|
const labels = deriveDistinctLabels(entries, labelOptions);
|
|
97
97
|
|
|
98
98
|
return variants.map((variant, i): LabeledEnrichmentRef => {
|
|
99
|
-
const path: EnrichmentStep[] = variant.path
|
|
99
|
+
const path: undefined | EnrichmentStep[] = variant.path?.map((step) => ({
|
|
100
100
|
type: "linker",
|
|
101
101
|
linker: step.linker.id,
|
|
102
102
|
}));
|
|
103
103
|
return {
|
|
104
104
|
ref: createEnrichmentRef(variant.column.id, {
|
|
105
105
|
path,
|
|
106
|
-
qualifications: variant.qualifications
|
|
106
|
+
qualifications: variant.qualifications?.forHit,
|
|
107
107
|
}),
|
|
108
108
|
label: labels[i],
|
|
109
109
|
};
|
|
@@ -289,7 +289,7 @@ function enrichRecord(value: Entry, index: number, options: DeriveLabelsOptions)
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
if (qualifications !== undefined) {
|
|
292
|
+
if (qualifications !== undefined && qualifications.forQueries !== undefined) {
|
|
293
293
|
for (const [anchorId, qs] of Object.entries(qualifications.forQueries)) {
|
|
294
294
|
if (qs.length === 0) continue;
|
|
295
295
|
const anchorText = isFunction(formatters?.anchorQualification)
|
|
@@ -302,7 +302,7 @@ function enrichRecord(value: Entry, index: number, options: DeriveLabelsOptions)
|
|
|
302
302
|
importance: -11,
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
-
if (qualifications.forHit.length > 0) {
|
|
305
|
+
if (qualifications.forHit !== undefined && qualifications.forHit.length > 0) {
|
|
306
306
|
const hitText = isFunction(formatters?.hitQualification)
|
|
307
307
|
? formatters.hitQualification(qualifications.forHit, spec, index)
|
|
308
308
|
: `[${formatQualifications(qualifications.forHit)}]`;
|
|
@@ -74,6 +74,7 @@ function formatOriginPath(entry: TooltipEntry): undefined | string {
|
|
|
74
74
|
|
|
75
75
|
function formatAnchors(q: undefined | MatchQualifications): undefined | string {
|
|
76
76
|
if (isNil(q)) return undefined;
|
|
77
|
+
if (isNil(q.forQueries)) return undefined;
|
|
77
78
|
const ids = Object.keys(q.forQueries);
|
|
78
79
|
if (ids.length === 0) return undefined;
|
|
79
80
|
|
|
@@ -90,7 +91,7 @@ function formatAnchors(q: undefined | MatchQualifications): undefined | string {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
function formatHit(q: undefined | MatchQualifications): undefined | string {
|
|
93
|
-
if (isNil(q) || q.forHit.length === 0) return undefined;
|
|
94
|
+
if (isNil(q) || isNil(q.forHit) || q.forHit.length === 0) return undefined;
|
|
94
95
|
const rendered = formatAxisQualifications(q.forHit);
|
|
95
96
|
if (rendered === undefined) return undefined;
|
|
96
97
|
return ["Hit column qualifications", `${BULLET_1}${rendered}`].join("\n");
|