@platforma-sdk/model 1.65.9 → 1.66.2
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/block_model.cjs +8 -11
- package/dist/block_model.cjs.map +1 -1
- package/dist/block_model.d.ts.map +1 -1
- package/dist/block_model.js +8 -10
- package/dist/block_model.js.map +1 -1
- package/dist/columns/column_collection_builder.cjs +61 -74
- package/dist/columns/column_collection_builder.cjs.map +1 -1
- package/dist/columns/column_collection_builder.d.ts +16 -22
- package/dist/columns/column_collection_builder.d.ts.map +1 -1
- package/dist/columns/column_collection_builder.js +62 -75
- package/dist/columns/column_collection_builder.js.map +1 -1
- package/dist/columns/column_selector.cjs.map +1 -1
- package/dist/columns/column_selector.d.ts +1 -1
- package/dist/columns/column_selector.js.map +1 -1
- package/dist/columns/column_snapshot.cjs.map +1 -1
- package/dist/columns/column_snapshot.d.ts +4 -4
- package/dist/columns/column_snapshot.d.ts.map +1 -1
- package/dist/columns/column_snapshot.js.map +1 -1
- package/dist/columns/ctx_column_sources.cjs.map +1 -1
- package/dist/columns/ctx_column_sources.d.ts +1 -1
- package/dist/columns/ctx_column_sources.d.ts.map +1 -1
- package/dist/columns/ctx_column_sources.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs +2 -2
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js +2 -2
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs +17 -18
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js +17 -18
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs +99 -91
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts +16 -16
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js +102 -94
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.cjs +32 -23
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts +5 -5
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.js +33 -24
- 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.d.ts +2 -3
- package/dist/components/PlDataTable/createPlDataTable/index.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.cjs +133 -16
- package/dist/components/PlDataTable/createPlDataTable/utils.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.d.ts +8 -6
- package/dist/components/PlDataTable/createPlDataTable/utils.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.js +130 -17
- package/dist/components/PlDataTable/createPlDataTable/utils.js.map +1 -1
- package/dist/components/PlDataTable/labels.cjs +1 -2
- package/dist/components/PlDataTable/labels.cjs.map +1 -1
- package/dist/components/PlDataTable/labels.js +1 -2
- package/dist/components/PlDataTable/labels.js.map +1 -1
- package/dist/filters/distill.cjs +73 -30
- package/dist/filters/distill.cjs.map +1 -1
- package/dist/filters/distill.d.ts.map +1 -1
- package/dist/filters/distill.js +73 -30
- package/dist/filters/distill.js.map +1 -1
- package/dist/index.cjs +19 -15
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -4
- package/dist/labels/derive_distinct_tooltips.cjs +85 -0
- package/dist/labels/derive_distinct_tooltips.cjs.map +1 -0
- package/dist/labels/derive_distinct_tooltips.d.ts +17 -0
- package/dist/labels/derive_distinct_tooltips.d.ts.map +1 -0
- package/dist/labels/derive_distinct_tooltips.js +84 -0
- package/dist/labels/derive_distinct_tooltips.js.map +1 -0
- package/dist/labels/index.cjs +1 -0
- package/dist/labels/index.d.ts +2 -1
- package/dist/labels/index.js +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/render/api.cjs +8 -13
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +8 -11
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/api.js +8 -13
- package/dist/render/api.js.map +1 -1
- package/dist/services/get_services.cjs +19 -0
- package/dist/services/get_services.cjs.map +1 -0
- package/dist/services/get_services.d.ts +7 -0
- package/dist/services/get_services.d.ts.map +1 -0
- package/dist/services/get_services.js +19 -0
- package/dist/services/get_services.js.map +1 -0
- package/dist/services/index.cjs +1 -0
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.js +1 -0
- package/dist/services/service_bridge.cjs +4 -4
- package/dist/services/service_bridge.cjs.map +1 -1
- package/dist/services/service_bridge.d.ts +4 -4
- package/dist/services/service_bridge.d.ts.map +1 -1
- package/dist/services/service_bridge.js +4 -4
- package/dist/services/service_bridge.js.map +1 -1
- package/package.json +6 -6
- package/src/block_model.ts +8 -11
- package/src/columns/column_collection_builder.test.ts +75 -30
- package/src/columns/column_collection_builder.ts +96 -133
- package/src/columns/column_selector.ts +1 -1
- package/src/columns/column_snapshot.ts +7 -4
- package/src/columns/ctx_column_sources.ts +1 -3
- package/src/components/PFrameForGraphs.test.ts +4 -4
- package/src/components/PlDataTable/createPlDataTable/createPTableDefV2.ts +2 -2
- package/src/components/PlDataTable/createPlDataTable/createPTableDefV3.ts +44 -21
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV3.ts +202 -218
- package/src/components/PlDataTable/createPlDataTable/discoverColumns.ts +69 -56
- package/src/components/PlDataTable/createPlDataTable/index.ts +6 -7
- package/src/components/PlDataTable/createPlDataTable/utils.test.ts +97 -1
- package/src/components/PlDataTable/createPlDataTable/utils.ts +190 -35
- package/src/components/PlDataTable/labels.ts +3 -7
- package/src/filters/distill.test.ts +91 -0
- package/src/filters/distill.ts +102 -46
- package/src/labels/derive_distinct_tooltips.test.ts +233 -0
- package/src/labels/derive_distinct_tooltips.ts +130 -0
- package/src/labels/index.ts +1 -0
- package/src/render/api.ts +15 -50
- package/src/services/get_services.ts +28 -0
- package/src/services/index.ts +1 -0
- package/src/services/service_bridge.ts +5 -5
|
@@ -2,8 +2,9 @@ import { toColumnSnapshotProvider } from "../../../columns/column_snapshot_provi
|
|
|
2
2
|
import { ColumnCollectionBuilder } from "../../../columns/column_collection_builder.js";
|
|
3
3
|
import { collectCtxColumnSnapshotProviders } from "../../../columns/ctx_column_sources.js";
|
|
4
4
|
import "../../../columns/index.js";
|
|
5
|
-
import { isPlRef } from "@milaboratories/pl-model-common";
|
|
5
|
+
import { createDiscoveredPColumnId, isPlRef } from "@milaboratories/pl-model-common";
|
|
6
6
|
import { throwError } from "@milaboratories/helpers";
|
|
7
|
+
import { isNil as isNil$1 } from "es-toolkit";
|
|
7
8
|
//#region src/components/PlDataTable/createPlDataTable/discoverColumns.ts
|
|
8
9
|
/** Discover columns from sources/anchors and normalize into a flat DiscoveredColumn list. */
|
|
9
10
|
function discoverTableColumnSnaphots(ctx, options) {
|
|
@@ -13,12 +14,13 @@ function discoverTableColumnSnaphots(ctx, options) {
|
|
|
13
14
|
};
|
|
14
15
|
const providers = resolveProviders(ctx, resolvedOptions.sources);
|
|
15
16
|
if (providers.length === 0) return void 0;
|
|
16
|
-
const collection = new ColumnCollectionBuilder(ctx.
|
|
17
|
+
const collection = new ColumnCollectionBuilder(ctx.getService("pframeSpec")).addSources(providers).build(resolvedOptions);
|
|
17
18
|
if (collection === void 0) return void 0;
|
|
18
19
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
return mapToDiscoveredColumns(collection.findColumns({
|
|
21
|
+
...resolvedOptions.selector ?? {},
|
|
22
|
+
exclude: [...Array.isArray(resolvedOptions.selector?.exclude) ? resolvedOptions.selector.exclude : !isNil$1(resolvedOptions.selector.exclude) ? [resolvedOptions.selector.exclude] : [], { name: "pl7.app/label" }]
|
|
23
|
+
}), collection.getAnchors());
|
|
22
24
|
} finally {
|
|
23
25
|
collection.dispose();
|
|
24
26
|
}
|
|
@@ -35,26 +37,33 @@ function resolveProviders(ctx, sources) {
|
|
|
35
37
|
return sources !== void 0 ? sources.map(toColumnSnapshotProvider) : collectCtxColumnSnapshotProviders(ctx);
|
|
36
38
|
}
|
|
37
39
|
/** Map matched columns into a flat DiscoveredColumn list with deduped IDs. */
|
|
38
|
-
function mapToDiscoveredColumns(matched,
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
return matched.map((match) => {
|
|
40
|
+
function mapToDiscoveredColumns(matched, anchors) {
|
|
41
|
+
const columnIdToAnchorName = new Map(Array.from(anchors.entries(), ([key, { id }]) => [id, key]));
|
|
42
|
+
return matched.flatMap((match) => {
|
|
42
43
|
const snap = match.column;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
const isPrimary = columnIdToAnchorName.get(match.column.id) !== void 0;
|
|
45
|
+
return match.variants.map((variant) => {
|
|
46
|
+
return {
|
|
47
|
+
id: createDiscoveredPColumnId({
|
|
48
|
+
column: snap.id,
|
|
49
|
+
path: variant.path.map((p) => ({
|
|
50
|
+
type: "linker",
|
|
51
|
+
column: p.linker.id,
|
|
52
|
+
qualifications: p.qualifications
|
|
53
|
+
})),
|
|
54
|
+
columnQualifications: variant.qualifications.forHit,
|
|
55
|
+
queriesQualifications: variant.qualifications.forQueries
|
|
56
|
+
}),
|
|
57
|
+
isPrimary,
|
|
58
|
+
originalId: snap.id,
|
|
59
|
+
spec: snap.spec,
|
|
60
|
+
data: snap.data,
|
|
61
|
+
dataStatus: snap.dataStatus,
|
|
62
|
+
linkerPath: variant.path,
|
|
63
|
+
qualifications: variant.qualifications,
|
|
64
|
+
distinctiveQualifications: variant.distinctiveQualifications
|
|
65
|
+
};
|
|
66
|
+
});
|
|
58
67
|
});
|
|
59
68
|
}
|
|
60
69
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discoverColumns.js","names":["resolveAnchors"],"sources":["../../../../src/components/PlDataTable/createPlDataTable/discoverColumns.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"discoverColumns.js","names":["resolveAnchors","isNil"],"sources":["../../../../src/components/PlDataTable/createPlDataTable/discoverColumns.ts"],"sourcesContent":["import type { PColumnSpec, PlRef, PObjectId } from \"@milaboratories/pl-model-common\";\nimport { createDiscoveredPColumnId, isPlRef } from \"@milaboratories/pl-model-common\";\nimport type { RenderCtxBase } from \"../../../render\";\nimport type {\n ColumnSource,\n ColumnMatch,\n RelaxedColumnSelector,\n ColumnSnapshotProvider,\n ColumnSnapshot,\n} from \"../../../columns\";\nimport { ColumnCollectionBuilder } from \"../../../columns\";\nimport { toColumnSnapshotProvider } from \"../../../columns/column_snapshot_provider\";\nimport { collectCtxColumnSnapshotProviders } from \"../../../columns/ctx_column_sources\";\nimport { throwError } from \"@milaboratories/helpers\";\nimport type { ColumnsSelectorConfig, TableColumnSnapshot } from \"./createPlDataTableV3\";\nimport { isNil } from \"es-toolkit\";\n\nexport type DiscoverTableColumnOptions = {\n sources?: ColumnSource[];\n anchors: Record<string, PlRef | PObjectId | PColumnSpec | RelaxedColumnSelector>;\n selector: ColumnsSelectorConfig;\n};\n\n/** Discover columns from sources/anchors and normalize into a flat DiscoveredColumn list. */\nexport function discoverTableColumnSnaphots(\n ctx: RenderCtxBase,\n options: DiscoverTableColumnOptions,\n): TableColumnSnapshot[] | undefined {\n // Resolve PlRef anchors to PColumnSpec\n const resolvedOptions = {\n ...options,\n anchors: resolveAnchors(ctx, options.anchors),\n };\n\n // Resolve providers\n const providers = resolveProviders(ctx, resolvedOptions.sources);\n if (providers.length === 0) return undefined;\n\n // Build collection (anchored or plain)\n const collection = new ColumnCollectionBuilder(ctx.getService(\"pframeSpec\"))\n .addSources(providers)\n .build(resolvedOptions);\n if (collection === undefined) return undefined;\n\n try {\n const columns = collection.findColumns({\n ...(resolvedOptions.selector ?? {}),\n exclude: [\n ...(Array.isArray(resolvedOptions.selector?.exclude)\n ? resolvedOptions.selector.exclude\n : !isNil(resolvedOptions.selector.exclude)\n ? [resolvedOptions.selector.exclude]\n : []),\n { name: \"pl7.app/label\" },\n ],\n });\n const anchors = collection.getAnchors();\n return mapToDiscoveredColumns(columns, anchors);\n } finally {\n collection.dispose();\n }\n}\n\n// --- Pure helper functions ---\n\n/** Resolve PlRef values in anchors to PColumnSpec via the result pool. */\nfunction resolveAnchors(\n ctx: RenderCtxBase,\n anchors: Record<string, PlRef | PObjectId | PColumnSpec | RelaxedColumnSelector>,\n): Record<string, PObjectId | PColumnSpec | RelaxedColumnSelector> {\n const result: Record<string, PObjectId | PColumnSpec | RelaxedColumnSelector> = {};\n for (const [key, value] of Object.entries(anchors)) {\n if (isPlRef(value)) {\n result[key] =\n ctx.resultPool.getPColumnSpecByRef(value) ??\n throwError(\n `Anchor ${key} with ref ${JSON.stringify(value)} could not be resolved to a PColumnSpec`,\n );\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n\n/** Resolve column snapshot providers from explicit sources or context. */\nfunction resolveProviders(\n ctx: RenderCtxBase,\n sources: undefined | ColumnSource[],\n): ColumnSnapshotProvider[] {\n return sources !== undefined\n ? sources.map(toColumnSnapshotProvider)\n : collectCtxColumnSnapshotProviders(ctx);\n}\n\n/** Map matched columns into a flat DiscoveredColumn list with deduped IDs. */\nfunction mapToDiscoveredColumns(\n matched: readonly ColumnMatch[],\n anchors: Map<string, ColumnSnapshot<PObjectId>>,\n): TableColumnSnapshot[] {\n const columnIdToAnchorName = new Map<PObjectId, string>(\n Array.from(anchors.entries(), ([key, { id }]) => [id, key] as const),\n );\n\n return matched.flatMap((match) => {\n const snap = match.column;\n const isPrimary = columnIdToAnchorName.get(match.column.id) !== undefined;\n\n return match.variants.map((variant): TableColumnSnapshot => {\n const discoveredId = createDiscoveredPColumnId({\n column: snap.id,\n path: variant.path.map((p) => ({\n type: \"linker\",\n column: p.linker.id,\n qualifications: p.qualifications,\n })),\n columnQualifications: variant.qualifications.forHit,\n queriesQualifications: variant.qualifications.forQueries,\n });\n return {\n id: discoveredId,\n isPrimary,\n\n originalId: snap.id,\n spec: snap.spec,\n data: snap.data,\n dataStatus: snap.dataStatus,\n\n linkerPath: variant.path,\n qualifications: variant.qualifications,\n distinctiveQualifications: variant.distinctiveQualifications,\n };\n });\n });\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAgB,4BACd,KACA,SACmC;CAEnC,MAAM,kBAAkB;EACtB,GAAG;EACH,SAASA,iBAAe,KAAK,QAAQ,QAAQ;EAC9C;CAGD,MAAM,YAAY,iBAAiB,KAAK,gBAAgB,QAAQ;AAChE,KAAI,UAAU,WAAW,EAAG,QAAO,KAAA;CAGnC,MAAM,aAAa,IAAI,wBAAwB,IAAI,WAAW,aAAa,CAAC,CACzE,WAAW,UAAU,CACrB,MAAM,gBAAgB;AACzB,KAAI,eAAe,KAAA,EAAW,QAAO,KAAA;AAErC,KAAI;AAaF,SAAO,uBAZS,WAAW,YAAY;GACrC,GAAI,gBAAgB,YAAY,EAAE;GAClC,SAAS,CACP,GAAI,MAAM,QAAQ,gBAAgB,UAAU,QAAQ,GAChD,gBAAgB,SAAS,UACzB,CAACC,QAAM,gBAAgB,SAAS,QAAQ,G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
1
|
-
{"version":3,"file":"index.cjs","names":["createPlDataTableV2","createPlDataTableV3"],"sources":["../../../../src/components/PlDataTable/createPlDataTable/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["createPlDataTableV2","createPlDataTableV3"],"sources":["../../../../src/components/PlDataTable/createPlDataTable/index.ts"],"sourcesContent":["import type { RenderCtxBase } from \"../../../render\";\nimport type { PlDataTableModel } from \"../typesV5\";\nimport { createPlDataTableOptionsV2, createPlDataTableV2 } from \"./createPlDataTableV2\";\nimport { createPlDataTableV3 } from \"./createPlDataTableV3\";\nimport type { createPlDataTableOptionsV3 } from \"./createPlDataTableV3\";\n\nexport function createPlDataTable<A, U>(\n ctx: RenderCtxBase<A, U>,\n options: { version: \"v2\" } & createPlDataTableOptionsV2,\n): ReturnType<typeof createPlDataTableV2>;\nexport function createPlDataTable<A, U>(\n ctx: RenderCtxBase<A, U>,\n options: { version?: \"v3\" } & createPlDataTableOptionsV3,\n): ReturnType<typeof createPlDataTableV3>;\nexport function createPlDataTable<A, U>(\n ctx: RenderCtxBase<A, U>,\n options:\n | ({ version: \"v2\" } & createPlDataTableOptionsV2)\n | ({ version?: \"v3\" } & createPlDataTableOptionsV3),\n): PlDataTableModel | undefined {\n if (options.version === \"v2\") {\n return createPlDataTableV2(ctx, options.columns, options.tableState, options.options);\n } else {\n // default version is last (v3 at the moment)\n return createPlDataTableV3(ctx, options);\n }\n}\n\nexport { discoverTableColumnSnaphots } from \"./discoverColumns\";\n"],"mappings":";;;;AAcA,SAAgB,kBACd,KACA,SAG8B;AAC9B,KAAI,QAAQ,YAAY,KACtB,QAAOA,4BAAAA,oBAAoB,KAAK,QAAQ,SAAS,QAAQ,YAAY,QAAQ,QAAQ;KAGrF,QAAOC,4BAAAA,oBAAoB,KAAK,QAAQ"}
|
|
@@ -2,13 +2,12 @@ import { RenderCtxBase } from "../../../render/api.js";
|
|
|
2
2
|
import { createPlDataTableOptionsV2, createPlDataTableV2 } from "./createPlDataTableV2.js";
|
|
3
3
|
import { discoverTableColumnSnaphots } from "./discoverColumns.js";
|
|
4
4
|
import { createPlDataTableOptionsV3, createPlDataTableV3 } from "./createPlDataTableV3.js";
|
|
5
|
-
import { RequireServices, Services } from "@milaboratories/pl-model-common";
|
|
6
5
|
|
|
7
6
|
//#region src/components/PlDataTable/createPlDataTable/index.d.ts
|
|
8
|
-
declare function createPlDataTable<A, U
|
|
7
|
+
declare function createPlDataTable<A, U>(ctx: RenderCtxBase<A, U>, options: {
|
|
9
8
|
version: "v2";
|
|
10
9
|
} & createPlDataTableOptionsV2): ReturnType<typeof createPlDataTableV2>;
|
|
11
|
-
declare function createPlDataTable<A, U
|
|
10
|
+
declare function createPlDataTable<A, U>(ctx: RenderCtxBase<A, U>, options: {
|
|
12
11
|
version?: "v3";
|
|
13
12
|
} & createPlDataTableOptionsV3): ReturnType<typeof createPlDataTableV3>;
|
|
14
13
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/components/PlDataTable/createPlDataTable/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/components/PlDataTable/createPlDataTable/index.ts"],"mappings":";;;;;;iBAMgB,iBAAA,MAAA,CACd,GAAA,EAAK,aAAA,CAAc,CAAA,EAAG,CAAA,GACtB,OAAA;EAAW,OAAA;AAAA,IAAkB,0BAAA,GAC5B,UAAA,QAAkB,mBAAA;AAAA,iBACL,iBAAA,MAAA,CACd,GAAA,EAAK,aAAA,CAAc,CAAA,EAAG,CAAA,GACtB,OAAA;EAAW,OAAA;AAAA,IAAmB,0BAAA,GAC7B,UAAA,QAAkB,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/PlDataTable/createPlDataTable/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/PlDataTable/createPlDataTable/index.ts"],"sourcesContent":["import type { RenderCtxBase } from \"../../../render\";\nimport type { PlDataTableModel } from \"../typesV5\";\nimport { createPlDataTableOptionsV2, createPlDataTableV2 } from \"./createPlDataTableV2\";\nimport { createPlDataTableV3 } from \"./createPlDataTableV3\";\nimport type { createPlDataTableOptionsV3 } from \"./createPlDataTableV3\";\n\nexport function createPlDataTable<A, U>(\n ctx: RenderCtxBase<A, U>,\n options: { version: \"v2\" } & createPlDataTableOptionsV2,\n): ReturnType<typeof createPlDataTableV2>;\nexport function createPlDataTable<A, U>(\n ctx: RenderCtxBase<A, U>,\n options: { version?: \"v3\" } & createPlDataTableOptionsV3,\n): ReturnType<typeof createPlDataTableV3>;\nexport function createPlDataTable<A, U>(\n ctx: RenderCtxBase<A, U>,\n options:\n | ({ version: \"v2\" } & createPlDataTableOptionsV2)\n | ({ version?: \"v3\" } & createPlDataTableOptionsV3),\n): PlDataTableModel | undefined {\n if (options.version === \"v2\") {\n return createPlDataTableV2(ctx, options.columns, options.tableState, options.options);\n } else {\n // default version is last (v3 at the moment)\n return createPlDataTableV3(ctx, options);\n }\n}\n\nexport { discoverTableColumnSnaphots } from \"./discoverColumns\";\n"],"mappings":";;;;AAcA,SAAgB,kBACd,KACA,SAG8B;AAC9B,KAAI,QAAQ,YAAY,KACtB,QAAO,oBAAoB,KAAK,QAAQ,SAAS,QAAQ,YAAY,QAAQ,QAAQ;KAGrF,QAAO,oBAAoB,KAAK,QAAQ"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_derive_distinct_labels = require("../../../labels/derive_distinct_labels.cjs");
|
|
3
|
+
const require_column_snapshot_provider = require("../../../columns/column_snapshot_provider.cjs");
|
|
4
|
+
const require_column_collection_builder = require("../../../columns/column_collection_builder.cjs");
|
|
5
|
+
require("../../../columns/index.cjs");
|
|
6
|
+
const require_derive_distinct_tooltips = require("../../../labels/derive_distinct_tooltips.cjs");
|
|
3
7
|
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
4
8
|
let es_toolkit = require("es-toolkit");
|
|
5
9
|
//#region src/components/PlDataTable/createPlDataTable/utils.ts
|
|
@@ -11,20 +15,65 @@ function isColumnHidden(spec) {
|
|
|
11
15
|
function isColumnOptional(spec) {
|
|
12
16
|
return (0, _milaboratories_pl_model_common.readAnnotation)(spec, _milaboratories_pl_model_common.Annotation.Table.Visibility) === "optional";
|
|
13
17
|
}
|
|
14
|
-
/** Get effective visibility for a column
|
|
15
|
-
function getEffectiveVisibility(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
/** Get effective visibility for a column. Rule map lookup first, then annotation fallback. */
|
|
19
|
+
function getEffectiveVisibility(col, visibilityByColId) {
|
|
20
|
+
const rule = visibilityByColId?.get(col.id);
|
|
21
|
+
if (rule !== void 0) return rule.visibility;
|
|
22
|
+
if (isColumnHidden(col.spec)) return "hidden";
|
|
23
|
+
if (isColumnOptional(col.spec)) return "optional";
|
|
24
|
+
}
|
|
25
|
+
/** Get ordering priority for a column. Rule map lookup first, then annotation fallback. */
|
|
26
|
+
function getOrderPriority(col, orderByColId) {
|
|
27
|
+
const rule = orderByColId?.get(col.id);
|
|
28
|
+
if (rule !== void 0) return rule.priority;
|
|
29
|
+
return (0, _milaboratories_pl_model_common.readAnnotationJson)(col.spec, _milaboratories_pl_model_common.Annotation.Table.OrderPriority);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Evaluate display rules against a set of columns and return a map of `colId → winning rule`
|
|
33
|
+
* (first-match-wins, preserving original rule order).
|
|
34
|
+
*
|
|
35
|
+
* Predicate-based rules (`ColumnMatcher`) are evaluated directly on the spec.
|
|
36
|
+
* Selector-based rules (`ColumnSelector`) are matched via `PFrameSpecDriver.discoverColumns`
|
|
37
|
+
* using the same engine as `ColumnCollection.findColumns` — no client-side matcher.
|
|
38
|
+
*/
|
|
39
|
+
function evaluateRules(rules, columns, pframeSpec) {
|
|
40
|
+
const result = /* @__PURE__ */ new Map();
|
|
41
|
+
if (rules.length === 0 || columns.length === 0) return result;
|
|
42
|
+
const hasSelectorRules = rules.some((rule) => typeof rule.match !== "function");
|
|
43
|
+
const selectorHitsByRule = /* @__PURE__ */ new Map();
|
|
44
|
+
if (hasSelectorRules) {
|
|
45
|
+
const pColumns = dedupeById(columns).map((c) => ({
|
|
46
|
+
id: c.id,
|
|
47
|
+
spec: c.spec,
|
|
48
|
+
data: void 0
|
|
49
|
+
}));
|
|
50
|
+
const collection = new require_column_collection_builder.ColumnCollectionBuilder(pframeSpec).addSource(new require_column_snapshot_provider.ArrayColumnProvider(pColumns)).build();
|
|
51
|
+
if (collection === void 0) return result;
|
|
52
|
+
try {
|
|
53
|
+
for (const rule of rules) {
|
|
54
|
+
if (typeof rule.match === "function") continue;
|
|
55
|
+
const hits = collection.findColumns({ include: rule.match });
|
|
56
|
+
selectorHitsByRule.set(rule, new Set(hits.map((h) => h.id)));
|
|
57
|
+
}
|
|
58
|
+
} finally {
|
|
59
|
+
collection.dispose();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
for (const col of columns) for (const rule of rules) if (typeof rule.match === "function" ? rule.match(col.spec) : selectorHitsByRule.get(rule)?.has(col.id) ?? false) {
|
|
63
|
+
result.set(col.id, rule);
|
|
64
|
+
break;
|
|
18
65
|
}
|
|
19
|
-
|
|
20
|
-
if (isColumnOptional(spec)) return "optional";
|
|
66
|
+
return result;
|
|
21
67
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
68
|
+
function dedupeById(columns) {
|
|
69
|
+
const seen = /* @__PURE__ */ new Set();
|
|
70
|
+
const result = [];
|
|
71
|
+
for (const col of columns) {
|
|
72
|
+
if (seen.has(col.id)) continue;
|
|
73
|
+
seen.add(col.id);
|
|
74
|
+
result.push(col);
|
|
26
75
|
}
|
|
27
|
-
return
|
|
76
|
+
return result;
|
|
28
77
|
}
|
|
29
78
|
/**
|
|
30
79
|
* Writes derived labels into column and axis annotations.
|
|
@@ -60,16 +109,16 @@ function withLabelAnnotations(derivedLabels, columns) {
|
|
|
60
109
|
});
|
|
61
110
|
}
|
|
62
111
|
/**
|
|
63
|
-
* Writes effective display properties (OrderPriority, Visibility) from
|
|
112
|
+
* Writes effective display properties (OrderPriority, Visibility) from precomputed rule maps
|
|
64
113
|
* into column annotations. Returns new column objects — originals are not mutated.
|
|
65
114
|
*/
|
|
66
|
-
function withTableVisualAnnotations(
|
|
67
|
-
if (
|
|
115
|
+
function withTableVisualAnnotations(visibilityByColId, orderByColId, columns) {
|
|
116
|
+
if (visibilityByColId === void 0 && orderByColId === void 0) return columns;
|
|
68
117
|
return columns.map((col) => {
|
|
69
118
|
const annotations = { ...col.spec.annotations };
|
|
70
|
-
const visibility = getEffectiveVisibility(col
|
|
119
|
+
const visibility = getEffectiveVisibility(col, visibilityByColId);
|
|
71
120
|
if (!(0, es_toolkit.isNil)(visibility)) annotations[_milaboratories_pl_model_common.Annotation.Table.Visibility] = visibility;
|
|
72
|
-
const orderPriority = getOrderPriority(col
|
|
121
|
+
const orderPriority = getOrderPriority(col, orderByColId);
|
|
73
122
|
if (!(0, es_toolkit.isNil)(orderPriority)) annotations[_milaboratories_pl_model_common.Annotation.Table.OrderPriority] = String(orderPriority);
|
|
74
123
|
return {
|
|
75
124
|
...col,
|
|
@@ -80,6 +129,42 @@ function withTableVisualAnnotations(displayOptions, columns) {
|
|
|
80
129
|
};
|
|
81
130
|
});
|
|
82
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Writes derived info annotations into column annotations.
|
|
134
|
+
* Columns without an info entry are passed through unchanged.
|
|
135
|
+
*/
|
|
136
|
+
function withInfoAnnotations(infoById, columns) {
|
|
137
|
+
if ((0, es_toolkit.isNil)(infoById)) return columns;
|
|
138
|
+
return columns.map((col) => {
|
|
139
|
+
const info = infoById[col.id];
|
|
140
|
+
if ((0, es_toolkit.isNil)(info)) return col;
|
|
141
|
+
return {
|
|
142
|
+
...col,
|
|
143
|
+
spec: {
|
|
144
|
+
...col.spec,
|
|
145
|
+
annotations: {
|
|
146
|
+
...col.spec.annotations,
|
|
147
|
+
[_milaboratories_pl_model_common.Annotation.Table.Info]: info
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function withHidenAxesAnnotations(columns) {
|
|
154
|
+
return columns.map((col) => ({
|
|
155
|
+
...col,
|
|
156
|
+
spec: {
|
|
157
|
+
...col.spec,
|
|
158
|
+
axesSpec: col.spec.axesSpec.map((axis) => ({
|
|
159
|
+
...axis,
|
|
160
|
+
annotations: {
|
|
161
|
+
...axis.annotations,
|
|
162
|
+
[_milaboratories_pl_model_common.Annotation.Table.Visibility]: "hidden"
|
|
163
|
+
}
|
|
164
|
+
}))
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
83
168
|
/** Derive labels for all table elements: columns via deriveDistinctLabels, axes from label columns. */
|
|
84
169
|
function deriveAllLabels(options) {
|
|
85
170
|
const { columns, labelColumns, deriveLabelsOptions } = options;
|
|
@@ -97,12 +182,44 @@ function deriveAxisLabels(columns, labelColumns) {
|
|
|
97
182
|
for (const axisKey of axisSpecMap.keys()) result[axisKey] = (0, _milaboratories_pl_model_common.readAnnotation)(labelColumns.find((lc) => (0, _milaboratories_pl_model_common.canonicalizeJson)((0, _milaboratories_pl_model_common.getAxisId)(lc.spec.axesSpec[0])) === axisKey)?.spec ?? axisSpecMap.get(axisKey) ?? {}, _milaboratories_pl_model_common.Annotation.Label)?.trim() ?? "Unlabeled";
|
|
98
183
|
return result;
|
|
99
184
|
}
|
|
185
|
+
/** Derive origin tooltips for columns whose qualifications or linker path carry info. */
|
|
186
|
+
function deriveAllTooltips(options) {
|
|
187
|
+
const { columns } = options;
|
|
188
|
+
const variantCountByOriginal = columns.reduce((acc, c) => {
|
|
189
|
+
return acc.set(c.originalId, (acc.get(c.originalId) ?? 0) + 1);
|
|
190
|
+
}, /* @__PURE__ */ new Map());
|
|
191
|
+
const { entries } = columns.reduce(({ entries, variantSeen }, c) => {
|
|
192
|
+
const variantCount = variantCountByOriginal.get(c.originalId);
|
|
193
|
+
const variantIndex = (variantSeen.set(c.originalId, (variantSeen.get(c.originalId) ?? 0) + 1), variantSeen.get(c.originalId));
|
|
194
|
+
entries.push({
|
|
195
|
+
spec: c.spec,
|
|
196
|
+
linkerPath: c.linkerPath,
|
|
197
|
+
qualifications: c.qualifications,
|
|
198
|
+
distinctiveQualifications: c.distinctiveQualifications,
|
|
199
|
+
variantIndex,
|
|
200
|
+
variantCount
|
|
201
|
+
});
|
|
202
|
+
return {
|
|
203
|
+
entries,
|
|
204
|
+
variantSeen
|
|
205
|
+
};
|
|
206
|
+
}, {
|
|
207
|
+
entries: [],
|
|
208
|
+
variantSeen: /* @__PURE__ */ new Map()
|
|
209
|
+
});
|
|
210
|
+
const tooltips = require_derive_distinct_tooltips.deriveDistinctTooltips(entries);
|
|
211
|
+
return Object.fromEntries(tooltips.flatMap((t, i) => (0, es_toolkit.isNil)(t) ? [] : [[columns[i].id, t]]));
|
|
212
|
+
}
|
|
100
213
|
//#endregion
|
|
101
214
|
exports.deriveAllLabels = deriveAllLabels;
|
|
215
|
+
exports.deriveAllTooltips = deriveAllTooltips;
|
|
216
|
+
exports.evaluateRules = evaluateRules;
|
|
102
217
|
exports.getEffectiveVisibility = getEffectiveVisibility;
|
|
103
218
|
exports.getOrderPriority = getOrderPriority;
|
|
104
219
|
exports.isColumnHidden = isColumnHidden;
|
|
105
220
|
exports.isColumnOptional = isColumnOptional;
|
|
221
|
+
exports.withHidenAxesAnnotations = withHidenAxesAnnotations;
|
|
222
|
+
exports.withInfoAnnotations = withInfoAnnotations;
|
|
106
223
|
exports.withLabelAnnotations = withLabelAnnotations;
|
|
107
224
|
exports.withTableVisualAnnotations = withTableVisualAnnotations;
|
|
108
225
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["Annotation","deriveDistinctLabels"],"sources":["../../../../src/components/PlDataTable/createPlDataTable/utils.ts"],"sourcesContent":["import {\n type PColumn,\n type PColumnSpec,\n type PObjectId,\n Annotation,\n canonicalizeAxisId,\n canonicalizeJson,\n getAxisId,\n readAnnotation,\n readAnnotationJson,\n} from \"@milaboratories/pl-model-common\";\nimport {\n deriveDistinctLabels,\n type DeriveLabelsOptions,\n} from \"../../../labels/derive_distinct_labels\";\nimport type { ColumnsDisplayOptions } from \"./createPlDataTableV3\";\nimport { isNil } from \"es-toolkit\";\n\n/** Check if column should be omitted from the table */\nexport function isColumnHidden(spec: { annotations?: Annotation }): boolean {\n return readAnnotation(spec, Annotation.Table.Visibility) === \"hidden\";\n}\n\n/** Check if column is hidden by default */\nexport function isColumnOptional(spec: { annotations?: Annotation }): boolean {\n return readAnnotation(spec, Annotation.Table.Visibility) === \"optional\";\n}\n\n/** Get effective visibility for a column, considering display config rules first, then annotations. */\nexport function getEffectiveVisibility(\n spec: PColumnSpec,\n displayConfig?: ColumnsDisplayOptions,\n): undefined | \"default\" | \"optional\" | \"hidden\" {\n if (displayConfig?.visibility) {\n for (const rule of displayConfig.visibility) {\n if (rule.match(spec)) {\n return rule.visibility;\n }\n }\n }\n if (isColumnHidden(spec)) return \"hidden\";\n if (isColumnOptional(spec)) return \"optional\";\n return undefined;\n}\n\n/** Get ordering priority for a column. Display config rules first, then annotation fallback. */\nexport function getOrderPriority(\n spec: PColumnSpec,\n displayConfig?: ColumnsDisplayOptions,\n): undefined | number {\n if (displayConfig?.ordering) {\n for (const rule of displayConfig.ordering) {\n if (rule.match(spec)) {\n return rule.priority;\n }\n }\n }\n return readAnnotationJson(spec, Annotation.Table.OrderPriority);\n}\n\n/**\n * Writes derived labels into column and axis annotations.\n * Returns new column objects with modified specs — original columns are not mutated.\n *\n * For each column: writes derived label into Annotation.Label (if present in derivedLabels).\n * For each axis in column specs: writes derived axis label into AxisSpec annotations.\n */\nexport function withLabelAnnotations<Data>(\n derivedLabels: undefined | Record<string, string>,\n columns: PColumn<Data>[],\n): PColumn<Data>[] {\n if (derivedLabels === undefined) return columns;\n return columns.map((col) => {\n const colLabel = derivedLabels[col.id];\n return {\n ...col,\n spec: {\n ...col.spec,\n ...(isNil(colLabel)\n ? {}\n : { annotations: { ...col.spec.annotations, [Annotation.Label]: colLabel } }),\n axesSpec: col.spec.axesSpec.map((axis) => {\n const label = derivedLabels[canonicalizeAxisId(axis)];\n return isNil(label)\n ? axis\n : { ...axis, annotations: { ...axis.annotations, [Annotation.Label]: label } };\n }),\n },\n };\n });\n}\n\n/**\n * Writes effective display properties (OrderPriority, Visibility) from ColumnDisplayOptions\n * into column annotations. Returns new column objects — originals are not mutated.\n */\nexport function withTableVisualAnnotations<Data>(\n displayOptions: undefined | ColumnsDisplayOptions,\n columns: PColumn<Data>[],\n): PColumn<Data>[] {\n if (displayOptions === undefined) return columns;\n return columns.map((col) => {\n const annotations = { ...col.spec.annotations };\n\n const visibility = getEffectiveVisibility(col.spec, displayOptions);\n if (!isNil(visibility)) annotations[Annotation.Table.Visibility] = visibility;\n\n const orderPriority = getOrderPriority(col.spec, displayOptions);\n if (!isNil(orderPriority)) annotations[Annotation.Table.OrderPriority] = String(orderPriority);\n\n return {\n ...col,\n spec: {\n ...col.spec,\n annotations: annotations,\n },\n };\n });\n}\n\n/** Column shape required by label derivation. */\nexport type LabelableColumn = {\n readonly id: PObjectId;\n readonly spec: PColumnSpec;\n readonly linkerPath?: { spec: PColumnSpec }[];\n};\n\n/** Derive labels for all table elements: columns via deriveDistinctLabels, axes from label columns. */\nexport function deriveAllLabels(options: {\n columns: LabelableColumn[];\n labelColumns: { readonly spec: PColumnSpec }[];\n deriveLabelsOptions?: DeriveLabelsOptions;\n}): Record<string, string> {\n const { columns, labelColumns, deriveLabelsOptions } = options;\n const axisLabels = deriveAxisLabels(columns, labelColumns);\n const columnLabels = deriveDistinctLabels(columns, deriveLabelsOptions).reduce(\n (acc, label, index) => ((acc[columns[index].id] = label), acc),\n {} as Record<string, string>,\n );\n return { ...axisLabels, ...columnLabels };\n}\n\n/** Derive axis labels from matching label columns, falling back to axis spec annotations. */\nfunction deriveAxisLabels(\n columns: { readonly spec: PColumnSpec }[],\n labelColumns: { readonly spec: PColumnSpec }[],\n): Record<string, string> {\n const axisSpecMap = new Map(\n columns.flatMap((c) => c.spec.axesSpec).map((a) => [canonicalizeJson(getAxisId(a)), a]),\n );\n const result: Record<string, string> = {};\n for (const axisKey of axisSpecMap.keys()) {\n const labelCol = labelColumns.find(\n (lc) => canonicalizeJson(getAxisId(lc.spec.axesSpec[0])) === axisKey,\n );\n const source = labelCol?.spec ?? axisSpecMap.get(axisKey);\n result[axisKey] = readAnnotation(source ?? {}, Annotation.Label)?.trim() ?? \"Unlabeled\";\n }\n return result;\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,eAAe,MAA6C;AAC1E,SAAA,GAAA,gCAAA,gBAAsB,MAAMA,gCAAAA,WAAW,MAAM,WAAW,KAAK;;;AAI/D,SAAgB,iBAAiB,MAA6C;AAC5E,SAAA,GAAA,gCAAA,gBAAsB,MAAMA,gCAAAA,WAAW,MAAM,WAAW,KAAK;;;AAI/D,SAAgB,uBACd,MACA,eAC+C;AAC/C,KAAI,eAAe;OACZ,MAAM,QAAQ,cAAc,WAC/B,KAAI,KAAK,MAAM,KAAK,CAClB,QAAO,KAAK;;AAIlB,KAAI,eAAe,KAAK,CAAE,QAAO;AACjC,KAAI,iBAAiB,KAAK,CAAE,QAAO;;;AAKrC,SAAgB,iBACd,MACA,eACoB;AACpB,KAAI,eAAe;OACZ,MAAM,QAAQ,cAAc,SAC/B,KAAI,KAAK,MAAM,KAAK,CAClB,QAAO,KAAK;;AAIlB,SAAA,GAAA,gCAAA,oBAA0B,MAAMA,gCAAAA,WAAW,MAAM,cAAc;;;;;;;;;AAUjE,SAAgB,qBACd,eACA,SACiB;AACjB,KAAI,kBAAkB,KAAA,EAAW,QAAO;AACxC,QAAO,QAAQ,KAAK,QAAQ;EAC1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Ac;;;AAI3C,SAAS,iBACP,SACA,cACwB;CACxB,MAAM,cAAc,IAAI,IACtB,QAAQ,SAAS,MAAM,EAAE,KAAK,SAAS,CAAC,KAAK,MAAM,EAAA,GAAA,gCAAA,mBAAA,GAAA,gCAAA,WAA4B,EAAE,CAAC,EAAE,EAAE,CAAC,CACxF;CACD,MAAM,SAAiC,EAAE;AACzC,MAAK,MAAM,WAAW,YAAY,MAAM,CAKtC,QAAO,YAAA,GAAA,gCAAA,gBAJU,aAAa,MAC3B,QAAA,GAAA,gCAAA,mBAAA,GAAA,gCAAA,WAAkC,GAAG,KAAK,SAAS,GAAG,CAAC,KAAK,QAC9D,EACwB,QAAQ,YAAY,IAAI,QAAQ,IACd,EAAE,EAAED,gCAAAA,WAAW,MAAM,EAAE,MAAM,IAAI;AAE9E,QAAO"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["Annotation","ColumnCollectionBuilder","ArrayColumnProvider","deriveDistinctLabels","deriveDistinctTooltips"],"sources":["../../../../src/components/PlDataTable/createPlDataTable/utils.ts"],"sourcesContent":["import {\n type PColumn,\n type PColumnSpec,\n type PFrameSpecDriver,\n type PObjectId,\n Annotation,\n canonicalizeAxisId,\n canonicalizeJson,\n DiscoveredPColumnId,\n getAxisId,\n readAnnotation,\n readAnnotationJson,\n} from \"@milaboratories/pl-model-common\";\nimport {\n deriveDistinctLabels,\n type DeriveLabelsOptions,\n} from \"../../../labels/derive_distinct_labels\";\nimport {\n deriveDistinctTooltips,\n type TooltipEntry,\n} from \"../../../labels/derive_distinct_tooltips\";\nimport type { MatchQualifications, MatchVariant } from \"../../../columns\";\nimport type { ColumnMatcher, ColumnOrderRule, ColumnVisibilityRule } from \"./createPlDataTableV3\";\nimport type { ColumnSelector } from \"../../../columns\";\nimport { ArrayColumnProvider, ColumnCollectionBuilder } from \"../../../columns\";\nimport { isNil } from \"es-toolkit\";\n\n/** Check if column should be omitted from the table */\nexport function isColumnHidden(spec: { annotations?: Annotation }): boolean {\n return readAnnotation(spec, Annotation.Table.Visibility) === \"hidden\";\n}\n\n/** Check if column is hidden by default */\nexport function isColumnOptional(spec: { annotations?: Annotation }): boolean {\n return readAnnotation(spec, Annotation.Table.Visibility) === \"optional\";\n}\n\n/** Column shape consumed by rule evaluation. */\nexport type RuleColumn = Pick<PColumn<PObjectId>, \"id\" | \"spec\">;\n\n/** Get effective visibility for a column. Rule map lookup first, then annotation fallback. */\nexport function getEffectiveVisibility(\n col: RuleColumn,\n visibilityByColId?: Map<PObjectId, ColumnVisibilityRule>,\n): undefined | \"default\" | \"optional\" | \"hidden\" {\n const rule = visibilityByColId?.get(col.id);\n if (rule !== undefined) return rule.visibility;\n if (isColumnHidden(col.spec)) return \"hidden\";\n if (isColumnOptional(col.spec)) return \"optional\";\n return undefined;\n}\n\n/** Get ordering priority for a column. Rule map lookup first, then annotation fallback. */\nexport function getOrderPriority(\n col: RuleColumn,\n orderByColId?: Map<PObjectId, ColumnOrderRule>,\n): undefined | number {\n const rule = orderByColId?.get(col.id);\n if (rule !== undefined) return rule.priority;\n return readAnnotationJson(col.spec, Annotation.Table.OrderPriority);\n}\n\n/**\n * Evaluate display rules against a set of columns and return a map of `colId → winning rule`\n * (first-match-wins, preserving original rule order).\n *\n * Predicate-based rules (`ColumnMatcher`) are evaluated directly on the spec.\n * Selector-based rules (`ColumnSelector`) are matched via `PFrameSpecDriver.discoverColumns`\n * using the same engine as `ColumnCollection.findColumns` — no client-side matcher.\n */\nexport function evaluateRules<R extends { match: ColumnMatcher | ColumnSelector }>(\n rules: R[],\n columns: RuleColumn[],\n pframeSpec: PFrameSpecDriver,\n): Map<PObjectId, R> {\n const result = new Map<PObjectId, R>();\n if (rules.length === 0 || columns.length === 0) return result;\n\n const hasSelectorRules = rules.some((rule) => typeof rule.match !== \"function\");\n const selectorHitsByRule = new Map<R, Set<PObjectId>>();\n\n if (hasSelectorRules) {\n const dedupedColumns = dedupeById(columns);\n const pColumns = dedupedColumns.map((c) => ({ id: c.id, spec: c.spec, data: undefined }));\n const collection = new ColumnCollectionBuilder(pframeSpec)\n .addSource(new ArrayColumnProvider(pColumns))\n .build();\n if (collection === undefined) return result;\n\n try {\n for (const rule of rules) {\n if (typeof rule.match === \"function\") continue;\n const hits = collection.findColumns({ include: rule.match });\n selectorHitsByRule.set(rule, new Set(hits.map((h) => h.id)));\n }\n } finally {\n collection.dispose();\n }\n }\n\n for (const col of columns) {\n for (const rule of rules) {\n const matches =\n typeof rule.match === \"function\"\n ? rule.match(col.spec)\n : (selectorHitsByRule.get(rule)?.has(col.id) ?? false);\n if (matches) {\n result.set(col.id, rule);\n break;\n }\n }\n }\n return result;\n}\n\nfunction dedupeById(columns: RuleColumn[]): RuleColumn[] {\n const seen = new Set<PObjectId>();\n const result: RuleColumn[] = [];\n for (const col of columns) {\n if (seen.has(col.id)) continue;\n seen.add(col.id);\n result.push(col);\n }\n return result;\n}\n\n/**\n * Writes derived labels into column and axis annotations.\n * Returns new column objects with modified specs — original columns are not mutated.\n *\n * For each column: writes derived label into Annotation.Label (if present in derivedLabels).\n * For each axis in column specs: writes derived axis label into AxisSpec annotations.\n */\nexport function withLabelAnnotations<\n T extends { readonly id: PObjectId; readonly spec: PColumnSpec },\n>(derivedLabels: undefined | Record<string, string>, columns: T[]): T[] {\n if (derivedLabels === undefined) return columns;\n return columns.map((col) => {\n const colLabel = derivedLabels[col.id];\n return {\n ...col,\n spec: {\n ...col.spec,\n ...(isNil(colLabel)\n ? {}\n : { annotations: { ...col.spec.annotations, [Annotation.Label]: colLabel } }),\n axesSpec: col.spec.axesSpec.map((axis) => {\n const label = derivedLabels[canonicalizeAxisId(axis)];\n return isNil(label)\n ? axis\n : { ...axis, annotations: { ...axis.annotations, [Annotation.Label]: label } };\n }),\n },\n } as T;\n });\n}\n\n/**\n * Writes effective display properties (OrderPriority, Visibility) from precomputed rule maps\n * into column annotations. Returns new column objects — originals are not mutated.\n */\nexport function withTableVisualAnnotations<\n T extends { readonly id: PObjectId; readonly spec: PColumnSpec },\n>(\n visibilityByColId: undefined | Map<PObjectId, ColumnVisibilityRule>,\n orderByColId: undefined | Map<PObjectId, ColumnOrderRule>,\n columns: T[],\n): T[] {\n if (visibilityByColId === undefined && orderByColId === undefined) return columns;\n return columns.map((col) => {\n const annotations = { ...col.spec.annotations };\n\n const visibility = getEffectiveVisibility(col, visibilityByColId);\n if (!isNil(visibility)) annotations[Annotation.Table.Visibility] = visibility;\n\n const orderPriority = getOrderPriority(col, orderByColId);\n if (!isNil(orderPriority)) annotations[Annotation.Table.OrderPriority] = String(orderPriority);\n\n return {\n ...col,\n spec: {\n ...col.spec,\n annotations: annotations,\n },\n } as T;\n });\n}\n\n/**\n * Writes derived info annotations into column annotations.\n * Columns without an info entry are passed through unchanged.\n */\nexport function withInfoAnnotations<\n T extends { readonly id: PObjectId; readonly spec: PColumnSpec },\n>(infoById: undefined | Record<string, string>, columns: T[]): T[] {\n if (isNil(infoById)) return columns;\n return columns.map((col) => {\n const info = infoById[col.id];\n if (isNil(info)) return col;\n return {\n ...col,\n spec: {\n ...col.spec,\n annotations: { ...col.spec.annotations, [Annotation.Table.Info]: info },\n },\n } as T;\n });\n}\n\nexport function withHidenAxesAnnotations<T extends { readonly spec: PColumnSpec }>(\n columns: T[],\n): T[] {\n return columns.map(\n (col) =>\n ({\n ...col,\n spec: {\n ...col.spec,\n axesSpec: col.spec.axesSpec.map((axis) => ({\n ...axis,\n annotations: { ...axis.annotations, [Annotation.Table.Visibility]: \"hidden\" },\n })),\n },\n }) as T,\n );\n}\n\n/** Column shape required by label derivation. */\nexport type LabelableColumn = {\n readonly id: PObjectId;\n readonly spec: PColumnSpec;\n readonly linkerPath?: { spec: PColumnSpec }[];\n};\n\n/** Derive labels for all table elements: columns via deriveDistinctLabels, axes from label columns. */\nexport function deriveAllLabels(options: {\n columns: LabelableColumn[];\n labelColumns: { readonly spec: PColumnSpec }[];\n deriveLabelsOptions?: DeriveLabelsOptions;\n}): Record<string, string> {\n const { columns, labelColumns, deriveLabelsOptions } = options;\n const axisLabels = deriveAxisLabels(columns, labelColumns);\n const columnLabels = deriveDistinctLabels(columns, deriveLabelsOptions).reduce(\n (acc, label, index) => ((acc[columns[index].id] = label), acc),\n {} as Record<string, string>,\n );\n return { ...axisLabels, ...columnLabels };\n}\n\n/** Derive axis labels from matching label columns, falling back to axis spec annotations. */\nfunction deriveAxisLabels(\n columns: { readonly spec: PColumnSpec }[],\n labelColumns: { readonly spec: PColumnSpec }[],\n): Record<string, string> {\n const axisSpecMap = new Map(\n columns.flatMap((c) => c.spec.axesSpec).map((a) => [canonicalizeJson(getAxisId(a)), a]),\n );\n const result: Record<string, string> = {};\n for (const axisKey of axisSpecMap.keys()) {\n const labelCol = labelColumns.find(\n (lc) => canonicalizeJson(getAxisId(lc.spec.axesSpec[0])) === axisKey,\n );\n const source = labelCol?.spec ?? axisSpecMap.get(axisKey);\n result[axisKey] = readAnnotation(source ?? {}, Annotation.Label)?.trim() ?? \"Unlabeled\";\n }\n return result;\n}\n\n/** Column shape required by tooltip derivation. */\nexport type TooltipableColumn = {\n readonly id: DiscoveredPColumnId;\n readonly spec: PColumnSpec;\n readonly originalId: PObjectId;\n readonly linkerPath?: MatchVariant[\"path\"];\n readonly qualifications?: MatchQualifications;\n readonly distinctiveQualifications?: MatchQualifications;\n};\n\n/** Derive origin tooltips for columns whose qualifications or linker path carry info. */\nexport function deriveAllTooltips(options: {\n columns: TooltipableColumn[];\n}): Record<DiscoveredPColumnId, string> {\n const { columns } = options;\n\n const variantCountByOriginal = columns.reduce<Map<PObjectId, number>>((acc, c) => {\n return acc.set(c.originalId, (acc.get(c.originalId) ?? 0) + 1);\n }, new Map());\n\n const { entries } = columns.reduce(\n ({ entries, variantSeen }, c) => {\n const variantCount = variantCountByOriginal.get(c.originalId);\n const variantIndex =\n (variantSeen.set(c.originalId, (variantSeen.get(c.originalId) ?? 0) + 1),\n variantSeen.get(c.originalId));\n\n entries.push({\n spec: c.spec,\n linkerPath: c.linkerPath,\n qualifications: c.qualifications,\n distinctiveQualifications: c.distinctiveQualifications,\n variantIndex,\n variantCount,\n });\n\n return { entries, variantSeen };\n },\n { entries: [] as TooltipEntry[], variantSeen: new Map<PObjectId, number>() },\n );\n\n const tooltips = deriveDistinctTooltips(entries);\n\n return Object.fromEntries(\n tooltips.flatMap((t, i) => (isNil(t) ? [] : [[columns[i].id, t] as const])),\n );\n}\n"],"mappings":";;;;;;;;;;AA4BA,SAAgB,eAAe,MAA6C;AAC1E,SAAA,GAAA,gCAAA,gBAAsB,MAAMA,gCAAAA,WAAW,MAAM,WAAW,KAAK;;;AAI/D,SAAgB,iBAAiB,MAA6C;AAC5E,SAAA,GAAA,gCAAA,gBAAsB,MAAMA,gCAAAA,WAAW,MAAM,WAAW,KAAK;;;AAO/D,SAAgB,uBACd,KACA,mBAC+C;CAC/C,MAAM,OAAO,mBAAmB,IAAI,IAAI,GAAG;AAC3C,KAAI,SAAS,KAAA,EAAW,QAAO,KAAK;AACpC,KAAI,eAAe,IAAI,KAAK,CAAE,QAAO;AACrC,KAAI,iBAAiB,IAAI,KAAK,CAAE,QAAO;;;AAKzC,SAAgB,iBACd,KACA,cACoB;CACpB,MAAM,OAAO,cAAc,IAAI,IAAI,GAAG;AACtC,KAAI,SAAS,KAAA,EAAW,QAAO,KAAK;AACpC,SAAA,GAAA,gCAAA,oBAA0B,IAAI,MAAMA,gCAAAA,WAAW,MAAM,cAAc;;;;;;;;;;AAWrE,SAAgB,cACd,OACA,SACA,YACmB;CACnB,MAAM,yBAAS,IAAI,KAAmB;AACtC,KAAI,MAAM,WAAW,KAAK,QAAQ,WAAW,EAAG,QAAO;CAEvD,MAAM,mBAAmB,MAAM,MAAM,SAAS,OAAO,KAAK,UAAU,WAAW;CAC/E,MAAM,qCAAqB,IAAI,KAAwB;AAEvD,KAAI,kBAAkB;EAEpB,MAAM,WADiB,WAAW,QAAQ,CACV,KAAK,OAAO;GAAE,IAAI,EAAE;GAAI,MAAM,EAAE;GAAM,MAAM,KAAA;GAAW,EAAE;EACz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AI,KAAK,EAAE,EACxE,YAAY,IAAI,EAAE,WAAW;AAE/B,UAAQ,KAAK;GACX,MAAM,EAAE;GACR,YAAY,EAAE;GACd,gBAAgB,EAAE;GAClB,2BAA2B,EAAE;GAC7B;GACA;GACD,CAAC;AAEF,SAAO;GAAE;GAAS;GAAa;IAEjC;EAAE,SAAS,EAAE;EAAoB,6BAAa,IAAI,KAAwB;EAAE,CAC7E;CAED,MAAM,WAAWI,iCAAAA,uBAAuB,QAAQ;AAEhD,QAAO,OAAO,YACZ,SAAS,SAAS,GAAG,OAAA,GAAA,WAAA,OAAa,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,GAAG,IAAI,EAAE,CAAU,CAAE,CAC5E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Annotation, PColumn, PColumnSpec, PObjectId } from "@milaboratories/pl-model-common";
|
|
1
|
+
import { ColumnOrderRule, ColumnVisibilityRule } from "./createPlDataTableV3.js";
|
|
2
|
+
import { Annotation, DiscoveredPColumnId, PColumn, PColumnSpec, PFrameSpecDriver, PObjectId } from "@milaboratories/pl-model-common";
|
|
3
3
|
|
|
4
4
|
//#region src/components/PlDataTable/createPlDataTable/utils.d.ts
|
|
5
5
|
/** Check if column should be omitted from the table */
|
|
@@ -10,10 +10,12 @@ declare function isColumnHidden(spec: {
|
|
|
10
10
|
declare function isColumnOptional(spec: {
|
|
11
11
|
annotations?: Annotation;
|
|
12
12
|
}): boolean;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
/** Get
|
|
16
|
-
declare function
|
|
13
|
+
/** Column shape consumed by rule evaluation. */
|
|
14
|
+
type RuleColumn = Pick<PColumn<PObjectId>, "id" | "spec">;
|
|
15
|
+
/** Get effective visibility for a column. Rule map lookup first, then annotation fallback. */
|
|
16
|
+
declare function getEffectiveVisibility(col: RuleColumn, visibilityByColId?: Map<PObjectId, ColumnVisibilityRule>): undefined | "default" | "optional" | "hidden";
|
|
17
|
+
/** Get ordering priority for a column. Rule map lookup first, then annotation fallback. */
|
|
18
|
+
declare function getOrderPriority(col: RuleColumn, orderByColId?: Map<PObjectId, ColumnOrderRule>): undefined | number;
|
|
17
19
|
//#endregion
|
|
18
20
|
export { getEffectiveVisibility, getOrderPriority, isColumnHidden, isColumnOptional };
|
|
19
21
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../../src/components/PlDataTable/createPlDataTable/utils.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../../src/components/PlDataTable/createPlDataTable/utils.ts"],"mappings":";;;;;iBA4BgB,cAAA,CAAe,IAAA;EAAQ,WAAA,GAAc,UAAA;AAAA;;iBAKrC,gBAAA,CAAiB,IAAA;EAAQ,WAAA,GAAc,UAAA;AAAA;;KAK3C,UAAA,GAAa,IAAA,CAAK,OAAA,CAAQ,SAAA;AALtC;AAAA,iBAQgB,sBAAA,CACd,GAAA,EAAK,UAAA,EACL,iBAAA,GAAoB,GAAA,CAAI,SAAA,EAAW,oBAAA;;iBAUrB,gBAAA,CACd,GAAA,EAAK,UAAA,EACL,YAAA,GAAe,GAAA,CAAI,SAAA,EAAW,eAAA"}
|