Browse Source

Merge pull request #4551 from nocodb/fix/add-rating-validation

fix(gui): Grid - add rating validation while pasting
pull/4554/head
Pranav C 2 years ago committed by GitHub
parent
commit
889efc365c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      packages/nc-gui/composables/useMultiSelect/convertCellData.ts
  2. 2
      packages/nc-gui/plugins/tele.ts

7
packages/nc-gui/composables/useMultiSelect/convertCellData.ts

@ -17,6 +17,13 @@ export default function convertCellData(args: { from: UITypes; to: UITypes; valu
} }
return parsedNumber return parsedNumber
} }
case UITypes.Rating: {
const parsedNumber = Number(value ?? 0)
if (isNaN(parsedNumber)) {
throw new TypeError(`Cannot convert '${value}' to rating`)
}
return parsedNumber
}
case UITypes.Checkbox: case UITypes.Checkbox:
return Boolean(value) return Boolean(value)
case UITypes.Date: { case UITypes.Date: {

2
packages/nc-gui/plugins/tele.ts

@ -86,5 +86,5 @@ export default defineNuxtPlugin(async (nuxtApp) => {
}) })
nuxtApp.provide('tele', tele) nuxtApp.provide('tele', tele)
nuxtApp.provide('e', tele.emit) nuxtApp.provide('e', (e: string, data?: Record<string, any>) => tele.emit(e, { data }))
}) })

Loading…
Cancel
Save