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

Loading…
Cancel
Save