bug fixed : table widget is not consistent with the dark theme (#3987)

* bug fixed : table widget is not consistent with the dark theme

* bug fixed : dropdown in filter is not consistent with the dark theme

* fixed dark theme for dropdown and multiselect column in table

* making generateColumns re-render with change in applied theme

* made badge and multibadge consistent withthe dark theme

* made text column consistent with the dark theme
This commit is contained in:
Manish Kushare 2022-10-18 08:47:06 +05:30 committed by GitHub
parent b0e6a34f18
commit 397b138d62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 3 deletions

View file

@ -2,7 +2,7 @@ import React from 'react';
import SelectSearch from 'react-select-search';
import { useTranslation } from 'react-i18next';
export const CustomSelect = ({ options, value, multiple, onChange }) => {
export const CustomSelect = ({ options, value, multiple, onChange, darkMode }) => {
const { t } = useTranslation();
function renderValue(valueProps) {
@ -26,6 +26,7 @@ export const CustomSelect = ({ options, value, multiple, onChange }) => {
onChange={onChange}
multiple={multiple}
placeholder={t('globals.select', 'Select') + '...'}
className={`${darkMode ? 'select-search-dark' : 'select-search'}`}
/>
</div>
);

View file

@ -140,6 +140,7 @@ export function Filter(props) {
search={true}
onChange={(value) => filterColumnChanged(index, value)}
placeholder={t('globals.select', 'Select') + '...'}
className={`${darkMode ? 'select-search-dark' : 'select-search'} mb-0`}
styles={selectStyles('100%')}
/>
</div>
@ -164,6 +165,7 @@ export function Filter(props) {
onChange={(value) => {
filterOperationChanged(index, value);
}}
className={`${darkMode ? 'select-search-dark' : 'select-search'}`}
placeholder={t('globals.select', 'Select') + '...'}
styles={selectStyles('100%')}
/>

View file

@ -7,6 +7,7 @@ export const GlobalFilter = ({
onComponentOptionChanged,
component,
onEvent,
darkMode,
}) => {
const [value, setValue] = React.useState(globalFilter);
const onChange = useAsyncDebounce((filterValue) => {
@ -26,7 +27,7 @@ export const GlobalFilter = ({
/>
<input
type="text"
className="global-search-field btn-light align-self-center"
className={`global-search-field btn-light align-self-center ${darkMode && 'dark-theme-placeholder'}`}
defaultValue={value || ''}
onChange={(e) => onChange(e.target.value)}
placeholder="Search"

View file

@ -278,6 +278,7 @@ export function Table({
fireEvent,
tableRef,
t,
darkMode,
});
const [leftActionsCellData, rightActionsCellData] = useMemo(
@ -315,6 +316,7 @@ export function Table({
JSON.stringify(component.definition.properties.columns),
showBulkSelector,
JSON.stringify(variablesExposedForPreview && variablesExposedForPreview[id]),
darkMode,
] // Hack: need to fix
);
@ -575,6 +577,7 @@ export function Table({
onComponentOptionChanged={onComponentOptionChanged}
component={component}
onEvent={onEvent}
darkMode={darkMode}
/>
)}
<div>

View file

@ -23,6 +23,7 @@ export default function generateColumnsData({
fireEvent,
tableRef,
t,
darkMode,
}) {
return columnProperties.map((column) => {
const columnSize = columnSizes[column.id] || columnSizes[column.name];
@ -219,7 +220,9 @@ export default function generateColumnsData({
return (
<textarea
rows="1"
className="form-control-plaintext text-container text-muted"
className={`form-control-plaintext text-container ${
darkMode ? 'text-light textarea-dark-theme' : 'text-muted'
}`}
readOnly={!column.isEditable}
style={{ maxWidth: width, minWidth: width - 10 }}
onBlur={(e) => {
@ -272,6 +275,7 @@ export default function generateColumnsData({
filterOptions={fuzzySearch}
placeholder={t('globals.select', 'Select') + '...'}
disabled={!column.isEditable}
className={`${darkMode ? 'select-search-dark' : 'select-search'}`}
/>
<div className={`invalid-feedback ${isValid ? '' : 'd-flex'}`}>{validationError}</div>
</div>
@ -291,6 +295,7 @@ export default function generateColumnsData({
handleCellValueChange(cell.row.index, column.key || column.name, value, cell.row.original);
}}
disabled={!column.isEditable}
className={`${darkMode ? 'select-search-dark' : 'select-search'}`}
/>
</div>
);
@ -306,6 +311,7 @@ export default function generateColumnsData({
onChange={(value) => {
handleCellValueChange(cell.row.index, column.key || column.name, value, cell.row.original);
}}
darkMode={darkMode}
/>
</div>
);

View file

@ -6554,3 +6554,11 @@ tbody {
}
}
.custom-select{
.select-search-dark__value::after{
content: none;
}
}
.jet-data-table td .textarea-dark-theme.text-container:focus {
background-color: transparent !important;
}