71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
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" | "string_list" | "telemetry_readings";
|
|
dataClass?: "operational" | "restricted";
|
|
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 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;
|
|
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;
|
|
profile?: MapSubjectDetailProfile;
|
|
aspects?: Record<string, {
|
|
fact: MapRuntimeFact;
|
|
bindingId?: string;
|
|
dataProductId?: string;
|
|
dataClass?: "operational" | "restricted";
|
|
}>;
|
|
},
|
|
): MapSubjectCardModel | null;
|
|
|
|
export function normalizeTelemetryReadings(value: unknown, allowedReadingIds?: string[]): MapTelemetryReading[];
|