Ben Lin
2024-08-22 436b52186129e60ba72c20e43d2845bc3f899901
src/components/Table/src/hooks/useTableHeader.ts
@@ -1,17 +1,20 @@
import type { ComputedRef, Slots } from 'vue';
import type { BasicTableProps, InnerHandlers } from '../types/table';
import type { BasicTableProps, InnerHandlers, InnerMethods } from '../types/table';
import { unref, computed, h } from 'vue';
import TableHeader from '../components/TableHeader.vue';
import { isString } from '/@/utils/is';
import { getSlot } from '/@/utils/helper/tsxHelper';
import { isString } from '@/utils/is';
import { getSlot } from '@/utils/helper/tsxHelper';
export function useTableHeader(
  propsRef: ComputedRef<BasicTableProps>,
  slots: Slots,
  handlers: InnerHandlers,
  //
  methods: InnerMethods,
) {
  const getHeaderProps = computed((): Recordable => {
    const { title, showTableSetting, titleHelpMessage, tableSetting } = unref(propsRef);
    const { title, showTableSetting, titleHelpMessage, tableSetting, showSelectionBar } =
      unref(propsRef);
    const hideTitle = !slots.tableTitle && !title && !slots.toolbar && !showTableSetting;
    if (hideTitle && !isString(title)) {
      return {};
@@ -29,6 +32,10 @@
                showTableSetting,
                tableSetting,
                onColumnsChange: handlers.onColumnsChange,
                //
                clearSelectedRowKeys: methods.clearSelectedRowKeys,
                count: methods.getSelectRowKeys().length,
                showSelectionBar,
              } as Recordable,
              {
                ...(slots.toolbar