Browse Source

refactor(nc-gui): use isNumericCol & numericUITypes from sdk

pull/4969/head
Wing-Kam Wong 2 years ago
parent
commit
83c6279a2f
  1. 16
      packages/nc-gui/utils/filterUtils.ts

16
packages/nc-gui/utils/filterUtils.ts

@ -1,17 +1,7 @@
import { UITypes } from 'nocodb-sdk'
const numericUITypes: UITypes[] = [
UITypes.Duration,
UITypes.Currency,
UITypes.Percent,
UITypes.Number,
UITypes.Decimal,
UITypes.Rating,
UITypes.Rollup,
]
import { isNumericCol, numericUITypes, UITypes } from 'nocodb-sdk'
const getEqText = (fieldUiType: UITypes) => {
if (numericUITypes.includes(fieldUiType)) {
if (isNumericCol(fieldUiType)) {
return '='
} else if ([UITypes.SingleSelect, UITypes.Collaborator, UITypes.LinkToAnotherRecord].includes(fieldUiType)) {
return 'is'
@ -20,7 +10,7 @@ const getEqText = (fieldUiType: UITypes) => {
}
const getNeqText = (fieldUiType: UITypes) => {
if (numericUITypes.includes(fieldUiType)) {
if (isNumericCol(fieldUiType)) {
return '!='
} else if ([UITypes.SingleSelect, UITypes.Collaborator, UITypes.LinkToAnotherRecord].includes(fieldUiType)) {
return 'is not'

Loading…
Cancel
Save