valueUtil.d.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import getValue from 'rc-util/lib/utils/get';
  2. import setValue from 'rc-util/lib/utils/set';
  3. import type { InternalNamePath, NamePath, Store, EventArgs } from '../interface';
  4. export { getValue, setValue };
  5. /**
  6. * Convert name to internal supported format.
  7. * This function should keep since we still thinking if need support like `a.b.c` format.
  8. * 'a' => ['a']
  9. * 123 => [123]
  10. * ['a', 123] => ['a', 123]
  11. */
  12. export declare function getNamePath(path: NamePath | null): InternalNamePath;
  13. export declare function cloneByNamePathList(store: Store, namePathList: InternalNamePath[]): Store;
  14. /**
  15. * Check if `namePathList` includes `namePath`.
  16. * @param namePathList A list of `InternalNamePath[]`
  17. * @param namePath Compare `InternalNamePath`
  18. * @param partialMatch True will make `[a, b]` match `[a, b, c]`
  19. */
  20. export declare function containsNamePath(namePathList: InternalNamePath[], namePath: InternalNamePath, partialMatch?: boolean): boolean;
  21. /**
  22. * Check if `namePath` is super set or equal of `subNamePath`.
  23. * @param namePath A list of `InternalNamePath[]`
  24. * @param subNamePath Compare `InternalNamePath`
  25. * @param partialMatch True will make `[a, b]` match `[a, b, c]`
  26. */
  27. export declare function matchNamePath(namePath: InternalNamePath, subNamePath: InternalNamePath | null, partialMatch?: boolean): boolean;
  28. type SimilarObject = string | number | object;
  29. export declare function isSimilar(source: SimilarObject, target: SimilarObject): boolean;
  30. export declare function defaultGetValueFromEvent(valuePropName: string, ...args: EventArgs): any;
  31. /**
  32. * Moves an array item from one position in an array to another.
  33. *
  34. * Note: This is a pure function so a new array will be returned, instead
  35. * of altering the array argument.
  36. *
  37. * @param array Array in which to move an item. (required)
  38. * @param moveIndex The index of the item to move. (required)
  39. * @param toIndex The index to move item at moveIndex to. (required)
  40. */
  41. export declare function move<T>(array: T[], moveIndex: number, toIndex: number): T[];