@dazhicheng/ui 1.5.6 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/components/tt-area/TtArea.vue.d.ts +2 -0
  2. package/dist/components/tt-area/index.d.ts +1 -0
  3. package/dist/components/tt-button/index.d.ts +1739 -0
  4. package/dist/components/tt-button/index.vue.d.ts +1004 -0
  5. package/dist/components/tt-checkbox/index.d.ts +36 -0
  6. package/dist/components/tt-checkbox/index.vue.d.ts +28 -0
  7. package/dist/components/tt-checkbox/type.d.ts +9 -0
  8. package/dist/components/tt-drawer/index.d.ts +3703 -0
  9. package/dist/components/tt-drawer/src/RenderDrawer.vue.d.ts +2121 -0
  10. package/dist/components/tt-drawer/src/components/DrawerFooter.vue.d.ts +94 -0
  11. package/dist/components/tt-drawer/src/components/DrawerHeader.vue.d.ts +27 -0
  12. package/dist/components/tt-drawer/src/hooks/useDrawerRender.d.ts +10 -0
  13. package/dist/components/tt-drawer/src/hooks/useResizable.d.ts +9 -0
  14. package/dist/components/tt-drawer/src/index.d.ts +10 -0
  15. package/dist/components/tt-drawer/src/props.d.ts +99 -0
  16. package/dist/components/tt-drawer/src/typing.d.ts +154 -0
  17. package/dist/components/tt-drawer/src/utils/drawer-api.d.ts +87 -0
  18. package/dist/components/tt-empty/index.d.ts +18 -0
  19. package/dist/components/tt-form/index.d.ts +13 -0
  20. package/dist/components/tt-form/src/components/ExpandableArrow.vue.d.ts +33 -0
  21. package/dist/components/tt-form/src/components/FormActions.vue.d.ts +34 -0
  22. package/dist/components/tt-form/src/components/Slot.d.ts +7 -0
  23. package/dist/components/tt-form/src/config.d.ts +6 -0
  24. package/dist/components/tt-form/src/form/FormControl.vue.d.ts +19 -0
  25. package/dist/components/tt-form/src/form/FormDescription.vue.d.ts +23 -0
  26. package/dist/components/tt-form/src/form/FormItem.vue.d.ts +23 -0
  27. package/dist/components/tt-form/src/form/FormLabel.vue.d.ts +23 -0
  28. package/dist/components/tt-form/src/form/FormMessage.vue.d.ts +2 -0
  29. package/dist/components/tt-form/src/form/FormMessageToolTip.vue.d.ts +8 -0
  30. package/dist/components/tt-form/src/form/FormWarnMessage.vue.d.ts +25 -0
  31. package/dist/components/tt-form/src/form/RenderContent.vue.d.ts +23 -0
  32. package/dist/components/tt-form/src/form/index.d.ts +10 -0
  33. package/dist/components/tt-form/src/form/injectionKeys.d.ts +2 -0
  34. package/dist/components/tt-form/src/form/useFormField.d.ts +11 -0
  35. package/dist/components/tt-form/src/form-render/FormField.vue.d.ts +28 -0
  36. package/dist/components/tt-form/src/form-render/FormLabel.vue.d.ts +27 -0
  37. package/dist/components/tt-form/src/form-render/context.d.ts +7 -0
  38. package/dist/components/tt-form/src/form-render/dependencies.d.ts +361 -0
  39. package/dist/components/tt-form/src/form-render/expandable.d.ts +9 -0
  40. package/dist/components/tt-form/src/form-render/form.vue.d.ts +38 -0
  41. package/dist/components/tt-form/src/form-render/helper.d.ts +11 -0
  42. package/dist/components/tt-form/src/form-render/index.d.ts +3 -0
  43. package/dist/components/tt-form/src/formApi.d.ts +71 -0
  44. package/dist/components/tt-form/src/hooks/useEmitAsProps.d.ts +7 -0
  45. package/dist/components/tt-form/src/hooks/useFormFieldBus.d.ts +14 -0
  46. package/dist/components/tt-form/src/hooks/useForwardPriorityValues.d.ts +14 -0
  47. package/dist/components/tt-form/src/hooks/useForwardProps.d.ts +7 -0
  48. package/dist/components/tt-form/src/hooks/useForwardPropsEmits.d.ts +8 -0
  49. package/dist/components/tt-form/src/index.vue.d.ts +27 -0
  50. package/dist/components/tt-form/src/shared/createContext.d.ts +8 -0
  51. package/dist/components/tt-form/src/shared/global-state.d.ts +17 -0
  52. package/dist/components/tt-form/src/shared/store.d.ts +1 -0
  53. package/dist/components/tt-form/src/shared/zod-defaults.d.ts +54 -0
  54. package/dist/components/tt-form/src/types/common.d.ts +11 -0
  55. package/dist/components/tt-form/src/types/forms.d.ts +280 -0
  56. package/dist/components/tt-form/src/types/index.d.ts +3 -0
  57. package/dist/components/tt-form/src/types/paths.d.ts +142 -0
  58. package/dist/components/tt-form/src/types/shared.d.ts +19 -0
  59. package/dist/components/tt-form/src/types.d.ts +383 -0
  60. package/dist/components/tt-form/src/useForm.d.ts +2 -0
  61. package/dist/components/tt-form/src/useFormContext.d.ts +12 -0
  62. package/dist/components/tt-form-item-error-tooltip/index.d.ts +1549 -0
  63. package/dist/components/tt-form-item-error-tooltip/index.vue.d.ts +784 -0
  64. package/dist/components/tt-icon/index.d.ts +76 -0
  65. package/dist/components/tt-icon/index.vue.d.ts +32 -0
  66. package/dist/components/tt-image/index.d.ts +127 -0
  67. package/dist/components/tt-image/src/components/ImageViewer.d.ts +89 -0
  68. package/dist/components/tt-image/tt-image.d.ts +126 -0
  69. package/dist/components/tt-loading/index.d.ts +16 -0
  70. package/dist/components/tt-loading/src/directive.d.ts +9 -0
  71. package/dist/components/tt-loading/src/loading.vue.d.ts +12 -0
  72. package/dist/components/tt-loading/src/service.d.ts +25 -0
  73. package/dist/components/tt-loading/src/type.d.ts +20 -0
  74. package/dist/components/tt-modal/index.d.ts +1809 -0
  75. package/dist/components/tt-modal/src/RenderModal.vue.d.ts +1008 -0
  76. package/dist/components/tt-modal/src/components/ModalFooter.vue.d.ts +210 -0
  77. package/dist/components/tt-modal/src/components/ModalHeader.vue.d.ts +31 -0
  78. package/dist/components/tt-modal/src/components/ModalWrapper.vue.d.ts +224 -0
  79. package/dist/components/tt-modal/src/hooks/useModalRender.d.ts +110 -0
  80. package/dist/components/tt-modal/src/index.d.ts +5 -0
  81. package/dist/components/tt-modal/src/props.d.ts +161 -0
  82. package/dist/components/tt-modal/src/typing.d.ts +188 -0
  83. package/dist/components/tt-modal/src/utils/modal-api.d.ts +97 -0
  84. package/dist/components/tt-part/index.d.ts +398 -0
  85. package/dist/components/tt-part/index.vue.d.ts +253 -0
  86. package/dist/components/tt-part/type.d.ts +100 -0
  87. package/dist/components/tt-part-item/index.d.ts +105 -0
  88. package/dist/components/tt-part-item/index.vue.d.ts +71 -0
  89. package/dist/components/tt-part-item/type.d.ts +81 -0
  90. package/dist/components/tt-select/index.d.ts +7 -0
  91. package/dist/components/tt-select/src/Select.vue.d.ts +861 -0
  92. package/dist/components/tt-select/src/components/SelectTable.vue.d.ts +111 -0
  93. package/dist/components/tt-select/src/components/Table.vue.d.ts +250 -0
  94. package/dist/components/tt-select/src/const.d.ts +16 -0
  95. package/dist/components/tt-select/src/hooks/useDataSource.d.ts +115 -0
  96. package/dist/components/tt-select/src/hooks/useGrid.d.ts +32 -0
  97. package/dist/components/tt-select/src/hooks/useKeyboard.d.ts +59 -0
  98. package/dist/components/tt-select/src/hooks/usePagination.d.ts +16 -0
  99. package/dist/components/tt-select/src/hooks/useSelect.d.ts +87 -0
  100. package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +178 -0
  101. package/dist/components/tt-select/src/props.d.ts +190 -0
  102. package/dist/components/tt-select/src/types/index.d.ts +142 -0
  103. package/dist/components/tt-select/src/utils/index.d.ts +9 -0
  104. package/dist/components/tt-table/index.d.ts +127 -0
  105. package/dist/components/tt-table/src/Table.vue.d.ts +1685 -0
  106. package/dist/components/tt-table/src/componentMap.d.ts +8 -0
  107. package/dist/components/tt-table/src/components/RowContext.d.ts +24 -0
  108. package/dist/components/tt-table/src/components/TableAction.vue.d.ts +79 -0
  109. package/dist/components/tt-table/src/components/TableButtons.d.ts +30 -0
  110. package/dist/components/tt-table/src/components/TableColumnModal.vue.d.ts +26 -0
  111. package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +1531 -0
  112. package/dist/components/tt-table/src/emits.d.ts +1 -0
  113. package/dist/components/tt-table/src/enum.d.ts +2 -0
  114. package/dist/components/tt-table/src/hooks/useCellArea.d.ts +15 -0
  115. package/dist/components/tt-table/src/hooks/useColumns.d.ts +27 -0
  116. package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +20 -0
  117. package/dist/components/tt-table/src/hooks/useDataSource.d.ts +29 -0
  118. package/dist/components/tt-table/src/hooks/useLeftRightSlot.d.ts +1082 -0
  119. package/dist/components/tt-table/src/hooks/usePagination.d.ts +102 -0
  120. package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +30 -0
  121. package/dist/components/tt-table/src/hooks/useTable.d.ts +7 -0
  122. package/dist/components/tt-table/src/hooks/useTableContext.d.ts +43 -0
  123. package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +101 -0
  124. package/dist/components/tt-table/src/hooks/useTableForm.d.ts +15 -0
  125. package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +10 -0
  126. package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +15 -0
  127. package/dist/components/tt-table/src/hooks/useTableRender.d.ts +93 -0
  128. package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +11 -0
  129. package/dist/components/tt-table/src/props.d.ts +433 -0
  130. package/dist/components/tt-table/src/toolProps.d.ts +19 -0
  131. package/dist/components/tt-table/src/types/table.d.ts +489 -0
  132. package/dist/components/tt-table/src/types/tableAction.d.ts +26 -0
  133. package/dist/components/tt-table/src/types/tableForm.d.ts +64 -0
  134. package/dist/components/tt-table/src/types/tableTools.d.ts +10 -0
  135. package/dist/components/tt-table/src/utils/context.d.ts +18 -0
  136. package/dist/components/tt-table/src/utils/filters.d.ts +109 -0
  137. package/dist/components/tt-table/src/utils/table-api.d.ts +250 -0
  138. package/dist/components/tt-table/src/utils/table-form-api.d.ts +88 -0
  139. package/dist/components/tt-table/src/utils/vxeTable.d.ts +28 -0
  140. package/dist/components/tt-text/index.d.ts +76 -0
  141. package/dist/components/tt-text/index.vue.d.ts +50 -0
  142. package/dist/components/tt-tree-select/index.d.ts +5 -0
  143. package/dist/components/tt-tree-select/src/TtTreeSelect.vue.d.ts +6 -0
  144. package/dist/components/tt-tree-select/src/cache-options.d.ts +35 -0
  145. package/dist/components/tt-tree-select/src/select.d.ts +10 -0
  146. package/dist/components/tt-tree-select/src/tree.d.ts +23 -0
  147. package/dist/components/tt-tree-select/src/utils.d.ts +10 -0
  148. package/dist/components/tt-validate/index.d.ts +1 -0
  149. package/dist/components/tt-validate/src/ErrorMessage.d.ts +61 -0
  150. package/dist/components/tt-validate/src/Field.d.ts +430 -0
  151. package/dist/components/tt-validate/src/FieldArray.d.ts +47 -0
  152. package/dist/components/tt-validate/src/Form.d.ts +271 -0
  153. package/dist/components/tt-validate/src/config.d.ts +14 -0
  154. package/dist/components/tt-validate/src/defineRule.d.ts +9 -0
  155. package/dist/components/tt-validate/src/index.d.ts +36 -0
  156. package/dist/components/tt-validate/src/symbols.d.ts +6 -0
  157. package/dist/components/tt-validate/src/types/common.d.ts +11 -0
  158. package/dist/components/tt-validate/src/types/forms.d.ts +280 -0
  159. package/dist/components/tt-validate/src/types/index.d.ts +3 -0
  160. package/dist/components/tt-validate/src/types/paths.d.ts +142 -0
  161. package/dist/components/tt-validate/src/types/shared.d.ts +19 -0
  162. package/dist/components/tt-validate/src/useField.d.ts +30 -0
  163. package/dist/components/tt-validate/src/useFieldArray.d.ts +3 -0
  164. package/dist/components/tt-validate/src/useFieldError.d.ts +5 -0
  165. package/dist/components/tt-validate/src/useFieldState.d.ts +47 -0
  166. package/dist/components/tt-validate/src/useFieldValue.d.ts +5 -0
  167. package/dist/components/tt-validate/src/useForm.d.ts +23 -0
  168. package/dist/components/tt-validate/src/useFormErrors.d.ts +4 -0
  169. package/dist/components/tt-validate/src/useFormValues.d.ts +4 -0
  170. package/dist/components/tt-validate/src/useIsFieldDirty.d.ts +5 -0
  171. package/dist/components/tt-validate/src/useIsFieldTouched.d.ts +5 -0
  172. package/dist/components/tt-validate/src/useIsFieldValid.d.ts +5 -0
  173. package/dist/components/tt-validate/src/useIsFormDirty.d.ts +4 -0
  174. package/dist/components/tt-validate/src/useIsFormTouched.d.ts +4 -0
  175. package/dist/components/tt-validate/src/useIsFormValid.d.ts +4 -0
  176. package/dist/components/tt-validate/src/useIsSubmitting.d.ts +4 -0
  177. package/dist/components/tt-validate/src/useIsValidating.d.ts +4 -0
  178. package/dist/components/tt-validate/src/useResetForm.d.ts +2 -0
  179. package/dist/components/tt-validate/src/useSetFieldError.d.ts +5 -0
  180. package/dist/components/tt-validate/src/useSetFieldTouched.d.ts +5 -0
  181. package/dist/components/tt-validate/src/useSetFieldValue.d.ts +5 -0
  182. package/dist/components/tt-validate/src/useSetFormErrors.d.ts +4 -0
  183. package/dist/components/tt-validate/src/useSetFormTouched.d.ts +4 -0
  184. package/dist/components/tt-validate/src/useSetFormValues.d.ts +4 -0
  185. package/dist/components/tt-validate/src/useSubmitCount.d.ts +4 -0
  186. package/dist/components/tt-validate/src/useSubmitForm.d.ts +2 -0
  187. package/dist/components/tt-validate/src/useValidateField.d.ts +6 -0
  188. package/dist/components/tt-validate/src/useValidateForm.d.ts +5 -0
  189. package/dist/components/tt-validate/src/utils/assertions.d.ts +54 -0
  190. package/dist/components/tt-validate/src/utils/common.d.ts +48 -0
  191. package/dist/components/tt-validate/src/utils/events.d.ts +1 -0
  192. package/dist/components/tt-validate/src/utils/index.d.ts +5 -0
  193. package/dist/components/tt-validate/src/utils/rules.d.ts +13 -0
  194. package/dist/components/tt-validate/src/utils/shared.d.ts +19 -0
  195. package/dist/components/tt-validate/src/utils/vnode.d.ts +22 -0
  196. package/dist/components/tt-validate/src/validate.d.ts +21 -0
  197. package/dist/components/tt-validate/zod/index.d.ts +1 -0
  198. package/dist/components/types.d.ts +227 -0
  199. package/dist/directives/auto-tip/index.d.ts +3 -0
  200. package/dist/directives/dialog-resize/index.d.ts +25 -0
  201. package/dist/directives/dialog-resize/use-css-variable.d.ts +1 -0
  202. package/dist/directives/dialog-resize/use-draggable.d.ts +4 -0
  203. package/dist/directives/dialog-resize/use-fullscreen.d.ts +1 -0
  204. package/dist/directives/dialog-resize/use-parse-translate.d.ts +4 -0
  205. package/dist/directives/dialog-resize/use-resizer.d.ts +2 -0
  206. package/dist/directives/disabled-tip/index.d.ts +17 -0
  207. package/dist/directives/index.d.ts +3 -0
  208. package/dist/hooks/useFormat.d.ts +73 -0
  209. package/dist/hooks/useLoading.d.ts +9 -0
  210. package/dist/hooks/useSetup.d.ts +8 -0
  211. package/dist/hooks/useTable.d.ts +5 -0
  212. package/dist/hooks/useTemplateSlot.d.ts +9 -0
  213. package/dist/{index-CMjNBMj5.js → index-NG5FNCLD.js} +2 -3
  214. package/dist/index.d.ts +46 -0
  215. package/dist/index.js +502 -542
  216. package/dist/style.css +1 -1
  217. package/package.json +4 -6
@@ -0,0 +1,142 @@
1
+ type BrowserNativeObject = Date | FileList | File;
2
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
3
+ /**
4
+ * Checks whether the type is any
5
+ * See {@link https://stackoverflow.com/a/49928360/3406963}
6
+ * @typeParam T - type which may be any
7
+ * ```
8
+ * IsAny<any> = true
9
+ * IsAny<string> = false
10
+ * ```
11
+ */
12
+ export type IsAny<T> = 0 extends 1 & T ? true : false;
13
+ /**
14
+ * Checks whether T1 can be exactly (mutually) assigned to T2
15
+ * @typeParam T1 - type to check
16
+ * @typeParam T2 - type to check against
17
+ * ```
18
+ * IsEqual<string, string> = true
19
+ * IsEqual<'foo', 'foo'> = true
20
+ * IsEqual<string, number> = false
21
+ * IsEqual<string, number> = false
22
+ * IsEqual<string, 'foo'> = false
23
+ * IsEqual<'foo', string> = false
24
+ * IsEqual<'foo' | 'bar', 'foo'> = boolean // 'foo' is assignable, but 'bar' is not (true | false) -> boolean
25
+ * ```
26
+ */
27
+ export type IsEqual<T1, T2> = T1 extends T2 ? (<G>() => G extends T1 ? 1 : 2) extends <G>() => G extends T2 ? 1 : 2 ? true : false : false;
28
+ /**
29
+ * Type to query whether an array type T is a tuple type.
30
+ * @typeParam T - type which may be an array or tuple
31
+ * @example
32
+ * ```
33
+ * IsTuple<[number]> = true
34
+ * IsTuple<number[]> = false
35
+ * ```
36
+ */
37
+ type IsTuple<T extends ReadonlyArray<any>> = number extends T['length'] ? false : true;
38
+ /**
39
+ * Type which can be used to index an array or tuple type.
40
+ */
41
+ type ArrayKey = number;
42
+ /**
43
+ * Helper function to break apart T1 and check if any are equal to T2
44
+ *
45
+ * See {@link IsEqual}
46
+ */
47
+ type AnyIsEqual<T1, T2> = T1 extends T2 ? (IsEqual<T1, T2> extends true ? true : never) : never;
48
+ /**
49
+ * Type which given a tuple type returns its own keys, i.e. only its indices.
50
+ * @typeParam T - tuple type
51
+ * @example
52
+ * ```
53
+ * TupleKeys<[number, string]> = '0' | '1'
54
+ * ```
55
+ */
56
+ type TupleKeys<T extends ReadonlyArray<any>> = Exclude<keyof T, keyof any[]>;
57
+ /**
58
+ * Helper type to construct tuple key paths and recurse into its elements.
59
+ *
60
+ * See {@link Path}
61
+ */
62
+ type PathInternalTuple<TValue extends ReadonlyArray<any>, TraversedTypes> = {
63
+ [Key in TupleKeys<TValue> & string]: `[${Key}]` | `[${Key}]${PathInternal<TValue[Key], TraversedTypes, false>}`;
64
+ }[TupleKeys<TValue> & string];
65
+ /**
66
+ * Helper type to construct array key paths and recurse into its elements.
67
+ *
68
+ * See {@link Path}
69
+ */
70
+ type PathInternalArray<TValue extends ReadonlyArray<any>, TraversedTypes> = `[${ArrayKey}]` | `[${ArrayKey}]${PathInternal<TValue[ArrayKey], TraversedTypes, false>}`;
71
+ /**
72
+ * Helper type to construct object key paths and recurse into its nested values.
73
+ *
74
+ * See {@link Path}
75
+ */
76
+ type PathInternalObject<TValue, TraversedTypes, First extends boolean> = {
77
+ [Key in keyof TValue & string]: First extends true ? `${Key}` | `${Key}${PathInternal<TValue[Key], TraversedTypes, false>}` : `.${Key}` | `.${Key}${PathInternal<TValue[Key], TraversedTypes, false>}`;
78
+ }[keyof TValue & string];
79
+ /**
80
+ * Helper type to construct nested any object key paths.
81
+ *
82
+ * See {@link Path}
83
+ */
84
+ type PathInternalAny = `.${string}` | `[${string}]` | `[${string}].${string}`;
85
+ /**
86
+ * Helper type for recursively constructing paths through a type.
87
+ *
88
+ * This obscures internal type params TraversedTypes and First from ed contract.
89
+ *
90
+ * See {@link Path}
91
+ */
92
+ type PathInternal<TValue, TraversedTypes, First extends boolean> = TValue extends Primitive | BrowserNativeObject ? IsAny<TValue> extends true ? PathInternalAny : never : TValue extends ReadonlyArray<any> ? true extends AnyIsEqual<TraversedTypes, TValue> ? never : IsTuple<TValue> extends true ? PathInternalTuple<TValue, TraversedTypes | TValue> : PathInternalArray<TValue, TraversedTypes | TValue> : TValue extends Record<string, any> ? PathInternalObject<TValue, TraversedTypes | TValue, First> : '';
93
+ /**
94
+ * Helper type for recursively constructing paths through a type.
95
+ * This actually constructs the strings and recurses into nested
96
+ * object types.
97
+ *
98
+ * See {@link ArrayPath}
99
+ */
100
+ type ArrayPathImpl<K extends string | number, V, TraversedTypes> = V extends Primitive | BrowserNativeObject ? IsAny<V> extends true ? string : never : V extends ReadonlyArray<infer U> ? U extends Primitive | BrowserNativeObject ? IsAny<V> extends true ? string : never : true extends AnyIsEqual<TraversedTypes, V> ? never : `${K}` | `${K}.${ArrayPathInternal<V, TraversedTypes | V>}` : true extends AnyIsEqual<TraversedTypes, V> ? never : `${K}.${ArrayPathInternal<V, TraversedTypes | V>}`;
101
+ /**
102
+ * Helper type for recursively constructing paths through a type.
103
+ * This obscures the internal type param TraversedTypes from ed contract.
104
+ *
105
+ * See {@link ArrayPath}
106
+ */
107
+ type ArrayPathInternal<T, TraversedTypes = T> = T extends ReadonlyArray<infer V> ? IsTuple<T> extends true ? {
108
+ [K in TupleKeys<T>]-?: ArrayPathImpl<K & string, T[K], TraversedTypes>;
109
+ }[TupleKeys<T>] : ArrayPathImpl<ArrayKey, V, TraversedTypes> : {
110
+ [K in keyof T]-?: ArrayPathImpl<K & string, T[K], TraversedTypes>;
111
+ }[keyof T];
112
+ /**
113
+ * Type which eagerly collects all paths through a type which point to an array
114
+ * type.
115
+ * @typeParam T - type which should be introspected.
116
+ * @example
117
+ * ```
118
+ * Path<{foo: {bar: string[], baz: number[]}}> = 'foo.bar' | 'foo.baz'
119
+ * ```
120
+ */
121
+ type ArrayPath<T> = T extends any ? ArrayPathInternal<T> : never;
122
+ /**
123
+ * Type to evaluate the type which the given path points to.
124
+ * @typeParam T - deeply nested type which is indexed by the path
125
+ * @typeParam P - path into the deeply nested type
126
+ * @example
127
+ * ```
128
+ * PathValue<{foo: {bar: string}}, 'foo.bar'> = string
129
+ * PathValue<[number, string], '1'> = string
130
+ * ```
131
+ */
132
+ export type PathValue<T, P extends Path<T> | ArrayPath<T>> = T extends any ? P extends `${infer K}.${infer R}` ? K extends keyof T ? R extends Path<T[K]> ? PathValue<T[K], R> : never : K extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? PathValue<V, R & Path<V>> : never : never : P extends keyof T ? T[P] : P extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? V : never : never : never;
133
+ /**
134
+ * Type which eagerly collects all paths through a type
135
+ * @typeParam T - type which should be introspected
136
+ * @example
137
+ * ```
138
+ * Path<{foo: {bar: string}}> = 'foo' | 'foo.bar'
139
+ * ```
140
+ */
141
+ export type Path<T> = T extends any ? PathInternal<T, T, true> & string : never;
142
+ export {};
@@ -0,0 +1,19 @@
1
+ export type FieldValidationMetaInfo = {
2
+ field: string;
3
+ name: string;
4
+ label?: string;
5
+ value: unknown;
6
+ form: Record<string, unknown>;
7
+ rule?: {
8
+ name: string;
9
+ params?: Record<string, unknown> | unknown[];
10
+ };
11
+ };
12
+ export type ValidationRuleFunction<TValue = unknown, TParams = unknown[] | Record<string, unknown>> = (value: TValue, params: TParams, ctx: FieldValidationMetaInfo) => boolean | string | Promise<boolean | string>;
13
+ export type SimpleValidationRuleFunction<TValue = unknown, TParams = unknown[] | Record<string, unknown>> = (value: TValue, params: TParams) => boolean | string | Promise<boolean | string>;
14
+ export type ValidationMessageGenerator = (ctx: FieldValidationMetaInfo) => string;
15
+ export type Optional<T> = T extends Record<string, any> ? Partial<T> : T | undefined;
16
+ export type InterpolateOptions = {
17
+ prefix: string;
18
+ suffix: string;
19
+ };
@@ -0,0 +1,30 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { MaybeRef, MaybeRefOrGetter } from 'vue';
3
+ import { FieldContext, FormContext, GenericValidateFunction, InputType } from './types';
4
+ export type FieldOptions<TValue = unknown> = {
5
+ initialValue?: MaybeRef<TValue>;
6
+ validateOnModelUpdate: boolean;
7
+ validateOnMount?: boolean;
8
+ bails?: boolean;
9
+ type?: InputType;
10
+ checkedValue?: MaybeRefOrGetter<TValue>;
11
+ uncheckedValue?: MaybeRefOrGetter<TValue>;
12
+ label?: MaybeRefOrGetter<string | undefined>;
13
+ controlled?: boolean;
14
+ keepValueOnUnmount?: MaybeRefOrGetter<boolean | undefined>;
15
+ syncVModel?: boolean | string;
16
+ form?: FormContext;
17
+ validateOnZodRefine?: boolean;
18
+ rulesBlur?: MaybeRef<RuleExpression<TValue>>;
19
+ /**
20
+ * 在判断 dirty 状态时需要排除的字段列表(仅对对象类型有效)
21
+ * @example
22
+ * excludeKeys: ['_timestamp']
23
+ */
24
+ excludeKeys?: string[];
25
+ };
26
+ export type RuleExpression<TValue> = string | Record<string, unknown> | GenericValidateFunction<TValue> | GenericValidateFunction<TValue>[] | StandardSchemaV1<TValue> | undefined;
27
+ /**
28
+ * Creates a field composite.
29
+ */
30
+ export declare function useField<TValue = unknown>(path: MaybeRefOrGetter<string>, rules?: MaybeRef<RuleExpression<TValue>>, opts?: Partial<FieldOptions<TValue>>): FieldContext<TValue>;
@@ -0,0 +1,3 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ import { FieldArrayContext } from './types';
3
+ export declare function useFieldArray<TValue = unknown>(arrayPath: MaybeRefOrGetter<string>): FieldArrayContext<TValue>;
@@ -0,0 +1,5 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * Gives access to a single field error
4
+ */
5
+ export declare function useFieldError(path?: MaybeRefOrGetter<string>): import('vue').ComputedRef<string | undefined>;
@@ -0,0 +1,47 @@
1
+ import { MaybeRef, MaybeRefOrGetter, Ref } from 'vue';
2
+ import { FieldMeta, FieldState, FieldValidator, InputType, PathState, PrivateFormContext } from './types';
3
+ export type StateSetterInit<TValue = unknown> = {
4
+ initialValue: TValue;
5
+ } & FieldState<TValue>;
6
+ export type FieldStateComposable<TValue = unknown> = {
7
+ id: number;
8
+ path: MaybeRef<string>;
9
+ meta: FieldMeta<TValue>;
10
+ value: Ref<TValue>;
11
+ flags: PathState['__flags'];
12
+ initialValue: Ref<TValue>;
13
+ errors: Ref<string[]>;
14
+ setState: (state: Partial<StateSetterInit<TValue>>) => void;
15
+ };
16
+ export type StateInit<TInput = unknown, TOutput = TInput> = {
17
+ modelValue: MaybeRef<TInput>;
18
+ form?: PrivateFormContext;
19
+ bails: boolean;
20
+ label?: MaybeRefOrGetter<string | undefined>;
21
+ type?: InputType;
22
+ validate?: FieldValidator<TOutput>;
23
+ /**
24
+ * 在判断 dirty 状态时需要排除的字段列表(仅对对象类型有效)
25
+ * @example
26
+ * excludeKeys: ['_timestamp']
27
+ */
28
+ excludeKeys?: string[];
29
+ };
30
+ export declare function useFieldState<TValue = unknown>(path: MaybeRef<string>, init: Partial<StateInit<TValue>>): FieldStateComposable<TValue>;
31
+ type FieldValueComposable<TValue = unknown> = {
32
+ value: Ref<TValue>;
33
+ initialValue: Ref<TValue>;
34
+ setInitialValue: (value: TValue) => void;
35
+ };
36
+ /**
37
+ * Creates the field value and resolves the initial value
38
+ */
39
+ export declare function _useFieldValue<TValue = unknown>(path: MaybeRef<string>, modelValue?: MaybeRef<TValue>, form?: PrivateFormContext): FieldValueComposable<TValue>;
40
+ /**
41
+ * Creates the error message state for the field state
42
+ */
43
+ export declare function createFieldErrors(): {
44
+ errors: Ref<string[], string[]>;
45
+ setErrors: (messages: string | string[] | null | undefined) => void;
46
+ };
47
+ export {};
@@ -0,0 +1,5 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * Gives access to a field's current value
4
+ */
5
+ export declare function useFieldValue<TValue = unknown>(path?: MaybeRefOrGetter<string>): import('vue').ComputedRef<TValue>;
@@ -0,0 +1,23 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { MaybeRef } from 'vue';
3
+ import { FlattenAndSetPathsType, FormContext, GenericObject, GenericValidateFunction } from './types';
4
+ type FormSchema<TValues extends Record<string, unknown>> = FlattenAndSetPathsType<TValues, GenericValidateFunction | string | GenericObject> | undefined;
5
+ export type FormOptions<TValues extends GenericObject, TOutput = TValues, TSchema extends StandardSchemaV1<TValues, TOutput> | FormSchema<TValues> = FormSchema<TValues>> = {
6
+ validationSchema?: MaybeRef<TSchema extends StandardSchemaV1 ? StandardSchemaV1<TValues, TOutput> : any>;
7
+ initialValues?: Partial<TValues> | undefined | null;
8
+ initialErrors?: FlattenAndSetPathsType<TValues, string | undefined>;
9
+ initialTouched?: FlattenAndSetPathsType<TValues, boolean>;
10
+ validateOnMount?: boolean;
11
+ keepValuesOnUnmount?: MaybeRef<boolean>;
12
+ name?: string;
13
+ /**
14
+ * 在判断 dirty 状态时需要排除的字段列表
15
+ * 这些字段的变化不会影响表单的 dirty 状态
16
+ * @example
17
+ * excludeKeys: ['_timestamp', '_validationToken']
18
+ */
19
+ excludeKeys?: string[];
20
+ };
21
+ export declare function useForm<TValues extends GenericObject = GenericObject, TOutput extends GenericObject = TValues, TSchema extends FormSchema<TValues> | StandardSchemaV1<TValues, TOutput> = FormSchema<TValues>>(opts?: FormOptions<TValues, TOutput, TSchema>): FormContext<TValues, TOutput>;
22
+ export declare function useFormContext<TValues extends GenericObject = GenericObject, TOutput extends GenericObject = TValues>(): FormContext<TValues, TOutput>;
23
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Gives access to all form errors
3
+ */
4
+ export declare function useFormErrors<TValues extends Record<string, unknown> = Record<string, unknown>>(): import('vue').ComputedRef<Partial<Record<"" | import('./types').Path<TValues>, string | undefined>>>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Gives access to a form's values
3
+ */
4
+ export declare function useFormValues<TValues extends Record<string, any> = Record<string, any>>(): import('vue').ComputedRef<Partial<TValues>>;
@@ -0,0 +1,5 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * If a field is dirty or not
4
+ */
5
+ export declare function useIsFieldDirty(path?: MaybeRefOrGetter<string>): import('vue').ComputedRef<boolean>;
@@ -0,0 +1,5 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * If a field is touched or not
4
+ */
5
+ export declare function useIsFieldTouched(path?: MaybeRefOrGetter<string>): import('vue').ComputedRef<boolean>;
@@ -0,0 +1,5 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * If a field is validated and is valid
4
+ */
5
+ export declare function useIsFieldValid(path?: MaybeRefOrGetter<string>): import('vue').ComputedRef<boolean>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * If the form is dirty or not
3
+ */
4
+ export declare function useIsFormDirty(): import('vue').ComputedRef<boolean>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * If the form is touched or not
3
+ */
4
+ export declare function useIsFormTouched(): import('vue').ComputedRef<boolean>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * If the form has been validated and is valid
3
+ */
4
+ export declare function useIsFormValid(): import('vue').ComputedRef<boolean>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * If the form is submitting or not
3
+ */
4
+ export declare function useIsSubmitting(): import('vue').ComputedRef<boolean>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * If the form is validating or not
3
+ */
4
+ export declare function useIsValidating(): import('vue').ComputedRef<boolean>;
@@ -0,0 +1,2 @@
1
+ import { FormState, ResetFormOpts } from './types';
2
+ export declare function useResetForm<TValues extends Record<string, unknown> = Record<string, unknown>>(): (state?: Partial<FormState<TValues>>, opts?: ResetFormOpts) => void;
@@ -0,0 +1,5 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * Sets a field's error message
4
+ */
5
+ export declare function useSetFieldError(path?: MaybeRefOrGetter<string>): (message: string | string[] | undefined) => void;
@@ -0,0 +1,5 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * Sets a field's touched meta state
4
+ */
5
+ export declare function useSetFieldTouched(path?: MaybeRefOrGetter<string>): (touched: boolean) => void;
@@ -0,0 +1,5 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * Sets a field's value
4
+ */
5
+ export declare function useSetFieldValue<TValue = unknown>(path?: MaybeRefOrGetter<string>): (value: TValue, shouldValidate?: boolean) => void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Sets multiple fields errors
3
+ */
4
+ export declare function useSetFormErrors(): (fields: Record<string, string | string[] | undefined>) => void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Sets multiple fields touched or all fields in the form
3
+ */
4
+ export declare function useSetFormTouched(): (fields: Record<string, boolean> | boolean) => void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Sets multiple fields values
3
+ */
4
+ export declare function useSetFormValues<TValues extends Record<string, unknown> = Record<string, unknown>>(): (fields: TValues, shouldValidate?: boolean) => void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The number of form's submission count
3
+ */
4
+ export declare function useSubmitCount(): import('vue').ComputedRef<number>;
@@ -0,0 +1,2 @@
1
+ import { SubmissionHandler } from './types';
2
+ export declare function useSubmitForm<TValues extends Record<string, unknown> = Record<string, unknown>>(cb: SubmissionHandler<TValues>): (e?: Event) => Promise<unknown> | undefined;
@@ -0,0 +1,6 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ import { ValidationResult } from './types';
3
+ /**
4
+ * Validates a single field
5
+ */
6
+ export declare function useValidateField<TOutput>(path?: MaybeRefOrGetter<string>): () => Promise<ValidationResult<TOutput>>;
@@ -0,0 +1,5 @@
1
+ import { FormValidationResult } from './types';
2
+ /**
3
+ * Validate multiple fields
4
+ */
5
+ export declare function useValidateForm<TValues extends Record<string, unknown> = Record<string, unknown>>(): () => Promise<FormValidationResult<TValues>>;
@@ -0,0 +1,54 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { Locator } from '../types';
3
+ export declare const isClient: boolean;
4
+ export declare function isLocator(value: unknown): value is Locator;
5
+ export declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
6
+ export declare function hasCheckedAttr(type: unknown): type is "checkbox" | "radio";
7
+ export declare function isContainerValue(value: unknown): value is Record<string, unknown>;
8
+ /**
9
+ * True if the value is an empty object or array
10
+ */
11
+ export declare function isEmptyContainer(value: unknown): boolean;
12
+ /**
13
+ * Checks if the path opted out of nested fields using `[fieldName]` syntax
14
+ */
15
+ export declare function isNotNestedPath(path: string): boolean;
16
+ /**
17
+ * Checks if an element is a native HTML5 multi-select input element
18
+ */
19
+ export declare function isNativeMultiSelect(el: HTMLElement): el is HTMLSelectElement;
20
+ /**
21
+ * Checks if an element is a native HTML5 select input element
22
+ */
23
+ export declare function isNativeSelect(el: HTMLElement): el is HTMLSelectElement;
24
+ /**
25
+ * Checks if a tag name with attrs object will render a native multi-select element
26
+ */
27
+ export declare function isNativeMultiSelectNode(tag: string, attrs: Record<string, unknown>): boolean;
28
+ /**
29
+ * Checks if a node should have a `:value` binding or not
30
+ *
31
+ * These nodes should not have a value binding
32
+ * For files, because they are not reactive
33
+ * For multi-selects because the value binding will reset the value
34
+ */
35
+ export declare function shouldHaveValueBinding(tag: string, attrs: Record<string, unknown>): boolean;
36
+ export declare function isFormSubmitEvent(evt: unknown): evt is Event & {
37
+ target: HTMLFormElement;
38
+ };
39
+ export declare function isEvent(evt: unknown): evt is Event;
40
+ export declare function isPropPresent(obj: Record<string, unknown>, prop: string): boolean;
41
+ export declare function deepEqual<T>(a: T, b: T): boolean;
42
+ export declare const isEqual: typeof deepEqual;
43
+ /**
44
+ * 比较两个值是否相等,支持排除指定字段
45
+ * @param a - 第一个值
46
+ * @param b - 第二个值
47
+ * @param excludeKeys - 需要排除的字段数组(可选)
48
+ * @returns 是否相等
49
+ * @example
50
+ * isEqualExclude({ a: 1, b: 2 }, { a: 1, b: 3 }, ['b']) // true
51
+ * isEqualExclude({ a: 1, b: 2 }, { a: 1, b: 3 }) // false
52
+ */
53
+ export declare function isEqualExclude<T>(a: T, b: T, excludeKeys?: string[]): boolean;
54
+ export declare function isFile(a: unknown): a is File;
@@ -0,0 +1,48 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { InjectionKey, MaybeRefOrGetter, Ref } from 'vue';
3
+ import { GenericObject, IssueCollection, MaybePromise } from '../types';
4
+ export declare function cleanupNonNestedPath(path: string): string;
5
+ type NestedRecord = GenericObject;
6
+ /**
7
+ * Gets a nested property value from an object
8
+ */
9
+ export declare function getFromPath<TValue = unknown>(object: NestedRecord | undefined, path: string): TValue | undefined;
10
+ export declare function getFromPath<TValue = unknown, TFallback = TValue>(object: NestedRecord | undefined, path: string, fallback?: TFallback): TValue | TFallback;
11
+ /**
12
+ * Sets a nested property value in a path, creates the path properties if it doesn't exist
13
+ */
14
+ export declare function setInPath(object: NestedRecord, path: string, value: unknown): void;
15
+ /**
16
+ * Removes a nested property from object
17
+ */
18
+ export declare function unsetPath(object: NestedRecord, path: string): void;
19
+ /**
20
+ * A typed version of Object.keys
21
+ */
22
+ export declare function keysOf<TRecord extends Record<string, unknown>>(record: TRecord): (keyof TRecord)[];
23
+ export declare function injectWithSelf<T>(symbol: InjectionKey<T>, def?: T | undefined): T | undefined;
24
+ export declare function warn(message: string): void;
25
+ export declare function resolveNextCheckboxValue<T>(currentValue: T, checkedValue: T, uncheckedValue: T): T;
26
+ export declare function resolveNextCheckboxValue<T>(currentValue: T[], checkedValue: T, uncheckedValue: T): T[];
27
+ type ThrottledFunction<T extends (...args: any) => any> = (...args: Parameters<T>) => ReturnType<T>;
28
+ /**
29
+ * Creates a throttled function that only invokes the provided function (`func`) at most once per within a given number of milliseconds
30
+ * (`limit`)
31
+ */
32
+ export declare function throttle<T extends (...args: any) => any>(func: T, limit: number): ThrottledFunction<T>;
33
+ export declare function debounceAsync<TFunction extends (...args: any) => Promise<any>, TResult = ReturnType<TFunction>>(inner: TFunction, ms?: number): (...args: Parameters<TFunction>) => Promise<TResult>;
34
+ export declare function applyModelModifiers<TValue = unknown>(value: TValue, modifiers: unknown): TValue;
35
+ export declare function withLatest<TFunction extends (...args: any[]) => Promise<any>, TResult = Awaited<ReturnType<TFunction>>>(fn: TFunction, onDone: (result: TResult, args: Parameters<TFunction>) => TResult): (...args: Parameters<TFunction>) => Promise<any>;
36
+ export declare function computedDeep<TValue = unknown>({ get, set, }: {
37
+ get: () => TValue;
38
+ set: (value: TValue) => void;
39
+ }): Ref<TValue>;
40
+ export declare function normalizeErrorItem(message: string | string[] | null | undefined): string[];
41
+ export declare function resolveFieldOrPathState(path?: MaybeRefOrGetter<string>): import('..').PrivateFieldContext<unknown> | import('vue').ComputedRef<import('..').PathState<any, any> | undefined> | undefined;
42
+ export declare function omit<TObj extends GenericObject>(obj: TObj, keys: (keyof GenericObject)[]): TObj;
43
+ export declare function debounceNextTick<TFunction extends (...args: any[]) => MaybePromise<any>, TResult = ReturnType<TFunction>>(inner: TFunction): (...args: Parameters<TFunction>) => Promise<TResult>;
44
+ /**
45
+ * Aggregates standard schema issues by path.
46
+ */
47
+ export declare function combineStandardIssues(issues: StandardSchemaV1.Issue[] | readonly StandardSchemaV1.Issue[]): IssueCollection[];
48
+ export {};
@@ -0,0 +1 @@
1
+ export declare function normalizeEventValue(value: Event | unknown): unknown;
@@ -0,0 +1,5 @@
1
+ export * from './assertions';
2
+ export * from './common';
3
+ export * from './events';
4
+ export * from './rules';
5
+ export * from './vnode';
@@ -0,0 +1,13 @@
1
+ import { Locator } from '../types';
2
+ /**
3
+ * Normalizes the given rules expression.
4
+ */
5
+ export declare function normalizeRules(rules: undefined | string | Record<string, unknown | unknown[] | Record<string, unknown>>): Record<string, unknown[] | Record<string, unknown>>;
6
+ /**
7
+ * Parses a rule string expression.
8
+ */
9
+ export declare function parseRule(rule: string): {
10
+ name: string | undefined;
11
+ params: string[];
12
+ };
13
+ export declare function extractLocators(params: Record<string, unknown> | unknown[]): Locator[];
@@ -0,0 +1,19 @@
1
+ export declare function isCallable(fn: unknown): fn is (...args: any[]) => any;
2
+ export declare function isObject(obj: unknown): obj is Record<string, unknown>;
3
+ export declare function isIndex(value: unknown): value is number;
4
+ export declare function isNullOrUndefined(value: unknown): value is undefined | null;
5
+ export declare function toNumber(value: string): number | string;
6
+ export declare function normalizeFormPath(path: string): string;
7
+ export declare function getTag(value: any): string;
8
+ export declare function isObjectLike(value: any): boolean;
9
+ export declare function isPlainObject(value: any): boolean;
10
+ export declare function merge(target: any, source: any): any;
11
+ /**
12
+ * 将对象扁平化为点/下标路径的键
13
+ * 例如:
14
+ * { a: { b: 1 }, arr: [{ x: 2 }] }
15
+ * => { 'a.b': 1, 'arr[0].x': 2 }
16
+ */
17
+ export declare function flattenToDotPaths(source: any, opts?: {
18
+ includeEmpty?: boolean;
19
+ }): Record<string, unknown>;
@@ -0,0 +1,22 @@
1
+ import { SetupContext } from 'vue';
2
+ type HTMLElementWithValueBinding = HTMLElement & {
3
+ _value: unknown;
4
+ };
5
+ export declare function normalizeChildren(tag: string | undefined | null, context: SetupContext<any>, slotProps: () => Record<string, unknown>): import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
6
+ [key: string]: any;
7
+ }>[] | {
8
+ default: () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
9
+ [key: string]: any;
10
+ }>[] | undefined;
11
+ } | undefined;
12
+ /**
13
+ * Vue adds a `_value` prop at the moment on the input elements to store the REAL value on them, real values are different than the `value` attribute
14
+ * as they do not get casted to strings unlike `el.value` which preserves user-code behavior
15
+ */
16
+ export declare function getBoundValue(el: HTMLElement): unknown;
17
+ /**
18
+ * Vue adds a `_value` prop at the moment on the input elements to store the REAL value on them, real values are different than the `value` attribute
19
+ * as they do not get casted to strings unlike `el.value` which preserves user-code behavior
20
+ */
21
+ export declare function hasValueBinding(el: HTMLElement): el is HTMLElementWithValueBinding;
22
+ export {};
@@ -0,0 +1,21 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { FormValidationResult, GenericObject, GenericValidateFunction, RawFormSchema, ValidationResult } from './types';
3
+ type ValidationOptions = {
4
+ name?: string;
5
+ label?: string;
6
+ values?: Record<string, unknown>;
7
+ bails?: boolean;
8
+ };
9
+ /**
10
+ * Validates a value against the rules.
11
+ */
12
+ export declare function validate<TInput, TOutput>(value: TInput, rules: string | Record<string, unknown | unknown[]> | GenericValidateFunction<TInput> | GenericValidateFunction<TInput>[] | StandardSchemaV1<TInput, TOutput>, options?: ValidationOptions): Promise<ValidationResult<TOutput>>;
13
+ export declare function validateStandardSchema<TValues extends GenericObject, TOutput extends GenericObject = TValues>(schema: StandardSchemaV1<TValues, TOutput>, values: TValues): Promise<FormValidationResult<TValues, TOutput>>;
14
+ export declare function validateObjectSchema<TValues extends GenericObject, TOutput extends GenericObject>(schema: RawFormSchema<TValues>, values: TValues | undefined, opts?: Partial<{
15
+ names: Record<string, {
16
+ name: string;
17
+ label: string;
18
+ }>;
19
+ bailsMap: Record<string, boolean>;
20
+ }>): Promise<FormValidationResult<TValues, TOutput>>;
21
+ export {};
@@ -0,0 +1 @@
1
+ export {};