Represents a field menu.

interface IFieldMenu<Data = IAnything, Payload = IAnything> {
    action?: string;
    divider?: boolean;
    icon?: any;
    isDisabled?: (data: Data, payload: Payload) => boolean | Promise<boolean>;
    isVisible?: (data: Data, payload: Payload) => boolean | Promise<boolean>;
    label?: string;
    onClick?: (
        data: Data,
        payload: Payload,
        onValueChange: (value: Value) => void,
        onChange: (data: Data) => void,
    ) => void;
    primary?: number | boolean;
}

Type Parameters

  • Data = IAnything

    The type of data for the menu.

  • Payload = IAnything

    The type of payload for the menu.

Hierarchy

  • Omit<IOption, keyof { isDisabled: never; isVisible: never }>
    • IFieldMenu

Properties

action?: string
divider?: boolean
icon?: any
isDisabled?: (data: Data, payload: Payload) => boolean | Promise<boolean>

Checks whether the given data and payload indicate that the feature is disabled.

Type declaration

    • (data: Data, payload: Payload): boolean | Promise<boolean>
    • Parameters

      • data: Data

        The data used to determine if the feature is disabled.

      • payload: Payload

        The payload used to determine if the feature is disabled.

      Returns boolean | Promise<boolean>

      • Returns a Promise resolving to a boolean indicating whether the feature is disabled. If a Promise is returned, it resolves to true if the feature is disabled, otherwise it resolves to false. If a boolean is returned directly, it indicates whether the feature is disabled.
isVisible?: (data: Data, payload: Payload) => boolean | Promise<boolean>

Determines the visibility of an element based on the given data and payload.

Type declaration

    • (data: Data, payload: Payload): boolean | Promise<boolean>
    • Parameters

      • data: Data

        The data used for determining visibility.

      • payload: Payload

        Additional payload used for determining visibility.

      Returns boolean | Promise<boolean>

      • A Promise resolving to a boolean value or a boolean value indicating the visibility of the element.
label?: string
onClick?: (
    data: Data,
    payload: Payload,
    onValueChange: (value: Value) => void,
    onChange: (data: Data) => void,
) => void

Represents a callback function that is triggered on click event.

Type declaration

    • (
          data: Data,
          payload: Payload,
          onValueChange: (value: Value) => void,
          onChange: (data: Data) => void,
      ): void
    • Parameters

      • data: Data

        The data object associated with the click event.

      • payload: Payload

        The payload object associated with the click event.

      • onValueChange: (value: Value) => void

        A callback function that is called when the value of data is changed. It is passed the new value as a parameter.

      • onChange: (data: Data) => void

        A callback function that is called when any change occurs in data. It is passed the updated data object as a parameter.

      Returns void

primary?: number | boolean