Blame view

天文台pc/tianwentai-ui/node_modules/react-hook-form/dist/useWatch.d.ts 3.4 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  import { Control, DeepPartialSkipArrayKey, FieldPath, FieldPathValue, FieldPathValues, FieldValues } from './types';
  /**
   * Subscribe to the entire form values change and re-render at the hook level.
   *
   * @remarks
   *
   * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)
   *
   * @param props - defaultValue, disable subscription and match exact name.
   *
   * @example
   * ```tsx
   * const { control } = useForm();
   * const values = useWatch({
   *   control,
   *   defaultValue: {
   *     name: "data"
   *   },
   *   exact: false,
   * })
   * ```
   */
  export declare function useWatch<TFieldValues extends FieldValues = FieldValues, TTransformedValues = TFieldValues>(props: {
      defaultValue?: DeepPartialSkipArrayKey<TFieldValues>;
      control?: Control<TFieldValues, any, TTransformedValues>;
      disabled?: boolean;
      exact?: boolean;
  }): DeepPartialSkipArrayKey<TFieldValues>;
  /**
   * Custom hook to subscribe to field change and isolate re-rendering at the component level.
   *
   * @remarks
   *
   * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)
   *
   * @param props - defaultValue, disable subscription and match exact name.
   *
   * @example
   * ```tsx
   * const { control } = useForm();
   * const values = useWatch({
   *   control,
   *   name: "fieldA",
   *   defaultValue: "default value",
   *   exact: false,
   * })
   * ```
   */
  export declare function useWatch<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TTransformedValues = TFieldValues>(props: {
      name: TFieldName;
      defaultValue?: FieldPathValue<TFieldValues, TFieldName>;
      control?: Control<TFieldValues, any, TTransformedValues>;
      disabled?: boolean;
      exact?: boolean;
  }): FieldPathValue<TFieldValues, TFieldName>;
  /**
   * Custom hook to subscribe to field change and isolate re-rendering at the component level.
   *
   * @remarks
   *
   * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)
   *
   * @param props - defaultValue, disable subscription and match exact name.
   *
   * @example
   * ```tsx
   * const { control } = useForm();
   * const values = useWatch({
   *   control,
   *   name: ["fieldA", "fieldB"],
   *   defaultValue: {
   *     fieldA: "data",
   *     fieldB: "data"
   *   },
   *   exact: false,
   * })
   * ```
   */
  export declare function useWatch<TFieldValues extends FieldValues = FieldValues, TFieldNames extends readonly FieldPath<TFieldValues>[] = readonly FieldPath<TFieldValues>[], TTransformedValues = TFieldValues>(props: {
      name: readonly [...TFieldNames];
      defaultValue?: DeepPartialSkipArrayKey<TFieldValues>;
      control?: Control<TFieldValues, any, TTransformedValues>;
      disabled?: boolean;
      exact?: boolean;
  }): FieldPathValues<TFieldValues, TFieldNames>;
  /**
   * Custom hook to subscribe to field change and isolate re-rendering at the component level.
   *
   * @remarks
   *
   * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)
   *
   * @example
   * ```tsx
   * // can skip passing down the control into useWatch if the form is wrapped with the FormProvider
   * const values = useWatch()
   * ```
   */
  export declare function useWatch<TFieldValues extends FieldValues = FieldValues>(): DeepPartialSkipArrayKey<TFieldValues>;
  //# sourceMappingURL=useWatch.d.ts.map