Browse Source

fix: trigger dtp to change value

pull/2355/head
Wing-Kam Wong 2 years ago
parent
commit
58f6bfada9
  1. 38
      packages/nc-gui/components/project/spreadsheet/components/editableCell/DateTimePickerCell.vue

38
packages/nc-gui/components/project/spreadsheet/components/editableCell/DateTimePickerCell.vue

@ -1,23 +1,24 @@
<template> <template>
<div> <div>
<v-datetime-picker <div v-show="!showMessage">
ref="picker" <v-datetime-picker
v-model="localState" ref="picker"
v-if="!showMessage" v-model="localState"
class="caption xc-date-time-picker" class="caption xc-date-time-picker"
:text-field-props="{ :text-field-props="{
class:'caption mt-0 pt-0', class:'caption mt-0 pt-0',
flat:true, flat:true,
solo:true, solo:true,
dense:true, dense:true,
hideDetails:true hideDetails:true
}" }"
:time-picker-props="{ :time-picker-props="{
format:'24hr' format:'24hr'
}" }"
v-on="parentListeners" v-on="parentListeners"
/> />
<div v-if="showMessage" class="edit-warning"> </div>
<div v-show="showMessage" class="edit-warning" @dblclick="$refs.picker.display = true">
<!-- TODO: i18n --> <!-- TODO: i18n -->
ERR: Couldn't parse {{ this.value }} ERR: Couldn't parse {{ this.value }}
</div> </div>
@ -50,6 +51,7 @@ export default {
} }
const d = (/^\d+$/.test(this.value) ? dayjs(+this.value) : dayjs(this.value)) const d = (/^\d+$/.test(this.value) ? dayjs(+this.value) : dayjs(this.value))
if (d.isValid()) { if (d.isValid()) {
this.showMessage = false
return d.format('YYYY-MM-DD HH:mm') return d.format('YYYY-MM-DD HH:mm')
} else { } else {
this.showMessage = true this.showMessage = true

Loading…
Cancel
Save