|
|
@ -1,5 +1,5 @@ |
|
|
|
import { ViewTypes, isSystemColumn } from 'nocodb-sdk' |
|
|
|
import { isSystemColumn } from 'nocodb-sdk' |
|
|
|
import type { ColumnType, MapType, TableType, ViewType } from 'nocodb-sdk' |
|
|
|
import type { ColumnType, TableType, ViewType } from 'nocodb-sdk' |
|
|
|
import type { ComputedRef, Ref } from 'vue' |
|
|
|
import type { ComputedRef, Ref } from 'vue' |
|
|
|
import { IsPublicInj, computed, inject, ref, useNuxtApp, useProject, useUIPermission, watch } from '#imports' |
|
|
|
import { IsPublicInj, computed, inject, ref, useNuxtApp, useProject, useUIPermission, watch } from '#imports' |
|
|
|
import type { Field } from '~/lib' |
|
|
|
import type { Field } from '~/lib' |
|
|
@ -25,7 +25,6 @@ export function useViewColumns( |
|
|
|
() => isPublic.value || !isUIAllowed('hideAllColumns') || !isUIAllowed('showAllColumns') || isSharedBase.value, |
|
|
|
() => isPublic.value || !isUIAllowed('hideAllColumns') || !isUIAllowed('showAllColumns') || isSharedBase.value, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// const isColumnOrFieldViewEssential = (columnOrField: { id?: string }) => {
|
|
|
|
|
|
|
|
const isColumnViewEssential = (column: ColumnType) => { |
|
|
|
const isColumnViewEssential = (column: ColumnType) => { |
|
|
|
// TODO: delegate this via a cleaner design pattern to map view specific check logic
|
|
|
|
// TODO: delegate this via a cleaner design pattern to map view specific check logic
|
|
|
|
// (on the other hand, the logic complexity is still very low atm - might be overkill)
|
|
|
|
// (on the other hand, the logic complexity is still very low atm - might be overkill)
|
|
|
@ -71,7 +70,6 @@ export function useViewColumns( |
|
|
|
...currentColumnField, |
|
|
|
...currentColumnField, |
|
|
|
order: currentColumnField.order || order++, |
|
|
|
order: currentColumnField.order || order++, |
|
|
|
system: isSystemColumn(metaColumnById?.value?.[currentColumnField.fk_column_id!]), |
|
|
|
system: isSystemColumn(metaColumnById?.value?.[currentColumnField.fk_column_id!]), |
|
|
|
// show: isColumnViewEssential(column) || !!currentColumnField.show,
|
|
|
|
|
|
|
|
isViewEssentialField: isColumnViewEssential(column), |
|
|
|
isViewEssentialField: isColumnViewEssential(column), |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -103,39 +101,27 @@ export function useViewColumns( |
|
|
|
reloadData?.() |
|
|
|
reloadData?.() |
|
|
|
$e('a:fields:show-all') |
|
|
|
$e('a:fields:show-all') |
|
|
|
} |
|
|
|
} |
|
|
|
const hideAll = async (ignoreIds?: any[]) => { |
|
|
|
const hideAll = async (ignoreIds?: any) => { |
|
|
|
console.info('isLocalMode.value', isLocalMode.value) |
|
|
|
|
|
|
|
const viewEssentialColumnIds = fields.value |
|
|
|
|
|
|
|
?.filter((field: Field) => field.isViewEssentialField) |
|
|
|
|
|
|
|
?.map((field: Field) => field.fk_column_id) |
|
|
|
|
|
|
|
console.info('viewEssentialColumnIds', viewEssentialColumnIds) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const mergedIgnoreIds = [...(viewEssentialColumnIds || []), ...(ignoreIds || [])] |
|
|
|
|
|
|
|
console.info('mergedIgnoreIds', mergedIgnoreIds) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isLocalMode.value) { |
|
|
|
if (isLocalMode.value) { |
|
|
|
fields.value = fields.value?.map((field: Field) => ({ |
|
|
|
fields.value = fields.value?.map((field: Field) => ({ |
|
|
|
...field, |
|
|
|
...field, |
|
|
|
|
|
|
|
// show: false,
|
|
|
|
show: !!field.isViewEssentialField, |
|
|
|
show: !!field.isViewEssentialField, |
|
|
|
})) |
|
|
|
})) |
|
|
|
console.info('fields.value', fields.value) |
|
|
|
|
|
|
|
reloadData?.() |
|
|
|
reloadData?.() |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if (view?.value?.id) { |
|
|
|
if (view?.value?.id) { |
|
|
|
if (mergedIgnoreIds) { |
|
|
|
if (ignoreIds) { |
|
|
|
console.info('API call with ignoreIds', mergedIgnoreIds) |
|
|
|
|
|
|
|
await $api.dbView.hideAllColumn(view.value.id, { |
|
|
|
await $api.dbView.hideAllColumn(view.value.id, { |
|
|
|
ignoreIds: mergedIgnoreIds, |
|
|
|
ignoreIds, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
await $api.dbView.hideAllColumn(view.value.id) |
|
|
|
await $api.dbView.hideAllColumn(view.value.id) |
|
|
|
} |
|
|
|
} |
|
|
|
console.info('fields.value AFTER API CALL for hideAllColumn', fields.value) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await loadViewColumns() |
|
|
|
await loadViewColumns() |
|
|
|
console.info('fields.value AFTER loadViewColumns', fields.value) |
|
|
|
|
|
|
|
reloadData?.() |
|
|
|
reloadData?.() |
|
|
|
$e('a:fields:show-all') |
|
|
|
$e('a:fields:show-all') |
|
|
|
} |
|
|
|
} |
|
|
|