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

Loading…
Cancel
Save