feat(dropdown): add dropdown

This commit is contained in:
Jonas Dellinger
2022-06-08 09:57:50 +02:00
parent d8794ef4d3
commit a99fb4a22d
2 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
import { ReactNode, VFC } from 'react';
import { CommonUIModule } from '../webpack';
export interface SingleDropdownOption {
data: number;
label: string;
options?: never;
}
export interface MultiDropdownOption {
label: string;
options: DropdownOption[];
data?: never;
}
export type DropdownOption = SingleDropdownOption | MultiDropdownOption;
export interface DropdownProps {
rgOptions: DropdownOption[];
selectedOption: number | null;
disabled?: boolean;
onMenuWillOpen?(showMenu: () => void): void;
onMenuOpened?(): void;
onChange?(data: SingleDropdownOption): void;
contextMenuPositionOptions?: any;
menuLabel?: string;
strDefaultLabel?: string;
renderButtonValue?(element: ReactNode): ReactNode;
focusable?: boolean;
}
export const Dropdown = Object.values(CommonUIModule).find(
(mod: any) => mod?.prototype?.SetSelectedOption && mod?.prototype?.BuildMenu,
) as VFC<DropdownProps>;
export interface DropdownItemProps extends DropdownProps {
label?: string;
tooltip?: string;
description?: string;
layout?: 'below';
bottomSeparator?: boolean;
indentLevel?: number;
}
export const DropdownItem = Object.values(CommonUIModule).find((mod: any) =>
mod?.toString()?.includes('"dropDownControlRef","description"'),
) as VFC<DropdownItemProps>;

View File

@@ -1,5 +1,6 @@
export * from './Button';
export * from './ButtonItem';
export * from './Dropdown';
export * from './Menu';
export * from './Modal';
export * from './Panel';