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