UNPKG

tav-ui

Version:
45 lines (40 loc) 1.3 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var is = require('../../../../utils/is2.js'); function useTableForm(propsRef, slots, fetch, getLoading) { const getFormProps = vue.computed(() => { const { formConfig } = vue.unref(propsRef); const { submitButtonOptions } = formConfig || {}; return { showAdvancedButton: true, ...formConfig, submitButtonOptions: { loading: vue.unref(getLoading), ...submitButtonOptions }, compact: true }; }); const getFormSlotKeys = vue.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 } = vue.unref(propsRef); if (handleSearchInfoFn && is.isFunction(handleSearchInfoFn)) { info = handleSearchInfoFn(info) || info; } fetch({ searchInfo: info, page: 1 }); } return { getFormProps, replaceFormSlotKey, getFormSlotKeys, handleSearchInfoChange }; } exports.useTableForm = useTableForm; //# sourceMappingURL=useTableForm2.js.map