π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: resolve filter index from filters.value instead of visibleFilters
DarkPhoenix27048b0e987ef3a4
diff --git a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vueindex 3abfcc6746..e99c8b8337 100644--- a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue+++ b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue@@ -669,6 +669,11 @@ const visibleFilters = computed(() =>}),)+// Resolve the real index in filters.value from a visibleFilters element.+// Needed because Draggable iterates visibleFilters (level-filtered) but+// useViewFilters operations use indices into the full filters array.+const getFilterIndex = (filter: ColumnFilterType) => filters.value.findIndex((f) => f === filter)+const isLogicalOpChangeAllowed = computed(() => {return new Set(visibleFilters.value.slice(1).map((filter) => filter.logical_op)).size > 1})@@ -1043,7 +1048,7 @@ defineExpose({v-if="visibleFilters && visibleFilters.length"ref="wrapperDomRef"v-bind="getDraggableAutoScrollOptions({ scrollSensitivity: 100 })"- :list="filters"+ :list="visibleFilters":disabled="!isReorderEnabled"group="nc-column-filters"ghost-class="bg-nc-bg-gray-extralight"@@ -1104,7 +1109,7 @@ defineExpose({size="default":disabled="isLockedView || readOnly"class="nc-filter-enabled-checkbox"- @change="onToggleFilterChange(filter, i)"+ @change="onToggleFilterChange(filter, getFilterIndex(filter))"/><span v-if="!visibleFilters.indexOf(filter)" class="flex items-center nc-filter-where-label ml-1">{{$t('labels.where')@@ -1124,7 +1129,7 @@ defineExpose({'!w-full': webHook,}"@click.stop- @change="onLogicalOpUpdate(filter, i)"+ @change="onLogicalOpUpdate(filter, getFilterIndex(filter))"><a-select-option v-for="op in logicalOps" :key="op.value" :value="op.value"><div class="flex items-center w-full justify-between w-full gap-2">@@ -1149,7 +1154,7 @@ defineExpose({size="small":disabled="isLockedView"class="nc-filter-item-remove-btn cursor-pointer"- @click.stop="deleteFilter(filter, i)"+ @click.stop="deleteFilter(filter, getFilterIndex(filter))"><GeneralIcon icon="deleteListItem" /></NcButton>@@ -1188,7 +1193,7 @@ defineExpose({size="default":disabled="isLockedView || readOnly"class="nc-filter-enabled-checkbox"- @change="onToggleFilterChange(filter, i)"+ @change="onToggleFilterChange(filter, getFilterIndex(filter))"/><divclass="flex flex-row gap-x-0 flex-1 nc-filter-wrapper"@@ -1219,7 +1224,7 @@ defineExpose({'nc-disabled-logical-op':filter.readOnly || (visibleFilters.indexOf(filter) > 1 && !isLogicalOpChangeAllowed) || readOnly,}"- @change="onLogicalOpUpdate(filter, i)"+ @change="onLogicalOpUpdate(filter, getFilterIndex(filter))"@click.stop><a-select-option v-for="op of logicalOps" :key="op.value" :value="op.value">@@ -1259,7 +1264,7 @@ defineExpose({:meta="meta":show-all-columns="filter.readOnly || isLockedView || readOnly"@click.stop- @change="selectFilterField(filter, i)"+ @change="selectFilterField(filter, getFilterIndex(filter))"/><NcSelect@@ -1276,7 +1281,7 @@ defineExpose({:disabled="filter.readOnly || isLockedView || readOnly"hide-detailsdropdown-class-name="nc-dropdown-filter-comp-op !max-w-80"- @change="filterUpdateCondition(filter, i)"+ @change="filterUpdateCondition(filter, getFilterIndex(filter))"><templatev-for="compOp of comparisonOpList(types[filter.fk_column_id], getColumn(filter)?.meta?.date_format)"@@ -1314,7 +1319,7 @@ defineExpose({:disabled="filter.readOnly || isLockedView || readOnly"hide-detailsdropdown-class-name="nc-dropdown-filter-comp-sub-op"- @change="filterUpdateCondition(filter, i)"+ @change="filterUpdateCondition(filter, getFilterIndex(filter))"><templatev-for="compSubOp of comparisonSubOpList(filter.comparison_op, getColumn(filter)?.meta?.date_format)"@@ -1345,14 +1350,14 @@ defineExpose({class="nc-filter-field-select min-w-32 w-full max-h-8":columns="dynamicColumns(filter)":meta="rootMeta"- @change="saveOrUpdate(filter, i)"+ @change="saveOrUpdate(filter, getFilterIndex(filter))"/></div><template v-else-if="workflow && filter.dynamic"><slotname="dynamic-filter":filter="filter"- @update-filter-value="(value) => updateFilterValue(value, filter, i)"+ @update-filter-value="(value) => updateFilterValue(value, filter, getFilterIndex(filter))"/></template>@@ -1362,7 +1367,7 @@ defineExpose({v-model:checked="filter.value"dense:disabled="filter.readOnly || isLockedView || readOnly"- @change="saveOrUpdate(filter, i)"+ @change="saveOrUpdate(filter, getFilterIndex(filter))"/><SmartsheetToolbarFilterInput@@ -1374,7 +1379,7 @@ defineExpose({:column="{ ...getColumn(filter), uidt: types[filter.fk_column_id] }":filter="filter":disabled="isLockedView || readOnly"- @update-filter-value="(value) => updateFilterValue(value, filter, i)"+ @update-filter-value="(value) => updateFilterValue(value, filter, getFilterIndex(filter))"@click.stop/>@@ -1398,7 +1403,7 @@ defineExpose({><divclass="px-4 py-3 flex flex-col select-none gap-y-2 cursor-pointer rounded-md hover:bg-nc-bg-gray-light text-nc-content-gray-subtle2 nc-new-record-with-grid group"- @click="resetDynamicField(filter, i)"+ @click="resetDynamicField(filter, getFilterIndex(filter))"><div class="flex flex-row items-center justify-between w-full"><div class="flex flex-row items-center justify-start gap-x-3">Static condition</div>@@ -1413,7 +1418,7 @@ defineExpose({<divv-e="['c:filter:dynamic-filter']"class="px-4 py-3 flex flex-col select-none gap-y-2 cursor-pointer cursor-pointer rounded-md hover:bg-nc-bg-gray-light text-nc-content-gray-subtle2 nc-new-record-with-form group"- @click="changeToDynamic(filter, i)"+ @click="changeToDynamic(filter, getFilterIndex(filter))"><div class="flex flex-row items-center justify-between w-full"><div class="flex flex-row items-center justify-start gap-x-2.5">Dynamic condition</div>@@ -1449,7 +1454,7 @@ defineExpose({><divclass="px-4 py-3 flex flex-col select-none gap-y-2 cursor-pointer rounded-md hover:bg-nc-bg-gray-light text-nc-content-gray-subtle2 nc-new-record-with-grid group"- @click="resetDynamicField(filter, i)"+ @click="resetDynamicField(filter, getFilterIndex(filter))"><div class="flex flex-row items-center justify-between w-full"><div class="flex flex-row items-center justify-start gap-x-3">Static condition</div>@@ -1469,7 +1474,7 @@ defineExpose({? 'cursor-pointer': 'cursor-not-allowed'"- @click="changeToDynamic(filter, i)"+ @click="changeToDynamic(filter, getFilterIndex(filter))"><div class="flex flex-row items-center justify-between w-full"><div class="flex flex-row items-center justify-start gap-x-2.5">Dynamic condition</div>@@ -1496,7 +1501,7 @@ defineExpose({size="small":disabled="isLockedView"class="nc-filter-item-remove-btn self-center"- @click.stop="deleteFilter(filter, i)"+ @click.stop="deleteFilter(filter, getFilterIndex(filter))"><GeneralIcon icon="deleteListItem" /></NcButton>@@ -1524,7 +1529,7 @@ defineExpose({size="small":disabled="!canPinFilter(filter) || isLockedView"class="nc-filter-item-pin-btn self-center"- @click.stop="blockPinnedFilter ? showUpgradeToUsePinnedFilter() : togglePinFilter(filter, i)"+ @click.stop="blockPinnedFilter ? showUpgradeToUsePinnedFilter() : togglePinFilter(filter, getFilterIndex(filter))"><GeneralIcon:icon="parseProp(filter.meta)?.pinned ? 'ncPinOff' : 'ncPin'"