π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: review comments & cleanup
Raju Udava7ca55b034dc5
diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vueindex b17b06ca7f..e8a20cb59b 100644--- a/packages/nc-gui/components/smartsheet/Gallery.vue+++ b/packages/nc-gui/components/smartsheet/Gallery.vue@@ -250,34 +250,14 @@ const visibleRows = computed(() => {})})-const { isRowColouringEnabled, getEvaluatedCellColorInfo } = useViewRowColorRender()--const getCellColorStyle = (record: Row, columnId: string) => {- if (!isRowColouringEnabled.value || !columnId) return {}-- const cellColorInfo = getEvaluatedCellColorInfo(record.row, columnId)- if (!cellColorInfo) return {}-- const style: Record<string, string> = {}-- if (cellColorInfo.cellBgColor) {- style.backgroundColor = cellColorInfo.cellBgColor- style.borderRadius = '8px'- }-- return style-}--const getCellLeftBorderStyle = (record: Row, columnId: string) => {- if (!isRowColouringEnabled.value || !columnId) return null-- const cellColorInfo = getEvaluatedCellColorInfo(record.row, columnId)- if (!cellColorInfo || cellColorInfo.is_set_as_background || !cellColorInfo.cellLeftBorderColor) return null+const {+ isRowColouringEnabled,+ getCellColorStyle: _getCellColorStyle,+ getCellLeftBorderStyle: _getCellLeftBorderStyle,+} = useViewRowColorRender()- return {- backgroundColor: cellColorInfo.cellLeftBorderColor,- }-}+const getCellColorStyle = (record: Row, columnId: string) => _getCellColorStyle(record.row, columnId)+const getCellLeftBorderStyle = (record: Row, columnId: string) => _getCellLeftBorderStyle(record.row, columnId)const updateVisibleRows = async () => {const { start, end } = rowSlicediff --git a/packages/nc-gui/components/smartsheet/Kanban.vue b/packages/nc-gui/components/smartsheet/Kanban.vueindex 72e9f35504..46cd78f8c6 100644--- a/packages/nc-gui/components/smartsheet/Kanban.vue+++ b/packages/nc-gui/components/smartsheet/Kanban.vue@@ -124,26 +124,14 @@ const isRequiredGroupingFieldColumn = computed(() => {return !!groupingFieldColumn.value?.rqd})-const { isRowColouringEnabled, getEvaluatedCellColorInfo } = useViewRowColorRender()--const getCellColorStyle = (record: Row, columnId: string) => {- if (!isRowColouringEnabled.value || !columnId) return {}- const cellColorInfo = getEvaluatedCellColorInfo(record.row, columnId)- if (!cellColorInfo) return {}- const style: Record<string, string> = {}- if (cellColorInfo.cellBgColor) {- style.backgroundColor = cellColorInfo.cellBgColor- style.borderRadius = '8px'- }- return style-}+const {+ isRowColouringEnabled,+ getCellColorStyle: _getCellColorStyle,+ getCellLeftBorderStyle: _getCellLeftBorderStyle,+} = useViewRowColorRender()-const getCellLeftBorderStyle = (record: Row, columnId: string) => {- if (!isRowColouringEnabled.value || !columnId) return null- const cellColorInfo = getEvaluatedCellColorInfo(record.row, columnId)- if (!cellColorInfo || cellColorInfo.is_set_as_background || !cellColorInfo.cellLeftBorderColor) return null- return { backgroundColor: cellColorInfo.cellLeftBorderColor }-}+const getCellColorStyle = (record: Row, columnId: string) => _getCellColorStyle(record.row, columnId)+const getCellLeftBorderStyle = (record: Row, columnId: string) => _getCellLeftBorderStyle(record.row, columnId)const kanbanContainerRef = ref()diff --git a/packages/nc-gui/components/smartsheet/KanbanOptimized.vue b/packages/nc-gui/components/smartsheet/KanbanOptimized.vueindex 92c1bc90a8..5f20268ec6 100644--- a/packages/nc-gui/components/smartsheet/KanbanOptimized.vue+++ b/packages/nc-gui/components/smartsheet/KanbanOptimized.vue@@ -124,26 +124,14 @@ const isRequiredGroupingFieldColumn = computed(() => {return !!groupingFieldColumn.value?.rqd})-const { isRowColouringEnabled, getEvaluatedCellColorInfo } = useViewRowColorRender()--const getCellColorStyle = (record: Row, columnId: string) => {- if (!isRowColouringEnabled.value || !columnId) return {}- const cellColorInfo = getEvaluatedCellColorInfo(record.row, columnId)- if (!cellColorInfo) return {}- const style: Record<string, string> = {}- if (cellColorInfo.cellBgColor) {- style.backgroundColor = cellColorInfo.cellBgColor- style.borderRadius = '8px'- }- return style-}+const {+ isRowColouringEnabled,+ getCellColorStyle: _getCellColorStyle,+ getCellLeftBorderStyle: _getCellLeftBorderStyle,+} = useViewRowColorRender()-const getCellLeftBorderStyle = (record: Row, columnId: string) => {- if (!isRowColouringEnabled.value || !columnId) return null- const cellColorInfo = getEvaluatedCellColorInfo(record.row, columnId)- if (!cellColorInfo || cellColorInfo.is_set_as_background || !cellColorInfo.cellLeftBorderColor) return null- return { backgroundColor: cellColorInfo.cellLeftBorderColor }-}+const getCellColorStyle = (record: Row, columnId: string) => _getCellColorStyle(record.row, columnId)+const getCellLeftBorderStyle = (record: Row, columnId: string) => _getCellLeftBorderStyle(record.row, columnId)const kanbanContainerRef = ref()diff --git a/packages/nc-gui/composables/viewRowColor/useViewRowColorRender.ts b/packages/nc-gui/composables/viewRowColor/useViewRowColorRender.tsindex bc3134d16a..58835572c3 100644--- a/packages/nc-gui/composables/viewRowColor/useViewRowColorRender.ts+++ b/packages/nc-gui/composables/viewRowColor/useViewRowColorRender.ts@@ -29,11 +29,31 @@ export function useViewRowColorRender() {}}+ const getCellColorStyle = (row: any, columnId: string) => {+ if (!isRowColouringEnabled.value || !columnId) return {}+ const cellColorInfo = getEvaluatedCellColorInfo(row, columnId)+ if (!cellColorInfo) return {}+ const style: Record<string, string> = {}+ if (cellColorInfo.cellBgColor) {+ style.backgroundColor = cellColorInfo.cellBgColor+ }+ return style+ }++ const getCellLeftBorderStyle = (row: any, columnId: string) => {+ if (!isRowColouringEnabled.value || !columnId) return null+ const cellColorInfo = getEvaluatedCellColorInfo(row, columnId)+ if (!cellColorInfo || cellColorInfo.is_set_as_background || !cellColorInfo.cellLeftBorderColor) return null+ return { backgroundColor: cellColorInfo.cellLeftBorderColor }+ }+return {rowColorInfo: activeViewRowColorInfo,evaluateRowColor,isRowColouringEnabled,getEvaluatedRowMetaRowColorInfo,getEvaluatedCellColorInfo,+ getCellColorStyle,+ getCellLeftBorderStyle,}}diff --git a/packages/nocodb/src/models/View.ts b/packages/nocodb/src/models/View.tsindex 788306a502..700bd65d0d 100644--- a/packages/nocodb/src/models/View.ts+++ b/packages/nocodb/src/models/View.ts@@ -2843,6 +2843,7 @@ export interface ViewMetaRowColoring {rowColoringInfo: {fk_column_id: string;is_set_as_background: boolean;+ /** @see COLORING_TYPE in nocodb-sdk */type?: 'row' | 'cell';};}