|
|
|
@ -66,43 +66,6 @@ const syncValue = useDebounceFn(
|
|
|
|
|
500, |
|
|
|
|
{ maxWait: 2000 }, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const isAutoSaved = $computed(() => { |
|
|
|
|
return [ |
|
|
|
|
UITypes.SingleLineText, |
|
|
|
|
UITypes.LongText, |
|
|
|
|
UITypes.PhoneNumber, |
|
|
|
|
UITypes.Email, |
|
|
|
|
UITypes.URL, |
|
|
|
|
UITypes.Number, |
|
|
|
|
UITypes.Decimal, |
|
|
|
|
UITypes.Percent, |
|
|
|
|
UITypes.Count, |
|
|
|
|
UITypes.AutoNumber, |
|
|
|
|
UITypes.SpecificDBType, |
|
|
|
|
UITypes.Geometry, |
|
|
|
|
UITypes.Duration, |
|
|
|
|
].includes(column?.value?.uidt as UITypes) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const isManualSaved = $computed(() => [UITypes.Currency].includes(column?.value?.uidt as UITypes)) |
|
|
|
|
|
|
|
|
|
const vModel = computed({ |
|
|
|
|
get: () => props.modelValue, |
|
|
|
|
set: (val) => { |
|
|
|
|
if (val !== props.modelValue) { |
|
|
|
|
currentRow.value.rowMeta.changed = true |
|
|
|
|
emit('update:modelValue', val) |
|
|
|
|
if (isAutoSaved) { |
|
|
|
|
syncValue() |
|
|
|
|
} else if (!isManualSaved) { |
|
|
|
|
emit('save') |
|
|
|
|
currentRow.value.rowMeta.changed = true |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
isPrimary, |
|
|
|
|
isURL, |
|
|
|
@ -126,8 +89,26 @@ const {
|
|
|
|
|
isMultiSelect, |
|
|
|
|
isPercent, |
|
|
|
|
isPhoneNumber, |
|
|
|
|
isAutoSaved, |
|
|
|
|
isManualSaved, |
|
|
|
|
} = useColumn(column) |
|
|
|
|
|
|
|
|
|
const vModel = computed({ |
|
|
|
|
get: () => props.modelValue, |
|
|
|
|
set: (val) => { |
|
|
|
|
if (val !== props.modelValue) { |
|
|
|
|
currentRow.value.rowMeta.changed = true |
|
|
|
|
emit('update:modelValue', val) |
|
|
|
|
if (isAutoSaved.value) { |
|
|
|
|
syncValue() |
|
|
|
|
} else if (!isManualSaved.value) { |
|
|
|
|
emit('save') |
|
|
|
|
currentRow.value.rowMeta.changed = true |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const syncAndNavigate = (dir: NavigateDir, e: KeyboardEvent) => { |
|
|
|
|
if (isJSON.value) return |
|
|
|
|
|
|
|
|
|