Browse Source

feat(nc-gui): add is within and mark ignoreVal compulsory

pull/5185/head
Wing-Kam Wong 2 years ago
parent
commit
525ce4cdef
  1. 22
      packages/nc-gui/utils/filterUtils.ts

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

@ -73,7 +73,7 @@ export const comparisonOpList = (
): { ): {
text: string text: string
value: string value: string
ignoreVal?: boolean ignoreVal: boolean
includedTypes?: UITypes[] includedTypes?: UITypes[]
excludedTypes?: UITypes[] excludedTypes?: UITypes[]
}[] => [ }[] => [
@ -92,21 +92,25 @@ export const comparisonOpList = (
{ {
text: getEqText(fieldUiType), text: getEqText(fieldUiType),
value: 'eq', value: 'eq',
ignoreVal: false,
excludedTypes: [UITypes.Checkbox, UITypes.MultiSelect, UITypes.Attachment], excludedTypes: [UITypes.Checkbox, UITypes.MultiSelect, UITypes.Attachment],
}, },
{ {
text: getNeqText(fieldUiType), text: getNeqText(fieldUiType),
value: 'neq', value: 'neq',
ignoreVal: false,
excludedTypes: [UITypes.Checkbox, UITypes.MultiSelect, UITypes.Attachment], excludedTypes: [UITypes.Checkbox, UITypes.MultiSelect, UITypes.Attachment],
}, },
{ {
text: getLikeText(fieldUiType), text: getLikeText(fieldUiType),
value: 'like', value: 'like',
ignoreVal: false,
excludedTypes: [UITypes.Checkbox, UITypes.SingleSelect, UITypes.MultiSelect, UITypes.Collaborator, ...numericUITypes], excludedTypes: [UITypes.Checkbox, UITypes.SingleSelect, UITypes.MultiSelect, UITypes.Collaborator, ...numericUITypes],
}, },
{ {
text: getNotLikeText(fieldUiType), text: getNotLikeText(fieldUiType),
value: 'nlike', value: 'nlike',
ignoreVal: false,
excludedTypes: [UITypes.Checkbox, UITypes.SingleSelect, UITypes.MultiSelect, UITypes.Collaborator, ...numericUITypes], excludedTypes: [UITypes.Checkbox, UITypes.SingleSelect, UITypes.MultiSelect, UITypes.Collaborator, ...numericUITypes],
}, },
{ {
@ -172,43 +176,57 @@ export const comparisonOpList = (
{ {
text: 'contains all of', text: 'contains all of',
value: 'allof', value: 'allof',
ignoreVal: false,
includedTypes: [UITypes.MultiSelect], includedTypes: [UITypes.MultiSelect],
}, },
{ {
text: 'contains any of', text: 'contains any of',
value: 'anyof', value: 'anyof',
ignoreVal: false,
includedTypes: [UITypes.MultiSelect, UITypes.SingleSelect], includedTypes: [UITypes.MultiSelect, UITypes.SingleSelect],
}, },
{ {
text: 'does not contain all of', text: 'does not contain all of',
value: 'nallof', value: 'nallof',
ignoreVal: false,
includedTypes: [UITypes.MultiSelect], includedTypes: [UITypes.MultiSelect],
}, },
{ {
text: 'does not contain any of', text: 'does not contain any of',
value: 'nanyof', value: 'nanyof',
ignoreVal: false,
includedTypes: [UITypes.MultiSelect, UITypes.SingleSelect], includedTypes: [UITypes.MultiSelect, UITypes.SingleSelect],
}, },
{ {
text: getGtText(fieldUiType), text: getGtText(fieldUiType),
value: 'gt', value: 'gt',
ignoreVal: false,
includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime], includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime],
}, },
{ {
text: getLtText(fieldUiType), text: getLtText(fieldUiType),
value: 'lt', value: 'lt',
ignoreVal: false,
includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime], includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime],
}, },
{ {
text: getGteText(fieldUiType), text: getGteText(fieldUiType),
value: 'gte', value: 'gte',
ignoreVal: false,
includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime], includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime],
}, },
{ {
text: getLteText(fieldUiType), text: getLteText(fieldUiType),
value: 'lte', value: 'lte',
ignoreVal: false,
includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime], includedTypes: [...numericUITypes, UITypes.Date, UITypes.DateTime],
}, },
{
text: 'is within',
value: 'isWithin',
ignoreVal: true,
includedTypes: [UITypes.Date, UITypes.DateTime],
},
{ {
text: 'is blank', text: 'is blank',
value: 'blank', value: 'blank',
@ -226,7 +244,7 @@ export const comparisonOpList = (
export const comparisonSubOpList: { export const comparisonSubOpList: {
text: string text: string
value: string value: string
ignoreVal?: boolean ignoreVal: boolean
includedTypes?: UITypes[] includedTypes?: UITypes[]
excludedTypes?: UITypes[] excludedTypes?: UITypes[]
}[] = [ }[] = [

Loading…
Cancel
Save