π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: gallery & kanban
Raju Udavaf899adecf14d
diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vueindex 34d813e1c5..b17b06ca7f 100644--- a/packages/nc-gui/components/smartsheet/Gallery.vue+++ b/packages/nc-gui/components/smartsheet/Gallery.vue@@ -250,7 +250,34 @@ const visibleRows = computed(() => {})})-const { isRowColouringEnabled } = useViewRowColorRender()+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++ return {+ backgroundColor: cellColorInfo.cellLeftBorderColor,+ }+}const updateVisibleRows = async () => {const { start, end } = rowSlice@@ -558,38 +585,48 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {'gap-3': isActiveViewFieldHeaderVisible,}">- <h2+ <divv-if="displayField"- class="nc-card-display-value-wrapper"- :class="{- '!children:pointer-events-auto': resetPointerEvent(record, displayField),- }"+ class="flex gap-2 rounded-lg"+ :style="getCellColorStyle(record, displayField.id)">- <template- v-if="- !isRowEmpty(record, displayField) ||- isAllowToRenderRowEmptyField(displayField) ||- isPercent(displayField)- "+ <div+ v-if="getCellLeftBorderStyle(record, displayField.id)"+ class="w-1 flex-none min-h-4 rounded-sm"+ :style="getCellLeftBorderStyle(record, displayField.id)"+ ></div>+ <h2+ class="nc-card-display-value-wrapper flex-1"+ :class="{+ '!children:pointer-events-auto': resetPointerEvent(record, displayField),+ }">- <LazySmartsheetVirtualCell- v-if="isVirtualCol(displayField)"- v-model="record.row[displayField.title]"- class="!text-nc-content-brand"- :column="displayField"- :row="record"- />- <LazySmartsheetCell- v-else- v-model="record.row[displayField.title]"- class="!text-nc-content-brand"- :column="displayField"- :edit-enabled="false"- :read-only="true"- />- </template>- <template v-else> - </template>- </h2>+ <template+ v-if="+ !isRowEmpty(record, displayField) ||+ isAllowToRenderRowEmptyField(displayField) ||+ isPercent(displayField)+ "+ >+ <LazySmartsheetVirtualCell+ v-if="isVirtualCol(displayField)"+ v-model="record.row[displayField.title]"+ class="!text-nc-content-brand"+ :column="displayField"+ :row="record"+ />+ <LazySmartsheetCell+ v-else+ v-model="record.row[displayField.title]"+ class="!text-nc-content-brand"+ :column="displayField"+ :edit-enabled="false"+ :read-only="true"+ />+ </template>+ <template v-else> - </template>+ </h2>+ </div><divv-for="col in fieldsWithoutDisplay":key="`record-${record.rowMeta.rowIndex}-${col.id}`"@@ -626,41 +663,49 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {/></template><div- class="flex flex-col rounded-lg w-full"+ class="flex gap-2 rounded-lg w-full":class="{'pointer-events-none': !resetPointerEvent(record, col),}"+ :style="getCellColorStyle(record, col.id)">- <div class="flex flex-row w-full justify-start">+ <div+ v-if="getCellLeftBorderStyle(record, col.id)"+ class="w-1 flex-none min-h-4 rounded-sm"+ :style="getCellLeftBorderStyle(record, col.id)"+ ></div>+ <div class="flex flex-col w-full">+ <div class="flex flex-row w-full justify-start">+ <div+ v-if="isActiveViewFieldHeaderVisible"+ class="nc-card-col-header w-full !children:text-gray-500"+ >+ <LazySmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" :hide-menu="true" />+ <LazySmartsheetHeaderCell v-else :column="col" :hide-menu="true" />+ </div>+ </div><div- v-if="isActiveViewFieldHeaderVisible"- class="nc-card-col-header w-full !children:text-gray-500"+ v-if="!isRowEmpty(record, col) || isAllowToRenderRowEmptyField(col)"+ class="flex flex-row w-full text-nc-content-gray items-center justify-start min-h-7 py-1">- <LazySmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" :hide-menu="true" />- <LazySmartsheetHeaderCell v-else :column="col" :hide-menu="true" />+ <LazySmartsheetVirtualCell+ v-if="isVirtualCol(col)"+ v-model="record.row[col.title]"+ :column="col"+ :row="record"+ class="!text-nc-content-gray"+ />+ <LazySmartsheetCell+ v-else+ v-model="record.row[col.title]"+ :column="col"+ :edit-enabled="false"+ :read-only="true"+ class="!text-nc-content-gray"+ /></div>+ <div v-else class="flex flex-row w-full h-7 items-center justify-start">-</div></div>- <div- v-if="!isRowEmpty(record, col) || isAllowToRenderRowEmptyField(col)"- class="flex flex-row w-full text-nc-content-gray items-center justify-start min-h-7 py-1"- >- <LazySmartsheetVirtualCell- v-if="isVirtualCol(col)"- v-model="record.row[col.title]"- :column="col"- :row="record"- class="!text-nc-content-gray"- />- <LazySmartsheetCell- v-else- v-model="record.row[col.title]"- :column="col"- :edit-enabled="false"- :read-only="true"- class="!text-nc-content-gray"- />- </div>- <div v-else class="flex flex-row w-full h-7 items-center justify-start">-</div></div></NcTooltip></div>diff --git a/packages/nc-gui/components/smartsheet/Kanban.vue b/packages/nc-gui/components/smartsheet/Kanban.vueindex f9f4230bdc..72e9f35504 100644--- a/packages/nc-gui/components/smartsheet/Kanban.vue+++ b/packages/nc-gui/components/smartsheet/Kanban.vue@@ -124,7 +124,26 @@ const isRequiredGroupingFieldColumn = computed(() => {return !!groupingFieldColumn.value?.rqd})-const { isRowColouringEnabled } = useViewRowColorRender()+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+ return { backgroundColor: cellColorInfo.cellLeftBorderColor }+}const kanbanContainerRef = ref()@@ -919,35 +938,45 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {'gap-3': isActiveViewFieldHeaderVisible,}">- <h2+ <divv-if="displayField"- class="nc-card-display-value-wrapper"- :class="{- '!children:pointer-events-auto': resetPointerEvent(record, displayField),- }"+ class="flex gap-2 rounded-lg"+ :style="getCellColorStyle(record, displayField.id)">- <template- v-if="!isRowEmpty(record, displayField) || isAllowToRenderRowEmptyField(displayField)"+ <div+ v-if="getCellLeftBorderStyle(record, displayField.id)"+ class="w-1 flex-none min-h-4 rounded-sm"+ :style="getCellLeftBorderStyle(record, displayField.id)"+ ></div>+ <h2+ class="nc-card-display-value-wrapper flex-1"+ :class="{+ '!children:pointer-events-auto': resetPointerEvent(record, displayField),+ }">- <LazySmartsheetVirtualCell- v-if="isVirtualCol(displayField)"- v-model="record.row[displayField.title]"- class="!text-nc-content-brand"- :column="displayField"- :row="record"- />+ <template+ v-if="!isRowEmpty(record, displayField) || isAllowToRenderRowEmptyField(displayField)"+ >+ <LazySmartsheetVirtualCell+ v-if="isVirtualCol(displayField)"+ v-model="record.row[displayField.title]"+ class="!text-nc-content-brand"+ :column="displayField"+ :row="record"+ />- <LazySmartsheetCell- v-else- v-model="record.row[displayField.title]"- class="!text-nc-content-brand"- :column="displayField"- :edit-enabled="false"- :read-only="true"- />- </template>- <template v-else> -</template>- </h2>+ <LazySmartsheetCell+ v-else+ v-model="record.row[displayField.title]"+ class="!text-nc-content-brand"+ :column="displayField"+ :edit-enabled="false"+ :read-only="true"+ />+ </template>+ <template v-else> -</template>+ </h2>+ </div><divv-for="col in fieldsWithoutDisplay"@@ -986,47 +1015,55 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {</template><div- class="flex flex-col rounded-lg w-full"+ class="flex gap-2 rounded-lg w-full":class="{'pointer-events-none': !resetPointerEvent(record, col),}"+ :style="getCellColorStyle(record, col.id)">- <div v-if="isActiveViewFieldHeaderVisible" class="flex flex-row w-full justify-start">- <div class="nc-card-col-header w-full !children:text-nc-content-gray-muted">- <LazySmartsheetHeaderVirtualCell+ <div+ v-if="getCellLeftBorderStyle(record, col.id)"+ class="w-1 flex-none min-h-4 rounded-sm"+ :style="getCellLeftBorderStyle(record, col.id)"+ ></div>+ <div class="flex flex-col w-full">+ <div v-if="isActiveViewFieldHeaderVisible" class="flex flex-row w-full justify-start">+ <div class="nc-card-col-header w-full !children:text-nc-content-gray-muted">+ <LazySmartsheetHeaderVirtualCell+ v-if="isVirtualCol(col)"+ :column="col"+ :hide-menu="true"+ />++ <LazySmartsheetHeaderCell v-else :column="col" :hide-menu="true" />+ </div>+ </div>++ <div+ v-if="+ !isRowEmpty(record, col) || isAllowToRenderRowEmptyField(col) || isPercent(col)+ "+ class="flex flex-row w-full text-nc-content-gray items-center justify-start min-h-7 py-1"+ >+ <LazySmartsheetVirtualCellv-if="isVirtualCol(col)"+ v-model="record.row[col.title]":column="col"- :hide-menu="true"+ :row="record"+ class="!text-nc-content-gray"/>- <LazySmartsheetHeaderCell v-else :column="col" :hide-menu="true" />+ <LazySmartsheetCell+ v-else+ v-model="record.row[col.title]"+ :column="col"+ :edit-enabled="false"+ :read-only="true"+ class="!text-nc-content-gray"+ /></div>+ <div v-else class="flex flex-row w-full h-7 items-center justify-start">-</div></div>-- <div- v-if="- !isRowEmpty(record, col) || isAllowToRenderRowEmptyField(col) || isPercent(col)- "- class="flex flex-row w-full text-nc-content-gray items-center justify-start min-h-7 py-1"- >- <LazySmartsheetVirtualCell- v-if="isVirtualCol(col)"- v-model="record.row[col.title]"- :column="col"- :row="record"- class="!text-nc-content-gray"- />-- <LazySmartsheetCell- v-else- v-model="record.row[col.title]"- :column="col"- :edit-enabled="false"- :read-only="true"- class="!text-nc-content-gray"- />- </div>- <div v-else class="flex flex-row w-full h-7 items-center justify-start">-</div></div></NcTooltip></div>diff --git a/packages/nc-gui/components/smartsheet/KanbanOptimized.vue b/packages/nc-gui/components/smartsheet/KanbanOptimized.vueindex 55b22cdf75..92c1bc90a8 100644--- a/packages/nc-gui/components/smartsheet/KanbanOptimized.vue+++ b/packages/nc-gui/components/smartsheet/KanbanOptimized.vue@@ -124,7 +124,26 @@ const isRequiredGroupingFieldColumn = computed(() => {return !!groupingFieldColumn.value?.rqd})-const { isRowColouringEnabled } = useViewRowColorRender()+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+ return { backgroundColor: cellColorInfo.cellLeftBorderColor }+}const kanbanContainerRef = ref()@@ -1658,35 +1677,45 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {'gap-3': isActiveViewFieldHeaderVisible,}">- <h2+ <divv-if="displayField"- class="nc-card-display-value-wrapper"- :class="{- '!children:pointer-events-auto': resetPointerEvent(record, displayField),- }"+ class="flex gap-2 rounded-lg"+ :style="getCellColorStyle(record, displayField.id)">- <template- v-if="!isRowEmpty(record, displayField) || isAllowToRenderRowEmptyField(displayField)"+ <div+ v-if="getCellLeftBorderStyle(record, displayField.id)"+ class="w-1 flex-none min-h-4 rounded-sm"+ :style="getCellLeftBorderStyle(record, displayField.id)"+ ></div>+ <h2+ class="nc-card-display-value-wrapper flex-1"+ :class="{+ '!children:pointer-events-auto': resetPointerEvent(record, displayField),+ }">- <LazySmartsheetVirtualCell- v-if="isVirtualCol(displayField)"- v-model="record.row[displayField.title]"- class="!text-nc-content-brand"- :column="displayField"- :row="record"- />+ <template+ v-if="!isRowEmpty(record, displayField) || isAllowToRenderRowEmptyField(displayField)"+ >+ <LazySmartsheetVirtualCell+ v-if="isVirtualCol(displayField)"+ v-model="record.row[displayField.title]"+ class="!text-nc-content-brand"+ :column="displayField"+ :row="record"+ />- <LazySmartsheetCell- v-else- v-model="record.row[displayField.title]"- class="!text-nc-content-brand"- :column="displayField"- :edit-enabled="false"- :read-only="true"- />- </template>- <template v-else> -</template>- </h2>+ <LazySmartsheetCell+ v-else+ v-model="record.row[displayField.title]"+ class="!text-nc-content-brand"+ :column="displayField"+ :edit-enabled="false"+ :read-only="true"+ />+ </template>+ <template v-else> -</template>+ </h2>+ </div><divv-for="col in fieldsWithoutDisplay"@@ -1725,47 +1754,55 @@ const resetPointerEvent = (record: RowType, col: ColumnType) => {</template><div- class="flex flex-col rounded-lg w-full"+ class="flex gap-2 rounded-lg w-full":class="{'pointer-events-none': !resetPointerEvent(record, col),}"+ :style="getCellColorStyle(record, col.id)">- <div v-if="isActiveViewFieldHeaderVisible" class="flex flex-row w-full justify-start">- <div class="nc-card-col-header w-full !children:text-nc-content-gray-muted">- <LazySmartsheetHeaderVirtualCell+ <div+ v-if="getCellLeftBorderStyle(record, col.id)"+ class="w-1 flex-none min-h-4 rounded-sm"+ :style="getCellLeftBorderStyle(record, col.id)"+ ></div>+ <div class="flex flex-col w-full">+ <div v-if="isActiveViewFieldHeaderVisible" class="flex flex-row w-full justify-start">+ <div class="nc-card-col-header w-full !children:text-nc-content-gray-muted">+ <LazySmartsheetHeaderVirtualCell+ v-if="isVirtualCol(col)"+ :column="col"+ :hide-menu="true"+ />++ <LazySmartsheetHeaderCell v-else :column="col" :hide-menu="true" />+ </div>+ </div>++ <div+ v-if="+ !isRowEmpty(record, col) || isAllowToRenderRowEmptyField(col) || isPercent(col)+ "+ class="flex flex-row w-full text-nc-content-gray items-center justify-start min-h-7 py-1"+ >+ <LazySmartsheetVirtualCellv-if="isVirtualCol(col)"+ v-model="record.row[col.title]":column="col"- :hide-menu="true"+ :row="record"+ class="!text-nc-content-gray"/>- <LazySmartsheetHeaderCell v-else :column="col" :hide-menu="true" />+ <LazySmartsheetCell+ v-else+ v-model="record.row[col.title]"+ :column="col"+ :edit-enabled="false"+ :read-only="true"+ class="!text-nc-content-gray"+ /></div>+ <div v-else class="flex flex-row w-full h-7 items-center justify-start">-</div></div>-- <div- v-if="- !isRowEmpty(record, col) || isAllowToRenderRowEmptyField(col) || isPercent(col)- "- class="flex flex-row w-full text-nc-content-gray items-center justify-start min-h-7 py-1"- >- <LazySmartsheetVirtualCell- v-if="isVirtualCol(col)"- v-model="record.row[col.title]"- :column="col"- :row="record"- class="!text-nc-content-gray"- />-- <LazySmartsheetCell- v-else- v-model="record.row[col.title]"- :column="col"- :edit-enabled="false"- :read-only="true"- class="!text-nc-content-gray"- />- </div>- <div v-else class="flex flex-row w-full h-7 items-center justify-start">-</div></div></NcTooltip></div>diff --git a/packages/nc-gui/composables/viewRowColor/useViewRowColorRender.ts b/packages/nc-gui/composables/viewRowColor/useViewRowColorRender.tsindex 17b1004df2..bc3134d16a 100644--- a/packages/nc-gui/composables/viewRowColor/useViewRowColorRender.ts+++ b/packages/nc-gui/composables/viewRowColor/useViewRowColorRender.ts@@ -19,10 +19,21 @@ export function useViewRowColorRender() {}}+ const getEvaluatedCellColorInfo = (_row: any, _columnId: string) => {+ return {+ is_set_as_background: false,+ cellBgColor: null as string | null,+ cellBorderColor: null as string | null,+ cellHoverColor: null as string | null,+ cellLeftBorderColor: null as string | null,+ }+ }+return {rowColorInfo: activeViewRowColorInfo,evaluateRowColor,isRowColouringEnabled,getEvaluatedRowMetaRowColorInfo,+ getEvaluatedCellColorInfo,}}