style: formatting code
This commit is contained in:
parent
2d3d04f547
commit
3ef5087be6
|
|
@ -131,16 +131,14 @@
|
||||||
return option?.label ?? value;
|
return option?.label ?? value;
|
||||||
});
|
});
|
||||||
|
|
||||||
const getWrapperStyle = computed(
|
const getWrapperStyle = computed((): CSSProperties => {
|
||||||
(): CSSProperties => {
|
|
||||||
if (unref(getIsCheckComp) || unref(getRowEditable)) {
|
if (unref(getIsCheckComp) || unref(getRowEditable)) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
width: 'calc(100% - 48px)',
|
width: 'calc(100% - 48px)',
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const getRowEditable = computed(() => {
|
const getRowEditable = computed(() => {
|
||||||
const { editable } = props.record || {};
|
const { editable } = props.record || {};
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,7 @@
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const getSetting = computed(
|
const getSetting = computed((): TableSetting => {
|
||||||
(): TableSetting => {
|
|
||||||
return {
|
return {
|
||||||
redo: true,
|
redo: true,
|
||||||
size: true,
|
size: true,
|
||||||
|
|
@ -45,8 +44,7 @@
|
||||||
fullScreen: false,
|
fullScreen: false,
|
||||||
...props.setting,
|
...props.setting,
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
return { getSetting, t };
|
return { getSetting, t };
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ export function useColumns(
|
||||||
propsRef: ComputedRef<BasicTableProps>,
|
propsRef: ComputedRef<BasicTableProps>,
|
||||||
getPaginationRef: ComputedRef<boolean | PaginationProps>
|
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;
|
let cacheColumns = unref(propsRef).columns;
|
||||||
|
|
||||||
const getColumnsRef = computed(() => {
|
const getColumnsRef = computed(() => {
|
||||||
|
|
|
||||||
|
|
@ -150,15 +150,8 @@ export function useDataSource(
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetch(opt?: FetchParams) {
|
async function fetch(opt?: FetchParams) {
|
||||||
const {
|
const { api, searchInfo, fetchSetting, beforeFetch, afterFetch, useSearchForm, pagination } =
|
||||||
api,
|
unref(propsRef);
|
||||||
searchInfo,
|
|
||||||
fetchSetting,
|
|
||||||
beforeFetch,
|
|
||||||
afterFetch,
|
|
||||||
useSearchForm,
|
|
||||||
pagination,
|
|
||||||
} = unref(propsRef);
|
|
||||||
if (!api || !isFunction(api)) return;
|
if (!api || !isFunction(api)) return;
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,7 @@ type UseTableMethod = TableActionType & {
|
||||||
getForm: () => FormActionType;
|
getForm: () => FormActionType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function useTable(
|
export function useTable(tableProps?: Props): [
|
||||||
tableProps?: Props
|
|
||||||
): [
|
|
||||||
(instance: TableActionType, formInstance: UseTableMethod) => void,
|
(instance: TableActionType, formInstance: UseTableMethod) => void,
|
||||||
TableActionType & {
|
TableActionType & {
|
||||||
getForm: () => FormActionType;
|
getForm: () => FormActionType;
|
||||||
|
|
@ -129,7 +127,7 @@ export function useTable(
|
||||||
return toRaw(getTableInstance().getCacheColumns());
|
return toRaw(getTableInstance().getCacheColumns());
|
||||||
},
|
},
|
||||||
getForm: () => {
|
getForm: () => {
|
||||||
return (unref(formRef) as unknown) as FormActionType;
|
return unref(formRef) as unknown as FormActionType;
|
||||||
},
|
},
|
||||||
setShowPagination: async (show: boolean) => {
|
setShowPagination: async (show: boolean) => {
|
||||||
getTableInstance().setShowPagination(show);
|
getTableInstance().setShowPagination(show);
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@ export function useTableForm(
|
||||||
fetch: (opt?: FetchParams | undefined) => Promise<void>,
|
fetch: (opt?: FetchParams | undefined) => Promise<void>,
|
||||||
getLoading: ComputedRef<boolean | undefined>
|
getLoading: ComputedRef<boolean | undefined>
|
||||||
) {
|
) {
|
||||||
const getFormProps = computed(
|
const getFormProps = computed((): Partial<FormProps> => {
|
||||||
(): Partial<FormProps> => {
|
|
||||||
const { formConfig } = unref(propsRef);
|
const { formConfig } = unref(propsRef);
|
||||||
const { submitButtonOptions } = formConfig || {};
|
const { submitButtonOptions } = formConfig || {};
|
||||||
return {
|
return {
|
||||||
|
|
@ -19,8 +18,7 @@ export function useTableForm(
|
||||||
submitButtonOptions: { loading: unref(getLoading), ...submitButtonOptions },
|
submitButtonOptions: { loading: unref(getLoading), ...submitButtonOptions },
|
||||||
compact: true,
|
compact: true,
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const getFormSlotKeys = computed(() => {
|
const getFormSlotKeys = computed(() => {
|
||||||
const keys = Object.keys(slots);
|
const keys = Object.keys(slots);
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@ import { isString } from '/@/utils/is';
|
||||||
import { getSlot } from '/@/utils/helper/tsxHelper';
|
import { getSlot } from '/@/utils/helper/tsxHelper';
|
||||||
|
|
||||||
export function useTableHeader(propsRef: ComputedRef<BasicTableProps>, slots: Slots) {
|
export function useTableHeader(propsRef: ComputedRef<BasicTableProps>, slots: Slots) {
|
||||||
const getHeaderProps = computed(
|
const getHeaderProps = computed((): Recordable => {
|
||||||
(): Recordable => {
|
|
||||||
const { title, showTableSetting, titleHelpMessage, tableSetting } = unref(propsRef);
|
const { title, showTableSetting, titleHelpMessage, tableSetting } = unref(propsRef);
|
||||||
const hideTitle = !slots.tableTitle && !title && !slots.toolbar && !showTableSetting;
|
const hideTitle = !slots.tableTitle && !title && !slots.toolbar && !showTableSetting;
|
||||||
if (hideTitle && !isString(title)) {
|
if (hideTitle && !isString(title)) {
|
||||||
|
|
@ -42,7 +41,6 @@ export function useTableHeader(propsRef: ComputedRef<BasicTableProps>, slots: Sl
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
);
|
|
||||||
return { getHeaderProps };
|
return { getHeaderProps };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue