@dazhicheng/ui 1.5.33 → 1.5.35
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 +15 -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 +41 -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/group-form/FieldRenderer.d.ts +81 -0
- package/dist/components/tt-form/src/group-form/GroupForm.vue.d.ts +49 -0
- package/dist/components/tt-form/src/group-form/GroupSection.vue.d.ts +25 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue.d.ts +13 -0
- package/dist/components/tt-form/src/group-form/index.d.ts +3 -0
- package/dist/components/tt-form/src/group-form/lazyContext.d.ts +37 -0
- package/dist/components/tt-form/src/group-form/types.d.ts +147 -0
- package/dist/components/tt-form/src/group-form/useGroupForm.d.ts +5 -0
- package/dist/components/tt-form/src/group-form/utils.d.ts +93 -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 +452 -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/components/AddIcon.vue.d.ts +7 -0
- package/dist/components/tt-icon/components/SubIcon.vue.d.ts +7 -0
- package/dist/components/tt-icon/index.d.ts +124 -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-nav-anchor/index.d.ts +19 -0
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.d.ts +19 -0
- package/dist/components/tt-nav-anchor/src/types.d.ts +29 -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 +47 -0
- package/dist/index.js +10239 -9224
- 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/dist/style.css +1 -1
- package/package.json +3 -10
|
@@ -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,81 @@
|
|
|
1
|
+
import { PropType, VNode } from 'vue';
|
|
2
|
+
import { FormSchema } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* @description 根据 virtual 标志选择 LazyFormField 或 FormField 渲染单个字段,
|
|
5
|
+
* 消除模板中重复的条件分支
|
|
6
|
+
* @property {Record<string, unknown>} fieldConfig - mergeFieldConfig 合并后的完整字段配置
|
|
7
|
+
* @property {FormSchema["rules"]} [rules] - 字段校验规则
|
|
8
|
+
* @property {boolean} [virtual] - 是否启用虚拟化(LazyFormField)
|
|
9
|
+
* @property {Element | null} [scrollElement] - 虚拟化滚动容器
|
|
10
|
+
* @property {string} [virtualRootMargin] - IntersectionObserver rootMargin
|
|
11
|
+
* @property {number} [virtualEstimateHeight] - 预估占位高度
|
|
12
|
+
*/
|
|
13
|
+
export declare const FieldRenderer: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
14
|
+
/** mergeFieldConfig 合并后的完整字段配置 */
|
|
15
|
+
fieldConfig: {
|
|
16
|
+
type: PropType<Record<string, unknown>>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
/** 字段校验规则 */
|
|
20
|
+
rules: {
|
|
21
|
+
type: PropType<FormSchema["rules"]>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
/** 是否启用虚拟化 */
|
|
25
|
+
virtual: {
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
default: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** 虚拟化滚动容器 */
|
|
30
|
+
scrollElement: {
|
|
31
|
+
type: PropType<Element | null>;
|
|
32
|
+
default: null;
|
|
33
|
+
};
|
|
34
|
+
/** IntersectionObserver rootMargin */
|
|
35
|
+
virtualRootMargin: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
default: string;
|
|
38
|
+
};
|
|
39
|
+
/** 预估占位高度(px) */
|
|
40
|
+
virtualEstimateHeight: {
|
|
41
|
+
type: NumberConstructor;
|
|
42
|
+
default: number;
|
|
43
|
+
};
|
|
44
|
+
}>, () => VNode, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
45
|
+
/** mergeFieldConfig 合并后的完整字段配置 */
|
|
46
|
+
fieldConfig: {
|
|
47
|
+
type: PropType<Record<string, unknown>>;
|
|
48
|
+
required: true;
|
|
49
|
+
};
|
|
50
|
+
/** 字段校验规则 */
|
|
51
|
+
rules: {
|
|
52
|
+
type: PropType<FormSchema["rules"]>;
|
|
53
|
+
default: undefined;
|
|
54
|
+
};
|
|
55
|
+
/** 是否启用虚拟化 */
|
|
56
|
+
virtual: {
|
|
57
|
+
type: BooleanConstructor;
|
|
58
|
+
default: boolean;
|
|
59
|
+
};
|
|
60
|
+
/** 虚拟化滚动容器 */
|
|
61
|
+
scrollElement: {
|
|
62
|
+
type: PropType<Element | null>;
|
|
63
|
+
default: null;
|
|
64
|
+
};
|
|
65
|
+
/** IntersectionObserver rootMargin */
|
|
66
|
+
virtualRootMargin: {
|
|
67
|
+
type: StringConstructor;
|
|
68
|
+
default: string;
|
|
69
|
+
};
|
|
70
|
+
/** 预估占位高度(px) */
|
|
71
|
+
virtualEstimateHeight: {
|
|
72
|
+
type: NumberConstructor;
|
|
73
|
+
default: number;
|
|
74
|
+
};
|
|
75
|
+
}>> & Readonly<{}>, {
|
|
76
|
+
rules: import('../types').FormSchemaRuleType | undefined;
|
|
77
|
+
virtual: boolean;
|
|
78
|
+
scrollElement: Element | null;
|
|
79
|
+
virtualRootMargin: string;
|
|
80
|
+
virtualEstimateHeight: number;
|
|
81
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { GroupFormSchema, GroupFormSectionProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @description 滚动到指定分组(通过 data-group-key 定位 DOM)。
|
|
4
|
+
* 滚动期间暂停 LazyFormField 渲染,滚动结束后才恢复,
|
|
5
|
+
* 避免途经字段挂载导致高度变化引起布局抖动
|
|
6
|
+
* @param {string} key 分组 key
|
|
7
|
+
*/
|
|
8
|
+
declare function scrollToGroup(key: string): void;
|
|
9
|
+
declare function __VLS_template(): {
|
|
10
|
+
attrs: Partial<{}>;
|
|
11
|
+
slots: any;
|
|
12
|
+
refs: {
|
|
13
|
+
scrollRef: HTMLDivElement;
|
|
14
|
+
};
|
|
15
|
+
rootEl: any;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
|
+
declare const __VLS_component: import('vue').DefineComponent<GroupFormSectionProps, {
|
|
19
|
+
scrollToGroup: typeof scrollToGroup;
|
|
20
|
+
navItems: import('vue').ComputedRef<{
|
|
21
|
+
key: string;
|
|
22
|
+
title: string;
|
|
23
|
+
}[]>;
|
|
24
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<GroupFormSectionProps> & Readonly<{}>, {
|
|
25
|
+
scrollToFirstError: boolean;
|
|
26
|
+
commonConfig: import('../types').FormCommonConfig;
|
|
27
|
+
compact: boolean;
|
|
28
|
+
layout: import('../types').FormLayout;
|
|
29
|
+
virtual: boolean;
|
|
30
|
+
containerHeight: number | string;
|
|
31
|
+
rootMargin: string;
|
|
32
|
+
estimateFieldHeight: number;
|
|
33
|
+
showNav: boolean;
|
|
34
|
+
navTitle: string;
|
|
35
|
+
autoScrollToGroup: import('./types').AutoScrollPosition;
|
|
36
|
+
groupSchema: GroupFormSchema[];
|
|
37
|
+
errorCacheMap: Map<string, string>;
|
|
38
|
+
resetSignal: import('vue').Ref<number>;
|
|
39
|
+
navErrorCounts: Record<string, number>;
|
|
40
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
41
|
+
scrollRef: HTMLDivElement;
|
|
42
|
+
}, any>;
|
|
43
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GroupSectionProps } from './types';
|
|
2
|
+
declare function __VLS_template(): any;
|
|
3
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
4
|
+
declare const __VLS_component: import('vue').DefineComponent<GroupSectionProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
5
|
+
toggleCollapse: (key: string) => any;
|
|
6
|
+
}, string, import('vue').PublicProps, Readonly<GroupSectionProps> & Readonly<{
|
|
7
|
+
onToggleCollapse?: ((key: string) => any) | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
commonConfig: import('../types').FormCommonConfig;
|
|
10
|
+
compact: boolean;
|
|
11
|
+
layout: string;
|
|
12
|
+
globalCommonConfig: import('../types').FormCommonConfig;
|
|
13
|
+
virtual: boolean;
|
|
14
|
+
scrollElement: Element | null;
|
|
15
|
+
virtualRootMargin: string;
|
|
16
|
+
virtualEstimateHeight: number;
|
|
17
|
+
depth: number;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LazyFormFieldProps } from './types';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<LazyFormFieldProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<LazyFormFieldProps> & Readonly<{}>, {
|
|
3
|
+
rules: import('../types').FormSchemaRuleType;
|
|
4
|
+
rootMargin: string;
|
|
5
|
+
fieldClass: string;
|
|
6
|
+
root: Element | null;
|
|
7
|
+
estimateHeight: number;
|
|
8
|
+
skeleton: boolean;
|
|
9
|
+
skeletonAnimated: boolean;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
11
|
+
containerRef: HTMLDivElement;
|
|
12
|
+
}, any>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 共享的字段错误缓存 Map,key 为 fieldName,value 为错误信息。
|
|
4
|
+
* 由 VirtualGroupForm provide,LazyFormField inject。
|
|
5
|
+
* validate 时对未挂载字段的校验错误写入此 map,
|
|
6
|
+
* LazyFormField 挂载时从中读取并通过 setFieldError 恢复。
|
|
7
|
+
*/
|
|
8
|
+
export declare const VIRTUAL_ERROR_CACHE_KEY: InjectionKey<Map<string, string>>;
|
|
9
|
+
/**
|
|
10
|
+
* 重置信号(递增计数器),resetForm / resetValidate 时 +1。
|
|
11
|
+
* LazyFormField watch 此值来清空自身 cachedError。
|
|
12
|
+
*/
|
|
13
|
+
export declare const VIRTUAL_RESET_SIGNAL_KEY: InjectionKey<Ref<number>>;
|
|
14
|
+
/**
|
|
15
|
+
* @description 分批渲染调度器,所有 LazyFormField 共享同一个实例。
|
|
16
|
+
* 滚动停稳后,视口内的字段排队请求渲染,调度器每帧只处理有限数量,
|
|
17
|
+
* 避免一次性挂载大量 FormField 导致主线程阻塞。
|
|
18
|
+
*/
|
|
19
|
+
export interface RenderScheduler {
|
|
20
|
+
/**
|
|
21
|
+
* @description 请求渲染一个字段,返回取消函数
|
|
22
|
+
* @param {() => void} callback - 渲染回调(设置 isVisible = true)
|
|
23
|
+
* @returns {() => void} 取消函数,字段离开视口时调用
|
|
24
|
+
*/
|
|
25
|
+
request: (callback: () => void) => () => void;
|
|
26
|
+
/** @description 暂停调度(滚动跳转期间调用,防止途经字段挂载导致高度抖动) */
|
|
27
|
+
pause: () => void;
|
|
28
|
+
/** @description 恢复调度并处理队列中积压的请求 */
|
|
29
|
+
resume: () => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @description 创建分批渲染调度器
|
|
33
|
+
* @param {number} [batchSize=4] - 每帧最多渲染的字段数
|
|
34
|
+
* @returns {RenderScheduler} 调度器实例
|
|
35
|
+
*/
|
|
36
|
+
export declare function createRenderScheduler(batchSize?: number): RenderScheduler;
|
|
37
|
+
export declare const RENDER_SCHEDULER_KEY: InjectionKey<RenderScheduler>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ExtendedFormApi, FormActions, FormCommonConfig, FormLayout, FormSchema, FormSlotSchema, TtFormProps, WrapperClassType } from '../types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
export type CollapsibleType = boolean | ((values: Record<string, any>, actions: FormActions) => boolean | PromiseLike<boolean>);
|
|
4
|
+
/** 控制 group / row / slot 是否显示,支持布尔值或函数(接收表单值与 formActions,可返回 Promise) */
|
|
5
|
+
export type IfShowConditionType = boolean | ((values: Record<string, any>, actions: FormActions) => boolean | PromiseLike<boolean>);
|
|
6
|
+
/** 分组表单项 */
|
|
7
|
+
export interface FormGroupSchema {
|
|
8
|
+
/** 类型 */
|
|
9
|
+
type: "group";
|
|
10
|
+
/** 分组唯一标识 */
|
|
11
|
+
key: string;
|
|
12
|
+
/** 分组标题 */
|
|
13
|
+
title: string;
|
|
14
|
+
/** 是否可折叠,支持布尔值或函数 (values, actions) => boolean | Promise<boolean> */
|
|
15
|
+
collapsible?: CollapsibleType;
|
|
16
|
+
/** 初始是否折叠 */
|
|
17
|
+
defaultCollapsed?: boolean;
|
|
18
|
+
/** 子项(字段或嵌套分组) */
|
|
19
|
+
children: GroupFormSchema[];
|
|
20
|
+
/** 组内字段栅格布局 */
|
|
21
|
+
wrapperClass?: WrapperClassType;
|
|
22
|
+
/** 组内字段通用配置(覆盖外层 commonConfig) */
|
|
23
|
+
commonConfig?: FormCommonConfig;
|
|
24
|
+
/** 是否显示,支持布尔值或函数 (values, actions) => boolean | Promise<boolean>,默认 true */
|
|
25
|
+
ifShow?: IfShowConditionType;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 纯布局行容器,不产生分组标题,仅将若干字段包裹在一行内并支持自定义样式
|
|
29
|
+
* @property {"row"} type - 固定为 "row"
|
|
30
|
+
* @property {FormSchema[]} children - 行内字段列表
|
|
31
|
+
* @property {WrapperClassType} [wrapperClass] - 行容器额外 class(如 grid-cols-3、bg-xxx 等)
|
|
32
|
+
*/
|
|
33
|
+
export interface FormRowSchema {
|
|
34
|
+
/** 类型标识 */
|
|
35
|
+
type: "row";
|
|
36
|
+
/** 行内字段列表 */
|
|
37
|
+
children: FormSchema[];
|
|
38
|
+
/** 行容器额外 class,可用于设置列数、背景、圆角等 */
|
|
39
|
+
wrapperClass?: WrapperClassType;
|
|
40
|
+
/** 是否显示,支持布尔值或函数 (values, actions) => boolean | Promise<boolean>,默认 true */
|
|
41
|
+
ifShow?: IfShowConditionType;
|
|
42
|
+
}
|
|
43
|
+
export type GroupFormSchema = FormGroupSchema | FormRowSchema | FormSlotSchema | FormSchema;
|
|
44
|
+
/** 分组表单组件选项 */
|
|
45
|
+
export interface UseGroupFormOptions extends Omit<TtFormProps, "schema" | "showDefaultActions"> {
|
|
46
|
+
schema: GroupFormSchema[];
|
|
47
|
+
/** 是否启用表单项级别的虚拟化(IntersectionObserver 懒渲染),默认 true */
|
|
48
|
+
virtual?: boolean;
|
|
49
|
+
/** 滚动容器高度,默认 '100%' */
|
|
50
|
+
containerHeight?: number | string;
|
|
51
|
+
/** IntersectionObserver rootMargin,控制提前渲染的距离,默认 '200px 0px'(仅 virtual 为 true 时生效) */
|
|
52
|
+
rootMargin?: string;
|
|
53
|
+
/** 预估每个表单项高度(px),用于占位,默认 52(仅 virtual 为 true 时生效) */
|
|
54
|
+
estimateFieldHeight?: number;
|
|
55
|
+
/** 是否显示悬浮导航锚点,默认 true */
|
|
56
|
+
showNav?: boolean;
|
|
57
|
+
/** 导航栏标题,默认 '导航' */
|
|
58
|
+
navTitle?: string;
|
|
59
|
+
/** 自动滚动到指定分组,默认 'top' */
|
|
60
|
+
autoScrollToGroup?: AutoScrollPosition;
|
|
61
|
+
/** 校验失败时是否自动滚动到第一个有错误的分组,默认 true */
|
|
62
|
+
scrollToFirstError?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** LazyFormField 组件 props */
|
|
65
|
+
export interface LazyFormFieldProps {
|
|
66
|
+
/** 传给 FormField 的完整 props(通过 v-bind 透传) */
|
|
67
|
+
fieldProps: Record<string, unknown>;
|
|
68
|
+
/** FormSchema.rules */
|
|
69
|
+
rules?: FormSchema["rules"];
|
|
70
|
+
/** FormSchema.formItemClass(用于外层 class) */
|
|
71
|
+
fieldClass?: string;
|
|
72
|
+
/** 滚动容器选择器或元素引用,默认取最近的 overflow:auto 祖先 */
|
|
73
|
+
root?: Element | null;
|
|
74
|
+
/** IntersectionObserver rootMargin,控制提前渲染的距离 */
|
|
75
|
+
rootMargin?: string;
|
|
76
|
+
/** 预估占位高度(px),首次渲染前使用 */
|
|
77
|
+
estimateHeight?: number;
|
|
78
|
+
/** 未进入视口时是否显示骨架屏(弹框首屏等场景减少白屏感),默认 true */
|
|
79
|
+
skeleton?: boolean;
|
|
80
|
+
/** 骨架屏是否开启动画,默认 true */
|
|
81
|
+
skeletonAnimated?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/** 分组表单组件 props */
|
|
84
|
+
export interface GroupFormSectionProps {
|
|
85
|
+
/** 分组表单定义(可选,优先从 store 读取) */
|
|
86
|
+
groupSchema?: GroupFormSchema[];
|
|
87
|
+
/** 表单 API */
|
|
88
|
+
formApi: ExtendedFormApi;
|
|
89
|
+
/** 分组折叠状态 */
|
|
90
|
+
collapseStates: Record<string, boolean>;
|
|
91
|
+
/** 滚动容器高度 */
|
|
92
|
+
containerHeight?: number | string;
|
|
93
|
+
/** 通用配置 */
|
|
94
|
+
commonConfig?: FormCommonConfig;
|
|
95
|
+
/** 布局 */
|
|
96
|
+
layout?: FormLayout;
|
|
97
|
+
/** 紧凑模式 */
|
|
98
|
+
compact?: boolean;
|
|
99
|
+
/** IntersectionObserver rootMargin,控制提前渲染距离 */
|
|
100
|
+
rootMargin?: string;
|
|
101
|
+
/** 预估每个表单项高度(px) */
|
|
102
|
+
estimateFieldHeight?: number;
|
|
103
|
+
/** 是否启用表单项级别的虚拟化,默认 true */
|
|
104
|
+
virtual?: boolean;
|
|
105
|
+
/** 共享的字段错误缓存,由 useGroupForm 创建 */
|
|
106
|
+
errorCacheMap?: Map<string, string>;
|
|
107
|
+
/** 重置信号,由 useGroupForm 创建 */
|
|
108
|
+
resetSignal?: Ref<number>;
|
|
109
|
+
/** 是否显示悬浮导航 */
|
|
110
|
+
showNav?: boolean;
|
|
111
|
+
/** 导航标题 */
|
|
112
|
+
navTitle?: string;
|
|
113
|
+
/** 导航各分组错误数量 */
|
|
114
|
+
navErrorCounts?: Record<string, number>;
|
|
115
|
+
/** 自动滚动到指定分组 */
|
|
116
|
+
autoScrollToGroup?: AutoScrollPosition;
|
|
117
|
+
/** 校验失败时是否自动滚动到第一个有错误的分组,默认 true */
|
|
118
|
+
scrollToFirstError?: boolean;
|
|
119
|
+
/** 切换分组折叠状态 */
|
|
120
|
+
toggleCollapse?: (key: string) => void;
|
|
121
|
+
}
|
|
122
|
+
/** GroupSection 递归组件 props */
|
|
123
|
+
export interface GroupSectionProps {
|
|
124
|
+
/** 当前节点的 schema(分组 / 行容器 / 字段) */
|
|
125
|
+
schema: GroupFormSchema;
|
|
126
|
+
/** 分组折叠状态 */
|
|
127
|
+
collapseStates: Record<string, boolean>;
|
|
128
|
+
/** 当前层级合并后的通用配置 */
|
|
129
|
+
commonConfig?: FormCommonConfig;
|
|
130
|
+
/** 全局通用配置(最外层传入,逐层透传) */
|
|
131
|
+
globalCommonConfig?: FormCommonConfig;
|
|
132
|
+
/** 表单布局方向 */
|
|
133
|
+
layout?: string;
|
|
134
|
+
/** 紧凑模式 */
|
|
135
|
+
compact?: boolean;
|
|
136
|
+
/** 当前嵌套深度,顶层为 0,递归时自增 */
|
|
137
|
+
depth?: number;
|
|
138
|
+
/** 是否启用表单项级别的虚拟化(IntersectionObserver 懒渲染) */
|
|
139
|
+
virtual?: boolean;
|
|
140
|
+
/** 虚拟化时滚动容器引用 */
|
|
141
|
+
scrollElement?: Element | null;
|
|
142
|
+
/** 虚拟化时 IntersectionObserver rootMargin */
|
|
143
|
+
virtualRootMargin?: string;
|
|
144
|
+
/** 虚拟化时预估表单项高度(px) */
|
|
145
|
+
virtualEstimateHeight?: number;
|
|
146
|
+
}
|
|
147
|
+
export type AutoScrollPosition = "top" | "bottom";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ExtendedFormApi } from '../types';
|
|
2
|
+
import { UseGroupFormOptions } from './types';
|
|
3
|
+
export declare function useGroupForm(options: UseGroupFormOptions): readonly [import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>, ExtendedFormApi, Record<string, boolean>];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { FormGroupSchema, FormRowSchema, GroupFormSchema } from './types';
|
|
2
|
+
import { FormSchema, FormSlotSchema } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* 判断当前节点是否为分组 schema(含 type: 'group' 与 children)
|
|
5
|
+
* @param {GroupFormSchema} schema - 分组表单 schema 节点(分组或字段)
|
|
6
|
+
* @returns {boolean} 若为分组则 true,且类型收窄为 FormGroupSchema
|
|
7
|
+
* @example
|
|
8
|
+
* if (isGroupSchema(item)) item.children; // 可安全访问 children
|
|
9
|
+
*/
|
|
10
|
+
export declare function isGroupSchema(schema: GroupFormSchema): schema is FormGroupSchema;
|
|
11
|
+
/**
|
|
12
|
+
* 判断当前节点是否为纯布局行容器(type: 'row')
|
|
13
|
+
* @param {GroupFormSchema} schema - 分组表单 schema 节点
|
|
14
|
+
* @returns {boolean} 若为行容器则 true,且类型收窄为 FormRowSchema
|
|
15
|
+
* @example
|
|
16
|
+
* if (isRowSchema(item)) item.children; // 可安全访问 children(均为字段)
|
|
17
|
+
*/
|
|
18
|
+
export declare function isRowSchema(schema: GroupFormSchema): schema is FormRowSchema;
|
|
19
|
+
/**
|
|
20
|
+
* 判断当前节点是否为自定义插槽(type: 'slot')
|
|
21
|
+
* @param {GroupFormSchema} schema - 分组表单 schema 节点
|
|
22
|
+
* @returns {boolean} 若为插槽则 true,且类型收窄为 FormSlotSchema
|
|
23
|
+
* @example
|
|
24
|
+
* if (isSlotSchema(item)) console.log(item.content);
|
|
25
|
+
*/
|
|
26
|
+
export declare function isSlotSchema(schema: GroupFormSchema): schema is FormSlotSchema;
|
|
27
|
+
/**
|
|
28
|
+
* 递归展平分组 schema,提取所有字段 schema(忽略分组结构)
|
|
29
|
+
* @param {GroupFormSchema[]} schemas - 分组 schema 数组,可包含分组与字段的混合结构
|
|
30
|
+
* @returns {FormSchema[]} 展平后的字段 schema 数组,不包含分组节点
|
|
31
|
+
* @example
|
|
32
|
+
* const flat = extractFlatSchemas([
|
|
33
|
+
* { type: 'group', key: 'basic', children: [{ fieldName: 'name' }] },
|
|
34
|
+
* { fieldName: 'age' }
|
|
35
|
+
* ]);
|
|
36
|
+
* // 返回: [{ fieldName: 'name' }, { fieldName: 'age' }]
|
|
37
|
+
*/
|
|
38
|
+
export declare function extractFlatSchemas(schemas: GroupFormSchema[]): FormSchema[];
|
|
39
|
+
/**
|
|
40
|
+
* 递归收集分组 schema 中 defaultCollapsed 为 true 的分组 key,写入 states
|
|
41
|
+
* @param {GroupFormSchema[]} schemas - 分组表单 schema 数组
|
|
42
|
+
* @param {Record<string, boolean>} states - 折叠状态对象,按分组 key 写入 true 表示初始折叠
|
|
43
|
+
* @example
|
|
44
|
+
* const states = {}; collectDefaultCollapseStates(groupSchema, states);
|
|
45
|
+
*/
|
|
46
|
+
export declare function collectDefaultCollapseStates(schemas: any[], states: Record<string, boolean>): void;
|
|
47
|
+
/**
|
|
48
|
+
* 插入位置描述
|
|
49
|
+
* @property {string} [before] - 在匹配节点之前插入(匹配 fieldName / slot content / group key)
|
|
50
|
+
* @property {string} [after] - 在匹配节点之后插入(匹配规则同 before)
|
|
51
|
+
*/
|
|
52
|
+
export interface InsertPosition {
|
|
53
|
+
before?: string;
|
|
54
|
+
after?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 在 groupSchema 树中查找指定 groupKey 的分组,并在其 children 中插入新字段。
|
|
58
|
+
* 当 before/after 匹配到 row 内部的字段时,会直接在 row 的 children 中插入
|
|
59
|
+
* @param {GroupFormSchema[]} schemas - 分组 schema 树(会被原地修改)
|
|
60
|
+
* @param {string} groupKey - 目标分组的 key
|
|
61
|
+
* @param {GroupFormSchema[]} fields - 要插入的字段
|
|
62
|
+
* @param {InsertPosition} [position] - 插入位置;省略则追加到末尾
|
|
63
|
+
* @returns {boolean} 是否找到目标分组并完成插入
|
|
64
|
+
* @example
|
|
65
|
+
* // 在 fieldName 为 'phone' 的字段之前插入
|
|
66
|
+
* insertFieldsInGroup(schema, 'contact', [newField], { before: 'phone' });
|
|
67
|
+
* @example
|
|
68
|
+
* // 在 row 内部的 'v_age' 字段之后插入
|
|
69
|
+
* insertFieldsInGroup(schema, 'basic', [newField], { after: 'v_age' });
|
|
70
|
+
*/
|
|
71
|
+
export declare function insertFieldsInGroup(schemas: GroupFormSchema[], groupKey: string, fields: GroupFormSchema[], position?: InsertPosition): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* 从 groupSchema 树中递归移除指定 fieldName 或 slot content 的节点
|
|
74
|
+
* @param {GroupFormSchema[]} schemas - 分组 schema 树(会被原地修改)
|
|
75
|
+
* @param {Set<string>} fieldNames - 要移除的标识集合(fieldName 或 slot content 字符串)
|
|
76
|
+
* @returns {GroupFormSchema[]} 过滤后的 schema 数组
|
|
77
|
+
* @example
|
|
78
|
+
* removeFieldsFromGroup(schema, new Set(['phone_0', 'divider-contact-0']));
|
|
79
|
+
*/
|
|
80
|
+
export declare function removeFieldsFromGroup(schemas: GroupFormSchema[], fieldNames: Set<string>): GroupFormSchema[];
|
|
81
|
+
/**
|
|
82
|
+
* 浅拷贝 groupSchema 树结构(只复制数组和分组/行的 children 引用,不深拷贝叶子节点)
|
|
83
|
+
* @param {GroupFormSchema[]} schemas - 原始 schema 树
|
|
84
|
+
* @returns {GroupFormSchema[]} 拷贝后的新树,可安全做 splice 等原地修改而不影响原树
|
|
85
|
+
*/
|
|
86
|
+
export declare function cloneSchemaTree(schemas: GroupFormSchema[]): GroupFormSchema[];
|
|
87
|
+
/**
|
|
88
|
+
* 获取分组 schema 的值
|
|
89
|
+
* @param {GroupFormSchema[]} groupSchema - 分组 schema 数组(可含 group / row / slot / 字段)
|
|
90
|
+
* @param {Record<string, any>} values - 表单值
|
|
91
|
+
* @returns {Record<string, any>} 分组值
|
|
92
|
+
*/
|
|
93
|
+
export declare function getGroupValues(groupSchema: GroupFormSchema[], values: Record<string, any>): Record<string, any>;
|
|
@@ -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';
|