Browse Source

feat(nc-gui): revise filter texts for Time columns

pull/5306/head
Wing-Kam Wong 2 years ago
parent
commit
5681b99619
  1. 14
      packages/nc-gui/utils/filterUtils.ts

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

@ -1,7 +1,7 @@
import { UITypes, isNumericCol, numericUITypes } from 'nocodb-sdk' import { UITypes, isNumericCol, numericUITypes } from 'nocodb-sdk'
const getEqText = (fieldUiType: UITypes) => { const getEqText = (fieldUiType: UITypes) => {
if (isNumericCol(fieldUiType)) { if (isNumericCol(fieldUiType) || UITypes.Time) {
return '=' return '='
} else if ( } else if (
[UITypes.SingleSelect, UITypes.Collaborator, UITypes.LinkToAnotherRecord, UITypes.Date, UITypes.DateTime].includes( [UITypes.SingleSelect, UITypes.Collaborator, UITypes.LinkToAnotherRecord, UITypes.Date, UITypes.DateTime].includes(
@ -14,7 +14,7 @@ const getEqText = (fieldUiType: UITypes) => {
} }
const getNeqText = (fieldUiType: UITypes) => { const getNeqText = (fieldUiType: UITypes) => {
if (isNumericCol(fieldUiType)) { if (isNumericCol(fieldUiType) || UITypes.Time) {
return '!=' return '!='
} else if ( } else if (
[UITypes.SingleSelect, UITypes.Collaborator, UITypes.LinkToAnotherRecord, UITypes.Date, UITypes.DateTime].includes( [UITypes.SingleSelect, UITypes.Collaborator, UITypes.LinkToAnotherRecord, UITypes.Date, UITypes.DateTime].includes(
@ -112,6 +112,7 @@ export const comparisonOpList = (
UITypes.Collaborator, UITypes.Collaborator,
UITypes.Date, UITypes.Date,
UITypes.DateTime, UITypes.DateTime,
UITypes.Time,
...numericUITypes, ...numericUITypes,
], ],
}, },
@ -126,6 +127,7 @@ export const comparisonOpList = (
UITypes.Collaborator, UITypes.Collaborator,
UITypes.Date, UITypes.Date,
UITypes.DateTime, UITypes.DateTime,
UITypes.Time,
...numericUITypes, ...numericUITypes,
], ],
}, },
@ -225,25 +227,25 @@ export const comparisonOpList = (
text: getGtText(fieldUiType), text: getGtText(fieldUiType),
value: 'gt', value: 'gt',
ignoreVal: false, ignoreVal: false,
includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime], includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime, UITypes.Time],
}, },
{ {
text: getLtText(fieldUiType), text: getLtText(fieldUiType),
value: 'lt', value: 'lt',
ignoreVal: false, ignoreVal: false,
includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime], includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime, UITypes.Time],
}, },
{ {
text: getGteText(fieldUiType), text: getGteText(fieldUiType),
value: 'gte', value: 'gte',
ignoreVal: false, ignoreVal: false,
includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime], includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime, UITypes.Time],
}, },
{ {
text: getLteText(fieldUiType), text: getLteText(fieldUiType),
value: 'lte', value: 'lte',
ignoreVal: false, ignoreVal: false,
includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime], includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime, UITypes.Time],
}, },
{ {
text: 'is within', text: 'is within',

Loading…
Cancel
Save