This commit is contained in:
dap
2025-01-01 12:57:20 +08:00
251 changed files with 619 additions and 959 deletions

View File

@@ -1,12 +1,11 @@
import type { Component } from 'vue';
import type {
BaseFormComponentType,
FormCommonConfig,
VbenFormAdapterOptions,
} from './types';
import type { Component } from 'vue';
import { h } from 'vue';
import {
VbenButton,
VbenCheckbox,
@@ -17,8 +16,8 @@ import {
VbenSelect,
} from '@vben-core/shadcn-ui';
import { globalShareState } from '@vben-core/shared/global-state';
import { defineRule } from 'vee-validate';
import { h } from 'vue';
const DEFAULT_MODEL_PROP_NAME = 'modelValue';

View File

@@ -8,8 +8,6 @@ import type {
import type { FormActions, FormSchema, VbenFormProps } from './types';
import { toRaw } from 'vue';
import { Store } from '@vben-core/shared/store';
import {
bindMethods,
@@ -21,6 +19,7 @@ import {
mergeWithArrayOverride,
StateHandler,
} from '@vben-core/shared/utils';
import { toRaw } from 'vue';
function getDefaultState(): VbenFormProps {
return {
@@ -112,11 +111,6 @@ export class FormApi {
}
}
// 如果需要多次更新状态,可以使用 batch 方法
batchStore(cb: () => void) {
this.store.batch(cb);
}
getLatestSubmissionValues() {
return this.latestSubmissionValues || {};
}

View File

@@ -3,8 +3,6 @@ import type { ZodType } from 'zod';
import type { FormSchema, MaybeComponentProps } from '../types';
import { computed, nextTick, useTemplateRef, watch } from 'vue';
import {
FormControl,
FormDescription,
@@ -14,9 +12,9 @@ import {
VbenRenderContent,
} from '@vben-core/shadcn-ui';
import { cn, isFunction, isObject, isString } from '@vben-core/shared/utils';
import { toTypedSchema } from '@vee-validate/zod';
import { useFieldError, useFormValues } from 'vee-validate';
import { computed, nextTick, useTemplateRef, watch } from 'vue';
import { injectRenderFormProps, useFormContext } from './context';
import useDependencies from './dependencies';

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import type { GenericObject } from 'vee-validate';
import type { ZodTypeAny } from 'zod';
import type {
@@ -8,12 +9,9 @@ import type {
FormShape,
} from '../types';
import { computed } from 'vue';
import { Form } from '@vben-core/shadcn-ui';
import { cn, isString, mergeWithArrayOverride } from '@vben-core/shared/utils';
import { type GenericObject } from 'vee-validate';
import { computed } from 'vue';
import { provideFormRenderProps } from './context';
import { useExpandable } from './expandable';

View File

@@ -1,12 +1,11 @@
import type { VbenButtonProps } from '@vben-core/shadcn-ui';
import type { ClassType } from '@vben-core/typings';
import type { FieldOptions, FormContext, GenericObject } from 'vee-validate';
import type { Component, HtmlHTMLAttributes, Ref } from 'vue';
import type { ZodTypeAny } from 'zod';
import type { FormApi } from './form-api';
import type { Component, HtmlHTMLAttributes, Ref } from 'vue';
export type FormLayout = 'horizontal' | 'vertical';
export type BaseFormComponentType =

View File

@@ -1,12 +1,13 @@
import type { FormActions, VbenFormProps } from './types';
import type { ComputedRef } from 'vue';
import type { ZodRawShape } from 'zod';
import { computed, type ComputedRef, unref, useSlots } from 'vue';
import type { FormActions, VbenFormProps } from './types';
import { createContext } from '@vben-core/shadcn-ui';
import { isString } from '@vben-core/shared/utils';
import { useForm } from 'vee-validate';
import { object, type ZodRawShape } from 'zod';
import { computed, unref, useSlots } from 'vue';
import { object } from 'zod';
import { getDefaultsForSchema } from 'zod-defaults';
export const [injectFormProps, provideFormProps] =

View File

@@ -2,14 +2,11 @@
import type { ExtendedFormApi, VbenFormProps } from './types';
// import { toRaw, watch } from 'vue';
import { useForwardPriorityValues } from '@vben-core/composables';
import { nextTick, onMounted, watch } from 'vue';
// import { isFunction } from '@vben-core/shared/utils';
import { nextTick, onMounted, watch } from 'vue';
import { useForwardPriorityValues } from '@vben-core/composables';
import { cloneDeep } from '@vben-core/shared/utils';
import { useDebounceFn } from '@vueuse/core';
import FormActions from './components/form-actions.vue';