Interface IDataComponentProps

Interface for DataComponent props.

interface IDataComponentProps {
    events: {
        key?: string;
        name: string;
        params?: any;
        update?: string;
    }[];
    loaderBlock?: boolean;
    loaderSize?:
        | "large"
        | "normal"
        | "small"
        | "xsmall";
    onData?: ((data: any) => any);
    onError?: ((error: any) => void);
    onStart?: (() => void);
    renderData: ((data: any) => Element);
    renderError?: ((error: {
        code: string;
        message: string;
    }, component: this) => Element);
    tookDisabled?: boolean;
}

Hierarchy

Properties

events: {
    key?: string;
    name: string;
    params?: any;
    update?: string;
}[]

List of events to load after the component did mount.

Type declaration

  • Optionalkey?: string

    The key where the response data are stored in the renderData function.

  • name: string

    Name of the event.

  • Optionalparams?: any

    Parameters for the event.

  • Optionalupdate?: string

    Update event. On this event is registered listener for updating the component.

loaderBlock?: boolean

Indicates if the loader should have block prop set to true.

loaderSize?:
    | "large"
    | "normal"
    | "small"
    | "xsmall"

Loader size.

onData?: ((data: any) => any)

Function called after the data load before the renderData. The data can be modified here.

Type declaration

    • (data): any
    • Parameters

      • data: any

        Loaded data. The event responses are accessible thought the key defined in the events or by the event name.

      Returns any

onError?: ((error: any) => void)

Function called if the error occured before the renderError.

Type declaration

    • (error): void
    • Parameters

      • error: any

        The error returned from the socket.

      Returns void

onStart?: (() => void)

Function called before the socket events execution.

renderData: ((data: any) => Element)

Function called for data rendering.

Type declaration

    • (data): Element
    • Parameters

      • data: any

        Loaded data. The event responses are accessible thought the key defined in the events or by the event name.

      Returns Element

renderError?: ((error: {
    code: string;
    message: string;
}, component: this) => Element)

Function called for error rendering.

Type declaration

    • (error, component): Element
    • Parameters

      • error: {
            code: string;
            message: string;
        }

        The error returned from the socket.

        • code: string
        • message: string
      • component: this

        Reference to the component.

      Returns Element

tookDisabled?: boolean

Indicates if the took info is disabled in dev mode.