From 83c6279a2ff54cd707e2b6b330290904e26b5770 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 16 Feb 2023 12:36:02 +0800 Subject: [PATCH] refactor(nc-gui): use isNumericCol & numericUITypes from sdk --- packages/nc-gui/utils/filterUtils.ts | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/packages/nc-gui/utils/filterUtils.ts b/packages/nc-gui/utils/filterUtils.ts index 1b09c418cb..4cfca87f78 100644 --- a/packages/nc-gui/utils/filterUtils.ts +++ b/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'