fix: table internal search collspaed configuration does not take effect (#4585)
* fix: table internal search collspaed configuration does not take effect * chore: typopull/48/MERGE
parent
f0edad8a51
commit
ab44926ec8
|
@ -78,7 +78,9 @@ watch(
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
:class="cn('col-span-full w-full text-right', rootProps.actionWrapperClass)"
|
:class="
|
||||||
|
cn('col-span-full w-full pb-6 text-right', rootProps.actionWrapperClass)
|
||||||
|
"
|
||||||
:style="queryFormStyle"
|
:style="queryFormStyle"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
|
|
|
@ -26,6 +26,7 @@ export function useVbenForm<
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
api.unmount();
|
api.unmount();
|
||||||
});
|
});
|
||||||
|
api.setState({ ...props, ...attrs });
|
||||||
return () =>
|
return () =>
|
||||||
h(VbenUseForm, { ...props, ...attrs, formApi: extendedApi }, slots);
|
h(VbenUseForm, { ...props, ...attrs, formApi: extendedApi }, slots);
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,23 +34,12 @@ props.formApi?.mount?.(form);
|
||||||
const handleUpdateCollapsed = (value: boolean) => {
|
const handleUpdateCollapsed = (value: boolean) => {
|
||||||
props.formApi?.setState({ collapsed: !!value });
|
props.formApi?.setState({ collapsed: !!value });
|
||||||
};
|
};
|
||||||
// if (isFunction(forward.value.handleValuesChange)) {
|
|
||||||
// watch(
|
|
||||||
// () => form.values,
|
|
||||||
// (val) => {
|
|
||||||
// forward.value.handleValuesChange?.(toRaw(val));
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// deep: true,
|
|
||||||
// immediate: true,
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Form
|
<Form
|
||||||
v-bind="forward"
|
v-bind="forward"
|
||||||
|
:collapsed="state.collapsed"
|
||||||
:component-bind-event-map="COMPONENT_BIND_EVENT_MAP"
|
:component-bind-event-map="COMPONENT_BIND_EVENT_MAP"
|
||||||
:component-map="COMPONENT_MAP"
|
:component-map="COMPONENT_MAP"
|
||||||
:form="form"
|
:form="form"
|
||||||
|
|
|
@ -20,6 +20,7 @@ export function useVbenVxeGrid(options: VxeGridProps) {
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
api.unmount();
|
api.unmount();
|
||||||
});
|
});
|
||||||
|
api.setState({ ...props, ...attrs });
|
||||||
return () => h(VxeGrid, { ...props, ...attrs, api: extendedApi }, slots);
|
return () => h(VxeGrid, { ...props, ...attrs, api: extendedApi }, slots);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -215,7 +215,6 @@ async function init() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
props.api?.mount?.(gridRef.value, formApi);
|
props.api?.mount?.(gridRef.value, formApi);
|
||||||
init();
|
init();
|
||||||
|
@ -246,7 +245,7 @@ onMounted(() => {
|
||||||
<slot :name="slotName" v-bind="slotProps"></slot>
|
<slot :name="slotName" v-bind="slotProps"></slot>
|
||||||
</template>
|
</template>
|
||||||
<template #form>
|
<template #form>
|
||||||
<div v-if="formOptions" class="relative rounded py-3 pb-6">
|
<div v-if="formOptions" class="relative rounded py-3 pb-4">
|
||||||
<slot name="form">
|
<slot name="form">
|
||||||
<Form v-bind="vbenFormOptions">
|
<Form v-bind="vbenFormOptions">
|
||||||
<template
|
<template
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { VbenFormProps, VxeGridProps } from '#/adapter';
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { Button, message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter';
|
import { useVbenVxeGrid } from '#/adapter';
|
||||||
import { getExampleTableApi } from '#/api';
|
import { getExampleTableApi } from '#/api';
|
||||||
|
@ -92,11 +92,28 @@ const gridOptions: VxeGridProps<RowType> = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
|
const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||||
|
|
||||||
|
function toggleFormCollspae() {
|
||||||
|
gridApi.formApi.resetForm();
|
||||||
|
gridApi.setState({
|
||||||
|
formOptions: {
|
||||||
|
showCollapseButton: !(
|
||||||
|
gridApi.state?.formOptions?.showCollapseButton ?? true
|
||||||
|
),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
<Grid />
|
<Grid>
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Button type="primary" @click="toggleFormCollspae">
|
||||||
|
切换表单折叠按钮
|
||||||
|
</Button>
|
||||||
|
</template>
|
||||||
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue