@sparklink-pro/apant
Version:
Apollo & Antd tools
55 lines • 2.05 kB
TypeScript
import * as React from 'react';
import { SelectProps, RadioGroupProps } from 'antd';
import { CheckboxGroupProps } from 'antd/lib/checkbox';
import { GraphQLType, GraphQLObject } from '../definitions';
type SelectTypeExtend<T> = T extends {
expand: true;
multiple?: false;
} ? RadioGroupProps : T extends {
expand: true;
multiple: true;
} ? CheckboxGroupProps : SelectProps;
export type SelectTypeProps<T> = {
type: GraphQLType;
column?: boolean;
isLoading?: boolean;
label?: string | ((object: GraphQLObject) => string | React.ReactNode);
search?: (object: GraphQLObject, search: string, context?: any) => boolean;
fragment?: string;
multiple?: boolean;
expand?: boolean;
filter?: (a: GraphQLObject) => boolean | ((b: GraphQLObject) => boolean)[];
extraOptions?: {
value: any;
label: string;
}[];
onOptions?: (options: {
value: any;
label: string;
}[]) => void;
} & Omit<SelectTypeExtend<T>, 'onChange' | 'options'>;
/**
* SelectType
* Returns a Select, Radio group or Checkbox group component with a list of options
*/
export declare const SelectType: React.ForwardRefExoticComponent<{
type: GraphQLType;
column?: boolean | undefined;
isLoading?: boolean | undefined;
label?: string | ((object: GraphQLObject) => string | React.ReactNode) | undefined;
search?: ((object: GraphQLObject, search: string, context?: any) => boolean) | undefined;
fragment?: string | undefined;
multiple?: boolean | undefined;
expand?: boolean | undefined;
filter?: ((a: GraphQLObject) => boolean | ((b: GraphQLObject) => boolean)[]) | undefined;
extraOptions?: {
value: any;
label: string;
}[] | undefined;
onOptions?: ((options: {
value: any;
label: string;
}[]) => void) | undefined;
} & Omit<SelectProps<any, import("rc-select/lib/Select").DefaultOptionType>, "onChange" | "options"> & React.RefAttributes<any>>;
export default SelectType;
//# sourceMappingURL=SelectType.d.ts.map