From 8f0c2fa811c01e88a154771212a7d89ac2c3ba8c Mon Sep 17 00:00:00 2001 From: xingyu Date: Fri, 19 May 2023 16:37:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=9A=90=E8=97=8F=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Table/src/BasicTable.vue | 13 +++++++--- .../src/components/settings/FormSetting.vue | 24 +++++++++++++++++++ .../src/components/settings/SizeSetting.vue | 14 +++++------ .../Table/src/components/settings/index.vue | 3 +++ .../Table/src/hooks/useTableForm.ts | 17 ++++++++++--- src/components/Table/src/types/table.ts | 3 +++ 6 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 src/components/Table/src/components/settings/FormSetting.vue diff --git a/src/components/Table/src/BasicTable.vue b/src/components/Table/src/BasicTable.vue index 3cee7705..ab2a8d52 100644 --- a/src/components/Table/src/BasicTable.vue +++ b/src/components/Table/src/BasicTable.vue @@ -4,7 +4,7 @@ ref="formRef" submitOnReset v-bind="getFormProps" - v-if="getBindValues.useSearchForm" + v-if="getShowForm() && getBindValues.useSearchForm" :tableAction="tableAction" @register="registerForm" @submit="handleSearchInfoChange" @@ -203,7 +203,12 @@ const { getHeaderProps } = useTableHeader(getProps, slots, handlers) const { getFooterProps } = useTableFooter(getProps, getScrollRef, tableElRef, getDataSourceRef) -const { getFormProps, replaceFormSlotKey, getFormSlotKeys, handleSearchInfoChange } = useTableForm(getProps, slots, fetch, getLoading) +const { getFormProps, replaceFormSlotKey, getFormSlotKeys, handleSearchInfoChange, getShowForm, setShowForm } = useTableForm( + getProps, + slots, + fetch, + getLoading +) const getBindValues = computed(() => { const dataSource = unref(getDataSourceRef) @@ -295,7 +300,9 @@ const tableAction: TableActionType = { getSize: () => { return unref(getBindValues).size as SizeType }, - setCacheColumns + setCacheColumns, + setShowForm, + getShowForm } createTableContext({ ...tableAction, wrapRef, getBindValues }) diff --git a/src/components/Table/src/components/settings/FormSetting.vue b/src/components/Table/src/components/settings/FormSetting.vue new file mode 100644 index 00000000..191f485b --- /dev/null +++ b/src/components/Table/src/components/settings/FormSetting.vue @@ -0,0 +1,24 @@ + + diff --git a/src/components/Table/src/components/settings/SizeSetting.vue b/src/components/Table/src/components/settings/SizeSetting.vue index 74f00b4f..b2f85e50 100644 --- a/src/components/Table/src/components/settings/SizeSetting.vue +++ b/src/components/Table/src/components/settings/SizeSetting.vue @@ -8,15 +8,15 @@ @@ -31,8 +31,6 @@ import { useI18n } from '@/hooks/web/useI18n' import { useTableContext } from '../../hooks/useTableContext' import { getPopupContainer } from '@/utils' -const MenuItem = Menu.Item - defineOptions({ name: 'SizeSetting' }) const table = useTableContext() diff --git a/src/components/Table/src/components/settings/index.vue b/src/components/Table/src/components/settings/index.vue index cbbcf5e5..d3909a53 100644 --- a/src/components/Table/src/components/settings/index.vue +++ b/src/components/Table/src/components/settings/index.vue @@ -1,6 +1,7 @@