From 445fb6cdcd6ceb564bc088ea286fc2819757a108 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 24 Feb 2023 16:51:08 +0800 Subject: [PATCH] refactor(nc-gui): rename date filter sub ops --- .../components/smartsheet/toolbar/ColumnFilter.vue | 4 ++-- .../components/smartsheet/toolbar/FilterInput.vue | 4 ++-- packages/nc-gui/utils/filterUtils.ts | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue index d4232ca929..f2710bdc4c 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue @@ -96,7 +96,7 @@ const filterUpdateCondition = (filter: FilterType, i: number) => { // the input type could be decimal or datepicker / datetime picker // hence remove the previous value filter.value = '' - if (!filter.comparison_sub_op) filter.comparison_sub_op = 'exact_date' + if (!filter.comparison_sub_op) filter.comparison_sub_op = 'exactDate' } saveOrUpdate(filter, i) filterPrevComparisonOp.value[filter.id] = filter.comparison_op @@ -160,7 +160,7 @@ const selectFilterField = (filter: Filter, index: number) => { )?.[0].value if ([UITypes.Date, UITypes.DateTime].includes(col.uidt as UITypes) && !['blank', 'notblank'].includes(filter.comparison_op)) { - filter.comparison_sub_op = 'exact_date' + filter.comparison_sub_op = 'exactDate' } else { // reset filter.comparison_sub_op = '' diff --git a/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue b/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue index a5d31b82e0..5c18353e49 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue @@ -117,9 +117,9 @@ const componentMap: Partial> = $computed(() => { // use MultiSelect for SingleSelect columns for anyof / nanyof filters isSingleSelect: ['anyof', 'nanyof'].includes(props.filter.comparison_op!) ? MultiSelect : SingleSelect, isMultiSelect: MultiSelect, - isDate: ['number_of_days_ago', 'number_of_days_from_now'].includes(props.filter.comparison_sub_op!) ? Decimal : DatePicker, + isDate: ['daysAgo', 'daysFromNow'].includes(props.filter.comparison_sub_op!) ? Decimal : DatePicker, isYear: YearPicker, - isDateTime: ['number_of_days_ago', 'number_of_days_from_now'].includes(props.filter.comparison_sub_op!) + isDateTime: ['daysAgo', 'daysFromNow'].includes(props.filter.comparison_sub_op!) ? Decimal : DateTimePicker, isTime: TimePicker, diff --git a/packages/nc-gui/utils/filterUtils.ts b/packages/nc-gui/utils/filterUtils.ts index 17f9701602..756736063c 100644 --- a/packages/nc-gui/utils/filterUtils.ts +++ b/packages/nc-gui/utils/filterUtils.ts @@ -250,43 +250,43 @@ export const comparisonSubOpList: { }, { text: 'one week ago', - value: 'one_week_ago', + value: 'oneWeekAgo', ignoreVal: true, includedTypes: [UITypes.Date, UITypes.DateTime], }, { text: 'one week from now', - value: 'one_week_from_now', + value: 'oneWeekFromNow', ignoreVal: true, includedTypes: [UITypes.Date, UITypes.DateTime], }, { text: 'one month ago', - value: 'one_month_ago', + value: 'oneMonthAgo', ignoreVal: true, includedTypes: [UITypes.Date, UITypes.DateTime], }, { text: 'one month from now', - value: 'one_month_from_now', + value: 'oneMonthFromNow', ignoreVal: true, includedTypes: [UITypes.Date, UITypes.DateTime], }, { text: 'number of days ago', - value: 'number_of_days_ago', + value: 'daysAgo', ignoreVal: false, includedTypes: [UITypes.Date, UITypes.DateTime], }, { text: 'number of days from now', - value: 'number_of_days_from_now', + value: 'daysFromNow', ignoreVal: false, includedTypes: [UITypes.Date, UITypes.DateTime], }, { text: 'exact date', - value: 'exact_date', + value: 'exactDate', ignoreVal: false, includedTypes: [UITypes.Date, UITypes.DateTime], },