diff --git a/frontend/src/Editor/Components/Table/Table.jsx b/frontend/src/Editor/Components/Table/Table.jsx index e95dad3004..0d8cd97a99 100644 --- a/frontend/src/Editor/Components/Table/Table.jsx +++ b/frontend/src/Editor/Components/Table/Table.jsx @@ -1,6 +1,6 @@ /* eslint-disable no-unused-vars */ /* eslint-disable react-hooks/exhaustive-deps */ -import React, { useMemo, useState, useEffect } from 'react'; +import React, { useMemo, useState, useEffect, useCallback } from 'react'; import { useTable, useFilters, @@ -260,6 +260,14 @@ export function Table({ const changeSet = componentState ? componentState.changeSet : {}; + const computeFontColor = useCallback(() => { + if (color !== undefined) { + return color; + } else { + return darkMode ? '#ffffff' : '#000000'; + } + }, [color, darkMode]); + const columnData = component.definition.properties.columns.value.map((column) => { const columnSize = columnSizes[column.id] || columnSizes[column.name]; const columnType = column.columnType; @@ -304,7 +312,7 @@ export function Table({ const textColor = resolveReferences(column.textColor, currentState, { cellValue }); const cellStyles = { - color: textColor === undefined ? (darkMode === true ? '#fff' : 'black') : textColor, + color: textColor ?? '', }; if (column.isEditable) { @@ -598,7 +606,6 @@ export function Table({ const data = useMemo(() => tableData, [tableData.length, componentState.changeSet]); const computedStyles = { - color, width: `${width}px`, }; @@ -729,7 +736,7 @@ export function Table({ )} {!loadingState && ( -
+ {console.log('page', page)} {page.map((row, index) => { prepareRow(row); diff --git a/frontend/src/Editor/Components/components.js b/frontend/src/Editor/Components/components.js index 2c7cc29af9..936e7a3aa5 100644 --- a/frontend/src/Editor/Components/components.js +++ b/frontend/src/Editor/Components/components.js @@ -85,7 +85,7 @@ export const componentTypes = [ }, events: [], styles: { - textColor: { value: '' }, + textColor: { value: undefined }, visibility: { value: '{{true}}' }, disabledState: { value: '{{false}}' }, }, diff --git a/frontend/src/Editor/Inspector/Components/Table.jsx b/frontend/src/Editor/Inspector/Components/Table.jsx index a1f1931443..d640facb43 100644 --- a/frontend/src/Editor/Inspector/Components/Table.jsx +++ b/frontend/src/Editor/Inspector/Components/Table.jsx @@ -671,18 +671,6 @@ class Table extends React.Component { currentState )} - {Object.keys(componentMeta.styles).map((style) => - renderElement( - component, - componentMeta, - paramUpdated, - dataQueries, - style, - 'styles', - currentState, - components - ) - )}