UNPKG

@kvaser/canking-api

Version:

CanKing API to communicate with the CanKing service using Node.js.

144 lines (143 loc) 6.2 kB
/** * This module includes a Select Signal dialog. * * To be able to use these controls the CanKingDataProvider component must be present in the * component tree above your component. Normally the CanKingDataProvider is added * at the root of the component tree. * * @packageDocumentation */ import { JSX } from 'react'; import { FrameDefinition, SignalDefinition } from '../models'; /** * Information about a selected signal. */ export interface SelectedSignalInfo { /** The source identifier of the selected signal. */ sourceId: string; /** The qualified name of the selected signal. */ qualifiedName: string; } /** * Arguments for the SelectedSignalInfo change event. * Includes the message definition containing the signal. */ export interface SelectedSignalInfoChangeArgs extends SelectedSignalInfo { /** The message definition containing the signal. */ message: FrameDefinition; } /** * Properties of the SelectSignalDialog React component. */ export interface SelectSignalDialogProps { /** Optional title of the parent dialog to be shown in the title bar as a breadcrumb. */ parentDialogTitle?: string; /** * Optional node identifier to limit the databases to those available on the specified node. * If not specified, all databases available in the system will be shown. */ nodeIdentifier?: string; /** * The source identifier that will be used to filter messages in the select dialog. * Leave undefined if no filtering should be done. */ sourceIdFilter?: string; /** Whether the dialog is open. */ open: boolean; /** * Optional array of initially selected message qualified names. * Only used if multiSelect is true. * If not specified, no messages are initially selected. * If specified, the messages with the specified qualified names will be initially selected. * Signals of the selected messages will also be selected. * @deprecated Use selectedSignalInfos instead. */ selectedMessages?: string[]; /** * Optional array of initially selected signal qualified names. * Only used if multiSelect is true. * If not specified, no signals are initially selected. * If specified, the signals with the specified qualified names will be initially selected. * @deprecated Use selectedSignalInfos instead. */ selectedSignals?: string[]; /** * Optional array of initially selected signal informations. * Only used if multiSelect is true. * If not specified, no signals are initially selected. * If specified, the signals with the specified informations will be initially selected. */ selectedSignalInfos?: SelectedSignalInfo[]; /** * If true, multiple signals can be selected. * If false, only a single signal can be selected. * Default is false. */ multiSelect?: boolean; /** * If true, checkboxes are shown for multi selection. * Only used if multiSelect is true. * Default is false. */ checkboxSelection?: boolean; /** * Callback function that is called when a signal is selected. * Only used if multiSelect is false. * The function receives the selected message and signal as parameters. * If not specified, nothing happens when a signal is selected. * After calling the onSelect callback, the onClose callback is called. * @deprecated Use onSelectSignalInfo instead. */ onSelect?: (message: FrameDefinition, signal: SignalDefinition) => void; /** * Callback function that is called when a signal is selected. * The function receives the selected signal information as parameter. * Only used if multiSelect is false. * If not specified, nothing happens when a signal is selected. * After calling the onSelectSignalInfo callback, the onClose callback is called. */ onSelectSignalInfo?: (args: SelectedSignalInfoChangeArgs) => void; /** * Callback function that is called when signals are selected and the Save button is clicked. * Only used if multiSelect is true. * The function receives the selected messages and signals as parameters. * If not specified, nothing happens when the Save button is clicked. * After calling the onMultiSelect callback, the onClose callback is called. * @deprecated Use onMultiSelectSignalInfos instead. */ onMultiSelect?: (messages: FrameDefinition[], signals: SignalDefinition[]) => void; /** * Callback function that is called when multiple signals are selected and the Save button is clicked. * Only used if multiSelect is true. * The function receives an array of selected signal informations as parameter. * If not specified, nothing happens when the Save button is clicked. * After calling the onMultiSelectSignalInfos callback, the onClose callback is called. */ onMultiSelectSignalInfos?: (args: SelectedSignalInfoChangeArgs[]) => void; /** * Callback function that is called when the dialog should be closed. * Set the open property to false to close the dialog. */ onClose: () => void; /** * If true, the dialog is shown as a modal dialog. * If false, the dialog is shown as a full screen dialog. * Default is false. */ modal?: boolean; } /** * A react component to be used for showing a select signal dialog. * * The dialog will show a tree view of all signals in the system, organized by source and database. The user can * select a signal, which will trigger the onSelectSignalInfo callback with the selected signal and source identifier. * * The dialog also supports multi selection of signals if the multiSelect property is set to true. In that case, a Save * button is shown which triggers the onMultiSelectSignalInfos callback with all selected signals when clicked. * * The dialog also includes a search field to filter signals by name. * @param props - Component properties. * @returns The SelectSignalDialog React component. */ declare function SelectSignalDialog(props: SelectSignalDialogProps): JSX.Element; export default SelectSignalDialog;