UNPKG

fox-block-builder

Version:

Maintainable code for loop slack-block-kit-like modal builder

47 lines (46 loc) 1.52 kB
import { ElementType } from '../../internal'; import { InputBlockFoxFields } from '../rdo/modal-block.rdo'; export type TMultiSelectElements = ElementType.UserMultiSelect | ElementType.StaticMultiSelect | ElementType.ChannelsMultiSelect | ElementType.Checkboxes; export type TPluginFormBlock = (InputBlockFoxFields & { elementType: Exclude<ElementType, TMultiSelectElements>; id: string; label: string | null; multi?: boolean; custom?: boolean; text?: string; value: string | null; files?: string[]; }) | { elementType: TMultiSelectElements; id: string; label: string | null; multi?: boolean; custom?: boolean; text?: string; value: string[] | null; files?: string[]; }; export declare class PluginFormBlockDto extends InputBlockFoxFields { id: string; label: string | null; elementType: ElementType; multi?: boolean; custom?: boolean; text?: string; value: string | string[] | null; files?: string[]; setLabel(label: string): this; setValue(value: string): this; setText(text: string): this; setParam<T extends keyof PluginFormBlockDto>(name: T, value: this[T]): this; } export declare class PluginFormSingleBlock extends PluginFormBlockDto { elementType: Exclude<ElementType, TMultiSelectElements>; multi?: false; value: string | null; } export declare class PluginFormMultiBlock extends PluginFormBlockDto { elementType: TMultiSelectElements; multi?: true; value: string[] | null; }