valueUtil.d.ts 1.1 KB

123456789101112131415161718192021222324
  1. import type { BaseOptionType, DefaultOptionType } from '../Select';
  2. import type { FieldNames } from '../Select';
  3. import type { FlattenOptionData } from '../interface';
  4. export declare function isValidCount(value?: number): boolean;
  5. export declare function fillFieldNames(fieldNames: FieldNames | undefined, childrenAsData: boolean): {
  6. label: string;
  7. value: string;
  8. options: string;
  9. groupLabel: string;
  10. };
  11. /**
  12. * Flat options into flatten list.
  13. * We use `optionOnly` here is aim to avoid user use nested option group.
  14. * Here is simply set `key` to the index if not provided.
  15. */
  16. export declare function flattenOptions<OptionType extends BaseOptionType = DefaultOptionType>(options: OptionType[], { fieldNames, childrenAsData }?: {
  17. fieldNames?: FieldNames;
  18. childrenAsData?: boolean;
  19. }): FlattenOptionData<OptionType>[];
  20. /**
  21. * Inject `props` into `option` for legacy usage
  22. */
  23. export declare function injectPropsWithOption<T extends object>(option: T): T;
  24. export declare const getSeparatedContent: (text: string, tokens: string[], end?: number) => string[];