Browse Source

feat(nc-gui): cmd + ; to select the current date(time)

pull/4482/head
Wing-Kam Wong 2 years ago
parent
commit
ae2271c7b8
  1. 5
      packages/nc-gui/components/cell/DatePicker.vue
  2. 5
      packages/nc-gui/components/cell/DateTimePicker.vue

5
packages/nc-gui/components/cell/DatePicker.vue

@ -33,7 +33,7 @@ let isDateInvalid = $ref(false)
const dateFormat = $computed(() => columnMeta?.value?.meta?.date_format ?? 'YYYY-MM-DD')
const localState = $computed({
let localState = $computed({
get() {
if (!modelValue) {
return undefined
@ -152,6 +152,9 @@ useSelectedCellKeyupListener(active, (e: KeyboardEvent) => {
case 'ArrowDown':
if (!localState) (document.querySelector('.ant-picker-header-super-next-btn') as HTMLButtonElement)?.click()
break
case ';':
localState = dayjs(new Date())
break
}
})
</script>

5
packages/nc-gui/components/cell/DateTimePicker.vue

@ -23,7 +23,7 @@ let isDateInvalid = $ref(false)
const dateFormat = isMysql ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ'
const localState = $computed({
let localState = $computed({
get() {
if (!modelValue) {
return undefined
@ -73,6 +73,9 @@ useSelectedCellKeyupListener(active, (e: KeyboardEvent) => {
open.value = false
}
break
case ';':
localState = dayjs(new Date())
break
}
})
</script>

Loading…
Cancel
Save