diff --git a/src/components/Table/src/components/editable/EditableCell.vue b/src/components/Table/src/components/editable/EditableCell.vue index 0b92ebf69d879e0343429bdc5c024ce87e3c0b39..326ba5014734f7ca97cf986a691bac45f3ebc153 100644 --- a/src/components/Table/src/components/editable/EditableCell.vue +++ b/src/components/Table/src/components/editable/EditableCell.vue @@ -131,16 +131,14 @@ return option?.label ?? value; }); - const getWrapperStyle = computed( - (): CSSProperties => { - if (unref(getIsCheckComp) || unref(getRowEditable)) { - return {}; - } - return { - width: 'calc(100% - 48px)', - }; + const getWrapperStyle = computed((): CSSProperties => { + if (unref(getIsCheckComp) || unref(getRowEditable)) { + return {}; } - ); + return { + width: 'calc(100% - 48px)', + }; + }); const getRowEditable = computed(() => { const { editable } = props.record || {}; diff --git a/src/components/Table/src/components/settings/index.vue b/src/components/Table/src/components/settings/index.vue index 71e5541243094b849f339762329f440f505f4a11..ed07999344bd49d62db55d1c4d143945e168df4a 100644 --- a/src/components/Table/src/components/settings/index.vue +++ b/src/components/Table/src/components/settings/index.vue @@ -36,17 +36,15 @@ setup(props) { const { t } = useI18n(); - const getSetting = computed( - (): TableSetting => { - return { - redo: true, - size: true, - setting: true, - fullScreen: false, - ...props.setting, - }; - } - ); + const getSetting = computed((): TableSetting => { + return { + redo: true, + size: true, + setting: true, + fullScreen: false, + ...props.setting, + }; + }); return { getSetting, t }; }, diff --git a/src/components/Table/src/hooks/useColumns.ts b/src/components/Table/src/hooks/useColumns.ts index 24f6f45c507e5d6f520cd9f1fc38b0cae5749ed6..7172486eff9e972840a35f3c83f40d8c45181c88 100644 --- a/src/components/Table/src/hooks/useColumns.ts +++ b/src/components/Table/src/hooks/useColumns.ts @@ -109,7 +109,7 @@ export function useColumns( propsRef: ComputedRef, getPaginationRef: ComputedRef ) { - const columnsRef = (ref(unref(propsRef).columns) as unknown) as Ref; + const columnsRef = ref(unref(propsRef).columns) as unknown as Ref; let cacheColumns = unref(propsRef).columns; const getColumnsRef = computed(() => { diff --git a/src/components/Table/src/hooks/useDataSource.ts b/src/components/Table/src/hooks/useDataSource.ts index b68866c4233d48b3aa215698e769de905bc130d7..1d161abd672da695eb845bc06b5721946bfeeda1 100644 --- a/src/components/Table/src/hooks/useDataSource.ts +++ b/src/components/Table/src/hooks/useDataSource.ts @@ -150,15 +150,8 @@ export function useDataSource( } async function fetch(opt?: FetchParams) { - const { - api, - searchInfo, - fetchSetting, - beforeFetch, - afterFetch, - useSearchForm, - pagination, - } = unref(propsRef); + const { api, searchInfo, fetchSetting, beforeFetch, afterFetch, useSearchForm, pagination } = + unref(propsRef); if (!api || !isFunction(api)) return; try { setLoading(true); diff --git a/src/components/Table/src/hooks/useTable.ts b/src/components/Table/src/hooks/useTable.ts index 1afd34b24d00749184699806b07719d76ba740f6..740420a5086bbddf8b71970667983083a0c8c174 100644 --- a/src/components/Table/src/hooks/useTable.ts +++ b/src/components/Table/src/hooks/useTable.ts @@ -15,9 +15,7 @@ type UseTableMethod = TableActionType & { getForm: () => FormActionType; }; -export function useTable( - tableProps?: Props -): [ +export function useTable(tableProps?: Props): [ (instance: TableActionType, formInstance: UseTableMethod) => void, TableActionType & { getForm: () => FormActionType; @@ -129,7 +127,7 @@ export function useTable( return toRaw(getTableInstance().getCacheColumns()); }, getForm: () => { - return (unref(formRef) as unknown) as FormActionType; + return unref(formRef) as unknown as FormActionType; }, setShowPagination: async (show: boolean) => { getTableInstance().setShowPagination(show); diff --git a/src/components/Table/src/hooks/useTableForm.ts b/src/components/Table/src/hooks/useTableForm.ts index 500aa0b81e1fce9aab241802c8a9133c113bcd08..09d2d7779b07f2e48ee414e1196215546c7aa1bb 100644 --- a/src/components/Table/src/hooks/useTableForm.ts +++ b/src/components/Table/src/hooks/useTableForm.ts @@ -9,18 +9,16 @@ export function useTableForm( fetch: (opt?: FetchParams | undefined) => Promise, getLoading: ComputedRef ) { - const getFormProps = computed( - (): Partial => { - const { formConfig } = unref(propsRef); - const { submitButtonOptions } = formConfig || {}; - return { - showAdvancedButton: true, - ...formConfig, - submitButtonOptions: { loading: unref(getLoading), ...submitButtonOptions }, - compact: true, - }; - } - ); + const getFormProps = computed((): Partial => { + const { formConfig } = unref(propsRef); + const { submitButtonOptions } = formConfig || {}; + return { + showAdvancedButton: true, + ...formConfig, + submitButtonOptions: { loading: unref(getLoading), ...submitButtonOptions }, + compact: true, + }; + }); const getFormSlotKeys = computed(() => { const keys = Object.keys(slots); diff --git a/src/components/Table/src/hooks/useTableHeader.ts b/src/components/Table/src/hooks/useTableHeader.ts index 515fc86da3569457495724c6ec995d3bba0b72c7..93c3ef4a6f16d2d206b762f6690979c92af5d20d 100644 --- a/src/components/Table/src/hooks/useTableHeader.ts +++ b/src/components/Table/src/hooks/useTableHeader.ts @@ -8,41 +8,39 @@ import { isString } from '/@/utils/is'; import { getSlot } from '/@/utils/helper/tsxHelper'; export function useTableHeader(propsRef: ComputedRef, slots: Slots) { - const getHeaderProps = computed( - (): Recordable => { - const { title, showTableSetting, titleHelpMessage, tableSetting } = unref(propsRef); - const hideTitle = !slots.tableTitle && !title && !slots.toolbar && !showTableSetting; - if (hideTitle && !isString(title)) { - return {}; - } - - return { - title: hideTitle - ? null - : () => - h( - TableHeader, - { - title, - titleHelpMessage, - showTableSetting, - tableSetting, - } as Recordable, - { - ...(slots.toolbar - ? { - toolbar: () => getSlot(slots, 'toolbar'), - } - : {}), - ...(slots.tableTitle - ? { - tableTitle: () => getSlot(slots, 'tableTitle'), - } - : {}), - } - ), - }; + const getHeaderProps = computed((): Recordable => { + const { title, showTableSetting, titleHelpMessage, tableSetting } = unref(propsRef); + const hideTitle = !slots.tableTitle && !title && !slots.toolbar && !showTableSetting; + if (hideTitle && !isString(title)) { + return {}; } - ); + + return { + title: hideTitle + ? null + : () => + h( + TableHeader, + { + title, + titleHelpMessage, + showTableSetting, + tableSetting, + } as Recordable, + { + ...(slots.toolbar + ? { + toolbar: () => getSlot(slots, 'toolbar'), + } + : {}), + ...(slots.tableTitle + ? { + tableTitle: () => getSlot(slots, 'tableTitle'), + } + : {}), + } + ), + }; + }); return { getHeaderProps }; }