|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { UITypes, isNumericCol, numericUITypes } from 'nocodb-sdk' |
|
|
|
|
import { UITypes, isDateMonthFormat, isNumericCol, numericUITypes } from 'nocodb-sdk' |
|
|
|
|
|
|
|
|
|
const getEqText = (fieldUiType: UITypes) => { |
|
|
|
|
if (isNumericCol(fieldUiType) || fieldUiType === UITypes.Time) { |
|
|
|
@ -70,13 +70,16 @@ const getLteText = (fieldUiType: UITypes) => {
|
|
|
|
|
|
|
|
|
|
export const comparisonOpList = ( |
|
|
|
|
fieldUiType: UITypes, |
|
|
|
|
dateFormat?: string, |
|
|
|
|
): { |
|
|
|
|
text: string |
|
|
|
|
value: string |
|
|
|
|
ignoreVal: boolean |
|
|
|
|
includedTypes?: UITypes[] |
|
|
|
|
excludedTypes?: UITypes[] |
|
|
|
|
}[] => [ |
|
|
|
|
}[] => { |
|
|
|
|
const isDateMonth = dateFormat && isDateMonthFormat(dateFormat) |
|
|
|
|
return [ |
|
|
|
|
{ |
|
|
|
|
text: 'is checked', |
|
|
|
|
value: 'checked', |
|
|
|
@ -255,7 +258,7 @@ export const comparisonOpList = (
|
|
|
|
|
text: 'is within', |
|
|
|
|
value: 'isWithin', |
|
|
|
|
ignoreVal: true, |
|
|
|
|
includedTypes: [UITypes.Date, UITypes.DateTime], |
|
|
|
|
includedTypes: [...(isDateMonth ? [] : [UITypes.Date, UITypes.DateTime])], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
text: 'is blank', |
|
|
|
@ -270,10 +273,12 @@ export const comparisonOpList = (
|
|
|
|
|
excludedTypes: [UITypes.Checkbox, UITypes.Links, UITypes.Rollup], |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const comparisonSubOpList = ( |
|
|
|
|
// TODO: type
|
|
|
|
|
comparison_op: string, |
|
|
|
|
dateFormat?: string, |
|
|
|
|
): { |
|
|
|
|
text: string |
|
|
|
|
value: string |
|
|
|
@ -281,6 +286,8 @@ export const comparisonSubOpList = (
|
|
|
|
|
includedTypes?: UITypes[] |
|
|
|
|
excludedTypes?: UITypes[] |
|
|
|
|
}[] => { |
|
|
|
|
const isDateMonth = dateFormat && isDateMonthFormat(dateFormat) |
|
|
|
|
|
|
|
|
|
if (comparison_op === 'isWithin') { |
|
|
|
|
return [ |
|
|
|
|
{ |
|
|
|
@ -338,31 +345,31 @@ export const comparisonSubOpList = (
|
|
|
|
|
text: 'today', |
|
|
|
|
value: 'today', |
|
|
|
|
ignoreVal: true, |
|
|
|
|
includedTypes: [UITypes.Date, UITypes.DateTime], |
|
|
|
|
includedTypes: [...(isDateMonth ? [] : [UITypes.Date, UITypes.DateTime])], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
text: 'tomorrow', |
|
|
|
|
value: 'tomorrow', |
|
|
|
|
ignoreVal: true, |
|
|
|
|
includedTypes: [UITypes.Date, UITypes.DateTime], |
|
|
|
|
includedTypes: [...(isDateMonth ? [] : [UITypes.Date, UITypes.DateTime])], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
text: 'yesterday', |
|
|
|
|
value: 'yesterday', |
|
|
|
|
ignoreVal: true, |
|
|
|
|
includedTypes: [UITypes.Date, UITypes.DateTime], |
|
|
|
|
includedTypes: [...(isDateMonth ? [] : [UITypes.Date, UITypes.DateTime])], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
text: 'one week ago', |
|
|
|
|
value: 'oneWeekAgo', |
|
|
|
|
ignoreVal: true, |
|
|
|
|
includedTypes: [UITypes.Date, UITypes.DateTime], |
|
|
|
|
includedTypes: [...(isDateMonth ? [] : [UITypes.Date, UITypes.DateTime])], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
text: 'one week from now', |
|
|
|
|
value: 'oneWeekFromNow', |
|
|
|
|
ignoreVal: true, |
|
|
|
|
includedTypes: [UITypes.Date, UITypes.DateTime], |
|
|
|
|
includedTypes: [...(isDateMonth ? [] : [UITypes.Date, UITypes.DateTime])], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
text: 'one month ago', |
|
|
|
@ -380,16 +387,16 @@ export const comparisonSubOpList = (
|
|
|
|
|
text: 'number of days ago', |
|
|
|
|
value: 'daysAgo', |
|
|
|
|
ignoreVal: false, |
|
|
|
|
includedTypes: [UITypes.Date, UITypes.DateTime], |
|
|
|
|
includedTypes: [...(isDateMonth ? [] : [UITypes.Date, UITypes.DateTime])], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
text: 'number of days from now', |
|
|
|
|
value: 'daysFromNow', |
|
|
|
|
ignoreVal: false, |
|
|
|
|
includedTypes: [UITypes.Date, UITypes.DateTime], |
|
|
|
|
includedTypes: [...(isDateMonth ? [] : [UITypes.Date, UITypes.DateTime])], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
text: 'exact date', |
|
|
|
|
text: isDateMonth ? 'exact month' : 'exact date', |
|
|
|
|
value: 'exactDate', |
|
|
|
|
ignoreVal: false, |
|
|
|
|
includedTypes: [UITypes.Date, UITypes.DateTime], |
|
|
|
|