UNPKG

@kvaser/canking-api

Version:

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

121 lines (120 loc) 5.28 kB
/** * This module includes UI controls implemented as React components. * * 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. * * @example * ```tsx * import { useSearchParams } from 'react-router-dom'; * import { useProjectData } from '@kvaser/canking-api/canking'; * import { CanChannelSelectControl, FillBox } from '@kvaser/canking-api/controls'; * * // If any data should be stored in the project file then add it to this interface * interface IProjectViewData { * // This is an example showing how to store the selected channel id to the project file * channelId: string; * } * * // Define any default values for the project data that will be used when the component is created * const defaultProjectViewData: IProjectViewData = { * channelId: '', * }; * * function WorkspaceView() { * // Get this view's unique id from search params * const [searchParams] = useSearchParams(); * const idString = searchParams.get('id'); * const id = idString !== null ? Number.parseInt(idString, 10) : -1; * * // Use the useProjectData hook to serialize/deserialize your view data to the project * const [projectData, setProjectData] = useProjectData<IProjectViewData>(id, defaultProjectViewData); * * // A callback that will get the new selected channel id and save it to the project data * const onChannelIdentifierChange = (channelId: string) => { * const data = { ...projectData }; * data.channelId = channelId; * setProjectData(data); * }; * * return ( * <FillBox component="form"> * <div>Add your elements here!</div> * <div>This is an example how to use the CanChannelSelectControl:</div> * <CanChannelSelectControl * channelIdentifier={projectData.channelId} * onChannelIdentifierChange={onChannelIdentifierChange} * hideSectionControl * /> * </FillBox> * ); * } * * export default WorkspaceView; * ``` * * @packageDocumentation */ export { type ILocalizedStrings, LocalizedStrings, type StringsMap } from './LocalizedStrings'; export * from './CheckboxControl'; export { default as CheckboxControl } from './CheckboxControl'; export * from './ColumnItemControl'; export { default as ColumnItemControl } from './ColumnItemControl'; export * from './ColumnItems'; export * from './DropdownButton'; export { default as OneLineButton } from './OneLineButton'; export * from './OneLineButton'; export { default as DropdownButton } from './DropdownButton'; export * from './DropdownPanel'; export { default as DropdownPanel } from './DropdownPanel'; export * from './FormControlRow'; export { default as FormControlRow } from './FormControlRow'; export * from './InlineEditor'; export { default as InlineEditor } from './InlineEditor'; export * from './NumberRangeControl'; export { default as NumberRangeControl } from './NumberRangeControl'; export * from './RadioControl'; export { default as RadioControl } from './RadioControl'; export * from './RadioGroupControl'; export { default as RadioGroupControl } from './RadioGroupControl'; export * from './SectionControl'; export { default as SectionControl } from './SectionControl'; export * from './SelectControl'; export { default as SelectControl } from './SelectControl'; export * from './SelectMessageDialog'; export { default as SelectMessageDialog } from './SelectMessageDialog'; export * from './SelectSignalDialog'; export { default as SelectSignalDialog } from './SelectSignalDialog'; export * from './SelectSignalsControl'; export { default as SelectSignalsControl } from './SelectSignalsControl'; export * from './SizedBox'; export { default as SizedBox } from './SizedBox'; export * from './TableControl'; export { default as TableControl } from './TableControl'; export * from './TabsPanel'; export { default as TabsPanel } from './TabsPanel'; export * from './TextControl'; export { default as TextControl } from './TextControl'; export * from './ToolbarControl'; export { default as ToolbarControl } from './ToolbarControl'; export * from './ValidateableTextControl'; export { default as ValidateableTextControl } from './ValidateableTextControl'; export * from './ContextMenu'; export { default as ContextMenu } from './ContextMenu'; export * from './CanIdentifierControl'; export { default as CanIdentifierControl } from './CanIdentifierControl'; export * from './CanChannelSelectControl'; export { default as CanChannelSelectControl } from './CanChannelSelectControl'; export * from './LinChannelSelectControl'; export { default as LinChannelSelectControl } from './LinChannelSelectControl'; export * from './LinIdentifierControl'; export { default as LinIdentifierControl } from './LinIdentifierControl'; export * from './FillBox'; export { default as FillBox } from './FillBox'; export * from './ColorControl'; export { default as ColorControl } from './ColorControl'; export * from './CanKingDataEvents'; export * from './CanKingDataProvider'; export { default as CanKingDataProvider } from './CanKingDataProvider'; export { type IExtensionWorkspaceViewProps } from './ExtensionWorkspaceViewProps';