feat(foundry): add composable subject detail profiles
This commit is contained in:
@@ -1,18 +1,64 @@
|
||||
import type { MapRuntimeFact } from "./useMapDataProductRuntime.js";
|
||||
|
||||
export type MapSubjectDetailField = {
|
||||
id: string;
|
||||
aspectId?: string;
|
||||
source: "fact" | "attribute" | "geometry" | "context";
|
||||
field: string;
|
||||
label: string;
|
||||
format: "text" | "number" | "timestamp" | "boolean" | "coordinate" | "signal_state" | "movement_state" | "telemetry_readings";
|
||||
unit?: string;
|
||||
allowedReadingIds?: string[];
|
||||
};
|
||||
|
||||
export type MapSubjectDetailProfile = {
|
||||
id: string;
|
||||
version: string;
|
||||
title: string;
|
||||
semanticTypes: string[];
|
||||
defaultTabId: string;
|
||||
tabs: Array<{
|
||||
id: string;
|
||||
label: string;
|
||||
emptyMessage: string;
|
||||
sections: Array<{ id: string; label: string; fields: MapSubjectDetailField[] }>;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type MapSubjectCardRow = { key: string; label: string; value: string };
|
||||
export type MapSubjectCardSection = { id: string; label: string; rows: MapSubjectCardRow[] };
|
||||
export type MapTelemetryReading = { id: string; label: string; value: string; observedAt?: string };
|
||||
export type MapSubjectCardSection = {
|
||||
id: string;
|
||||
label: string;
|
||||
rows: MapSubjectCardRow[];
|
||||
readings: MapTelemetryReading[];
|
||||
};
|
||||
export type MapSubjectCardTab = {
|
||||
id: string;
|
||||
label: string;
|
||||
emptyMessage: string;
|
||||
sections: MapSubjectCardSection[];
|
||||
empty: boolean;
|
||||
};
|
||||
export type MapSubjectCardModel = {
|
||||
title: string;
|
||||
sourceId: string;
|
||||
sections: MapSubjectCardSection[];
|
||||
readings: MapTelemetryReading[];
|
||||
profileId: string;
|
||||
defaultTabId: string;
|
||||
tabs: MapSubjectCardTab[];
|
||||
};
|
||||
|
||||
export const DEFAULT_MAP_SUBJECT_DETAIL_PROFILE: Readonly<MapSubjectDetailProfile>;
|
||||
|
||||
export function buildMapSubjectCardModel(
|
||||
fact: MapRuntimeFact,
|
||||
context?: { title?: string; bindingId?: string; dataProductId?: string },
|
||||
context?: {
|
||||
title?: string;
|
||||
bindingId?: string;
|
||||
dataProductId?: string;
|
||||
profile?: MapSubjectDetailProfile;
|
||||
aspects?: Record<string, { fact: MapRuntimeFact; bindingId?: string; dataProductId?: string }>;
|
||||
},
|
||||
): MapSubjectCardModel | null;
|
||||
|
||||
export function normalizeTelemetryReadings(value: unknown): MapTelemetryReading[];
|
||||
export function normalizeTelemetryReadings(value: unknown, allowedReadingIds?: string[]): MapTelemetryReading[];
|
||||
|
||||
Reference in New Issue
Block a user