|
|
@ -112,6 +112,17 @@ const syncValue = useDebounceFn( |
|
|
|
{ maxWait: 2000 }, |
|
|
|
{ maxWait: 2000 }, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const saveTimer = ref<NodeJS.Timeout>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const updateWhenEditCompleted = () => { |
|
|
|
|
|
|
|
if (editEnabled.value) { |
|
|
|
|
|
|
|
if (saveTimer.value) clearTimeout(saveTimer.value) |
|
|
|
|
|
|
|
saveTimer.value = setTimeout(updateWhenEditCompleted, 500) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
emit('save') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const vModel = computed({ |
|
|
|
const vModel = computed({ |
|
|
|
get: () => { |
|
|
|
get: () => { |
|
|
|
return props.modelValue |
|
|
|
return props.modelValue |
|
|
@ -122,7 +133,9 @@ const vModel = computed({ |
|
|
|
} else if (val !== props.modelValue) { |
|
|
|
} else if (val !== props.modelValue) { |
|
|
|
currentRow.value.rowMeta.changed = true |
|
|
|
currentRow.value.rowMeta.changed = true |
|
|
|
emit('update:modelValue', val) |
|
|
|
emit('update:modelValue', val) |
|
|
|
if (isAutoSaved(column.value)) { |
|
|
|
if (column.value.pk) { |
|
|
|
|
|
|
|
updateWhenEditCompleted() |
|
|
|
|
|
|
|
} else if (isAutoSaved(column.value)) { |
|
|
|
syncValue() |
|
|
|
syncValue() |
|
|
|
} else if (!isManualSaved(column.value)) { |
|
|
|
} else if (!isManualSaved(column.value)) { |
|
|
|
emit('save') |
|
|
|
emit('save') |
|
|
|