浏览代码

style: formatting code

zuihou 3 年之前
父节点
当前提交
3ef5087be6

+ 7 - 9
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 || {};

+ 9 - 11
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 };
     },

+ 1 - 1
src/components/Table/src/hooks/useColumns.ts

@@ -109,7 +109,7 @@ export function useColumns(
   propsRef: ComputedRef<BasicTableProps>,
   getPaginationRef: ComputedRef<boolean | PaginationProps>
 ) {
-  const columnsRef = (ref(unref(propsRef).columns) as unknown) as Ref<BasicColumn[]>;
+  const columnsRef = ref(unref(propsRef).columns) as unknown as Ref<BasicColumn[]>;
   let cacheColumns = unref(propsRef).columns;
 
   const getColumnsRef = computed(() => {

+ 2 - 9
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);

+ 2 - 4
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);

+ 10 - 12
src/components/Table/src/hooks/useTableForm.ts

@@ -9,18 +9,16 @@ export function useTableForm(
   fetch: (opt?: FetchParams | undefined) => Promise<void>,
   getLoading: ComputedRef<boolean | undefined>
 ) {
-  const getFormProps = computed(
-    (): Partial<FormProps> => {
-      const { formConfig } = unref(propsRef);
-      const { submitButtonOptions } = formConfig || {};
-      return {
-        showAdvancedButton: true,
-        ...formConfig,
-        submitButtonOptions: { loading: unref(getLoading), ...submitButtonOptions },
-        compact: true,
-      };
-    }
-  );
+  const getFormProps = computed((): Partial<FormProps> => {
+    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);

+ 33 - 35
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<BasicTableProps>, 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 };
 }