Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Oct 3, 2024
1 parent 36d995f commit 903c9d3
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/web-antd/src/adapter/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const withDefaultPlaceholder = <T extends Component>(
) => {
return (props: any, { attrs, slots }: Omit<SetupContext, 'expose'>) => {
const placeholder = props?.placeholder || $t(`placeholder.${type}`);
return h(component, { ...props, attrs, placeholder }, slots);
return h(component, { ...props, ...attrs, placeholder }, slots);
};
};

Expand Down
2 changes: 1 addition & 1 deletion apps/web-ele/src/adapter/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const withDefaultPlaceholder = <T extends Component>(
) => {
return (props: any, { attrs, slots }: Omit<SetupContext, 'expose'>) => {
const placeholder = props?.placeholder || $t(`placeholder.${type}`);
return h(component, { ...props, attrs, placeholder }, slots);
return h(component, { ...props, ...attrs, placeholder }, slots);
};
};

Expand Down
2 changes: 1 addition & 1 deletion apps/web-naive/src/adapter/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const withDefaultPlaceholder = <T extends Component>(
) => {
return (props: any, { attrs, slots }: Omit<SetupContext, 'expose'>) => {
const placeholder = props?.placeholder || $t(`placeholder.${type}`);
return h(component, { ...props, attrs, placeholder }, slots);
return h(component, { ...props, ...attrs, placeholder }, slots);
};
};

Expand Down
4 changes: 2 additions & 2 deletions packages/@core/ui-kit/form-ui/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { defineRule } from 'vee-validate';

const DEFAULT_MODEL_PROP_NAME = 'modelValue';

export const DEFAULT_FORM_COMMOM_CONFIG: FormCommonConfig = {};
export const DEFAULT_FORM_COMMON_CONFIG: FormCommonConfig = {};

export const COMPONENT_MAP: Record<BaseFormComponentType, Component> = {
DefaultResetActionButton: h(VbenButton, { size: 'sm', variant: 'outline' }),
Expand All @@ -43,7 +43,7 @@ export function setupVbenForm<
>(options: VbenFormAdapterOptions<T>) {
const { components, config, defineRules } = options;

DEFAULT_FORM_COMMOM_CONFIG.disabledOnChangeListener =
DEFAULT_FORM_COMMON_CONFIG.disabledOnChangeListener =
config?.disabledOnChangeListener ?? false;

if (defineRules) {
Expand Down
4 changes: 2 additions & 2 deletions packages/@core/ui-kit/form-ui/src/form-render/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
import { computed } from 'vue';
import { Form } from '@vben-core/shadcn-ui';
import { cn, isString } from '@vben-core/shared/utils';
import { cn, isString, mergeWithArrayOverride } from '@vben-core/shared/utils';
import { type GenericObject } from 'vee-validate';
Expand Down Expand Up @@ -94,7 +94,7 @@ const computedSchema = computed(
labelClass = '',
labelWidth = 100,
wrapperClass = '',
} = Object.assign({}, props.globalCommonConfig, props.commonConfig);
} = mergeWithArrayOverride(props.commonConfig, props.globalCommonConfig);
return (props.schema || []).map((schema, index) => {
const keepIndex = keepFormItemIndex.value;
Expand Down
4 changes: 2 additions & 2 deletions packages/@core/ui-kit/form-ui/src/vben-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import FormActions from './components/form-actions.vue';
import {
COMPONENT_BIND_EVENT_MAP,
COMPONENT_MAP,
DEFAULT_FORM_COMMOM_CONFIG,
DEFAULT_FORM_COMMON_CONFIG,
} from './config';
import { Form } from './form-render';
import { provideFormProps, useFormInitial } from './use-form-context';
Expand Down Expand Up @@ -55,7 +55,7 @@ watchEffect(() => {
:component-bind-event-map="COMPONENT_BIND_EVENT_MAP"
:component-map="COMPONENT_MAP"
:form="form"
:global-common-config="DEFAULT_FORM_COMMOM_CONFIG"
:global-common-config="DEFAULT_FORM_COMMON_CONFIG"
>
<template
v-for="slotName in delegatedSlots"
Expand Down
4 changes: 2 additions & 2 deletions packages/@core/ui-kit/form-ui/src/vben-use-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import FormActions from './components/form-actions.vue';
import {
COMPONENT_BIND_EVENT_MAP,
COMPONENT_MAP,
DEFAULT_FORM_COMMOM_CONFIG,
DEFAULT_FORM_COMMON_CONFIG,
} from './config';
import { Form } from './form-render';
import { provideFormProps, useFormInitial } from './use-form-context';
Expand Down Expand Up @@ -39,7 +39,7 @@ const handleUpdateCollapsed = (value: boolean) => {
:component-bind-event-map="COMPONENT_BIND_EVENT_MAP"
:component-map="COMPONENT_MAP"
:form="form"
:global-common-config="DEFAULT_FORM_COMMOM_CONFIG"
:global-common-config="DEFAULT_FORM_COMMON_CONFIG"
>
<template
v-for="slotName in delegatedSlots"
Expand Down
2 changes: 1 addition & 1 deletion playground/src/adapter/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const withDefaultPlaceholder = <T extends Component>(
) => {
return (props: any, { attrs, slots }: Omit<SetupContext, 'expose'>) => {
const placeholder = props?.placeholder || $t(`placeholder.${type}`);
return h(component, { ...props, attrs, placeholder }, slots);
return h(component, { ...props, ...attrs, placeholder }, slots);
};
};

Expand Down

0 comments on commit 903c9d3

Please sign in to comment.