Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

chore(nc-gui): lint

Ramesh Maneee5e8b5bcbbd
diff --git a/packages/nc-gui/components/nc/List/AggregationSelector.vue b/packages/nc-gui/components/nc/List/AggregationSelector.vue
index b182e88b96..48d71e3275 100644
--- a/packages/nc-gui/components/nc/List/AggregationSelector.vue
+++ b/packages/nc-gui/components/nc/List/AggregationSelector.vue
@@ -75,7 +75,7 @@ const loadAggregationList = async () => {
// Filter out None aggregation
availableAggregations = availableAggregations.filter((agg) => agg !== CommonAggregations.None)
-
+
// Apply custom filter if provided
if (props.filterAggregation) {
availableAggregations = availableAggregations.filter(props.filterAggregation)
@@ -96,15 +96,13 @@ const loadAggregationList = async () => {
}
}
-
watch([() => props.tableId, () => props.columnId], () => {
loadAggregationList()
})
-
const aggregationListMap = computed(() => {
if (!aggregationList.value || aggregationList.value.length === 0) return new Map()
-
+
return new Map(aggregationList.value.map((agg) => [agg.value, agg]))
})
@@ -114,26 +112,29 @@ const selectedAggregation = computed(() => {
return aggregationListMap.value.get(modelValue.value) || undefined
})
-watch(aggregationList, (newAggregationList) => {
- if (newAggregationList && newAggregationList.length > 0) {
- const newAggregationListMap = new Map(newAggregationList.map((agg) => [agg.value, agg]))
-
- // Check if current value exists in the new aggregation list
- if (modelValue.value && !newAggregationListMap.has(modelValue.value)) {
- // Current value is not in the list, set null to clear it
- modelValue.value = undefined
- return
- }
+watch(
+ aggregationList,
+ (newAggregationList) => {
+ if (newAggregationList && newAggregationList.length > 0) {
+ const newAggregationListMap = new Map(newAggregationList.map((agg) => [agg.value, agg]))
+
+ // Check if current value exists in the new aggregation list
+ if (modelValue.value && !newAggregationListMap.has(modelValue.value)) {
+ // Current value is not in the list, set null to clear it
+ modelValue.value = undefined
+ return
+ }
- // Auto-select logic (only if autoSelect is enabled and no current value)
- if (!modelValue.value && props.autoSelect) {
- const newAggregationValue = newAggregationList[0]?.value
+ // Auto-select logic (only if autoSelect is enabled and no current value)
+ if (!modelValue.value && props.autoSelect) {
+ const newAggregationValue = newAggregationList[0]?.value
- modelValue.value = newAggregationValue
+ modelValue.value = newAggregationValue
+ }
}
- }
-}, { immediate: true })
-
+ },
+ { immediate: true },
+)
defineExpose({
modelValue,
@@ -171,15 +172,20 @@ defineExpose({
>
<div class="flex-1 flex items-center gap-2 min-w-0">
<NcTooltip hide-on-click class="flex-1 truncate" show-on-truncate-only>
- <span v-if="selectedAggregation" :key="selectedAggregation?.value" class="text-sm flex-1 truncate" :class="{ 'text-nc-content-gray-muted': !selectedAggregation }">
- {{ selectedAggregation?.label }}
- </span>
- <span v-else class="text-sm flex-1 truncate text-nc-content-gray-muted">-- Select aggregation --</span>
-
- <template #title>
- {{ selectedAggregation?.label || 'Select aggregation' }}
- </template>
- </NcTooltip>
+ <span
+ v-if="selectedAggregation"
+ :key="selectedAggregation?.value"
+ class="text-sm flex-1 truncate"
+ :class="{ 'text-nc-content-gray-muted': !selectedAggregation }"
+ >
+ {{ selectedAggregation?.label }}
+ </span>
+ <span v-else class="text-sm flex-1 truncate text-nc-content-gray-muted">-- Select aggregation --</span>
+
+ <template #title>
+ {{ selectedAggregation?.label || 'Select aggregation' }}
+ </template>
+ </NcTooltip>
<GeneralIcon
icon="ncChevronDown"
class="flex-none h-4 w-4 transition-transform opacity-70"
diff --git a/packages/nc-gui/components/nc/List/ColumnSelector.vue b/packages/nc-gui/components/nc/List/ColumnSelector.vue
index bdd520a5e4..2586f5273e 100644
--- a/packages/nc-gui/components/nc/List/ColumnSelector.vue
+++ b/packages/nc-gui/components/nc/List/ColumnSelector.vue
@@ -41,14 +41,14 @@ const handleValueUpdate = (value: any) => {
const columnList = computedAsync(async () => {
let fields: ColumnType[]
-
+
if (props.tableId) {
const tableMeta = await loadTableMeta(props.tableId)
fields = tableMeta?.columns || []
} else {
fields = activeTable.value?.columns || []
}
-
+
if (props.filterColumn) {
fields = fields.filter(props.filterColumn)
} else {
@@ -57,10 +57,8 @@ const columnList = computedAsync(async () => {
return fields.map((column) => {
const isDisabled = Boolean(column.system && !column.pk)
-
- const ncItemTooltip = isDisabled
- ? t('tooltip.systemColumnNotEditable')
- : ''
+
+ const ncItemTooltip = isDisabled ? t('tooltip.systemColumnNotEditable') : ''
return {
label: column.title || column.column_name,
@@ -74,7 +72,7 @@ const columnList = computedAsync(async () => {
const columnListMap = computed(() => {
if (!columnList.value || columnList.value.length === 0) return new Map()
-
+
return new Map(columnList.value.map((column) => [column.value, column]))
})
@@ -85,33 +83,37 @@ const selectedColumn = computed(() => {
})
// Watch for columnList changes and set initial value
-watch(columnList, (newColumnList) => {
- if (newColumnList && newColumnList.length > 0) {
- const newColumnListMap = new Map(newColumnList.map((column) => [column.value, column]))
-
- // Check if current value exists in the new column list
- if (modelValue.value && !newColumnListMap.has(modelValue.value)) {
- // Current value is not in the list, set null to clear it
- modelValue.value = undefined
- return
- }
+watch(
+ columnList,
+ (newColumnList) => {
+ if (newColumnList && newColumnList.length > 0) {
+ const newColumnListMap = new Map(newColumnList.map((column) => [column.value, column]))
+
+ // Check if current value exists in the new column list
+ if (modelValue.value && !newColumnListMap.has(modelValue.value)) {
+ // Current value is not in the list, set null to clear it
+ modelValue.value = undefined
+ return
+ }
- // Auto-select logic (only if autoSelect is enabled and no current value)
- if (!modelValue.value && props.autoSelect) {
- const newColumnId = props.columnId || newColumnList[0]?.value
+ // Auto-select logic (only if autoSelect is enabled and no current value)
+ if (!modelValue.value && props.autoSelect) {
+ const newColumnId = props.columnId || newColumnList[0]?.value
- const columnObj = newColumnListMap.get(newColumnId)
+ const columnObj = newColumnListMap.get(newColumnId)
- // Change column id only if it is default column selected initially and its not enabled
- if (columnObj && columnObj.ncItemDisabled && columnObj.value === newColumnList[0]?.value) {
- const selectedValue = newColumnList.find((column) => !column.ncItemDisabled)?.value || newColumnList[0]?.value
- modelValue.value = selectedValue
- } else {
- modelValue.value = newColumnId
+ // Change column id only if it is default column selected initially and its not enabled
+ if (columnObj && columnObj.ncItemDisabled && columnObj.value === newColumnList[0]?.value) {
+ const selectedValue = newColumnList.find((column) => !column.ncItemDisabled)?.value || newColumnList[0]?.value
+ modelValue.value = selectedValue
+ } else {
+ modelValue.value = newColumnId
+ }
}
}
- }
-}, { immediate: true })
+ },
+ { immediate: true },
+)
defineExpose({
modelValue,
@@ -151,7 +153,7 @@ defineExpose({
<div v-if="selectedColumn" class="min-w-5 flex items-center justify-center">
<NIconField :field="selectedColumn" class="text-gray-500" />
</div>
- <NcTooltip hide-on-click class="flex-1 truncate" show-on-truncate-only>
+ <NcTooltip hide-on-click class="flex-1 truncate" show-on-truncate-only>
<span v-if="selectedColumn" class="text-sm flex-1 truncate text-nc-content-gray-default">
{{ selectedColumn?.label }}
</span>
diff --git a/packages/nc-gui/components/nc/List/TableSelector.vue b/packages/nc-gui/components/nc/List/TableSelector.vue
index 94641fe651..61a3a20bb7 100644
--- a/packages/nc-gui/components/nc/List/TableSelector.vue
+++ b/packages/nc-gui/components/nc/List/TableSelector.vue
@@ -41,14 +41,14 @@ const handleValueUpdate = (value: any) => {
const tableList = computedAsync(async () => {
let tables: TableType[]
-
+
if (props.baseId) {
await tableStore.loadProjectTables(props.baseId, props.forceLoadBaseTables)
tables = baseTables.value.get(props.baseId) || []
} else {
tables = activeTables.value || []
}
-
+
if (props.filterTable) {
tables = tables.filter(props.filterTable)
}
@@ -68,7 +68,7 @@ const tableList = computedAsync(async () => {
const tableListMap = computed(() => {
if (!tableList.value || tableList.value.length === 0) return new Map()
-
+
return new Map(tableList.value.map((table) => [table.value, table]))
})
@@ -78,32 +78,36 @@ const selectedTable = computed(() => {
return tableListMap.value.get(modelValue.value) || undefined
})
-watch(tableList, (newTableList) => {
- if (newTableList && newTableList.length > 0) {
- const newTableListMap = new Map(newTableList.map((table) => [table.value, table]))
-
- // Check if current value exists in the new table list
- if (modelValue.value && !newTableListMap.has(modelValue.value)) {
- // Current value is not in the list, set null to clear it
- modelValue.value = null
- return
- }
+watch(
+ tableList,
+ (newTableList) => {
+ if (newTableList && newTableList.length > 0) {
+ const newTableListMap = new Map(newTableList.map((table) => [table.value, table]))
+
+ // Check if current value exists in the new table list
+ if (modelValue.value && !newTableListMap.has(modelValue.value)) {
+ // Current value is not in the list, set null to clear it
+ modelValue.value = null
+ return
+ }
- // Auto-select logic (only if autoSelect is enabled and no current value)
- if (!modelValue.value && props.autoSelect) {
- const newTableId = props.tableId || newTableList[0]?.value
+ // Auto-select logic (only if autoSelect is enabled and no current value)
+ if (!modelValue.value && props.autoSelect) {
+ const newTableId = props.tableId || newTableList[0]?.value
- const tableObj = newTableListMap.get(newTableId)
+ const tableObj = newTableListMap.get(newTableId)
- if (tableObj && tableObj.ncItemDisabled && tableObj.value === newTableList[0]?.value) {
- const selectedValue = newTableList.find((table) => !table.ncItemDisabled)?.value || newTableList[0]?.value
- modelValue.value = selectedValue
- } else {
- modelValue.value = newTableId
+ if (tableObj && tableObj.ncItemDisabled && tableObj.value === newTableList[0]?.value) {
+ const selectedValue = newTableList.find((table) => !table.ncItemDisabled)?.value || newTableList[0]?.value
+ modelValue.value = selectedValue
+ } else {
+ modelValue.value = newTableId
+ }
}
}
- }
-}, { immediate: true })
+ },
+ { immediate: true },
+)
defineExpose({
modelValue,
@@ -144,7 +148,12 @@ defineExpose({
<NIconTable :table="selectedTable || { title: '', table_name: '' }" class="text-gray-500" />
</div>
<NcTooltip hide-on-click class="flex-1 truncate" show-on-truncate-only>
- <span v-if="selectedTable" :key="selectedTable?.value" class="text-sm flex-1 truncate" :class="{ 'text-nc-content-gray-muted': !selectedTable }">
+ <span
+ v-if="selectedTable"
+ :key="selectedTable?.value"
+ class="text-sm flex-1 truncate"
+ :class="{ 'text-nc-content-gray-muted': !selectedTable }"
+ >
{{ selectedTable?.label }}
</span>
<span v-else class="text-sm flex-1 truncate text-nc-content-gray-muted">-- Select table --</span>
diff --git a/packages/nc-gui/components/nc/List/ViewSelector.vue b/packages/nc-gui/components/nc/List/ViewSelector.vue
index dd4164d759..091ba289af 100644
--- a/packages/nc-gui/components/nc/List/ViewSelector.vue
+++ b/packages/nc-gui/components/nc/List/ViewSelector.vue
@@ -46,10 +46,10 @@ const viewList = computedAsync(async () => {
if (!props.tableId) return []
try {
- await viewsStore.loadViews({
- tableId: props.tableId,
- ignoreLoading: props.ignoreLoading,
- force: props.forceFetchViews
+ await viewsStore.loadViews({
+ tableId: props.tableId,
+ ignoreLoading: props.ignoreLoading,
+ force: props.forceFetchViews,
})
} catch (e) {
console.error(e)
@@ -57,11 +57,11 @@ const viewList = computedAsync(async () => {
}
let viewsList: ViewType[] = viewsByTable.value.get(props.tableId) || []
-
+
if (props.labelDefaultViewAsDefault) {
viewsList = viewsList.map((v) => ({ ...v, title: v.is_default ? 'Default View' : v.title }))
}
-
+
if (props.filterView) {
viewsList = viewsList.filter(props.filterView)
}
@@ -80,7 +80,7 @@ const viewList = computedAsync(async () => {
const viewListMap = computed(() => {
if (!viewList.value || viewList.value.length === 0) return new Map()
-
+
return new Map(viewList.value.map((view) => [view.value, view]))
})
@@ -90,33 +90,37 @@ const selectedView = computed(() => {
return viewListMap.value.get(modelValue.value) || viewList.value?.[0]
})
-watch(viewList, (newViewList) => {
- if (newViewList && newViewList.length > 0) {
- const newViewListMap = new Map(newViewList.map((view) => [view.value, view]))
-
- // Check if current value exists in the new view list
- if (modelValue.value && !newViewListMap.has(modelValue.value)) {
- // Current value is not in the list, set null to clear it
- modelValue.value = undefined
- return
- }
+watch(
+ viewList,
+ (newViewList) => {
+ if (newViewList && newViewList.length > 0) {
+ const newViewListMap = new Map(newViewList.map((view) => [view.value, view]))
+
+ // Check if current value exists in the new view list
+ if (modelValue.value && !newViewListMap.has(modelValue.value)) {
+ // Current value is not in the list, set null to clear it
+ modelValue.value = undefined
+ return
+ }
- // Auto-select logic (only if autoSelect is enabled and no current value)
- if (!modelValue.value && props.autoSelect) {
- const newViewId = props.viewId || newViewList[0]?.value
+ // Auto-select logic (only if autoSelect is enabled and no current value)
+ if (!modelValue.value && props.autoSelect) {
+ const newViewId = props.viewId || newViewList[0]?.value
- const viewObj = newViewListMap.get(newViewId)
+ const viewObj = newViewListMap.get(newViewId)
- // Change view id only if it is default view selected initially and its not enabled
- if (viewObj && viewObj.ncItemDisabled && viewObj.value === newViewList[0]?.value) {
- const selectedValue = newViewList.find((view) => !view.ncItemDisabled)?.value || newViewList[0]?.value
- modelValue.value = selectedValue
- } else {
- modelValue.value = newViewId
+ // Change view id only if it is default view selected initially and its not enabled
+ if (viewObj && viewObj.ncItemDisabled && viewObj.value === newViewList[0]?.value) {
+ const selectedValue = newViewList.find((view) => !view.ncItemDisabled)?.value || newViewList[0]?.value
+ modelValue.value = selectedValue
+ } else {
+ modelValue.value = newViewId
+ }
}
}
- }
-}, { immediate: true })
+ },
+ { immediate: true },
+)
defineExpose({
modelValue,
@@ -157,7 +161,12 @@ defineExpose({
<NIconView :view="selectedView" class="text-gray-500" />
</div>
<NcTooltip hide-on-click class="flex-1 truncate" show-on-truncate-only>
- <span v-if="selectedView" :key="selectedView?.value" class="text-sm flex-1 truncate" :class="{ 'text-nc-content-gray-muted': !selectedView }">
+ <span
+ v-if="selectedView"
+ :key="selectedView?.value"
+ class="text-sm flex-1 truncate"
+ :class="{ 'text-nc-content-gray-muted': !selectedView }"
+ >
{{ selectedView?.label }}
</span>
<span v-else class="text-sm flex-1 truncate text-nc-content-gray-muted">-- Select view --</span>