|
1 | 1 | import { UseFieldApiComponentConfig, AnyObject } from "@data-driven-forms/react-form-renderer"; |
| 2 | +import { DualListSelectorProps } from "@patternfly/react-core"; |
2 | 3 | import { ReactNode } from "react"; |
3 | 4 | import FormGroupProps from "./form-group"; |
4 | | -import { FormGroupProps as FormGrpProps, ListProps, ToolbarProps, TextInputProps, ButtonProps, GridProps, GridItemProps, TextContentProps, FlexProps, FlexItemProps } from "@patternfly/react-core"; |
5 | | -import { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon"; |
6 | | - |
7 | 5 | export interface DualListSelectOption extends AnyObject { |
8 | | - value?: any; |
9 | | - label: ReactNode; |
10 | | -} |
11 | | - |
12 | | -export interface RenderStatusInput { |
13 | | - selected: number; |
14 | | - options: number; |
| 6 | + value: any; |
| 7 | + label: ReactNode | string; |
15 | 8 | } |
16 | 9 |
|
17 | | -export interface RenderStatusFunction { |
18 | | - (input: RenderStatusInput): ReactNode; |
19 | | -} |
| 10 | +export type GetValueFromNode = (node: ReactNode) => string; |
20 | 11 |
|
21 | 12 | interface InternalDualListSelectProps { |
22 | | - leftTitle?: ReactNode; |
23 | | - rightTitle?: ReactNode; |
24 | | - moveLeftTitle?: ReactNode; |
25 | | - moveRightTitle?: ReactNode; |
26 | | - allToLeft?: boolean; |
27 | | - allToRight?: boolean; |
28 | | - moveAllLeftTitle?: ReactNode; |
29 | | - moveAllRightTitle?: ReactNode; |
30 | | - label?: ReactNode; |
31 | | - isRequired?: boolean; |
32 | | - helperText?: ReactNode; |
33 | | - noValueTitle?: ReactNode; |
34 | | - noOptionsTitle?: ReactNode; |
35 | | - filterOptionsTitle?: ReactNode; |
36 | | - filterValueTitle?: ReactNode; |
37 | | - filterValueText?: ReactNode; |
38 | | - filterOptionsText?: ReactNode; |
39 | | - description?: ReactNode; |
40 | | - hideLabel?: boolean; |
41 | | - id?: string; |
42 | | - renderStatus?: RenderStatusFunction; |
43 | | - FormGroupProps: FormGrpProps, |
44 | | - ListProps: ListProps, |
45 | | - LeftListProps: ListProps, |
46 | | - RightListProps: ListProps, |
47 | | - ListItemProps: React.HTMLProps<HTMLDivElement>, |
48 | | - LeftListItemProps: React.HTMLProps<HTMLDivElement>, |
49 | | - RightListItemProps: React.HTMLProps<HTMLDivElement>, |
50 | | - ToolbarProps: ToolbarProps, |
51 | | - LeftToolbarProps: ToolbarProps, |
52 | | - RightToolbarProps: ToolbarProps, |
53 | | - FilterFieldProps: TextInputProps, |
54 | | - LeftFilterFieldProps: TextInputProps, |
55 | | - RightFilterFieldProps: TextInputProps, |
56 | | - SearchIconProps: SVGIconProps, |
57 | | - LeftSearchIconProps: SVGIconProps, |
58 | | - RightSearchIconProps: SVGIconProps, |
59 | | - SearchIconButtonProps: ButtonProps, |
60 | | - LeftSearchIconButtonProps: ButtonProps, |
61 | | - RightSearchIconButtonProps: ButtonProps, |
62 | | - SortIconButtonProps: ButtonProps, |
63 | | - LeftSortIconButtonProps: ButtonProps, |
64 | | - RightSortIconButtonProps: ButtonProps, |
65 | | - SortIconProps: SVGIconProps, |
66 | | - LeftSortIconProps: SVGIconProps, |
67 | | - RightSortIconProps: SVGIconProps, |
68 | | - InternalGridProps: GridProps, |
69 | | - ListGridProps: GridItemProps, |
70 | | - LeftListGridProps: GridItemProps, |
71 | | - RightListGridProps: GridItemProps, |
72 | | - TitleProps: TextContentProps, |
73 | | - LeftTitleProps: TextContentProps, |
74 | | - RightTitleProps: TextContentProps, |
75 | | - ButtonsGridProps: GridItemProps, |
76 | | - ButtonsInternalFlexProps: FlexProps, |
77 | | - ButtonFlexProps: FlexItemProps, |
78 | | - ToRightFlexProps: FlexItemProps, |
79 | | - IconButtonProps: ButtonProps, |
80 | | - ToRightIconButtonProps: ButtonProps, |
81 | | - IconProps: SVGIconProps, |
82 | | - AllToRightFlexProps: FlexItemProps, |
83 | | - AllToRightIconButtonProps: ButtonProps, |
84 | | - AllToLeftFlexProps: FlexProps, |
85 | | - AllToLeftIconButtonProps: ButtonProps, |
86 | | - ToLeftFlexProps: FlexProps, |
87 | | - ToLeftIconButtonProps: ButtonProps, |
88 | | - ToRightIconProps: SVGIconProps, |
89 | | - AllToRightIconProps: SVGIconProps, |
90 | | - AllToLeftIconProps: SVGIconProps, |
91 | | - ToLeftIconProps: SVGIconProps |
| 13 | + options: Array<DualListSelectOption | string>; |
| 14 | + getValueFromNode?: GetValueFromNode; |
| 15 | + isSortable?: boolean; |
92 | 16 | } |
93 | 17 |
|
94 | | -export type DualListSelectProps = InternalDualListSelectProps & FormGroupProps & UseFieldApiComponentConfig; |
| 18 | +export type DualListSelectProps = InternalDualListSelectProps & FormGroupProps & UseFieldApiComponentConfig & DualListSelectorProps; |
95 | 19 |
|
96 | 20 | declare const DualListSelect: React.ComponentType<DualListSelectProps>; |
97 | 21 |
|
|
0 commit comments