pull/176/head
xingyu4j 2025-07-19 12:24:22 +08:00
commit 879de80857
7 changed files with 49 additions and 29 deletions

View File

@ -395,7 +395,7 @@ export interface FormCommonConfig {
* 所有表单项的栅格布局
* @default ""
*/
formItemClass?: string;
formItemClass?: (() => string) | string;
/**
* 隐藏所有表单项label
* @default false

View File

@ -12,7 +12,12 @@ import type {
import { computed } from 'vue';
import { Form } from '@vben-core/shadcn-ui';
import { cn, isString, mergeWithArrayOverride } from '@vben-core/shared/utils';
import {
cn,
isFunction,
isString,
mergeWithArrayOverride,
} from '@vben-core/shared/utils';
import { provideFormRenderProps } from './context';
import { useExpandable } from './expandable';
@ -110,6 +115,17 @@ const computedSchema = computed(
? keepIndex <= index
: false;
// formItemClass
let resolvedSchemaFormItemClass = schema.formItemClass;
if (isFunction(schema.formItemClass)) {
try {
resolvedSchemaFormItemClass = schema.formItemClass();
} catch (error) {
console.error('Error calling formItemClass function:', error);
resolvedSchemaFormItemClass = '';
}
}
return {
colon,
disabled,
@ -133,7 +149,7 @@ const computedSchema = computed(
'flex-shrink-0',
{ hidden },
formItemClass,
schema.formItemClass,
resolvedSchemaFormItemClass,
),
labelClass: cn(labelClass, schema.labelClass),
};

View File

@ -176,10 +176,10 @@ export interface FormCommonConfig {
*/
formFieldProps?: FormFieldOptions;
/**
*
*
* @default ""
*/
formItemClass?: string;
formItemClass?: (() => string) | string;
/**
* label
* @default false

View File

@ -85,7 +85,7 @@ useScrollLock();
<transition name="slide-left">
<div v-show="!showUnlockForm" class="size-full">
<div
class="flex-col-center text-foreground/80 hover:text-foreground group my-4 cursor-pointer text-xl font-semibold"
class="flex-col-center text-foreground/80 hover:text-foreground group fixed left-1/2 top-6 z-[2001] -translate-x-1/2 cursor-pointer text-xl font-semibold"
@click="toggleUnlockForm"
>
<LockKeyhole
@ -93,19 +93,23 @@ useScrollLock();
/>
<span>{{ $t('ui.widgets.lockScreen.unlock') }}</span>
</div>
<div class="flex h-full justify-center px-[10%]">
<div
class="bg-accent flex-center relative mb-14 mr-20 h-4/5 w-2/5 flex-auto rounded-3xl text-center text-[260px]"
>
<span class="absolute left-4 top-4 text-xl font-semibold">
{{ meridiem }}
</span>
{{ hour }}
</div>
<div
class="bg-accent flex-center mb-14 h-4/5 w-2/5 flex-auto rounded-3xl text-center text-[260px]"
>
{{ minute }}
<div class="flex h-full w-full items-center justify-center">
<div class="flex w-full justify-center gap-4 px-4 sm:gap-6 md:gap-8">
<div
class="bg-accent relative flex h-[140px] w-[140px] items-center justify-center rounded-xl text-[36px] sm:h-[160px] sm:w-[160px] sm:text-[42px] md:h-[200px] md:w-[200px] md:text-[72px]"
>
<span
class="absolute left-3 top-3 text-xs font-semibold sm:text-sm md:text-xl"
>
{{ meridiem }}
</span>
{{ hour }}
</div>
<div
class="bg-accent flex h-[140px] w-[140px] items-center justify-center rounded-xl text-[36px] sm:h-[160px] sm:w-[160px] sm:text-[42px] md:h-[200px] md:w-[200px] md:text-[72px]"
>
{{ minute }}
</div>
</div>
</div>
</div>
@ -117,9 +121,8 @@ useScrollLock();
class="flex-center size-full"
@keydown.enter.prevent="handleSubmit"
>
<div class="flex-col-center mb-10 w-[300px]">
<div class="flex-col-center mb-10 w-[90%] max-w-[300px] px-4">
<VbenAvatar :src="avatar" class="enter-x mb-6 size-20" />
<div class="enter-x mb-2 w-full items-center">
<Form />
</div>
@ -145,12 +148,13 @@ useScrollLock();
</transition>
<div
class="enter-y absolute bottom-5 w-full text-center xl:text-xl 2xl:text-3xl"
class="enter-y absolute bottom-5 w-full text-center text-xl md:text-2xl xl:text-xl 2xl:text-3xl"
>
<div v-if="showUnlockForm" class="enter-x mb-2 text-3xl">
{{ hour }}:{{ minute }} <span class="text-lg">{{ meridiem }}</span>
<div v-if="showUnlockForm" class="enter-x mb-2 text-2xl md:text-3xl">
{{ hour }}:{{ minute }}
<span class="text-base md:text-lg">{{ meridiem }}</span>
</div>
<div class="text-3xl">{{ date }}</div>
<div class="text-xl md:text-3xl">{{ date }}</div>
</div>
</div>
</template>

View File

@ -300,7 +300,7 @@ async function init() {
const enableProxyConfig = options.value.proxyConfig?.enabled;
if (enableProxyConfig && autoLoad) {
props.api.grid.commitProxy?.(
'_init',
'initial',
formOptions.value ? ((await formApi.getValues()) ?? {}) : {},
);
// props.api.reload(formApi.form?.values ?? {});

View File

@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<RowType> = {
custom: true,
export: true,
// import: true,
refresh: { code: 'query' },
refresh: true,
zoom: true,
},
};

View File

@ -204,8 +204,8 @@ catalog:
vue-router: ^4.5.1
vue-tippy: ^6.7.1
vue-tsc: 2.2.10
vxe-pc-ui: ^4.6.42
vxe-table: ^4.13.51
vxe-pc-ui: ^4.7.12
vxe-table: ^4.14.4
watermark-js-plus: ^1.6.2
zod: ^3.25.67
zod-defaults: ^0.1.3