UNPKG

tav-ui

Version:
41 lines (38 loc) 1.21 kB
import { computed, unref } from 'vue'; import { isFunction } from '../../../../utils/is2.mjs'; function useTableForm(propsRef, slots, fetch, getLoading) { const getFormProps = computed(() => { 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); return keys.map((item) => item.startsWith("form-") ? item : null).filter((item) => !!item); }); function replaceFormSlotKey(key) { if (!key) return ""; return key?.replace?.(/form\-/, "") ?? ""; } function handleSearchInfoChange(info) { const { handleSearchInfoFn } = unref(propsRef); if (handleSearchInfoFn && isFunction(handleSearchInfoFn)) { info = handleSearchInfoFn(info) || info; } fetch({ searchInfo: info, page: 1 }); } return { getFormProps, replaceFormSlotKey, getFormSlotKeys, handleSearchInfoChange }; } export { useTableForm }; //# sourceMappingURL=useTableForm2.mjs.map