@dazhicheng/ui 1.5.32 → 1.5.34
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.
- package/dist/components/tt-area/TtArea.vue.d.ts +2 -0
- package/dist/components/tt-area/index.d.ts +1 -0
- package/dist/components/tt-button/components/AddButton.vue.d.ts +2 -0
- package/dist/components/tt-button/index.d.ts +1740 -0
- package/dist/components/tt-button/index.vue.d.ts +1004 -0
- package/dist/components/tt-checkbox/index.d.ts +36 -0
- package/dist/components/tt-checkbox/index.vue.d.ts +28 -0
- package/dist/components/tt-checkbox/type.d.ts +9 -0
- package/dist/components/tt-drawer/index.d.ts +3703 -0
- package/dist/components/tt-drawer/src/RenderDrawer.vue.d.ts +2121 -0
- package/dist/components/tt-drawer/src/components/DrawerFooter.vue.d.ts +94 -0
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.d.ts +27 -0
- package/dist/components/tt-drawer/src/hooks/useDrawerRender.d.ts +10 -0
- package/dist/components/tt-drawer/src/hooks/useResizable.d.ts +9 -0
- package/dist/components/tt-drawer/src/index.d.ts +10 -0
- package/dist/components/tt-drawer/src/props.d.ts +99 -0
- package/dist/components/tt-drawer/src/typing.d.ts +154 -0
- package/dist/components/tt-drawer/src/utils/drawer-api.d.ts +87 -0
- package/dist/components/tt-empty/index.d.ts +18 -0
- package/dist/components/tt-form/index.d.ts +13 -0
- package/dist/components/tt-form/src/components/ExpandableArrow.vue.d.ts +33 -0
- package/dist/components/tt-form/src/components/FormActions.vue.d.ts +34 -0
- package/dist/components/tt-form/src/components/Slot.d.ts +7 -0
- package/dist/components/tt-form/src/config.d.ts +6 -0
- package/dist/components/tt-form/src/form/FormControl.vue.d.ts +19 -0
- package/dist/components/tt-form/src/form/FormDescription.vue.d.ts +23 -0
- package/dist/components/tt-form/src/form/FormItem.vue.d.ts +23 -0
- package/dist/components/tt-form/src/form/FormLabel.vue.d.ts +23 -0
- package/dist/components/tt-form/src/form/FormMessage.vue.d.ts +2 -0
- package/dist/components/tt-form/src/form/FormMessageToolTip.vue.d.ts +8 -0
- package/dist/components/tt-form/src/form/FormWarnMessage.vue.d.ts +25 -0
- package/dist/components/tt-form/src/form/RenderContent.vue.d.ts +23 -0
- package/dist/components/tt-form/src/form/index.d.ts +10 -0
- package/dist/components/tt-form/src/form/injectionKeys.d.ts +2 -0
- package/dist/components/tt-form/src/form/useFormField.d.ts +11 -0
- package/dist/components/tt-form/src/form-render/FormField.vue.d.ts +28 -0
- package/dist/components/tt-form/src/form-render/FormLabel.vue.d.ts +27 -0
- package/dist/components/tt-form/src/form-render/context.d.ts +7 -0
- package/dist/components/tt-form/src/form-render/dependencies.d.ts +361 -0
- package/dist/components/tt-form/src/form-render/expandable.d.ts +9 -0
- package/dist/components/tt-form/src/form-render/form.vue.d.ts +38 -0
- package/dist/components/tt-form/src/form-render/helper.d.ts +11 -0
- package/dist/components/tt-form/src/form-render/index.d.ts +3 -0
- package/dist/components/tt-form/src/formApi.d.ts +71 -0
- package/dist/components/tt-form/src/hooks/useEmitAsProps.d.ts +7 -0
- package/dist/components/tt-form/src/hooks/useFormFieldBus.d.ts +14 -0
- package/dist/components/tt-form/src/hooks/useForwardPriorityValues.d.ts +14 -0
- package/dist/components/tt-form/src/hooks/useForwardProps.d.ts +7 -0
- package/dist/components/tt-form/src/hooks/useForwardPropsEmits.d.ts +8 -0
- package/dist/components/tt-form/src/index.vue.d.ts +27 -0
- package/dist/components/tt-form/src/shared/createContext.d.ts +8 -0
- package/dist/components/tt-form/src/shared/global-state.d.ts +17 -0
- package/dist/components/tt-form/src/shared/store.d.ts +1 -0
- package/dist/components/tt-form/src/shared/zod-defaults.d.ts +54 -0
- package/dist/components/tt-form/src/types/common.d.ts +11 -0
- package/dist/components/tt-form/src/types/forms.d.ts +280 -0
- package/dist/components/tt-form/src/types/index.d.ts +3 -0
- package/dist/components/tt-form/src/types/paths.d.ts +142 -0
- package/dist/components/tt-form/src/types/shared.d.ts +19 -0
- package/dist/components/tt-form/src/types.d.ts +385 -0
- package/dist/components/tt-form/src/useForm.d.ts +2 -0
- package/dist/components/tt-form/src/useFormContext.d.ts +12 -0
- package/dist/components/tt-form-item-error-tooltip/index.d.ts +1549 -0
- package/dist/components/tt-form-item-error-tooltip/index.vue.d.ts +784 -0
- package/dist/components/tt-icon/index.d.ts +76 -0
- package/dist/components/tt-icon/index.vue.d.ts +32 -0
- package/dist/components/tt-image/index.d.ts +127 -0
- package/dist/components/tt-image/src/components/ImageViewer.d.ts +89 -0
- package/dist/components/tt-image/tt-image.d.ts +126 -0
- package/dist/components/tt-loading/index.d.ts +16 -0
- package/dist/components/tt-loading/src/directive.d.ts +9 -0
- package/dist/components/tt-loading/src/loading.vue.d.ts +12 -0
- package/dist/components/tt-loading/src/service.d.ts +25 -0
- package/dist/components/tt-loading/src/type.d.ts +20 -0
- package/dist/components/tt-modal/index.d.ts +1809 -0
- package/dist/components/tt-modal/src/RenderModal.vue.d.ts +1008 -0
- package/dist/components/tt-modal/src/components/ModalFooter.vue.d.ts +210 -0
- package/dist/components/tt-modal/src/components/ModalHeader.vue.d.ts +31 -0
- package/dist/components/tt-modal/src/components/ModalWrapper.vue.d.ts +224 -0
- package/dist/components/tt-modal/src/hooks/useModalRender.d.ts +110 -0
- package/dist/components/tt-modal/src/index.d.ts +5 -0
- package/dist/components/tt-modal/src/props.d.ts +161 -0
- package/dist/components/tt-modal/src/typing.d.ts +188 -0
- package/dist/components/tt-modal/src/utils/modal-api.d.ts +97 -0
- package/dist/components/tt-modal-form/hooks/useModalFormSlot.d.ts +6 -0
- package/dist/components/tt-modal-form/index.d.ts +2 -0
- package/dist/components/tt-modal-form/index.vue.d.ts +43 -0
- package/dist/components/tt-modal-form/props.d.ts +38 -0
- package/dist/components/tt-modal-form/useModalForm.d.ts +6 -0
- package/dist/components/tt-select/index.d.ts +7 -0
- package/dist/components/tt-select/src/Select.vue.d.ts +861 -0
- package/dist/components/tt-select/src/components/SelectTable.vue.d.ts +111 -0
- package/dist/components/tt-select/src/components/Table.vue.d.ts +250 -0
- package/dist/components/tt-select/src/const.d.ts +16 -0
- package/dist/components/tt-select/src/hooks/useDataSource.d.ts +115 -0
- package/dist/components/tt-select/src/hooks/useGrid.d.ts +32 -0
- package/dist/components/tt-select/src/hooks/useKeyboard.d.ts +59 -0
- package/dist/components/tt-select/src/hooks/usePagination.d.ts +16 -0
- package/dist/components/tt-select/src/hooks/useSelect.d.ts +87 -0
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +178 -0
- package/dist/components/tt-select/src/props.d.ts +190 -0
- package/dist/components/tt-select/src/types/index.d.ts +142 -0
- package/dist/components/tt-select/src/utils/index.d.ts +9 -0
- package/dist/components/tt-table/index.d.ts +127 -0
- package/dist/components/tt-table/src/Table.vue.d.ts +1685 -0
- package/dist/components/tt-table/src/componentMap.d.ts +8 -0
- package/dist/components/tt-table/src/components/RowContext.d.ts +24 -0
- package/dist/components/tt-table/src/components/TableAction.vue.d.ts +79 -0
- package/dist/components/tt-table/src/components/TableButtons.d.ts +30 -0
- package/dist/components/tt-table/src/components/TableColumnModal.vue.d.ts +26 -0
- package/dist/components/tt-table/src/components/TableToobalTools.vue.d.ts +1531 -0
- package/dist/components/tt-table/src/emits.d.ts +1 -0
- package/dist/components/tt-table/src/enum.d.ts +2 -0
- package/dist/components/tt-table/src/hooks/useCellArea.d.ts +15 -0
- package/dist/components/tt-table/src/hooks/useColumns.d.ts +27 -0
- package/dist/components/tt-table/src/hooks/useCustomColumns.d.ts +20 -0
- package/dist/components/tt-table/src/hooks/useDataSource.d.ts +29 -0
- package/dist/components/tt-table/src/hooks/useLeftRightSlot.d.ts +1082 -0
- package/dist/components/tt-table/src/hooks/usePagination.d.ts +102 -0
- package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +30 -0
- package/dist/components/tt-table/src/hooks/useTable.d.ts +7 -0
- package/dist/components/tt-table/src/hooks/useTableContext.d.ts +43 -0
- package/dist/components/tt-table/src/hooks/useTableEvent.d.ts +101 -0
- package/dist/components/tt-table/src/hooks/useTableForm.d.ts +15 -0
- package/dist/components/tt-table/src/hooks/useTableFormEvent.d.ts +10 -0
- package/dist/components/tt-table/src/hooks/useTableHeight.d.ts +15 -0
- package/dist/components/tt-table/src/hooks/useTableRender.d.ts +93 -0
- package/dist/components/tt-table/src/hooks/useTableSlot.d.ts +11 -0
- package/dist/components/tt-table/src/props.d.ts +433 -0
- package/dist/components/tt-table/src/toolProps.d.ts +19 -0
- package/dist/components/tt-table/src/types/table.d.ts +489 -0
- package/dist/components/tt-table/src/types/tableAction.d.ts +26 -0
- package/dist/components/tt-table/src/types/tableForm.d.ts +64 -0
- package/dist/components/tt-table/src/types/tableTools.d.ts +10 -0
- package/dist/components/tt-table/src/utils/context.d.ts +18 -0
- package/dist/components/tt-table/src/utils/filters.d.ts +109 -0
- package/dist/components/tt-table/src/utils/table-api.d.ts +250 -0
- package/dist/components/tt-table/src/utils/table-form-api.d.ts +88 -0
- package/dist/components/tt-table/src/utils/vxeTable.d.ts +28 -0
- package/dist/components/tt-text/index.d.ts +76 -0
- package/dist/components/tt-text/index.vue.d.ts +50 -0
- package/dist/components/tt-tree-select/index.d.ts +5 -0
- package/dist/components/tt-tree-select/src/TtTreeSelect.vue.d.ts +6 -0
- package/dist/components/tt-tree-select/src/cache-options.d.ts +35 -0
- package/dist/components/tt-tree-select/src/select.d.ts +10 -0
- package/dist/components/tt-tree-select/src/tree.d.ts +23 -0
- package/dist/components/tt-tree-select/src/utils.d.ts +10 -0
- package/dist/components/tt-upload/index.d.ts +428 -0
- package/dist/components/tt-upload/src/TtUpload.d.ts +449 -0
- package/dist/components/tt-upload/src/typing.d.ts +251 -0
- package/dist/components/types.d.ts +230 -0
- package/dist/directives/auto-tip/index.d.ts +3 -0
- package/dist/directives/dialog-resize/index.d.ts +25 -0
- package/dist/directives/dialog-resize/use-css-variable.d.ts +1 -0
- package/dist/directives/dialog-resize/use-draggable.d.ts +4 -0
- package/dist/directives/dialog-resize/use-fullscreen.d.ts +1 -0
- package/dist/directives/dialog-resize/use-parse-translate.d.ts +4 -0
- package/dist/directives/dialog-resize/use-resizer.d.ts +2 -0
- package/dist/directives/disabled-tip/index.d.ts +17 -0
- package/dist/directives/index.d.ts +3 -0
- package/dist/hooks/useFormat.d.ts +73 -0
- package/dist/hooks/useLoading.d.ts +9 -0
- package/dist/hooks/useSetup.d.ts +8 -0
- package/dist/hooks/useTable.d.ts +5 -0
- package/dist/hooks/useTemplateSlot.d.ts +9 -0
- package/dist/{index-CMjNBMj5.js → index-NG5FNCLD.js} +2 -3
- package/dist/index.d.ts +46 -0
- package/dist/index.js +342 -384
- package/dist/{index.modern-BfZxYaPy.js → index.modern-DfItAsVf.js} +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/vxeTable/switchStatus.d.ts +7 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +29 -30
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FormState, GenericObject, ResetFormOpts, ValidationOptions } from 'vee-validate';
|
|
2
|
+
import { ComponentPublicInstance } from 'vue';
|
|
3
|
+
import { Recordable, StateHandler } from '../../../../../utils/src';
|
|
4
|
+
import { FormActions, FormSchema, TtFormProps } from './types';
|
|
5
|
+
import { Store } from './shared/store';
|
|
6
|
+
export declare class FormApi {
|
|
7
|
+
form: FormActions;
|
|
8
|
+
isMounted: boolean;
|
|
9
|
+
state: null | TtFormProps;
|
|
10
|
+
stateHandler: StateHandler;
|
|
11
|
+
store: Store<TtFormProps>;
|
|
12
|
+
/**
|
|
13
|
+
* 组件实例映射
|
|
14
|
+
*/
|
|
15
|
+
private componentRefMap;
|
|
16
|
+
private latestSubmissionValues;
|
|
17
|
+
private prevState;
|
|
18
|
+
constructor(options?: TtFormProps);
|
|
19
|
+
/**
|
|
20
|
+
* 获取字段组件实例
|
|
21
|
+
* @param fieldName 字段名
|
|
22
|
+
* @returns 组件实例
|
|
23
|
+
*/
|
|
24
|
+
getFieldComponentRef<T = ComponentPublicInstance>(fieldName: string): T | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* 获取当前聚焦的字段,如果没有聚焦的字段则返回undefined
|
|
27
|
+
*/
|
|
28
|
+
getFocusedField(): string | undefined;
|
|
29
|
+
getLatestSubmissionValues(): Recordable<any>;
|
|
30
|
+
getState(): TtFormProps<keyof import('./types').BaseFormComponentMap> | null;
|
|
31
|
+
getValues<T = Recordable<any>>(): Promise<T>;
|
|
32
|
+
isFieldValid(fieldName: string): Promise<boolean>;
|
|
33
|
+
merge(formApi: FormApi): any;
|
|
34
|
+
mount(formActions: FormActions, componentRefMap: Map<string, unknown>): void;
|
|
35
|
+
/**
|
|
36
|
+
* 根据字段名移除表单项
|
|
37
|
+
* @param fields
|
|
38
|
+
*/
|
|
39
|
+
removeSchemaByFields(fields: string[]): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* 重置表单
|
|
42
|
+
*/
|
|
43
|
+
resetForm(state?: Partial<FormState<GenericObject>> | undefined, opts?: Partial<ResetFormOpts>): Promise<void>;
|
|
44
|
+
resetValidate(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* 滚动到第一个错误字段
|
|
47
|
+
* @param errors 验证错误对象
|
|
48
|
+
*/
|
|
49
|
+
scrollToFirstError(errors: Record<string, any> | string): void;
|
|
50
|
+
setFieldValue(field: string, value: any, shouldValidate?: boolean): Promise<void>;
|
|
51
|
+
setLatestSubmissionValues(values: null | Recordable<any>): void;
|
|
52
|
+
setState(stateOrFn: ((prev: TtFormProps) => Partial<TtFormProps>) | Partial<TtFormProps>): void;
|
|
53
|
+
/**
|
|
54
|
+
* 设置表单值
|
|
55
|
+
* @param fields record
|
|
56
|
+
* @param filterFields 过滤不在schema中定义的字段 默认为true
|
|
57
|
+
* @param shouldValidate
|
|
58
|
+
*/
|
|
59
|
+
setValues(fields: Record<string, any>, filterFields?: boolean, shouldValidate?: boolean): Promise<void>;
|
|
60
|
+
submitForm(e?: Event): Promise<Recordable<any>>;
|
|
61
|
+
unmount(): void;
|
|
62
|
+
updateSchema(schema: Partial<FormSchema>[]): void;
|
|
63
|
+
validate(opts?: Partial<ValidationOptions>): Promise<import('vee-validate').FormValidationResult<GenericObject, GenericObject>>;
|
|
64
|
+
validateAndSubmitForm(): Promise<Recordable<any> | undefined>;
|
|
65
|
+
validateField(fieldName: string, opts?: Partial<ValidationOptions>): Promise<import('vee-validate').ValidationResult<any>>;
|
|
66
|
+
private getForm;
|
|
67
|
+
private handleMultiFields;
|
|
68
|
+
private handleRangeTimeValue;
|
|
69
|
+
private processFields;
|
|
70
|
+
private updateState;
|
|
71
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useEmitAsProps` 是一个 TypeScript 工具函数,用于将组件发出的事件转换为 props
|
|
3
|
+
* @param emit - `emit` 参数是一个用于从组件发出事件的函数
|
|
4
|
+
* 接收两个参数:`name` 是要发出的事件名称,`...args` 是随事件传递的参数
|
|
5
|
+
* @returns 返回一个对象,该对象将事件名称映射到调用 `emit` 函数的处理函数
|
|
6
|
+
*/
|
|
7
|
+
export declare function useEmitAsProps<Name extends string>(emit: (name: Name, ...args: any[]) => void): Record<string, any>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormValidationResult } from '../types/forms';
|
|
2
|
+
import { GenericObject } from '../types/common';
|
|
3
|
+
/**
|
|
4
|
+
* Hook for form field event bus
|
|
5
|
+
* @param key - Optional custom key for the event bus, defaults to Symbol('FormField')
|
|
6
|
+
* @returns Event bus instance
|
|
7
|
+
*/
|
|
8
|
+
export declare function useFormFieldBus(key?: string | symbol): import('@vueuse/core').UseEventBusReturn<FormValidationResult<GenericObject, GenericObject>, any>;
|
|
9
|
+
/**
|
|
10
|
+
* Hook for form filter event bus
|
|
11
|
+
* @param key - Optional custom key for the event bus, defaults to Symbol('FormFilter')
|
|
12
|
+
* @returns Event bus instance
|
|
13
|
+
*/
|
|
14
|
+
export declare function useFormFilterBus(key?: string | symbol): import('@vueuse/core').UseEventBusReturn<string, any>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 依次从插槽、attrs、props、state 中获取值
|
|
4
|
+
* @param key
|
|
5
|
+
* @param props
|
|
6
|
+
* @param state
|
|
7
|
+
*/
|
|
8
|
+
export declare function usePriorityValue<T extends Record<string, any>, S extends Record<string, any>, K extends keyof T = keyof T>(key: K, props: T, state: Readonly<Ref<NoInfer<S>>> | undefined): ComputedRef<T[K]>;
|
|
9
|
+
/**
|
|
10
|
+
* 批量获取state中的值(集中在一个computed,用于透传)
|
|
11
|
+
* @param props
|
|
12
|
+
* @param state
|
|
13
|
+
*/
|
|
14
|
+
export declare function useForwardPriorityValues<T extends Record<string, any>, S extends Ref<Record<string, any>> = Readonly<Ref<NoInfer<T>, NoInfer<T>>>>(props: T, state: S | undefined): ComputedRef<{ [K in keyof T]: T[K]; }>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* `useForwardProps` 函数接收一组 props 并返回一个计算值,该值合并了当前实例的默认 props 和传入的 props。
|
|
4
|
+
* @param {T} props - `props` 参数是一个对象,表示传递给组件的 props。
|
|
5
|
+
* @returns 返回一个计算值,合并了默认 props、保留的 props 和传入的 props。
|
|
6
|
+
*/
|
|
7
|
+
export declare function useForwardProps<T extends Record<string, any>>(props: MaybeRefOrGetter<T>): import('vue').ComputedRef<T>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 函数 `useForwardPropsEmits` 接收 props 和可选的 emit 函数,返回一个计算属性对象,该对象合并了解析后的 props 和 emits。
|
|
4
|
+
* @param {T} props - `props` 参数类型为 `T`,是扩展自 `useForwardProps` 函数参数的泛型类型。表示传递给 `useForwardProps` 函数的 props 对象。
|
|
5
|
+
* @param [emit] - `emit` 参数是一个可用于触发事件的函数。它接收两个参数:`name` 表示要触发的事件名称,`args` 是要随事件传递的参数。
|
|
6
|
+
* @returns 返回一个计算属性,合并了解析后的 props 和 emits。
|
|
7
|
+
*/
|
|
8
|
+
export declare function useForwardPropsEmits<T extends Record<string, any>, Name extends string>(props: MaybeRefOrGetter<T>, emit?: (name: Name, ...args: any[]) => void): import('vue').ComputedRef<T & Record<string, any>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ExtendedFormApi, TtFormProps } from './types';
|
|
2
|
+
interface Props extends TtFormProps {
|
|
3
|
+
formApi?: ExtendedFormApi;
|
|
4
|
+
}
|
|
5
|
+
declare function __VLS_template(): {
|
|
6
|
+
attrs: Partial<{}>;
|
|
7
|
+
slots: Partial<Record<string, (_: any) => any>> & {
|
|
8
|
+
default?(_: {
|
|
9
|
+
shapes: import('./types').FormShape[];
|
|
10
|
+
}): any;
|
|
11
|
+
'reset-before'?(_: {}): any;
|
|
12
|
+
'submit-before'?(_: {}): any;
|
|
13
|
+
'expand-before'?(_: {}): any;
|
|
14
|
+
'expand-after'?(_: {}): any;
|
|
15
|
+
};
|
|
16
|
+
refs: {};
|
|
17
|
+
rootEl: any;
|
|
18
|
+
};
|
|
19
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
20
|
+
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param providerComponentName - The name(s) of the component(s) providing the context.
|
|
3
|
+
*
|
|
4
|
+
* There are situations where context can come from multiple components. In such cases, you might need to give an array of component names to provide your context, instead of just a single string.
|
|
5
|
+
*
|
|
6
|
+
* @param contextName The description for injection key symbol.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createContext<ContextValue>(providerComponentName: string | string[], contextName?: string): readonly [<T extends ContextValue | null | undefined = ContextValue>(fallback?: T) => T extends null ? ContextValue | null : ContextValue, (contextValue: ContextValue) => ContextValue];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 全局复用的变量、组件、配置,各个模块之间共享
|
|
3
|
+
* 通过单例模式实现,单例必须注意不受请求影响,例如用户信息这些需要根据请求获取的。后续如果有ssr需求,也不会影响
|
|
4
|
+
*/
|
|
5
|
+
interface ComponentsState {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export interface IGlobalSharedState {
|
|
9
|
+
components: ComponentsState;
|
|
10
|
+
}
|
|
11
|
+
declare class GlobalShareState {
|
|
12
|
+
#private;
|
|
13
|
+
getComponents(): ComponentsState;
|
|
14
|
+
setComponents(value: ComponentsState): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const globalShareState: GlobalShareState;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tanstack/vue-store';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A type which represents all the simple Zod types
|
|
4
|
+
* that do not require special handling.
|
|
5
|
+
*/
|
|
6
|
+
export type SimpleSupportedZodTypes = z.ZodBoolean | z.ZodNumber | z.ZodString | z.ZodArray<any>;
|
|
7
|
+
/**
|
|
8
|
+
* A type which represents all the supported Zod types
|
|
9
|
+
* that do not require special handling.
|
|
10
|
+
*
|
|
11
|
+
* Other special types like ZodUnion, ZodIntersection, etc.
|
|
12
|
+
* require special handling and are not included in this type.
|
|
13
|
+
*
|
|
14
|
+
* TODO: Add support for missing Zod types.
|
|
15
|
+
*/
|
|
16
|
+
export type BaseSupportedZodTypes = SimpleSupportedZodTypes | z.ZodRecord<any, any> | z.ZodObject<any, any> | z.ZodTuple<[any, ...any[]]>;
|
|
17
|
+
/**
|
|
18
|
+
* A type which represents all the supported Zod types
|
|
19
|
+
* that require special handling because they are composed
|
|
20
|
+
* of multiple Zod types.
|
|
21
|
+
*
|
|
22
|
+
* TODO: Add support for missing Zod types.
|
|
23
|
+
*/
|
|
24
|
+
export type AdvancedSupportedZodTypes = z.ZodDefault<any> | z.ZodOptional<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>;
|
|
25
|
+
/**
|
|
26
|
+
* A type which represents all the supported Zod types.
|
|
27
|
+
*/
|
|
28
|
+
export type SupportedZodTypes = BaseSupportedZodTypes | AdvancedSupportedZodTypes;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the default values as an object for the provided schema.
|
|
31
|
+
*
|
|
32
|
+
* For example, given the following schema:
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const schema = z.object({
|
|
35
|
+
* name: z.string(),
|
|
36
|
+
* age: z.number(),
|
|
37
|
+
* isStudent: z.boolean().default(true),
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* The default object would be:
|
|
42
|
+
* ```json
|
|
43
|
+
* {
|
|
44
|
+
* name: "",
|
|
45
|
+
* age: 0,
|
|
46
|
+
* isStudent: true
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
* Note the default value for `isStudent` is `true` because it is specified in
|
|
50
|
+
* the schema.
|
|
51
|
+
*
|
|
52
|
+
* @param schema
|
|
53
|
+
*/
|
|
54
|
+
export declare function getDefaultsForSchema<T extends z.ZodObject<any> | z.ZodUnion<any> | z.ZodIntersection<any, any>>(schema: T): Record<string, never> | z.infer<T>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MaybeRef, Ref } from 'vue';
|
|
2
|
+
import { Path, PathValue } from './paths';
|
|
3
|
+
export type GenericObject = Record<string, any>;
|
|
4
|
+
export type MaybeArray<T> = T | T[];
|
|
5
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
6
|
+
export type FlattenAndSetPathsType<TRecord, TType> = {
|
|
7
|
+
[K in Path<TRecord>]: TType;
|
|
8
|
+
};
|
|
9
|
+
export type MapValuesPathsToRefs<TValues extends GenericObject, TPaths extends readonly [...MaybeRef<Path<TValues>>[]]> = {
|
|
10
|
+
readonly [K in keyof TPaths]: TPaths[K] extends MaybeRef<infer TKey> ? TKey extends Path<TValues> ? Ref<PathValue<TValues, TKey>> : Ref<unknown> : Ref<unknown>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import { PartialDeep } from 'type-fest';
|
|
3
|
+
import { ComputedRef, MaybeRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
4
|
+
import { FlattenAndSetPathsType, GenericObject, MapValuesPathsToRefs, MaybeArray, MaybePromise } from './common';
|
|
5
|
+
import { Path, PathValue } from './paths';
|
|
6
|
+
import { FieldValidationMetaInfo } from './shared';
|
|
7
|
+
export type ValidationResult<TValue = unknown> = {
|
|
8
|
+
errors: string[];
|
|
9
|
+
valid: boolean;
|
|
10
|
+
value?: TValue;
|
|
11
|
+
};
|
|
12
|
+
export type FlattenAndMapPathsValidationResult<TInput extends GenericObject, TOutput extends GenericObject> = {
|
|
13
|
+
[K in Path<TInput>]: ValidationResult<TOutput[K]>;
|
|
14
|
+
};
|
|
15
|
+
export type Locator = {
|
|
16
|
+
__locatorRef: string;
|
|
17
|
+
} & ((values: GenericObject) => unknown);
|
|
18
|
+
export interface FieldMeta<TValue> {
|
|
19
|
+
touched: boolean;
|
|
20
|
+
dirty: boolean;
|
|
21
|
+
valid: boolean;
|
|
22
|
+
validated: boolean;
|
|
23
|
+
pending: boolean;
|
|
24
|
+
initialValue?: TValue;
|
|
25
|
+
}
|
|
26
|
+
export interface FormMeta<TValues extends GenericObject> {
|
|
27
|
+
touched: boolean;
|
|
28
|
+
dirty: boolean;
|
|
29
|
+
valid: boolean;
|
|
30
|
+
pending: boolean;
|
|
31
|
+
initialValues?: Partial<TValues>;
|
|
32
|
+
}
|
|
33
|
+
export interface FieldState<TValue = unknown> {
|
|
34
|
+
value: TValue;
|
|
35
|
+
touched: boolean;
|
|
36
|
+
errors: string[];
|
|
37
|
+
}
|
|
38
|
+
export type InputType = "checkbox" | "radio" | "default";
|
|
39
|
+
/**
|
|
40
|
+
* validated-only: only mutate the previously validated fields
|
|
41
|
+
* silent: do not mutate any field
|
|
42
|
+
* force: validate all fields and mutate their state
|
|
43
|
+
*/
|
|
44
|
+
export type SchemaValidationMode = "validated-only" | "silent" | "force" | "no-validated";
|
|
45
|
+
export type ValidationOptions = {
|
|
46
|
+
mode: SchemaValidationMode;
|
|
47
|
+
warn: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type FieldValidator<TOutput> = (opts?: Partial<ValidationOptions>) => Promise<ValidationResult<TOutput>>;
|
|
50
|
+
export type PathStateConfig<TOutput> = {
|
|
51
|
+
bails: boolean;
|
|
52
|
+
label: MaybeRefOrGetter<string | undefined>;
|
|
53
|
+
type: InputType;
|
|
54
|
+
validate: FieldValidator<TOutput>;
|
|
55
|
+
schema?: MaybeRefOrGetter<StandardSchemaV1 | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* 在判断 dirty 状态时需要排除的字段列表(仅对对象类型有效)
|
|
58
|
+
* @example
|
|
59
|
+
* excludeKeys: ['_timestamp']
|
|
60
|
+
*/
|
|
61
|
+
excludeKeys?: string[];
|
|
62
|
+
};
|
|
63
|
+
export type IssueCollection<TPath = string> = {
|
|
64
|
+
path: TPath;
|
|
65
|
+
messages: string[];
|
|
66
|
+
};
|
|
67
|
+
export type PathState<TInput = unknown, TOutput = TInput> = {
|
|
68
|
+
id: number | number[];
|
|
69
|
+
path: string;
|
|
70
|
+
touched: boolean;
|
|
71
|
+
dirty: boolean;
|
|
72
|
+
valid: boolean;
|
|
73
|
+
validated: boolean;
|
|
74
|
+
pending: boolean;
|
|
75
|
+
initialValue: TInput | undefined;
|
|
76
|
+
value: TInput | undefined;
|
|
77
|
+
errors: string[];
|
|
78
|
+
bails: boolean;
|
|
79
|
+
label: string | undefined;
|
|
80
|
+
type: InputType;
|
|
81
|
+
multiple: boolean;
|
|
82
|
+
fieldsCount: number;
|
|
83
|
+
__flags: {
|
|
84
|
+
pendingUnmount: Record<string, boolean>;
|
|
85
|
+
pendingReset: boolean;
|
|
86
|
+
};
|
|
87
|
+
validate?: FieldValidator<TOutput>;
|
|
88
|
+
};
|
|
89
|
+
export type FieldEntry<TValue = unknown> = {
|
|
90
|
+
value: TValue;
|
|
91
|
+
key: string | number;
|
|
92
|
+
isFirst: boolean;
|
|
93
|
+
isLast: boolean;
|
|
94
|
+
};
|
|
95
|
+
export type FieldArrayContext<TValue = unknown> = {
|
|
96
|
+
fields: Ref<FieldEntry<TValue>[]>;
|
|
97
|
+
remove: (idx: number) => void;
|
|
98
|
+
replace: (newArray: TValue[]) => void;
|
|
99
|
+
update: (idx: number, value: TValue) => void;
|
|
100
|
+
push: (value: TValue) => void;
|
|
101
|
+
swap: (indexA: number, indexB: number) => void;
|
|
102
|
+
insert: (idx: number, value: TValue) => void;
|
|
103
|
+
prepend: (value: TValue) => void;
|
|
104
|
+
move: (oldIdx: number, newIdx: number) => void;
|
|
105
|
+
};
|
|
106
|
+
export type PrivateFieldArrayContext<TValue = unknown> = {
|
|
107
|
+
reset: () => void;
|
|
108
|
+
path: MaybeRefOrGetter<string>;
|
|
109
|
+
} & FieldArrayContext<TValue>;
|
|
110
|
+
export type PrivateFieldContext<TInput = unknown, TOutput = TInput> = {
|
|
111
|
+
id: number;
|
|
112
|
+
name: MaybeRef<string>;
|
|
113
|
+
value: Ref<TInput>;
|
|
114
|
+
meta: FieldMeta<TInput>;
|
|
115
|
+
errors: Ref<string[]>;
|
|
116
|
+
errorMessage: Ref<string | undefined>;
|
|
117
|
+
label?: MaybeRefOrGetter<string | undefined>;
|
|
118
|
+
type?: string;
|
|
119
|
+
bails?: boolean;
|
|
120
|
+
keepValueOnUnmount?: MaybeRefOrGetter<boolean | undefined>;
|
|
121
|
+
checkedValue?: MaybeRefOrGetter<TInput>;
|
|
122
|
+
uncheckedValue?: MaybeRefOrGetter<TInput>;
|
|
123
|
+
checked?: Ref<boolean>;
|
|
124
|
+
resetField: (state?: Partial<FieldState<TInput>>) => void;
|
|
125
|
+
handleReset: () => void;
|
|
126
|
+
validate: FieldValidator<TOutput>;
|
|
127
|
+
handleChange: (e: Event | unknown, shouldValidate?: boolean) => void;
|
|
128
|
+
handleBlur: (e?: Event, shouldValidate?: boolean) => void;
|
|
129
|
+
handleFocus: (e?: Event) => void;
|
|
130
|
+
setState: (state: Partial<FieldState<TInput>>) => void;
|
|
131
|
+
setTouched: (isTouched: boolean) => void;
|
|
132
|
+
setErrors: (message: string | string[]) => void;
|
|
133
|
+
setValue: (value: TInput, shouldValidate?: boolean) => void;
|
|
134
|
+
};
|
|
135
|
+
export type FieldContext<TValue = unknown> = Omit<PrivateFieldContext<TValue>, "id" | "instances">;
|
|
136
|
+
export type GenericValidateFunction<TValue = unknown> = (value: TValue, ctx: FieldValidationMetaInfo) => MaybePromise<boolean | MaybeArray<string>>;
|
|
137
|
+
export interface FormState<TValues> {
|
|
138
|
+
values: PartialDeep<TValues>;
|
|
139
|
+
errors: Partial<Record<Path<TValues>, string | undefined>>;
|
|
140
|
+
touched: Partial<Record<Path<TValues>, boolean>>;
|
|
141
|
+
submitCount: number;
|
|
142
|
+
}
|
|
143
|
+
export type FormErrors<TValues extends GenericObject> = Partial<Record<Path<TValues> | "", string | undefined>>;
|
|
144
|
+
export type FormErrorBag<TValues extends GenericObject> = Partial<Record<Path<TValues> | "", string[]>>;
|
|
145
|
+
export interface ResetFormOpts {
|
|
146
|
+
force?: boolean;
|
|
147
|
+
}
|
|
148
|
+
export interface FormActions<TValues extends GenericObject, _TOutput = TValues> {
|
|
149
|
+
setFieldValue: <T extends Path<TValues>>(field: T, value: PathValue<TValues, T>, shouldValidate?: boolean) => void;
|
|
150
|
+
setFieldError: (field: Path<TValues>, message: string | string[] | undefined) => void;
|
|
151
|
+
setErrors: (fields: Partial<FlattenAndSetPathsType<TValues, string | string[] | undefined>>) => void;
|
|
152
|
+
setValues: (fields: Partial<TValues>, shouldValidate?: boolean) => void;
|
|
153
|
+
setFieldTouched: (field: Path<TValues>, isTouched: boolean) => void;
|
|
154
|
+
setTouched: (fields: Partial<Record<Path<TValues>, boolean>> | boolean) => void;
|
|
155
|
+
resetForm: (state?: Partial<FormState<TValues>>, opts?: Partial<ResetFormOpts>) => void;
|
|
156
|
+
resetField: (field: Path<TValues>, state?: Partial<FieldState>) => void;
|
|
157
|
+
}
|
|
158
|
+
export interface FormValidationResult<TInput extends GenericObject, TOutput extends GenericObject = TInput> {
|
|
159
|
+
valid: boolean;
|
|
160
|
+
results: Partial<FlattenAndMapPathsValidationResult<TInput, TOutput>>;
|
|
161
|
+
errors: Partial<Record<Path<TInput>, string>>;
|
|
162
|
+
values?: Partial<TOutput>;
|
|
163
|
+
source: "schema" | "fields" | "none";
|
|
164
|
+
}
|
|
165
|
+
export interface SubmissionContext<TInput extends GenericObject = GenericObject> extends FormActions<TInput> {
|
|
166
|
+
evt?: Event;
|
|
167
|
+
controlledValues: Partial<TInput>;
|
|
168
|
+
}
|
|
169
|
+
export type SubmissionHandler<TInput extends GenericObject = GenericObject, TOutput = TInput, TReturn = unknown> = (values: TOutput, ctx: SubmissionContext<TInput>) => TReturn;
|
|
170
|
+
export interface InvalidSubmissionContext<TInput extends GenericObject = GenericObject, TOutput extends GenericObject = TInput> {
|
|
171
|
+
values: TInput;
|
|
172
|
+
evt?: Event;
|
|
173
|
+
errors: Partial<Record<Path<TInput>, string>>;
|
|
174
|
+
results: FormValidationResult<TInput, TOutput>["results"];
|
|
175
|
+
}
|
|
176
|
+
export type InvalidSubmissionHandler<TInput extends GenericObject = GenericObject, TOutput extends GenericObject = TInput> = (ctx: InvalidSubmissionContext<TInput, TOutput>) => void;
|
|
177
|
+
export type RawFormSchema<TValues> = Record<Path<TValues>, string | GenericValidateFunction | GenericObject>;
|
|
178
|
+
export type FieldPathLookup<TValues extends GenericObject = GenericObject> = Partial<Record<Path<TValues>, PrivateFieldContext | PrivateFieldContext[]>>;
|
|
179
|
+
type HandleSubmitFactory<TValues extends GenericObject, TOutput extends GenericObject = TValues> = <TReturn = unknown>(cb: SubmissionHandler<TValues, TOutput, TReturn>, onSubmitValidationErrorCb?: InvalidSubmissionHandler<TValues, TOutput>) => (e?: Event) => Promise<TReturn | undefined>;
|
|
180
|
+
export type PublicPathState<TValue = unknown> = Omit<PathState<TValue>, "bails" | "label" | "multiple" | "fieldsCount" | "validate" | "id" | "type" | "__flags">;
|
|
181
|
+
export interface BaseFieldProps {
|
|
182
|
+
onBlur: () => void;
|
|
183
|
+
onChange: () => void;
|
|
184
|
+
onInput: () => void;
|
|
185
|
+
}
|
|
186
|
+
export interface InputBindsConfig<TValue = unknown, TExtraProps extends GenericObject = GenericObject> {
|
|
187
|
+
props: (state: PublicPathState<TValue>) => TExtraProps;
|
|
188
|
+
validateOnBlur: boolean;
|
|
189
|
+
label: MaybeRefOrGetter<string>;
|
|
190
|
+
validateOnChange: boolean;
|
|
191
|
+
validateOnInput: boolean;
|
|
192
|
+
validateOnModelUpdate: boolean;
|
|
193
|
+
}
|
|
194
|
+
export type LazyInputBindsConfig<TValue = unknown, TExtraProps extends GenericObject = GenericObject> = (state: PublicPathState<TValue>) => Partial<{
|
|
195
|
+
props: TExtraProps;
|
|
196
|
+
validateOnBlur: boolean;
|
|
197
|
+
validateOnChange: boolean;
|
|
198
|
+
validateOnInput: boolean;
|
|
199
|
+
validateOnModelUpdate: boolean;
|
|
200
|
+
}>;
|
|
201
|
+
export interface ComponentBindsConfig<TValue = unknown, TExtraProps extends GenericObject = GenericObject, TModel extends string = "modelValue"> {
|
|
202
|
+
mapProps: (state: PublicPathState<TValue>) => TExtraProps;
|
|
203
|
+
validateOnBlur: boolean;
|
|
204
|
+
validateOnModelUpdate: boolean;
|
|
205
|
+
model: TModel;
|
|
206
|
+
}
|
|
207
|
+
export type LazyComponentBindsConfig<TValue = unknown, TExtraProps extends GenericObject = GenericObject, TModel extends string = "modelValue"> = (state: PublicPathState<TValue>) => Partial<{
|
|
208
|
+
props: TExtraProps;
|
|
209
|
+
validateOnBlur: boolean;
|
|
210
|
+
validateOnModelUpdate: boolean;
|
|
211
|
+
model: TModel;
|
|
212
|
+
}>;
|
|
213
|
+
export interface ComponentModellessBinds {
|
|
214
|
+
onBlur: () => void;
|
|
215
|
+
}
|
|
216
|
+
export type ComponentModelBinds<TValue = any, TModel extends string = "modelValue"> = ComponentModellessBinds & {
|
|
217
|
+
[TKey in `onUpdate:${TModel}`]: (value: TValue) => void;
|
|
218
|
+
};
|
|
219
|
+
export type BaseComponentBinds<TValue = any, TModel extends string = "modelValue"> = ComponentModelBinds<TValue, TModel> & {
|
|
220
|
+
[k in TModel]: TValue;
|
|
221
|
+
};
|
|
222
|
+
export interface BaseInputBinds<TValue = unknown> {
|
|
223
|
+
value: TValue | undefined;
|
|
224
|
+
onBlur: (e: Event) => void;
|
|
225
|
+
onChange: (e: Event) => void;
|
|
226
|
+
onInput: (e: Event) => void;
|
|
227
|
+
}
|
|
228
|
+
export interface PrivateFormContext<TValues extends GenericObject = GenericObject, TOutput extends GenericObject = TValues> extends FormActions<TValues> {
|
|
229
|
+
name: string;
|
|
230
|
+
formId: number;
|
|
231
|
+
values: TValues;
|
|
232
|
+
initialValues: Ref<Partial<TValues>>;
|
|
233
|
+
controlledValues: Ref<TValues>;
|
|
234
|
+
fieldArrays: PrivateFieldArrayContext[];
|
|
235
|
+
submitCount: Ref<number>;
|
|
236
|
+
schema?: MaybeRef<RawFormSchema<TValues> | StandardSchemaV1<TValues, TOutput> | undefined>;
|
|
237
|
+
errorBag: Ref<FormErrorBag<TValues>>;
|
|
238
|
+
errors: ComputedRef<FormErrors<TValues>>;
|
|
239
|
+
meta: ComputedRef<FormMeta<TValues>>;
|
|
240
|
+
isSubmitting: Ref<boolean>;
|
|
241
|
+
isValidating: Ref<boolean>;
|
|
242
|
+
keepValuesOnUnmount: MaybeRef<boolean>;
|
|
243
|
+
validateSchema?: (mode: SchemaValidationMode) => Promise<FormValidationResult<TValues, TOutput>>;
|
|
244
|
+
validate: (opts?: Partial<ValidationOptions>) => Promise<FormValidationResult<TValues, TOutput>>;
|
|
245
|
+
validateField: <TPath extends Path<TValues>>(field: TPath, opts?: Partial<ValidationOptions>) => Promise<ValidationResult<TOutput[TPath]>>;
|
|
246
|
+
stageInitialValue: (path: string, value: unknown, updateOriginal?: boolean) => void;
|
|
247
|
+
unsetInitialValue: (path: string) => void;
|
|
248
|
+
handleSubmit: HandleSubmitFactory<TValues, TOutput> & {
|
|
249
|
+
withControlled: HandleSubmitFactory<TValues, TOutput>;
|
|
250
|
+
};
|
|
251
|
+
setFieldInitialValue: (path: string, value: unknown, updateOriginal?: boolean) => void;
|
|
252
|
+
createPathState: <TPath extends Path<TValues>>(path: MaybeRef<TPath>, config?: Partial<PathStateConfig<TOutput[TPath]>>) => PathState<PathValue<TValues, TPath>>;
|
|
253
|
+
getPathState: <TPath extends Path<TValues>>(path: TPath) => PathState<PathValue<TValues, TPath>> | undefined;
|
|
254
|
+
getAllPathStates: () => PathState[];
|
|
255
|
+
removePathState: <TPath extends Path<TValues>>(path: TPath, id: number) => void;
|
|
256
|
+
unsetPathValue: <TPath extends Path<TValues>>(path: TPath) => void;
|
|
257
|
+
destroyPath: (path: string) => void;
|
|
258
|
+
isFieldTouched: <TPath extends Path<TValues>>(path: TPath) => boolean;
|
|
259
|
+
isFieldDirty: <TPath extends Path<TValues>>(path: TPath) => boolean;
|
|
260
|
+
isFieldValid: <TPath extends Path<TValues>>(path: TPath) => boolean;
|
|
261
|
+
defineField: <TPath extends Path<TValues>, TValue = PathValue<TValues, TPath>, TExtras extends GenericObject = GenericObject>(path: MaybeRefOrGetter<TPath>, config?: Partial<InputBindsConfig<TValue, TExtras>> | LazyInputBindsConfig<TValue, TExtras>) => [Ref<TValue>, Ref<BaseFieldProps & TExtras>];
|
|
262
|
+
/**
|
|
263
|
+
* @deprecated use defineField instead
|
|
264
|
+
*/
|
|
265
|
+
useFieldModel: (<TPath extends Path<TValues>>(path: TPath) => Ref<PathValue<TValues, TPath>>) & (<TPaths extends readonly [...MaybeRef<Path<TValues>>[]]>(paths: TPaths) => MapValuesPathsToRefs<TValues, TPaths>);
|
|
266
|
+
/**
|
|
267
|
+
* @deprecated use defineField instead
|
|
268
|
+
*/
|
|
269
|
+
defineComponentBinds: <TPath extends Path<TValues>, TValue = PathValue<TValues, TPath>, TModel extends string = "modelValue", TExtras extends GenericObject = GenericObject>(path: MaybeRefOrGetter<TPath>, config?: Partial<ComponentBindsConfig<TValue, TExtras, TModel>> | LazyComponentBindsConfig<TValue, TExtras, TModel>) => Ref<BaseComponentBinds<TValue, TModel> & TExtras>;
|
|
270
|
+
/**
|
|
271
|
+
* @deprecated use defineField instead
|
|
272
|
+
*/
|
|
273
|
+
defineInputBinds: <TPath extends Path<TValues>, TValue = PathValue<TValues, TPath>, TExtras extends GenericObject = GenericObject>(path: MaybeRefOrGetter<TPath>, config?: Partial<InputBindsConfig<TValue, TExtras>> | LazyInputBindsConfig<TValue, TExtras>) => Ref<BaseInputBinds<TValue> & TExtras>;
|
|
274
|
+
}
|
|
275
|
+
export interface FormContext<TValues extends GenericObject = GenericObject, TOutput extends GenericObject = TValues> extends Omit<PrivateFormContext<TValues, TOutput>, "formId" | "schema" | "initialValues" | "getPathState" | "getAllPathStates" | "removePathState" | "unsetPathValue" | "validateSchema" | "stageInitialValue" | "setFieldInitialValue" | "unsetInitialValue" | "fieldArrays" | "markForUnmount" | "keepValuesOnUnmount" | "values"> {
|
|
276
|
+
values: TValues;
|
|
277
|
+
handleReset: () => void;
|
|
278
|
+
submitForm: (e?: unknown) => Promise<void>;
|
|
279
|
+
}
|
|
280
|
+
export {};
|