| | |
| | | import type { BasicColumn } from '/@/components/Table/src/types/table'; |
| | | import type { BasicColumn } from '@/components/Table/src/types/table'; |
| | | |
| | | import { h, Ref } from 'vue'; |
| | | import { h, Ref, toRaw } from 'vue'; |
| | | |
| | | import EditableCell from './EditableCell.vue'; |
| | | import { isArray } from '/@/utils/is'; |
| | | import { isArray } from '@/utils/is'; |
| | | |
| | | interface Params { |
| | | text: string; |
| | |
| | | |
| | | export function renderEditCell(column: BasicColumn) { |
| | | return ({ text: value, record, index }: Params) => { |
| | | record.onValid = async () => { |
| | | toRaw(record).onValid = async () => { |
| | | if (isArray(record?.validCbs)) { |
| | | const validFns = (record?.validCbs || []).map((fn) => fn()); |
| | | const res = await Promise.all(validFns); |
| | |
| | | } |
| | | }; |
| | | |
| | | record.onEdit = async (edit: boolean, submit = false) => { |
| | | toRaw(record).onEdit = async (edit: boolean, submit = false) => { |
| | | if (!submit) { |
| | | record.editable = edit; |
| | | } |