@@ -2,7 +2,7 @@ import styled from 'styled-components';
22
33import IndeterminateCheckbox from './IndeterminateCheckbox' ;
44
5- import React , { useEffect , useRef , useState } from 'react' ;
5+ import React , { useEffect , useState } from 'react' ;
66
77import {
88 useTable ,
@@ -23,7 +23,6 @@ import { Dropdown, Input, Menu, Tooltip, Button, Empty } from 'antd';
2323
2424import { debounce } from '../services/util/debounce' ;
2525import { getConditionalSelectHeaderCheckboxProps } from '../services/GetConditionalSelectHeaderCheckboxProps' ;
26- import { useIsOverflow } from '../hooks/useIsOverflow' ;
2726
2827//TODO: Move all of the styled components to another file.
2928
@@ -44,7 +43,7 @@ const CellActionContainer = styled.div`
4443 width: fit-content;
4544` ;
4645
47- const SearchContainer = styled . div < { reloadDisabled : boolean , loading : boolean } > `
46+ const SearchContainer = styled . div < { reloadDisabled : number , loading : number } > `
4847 display: flex;
4948 border-bottom: 1px solid #f0f0f0;
5049 background-color: #fafafa;
@@ -258,9 +257,9 @@ const FilterDropdownButton = styled.span<{ isFiltered: boolean; }>`
258257const FilterDropdown = styled . div `
259258 position: absolute;
260259
261- right: 1rem ;
260+ right: 1em ;
262261
263- top: 3rem ;
262+ top: 3em ;
264263
265264 background-color: #fff;
266265
@@ -273,7 +272,7 @@ const FilterDropdown = styled.div`
273272 box-shadow: 0 3px 6px -4px #0000001f, 0 6px 16px #00000014,
274273 0 9px 28px 8px #0000000d;
275274
276- min-width: 20rem ;
275+ min-width: 20em ;
277276
278277 cursor: default;
279278` ;
@@ -312,6 +311,10 @@ const CellInputContainer = styled.div<{ validationError?: IValidationError | nul
312311 box-shadow: ${ ( { validationError, columnId } ) => ( validationError && ( validationError . name || validationError . isUnique ) && columnId === 'name' ) || ( validationError && validationError . value && columnId === 'value' ) ? '0px 0px 0px 2px rgb(255 77 79 / 20%)' : '0 0 0 2px rgb(24 144 255 / 20%);' } ;
313312 }
314313
314+ input::selection {
315+ background-color: #1a98ff;
316+ }
317+
315318 input {
316319 padding: 0;
317320 border: none;
@@ -341,25 +344,10 @@ const CellInputSuffixContainer = styled.span<{ validationError?: IValidationErro
341344 }
342345` ;
343346
344- const CellValue = styled . div < { hasOverflow : boolean | undefined } > `
345- overflow-x: auto;
347+ const CellValue = styled . div `
348+ text-overflow: ellipsis;
349+ overflow-x: hidden;
346350 overflow-wrap: normal;
347-
348- margin-bottom: ${ ( { hasOverflow } ) => hasOverflow ? '-10px' : '' } ;
349-
350- ::-webkit-scrollbar {
351- height: 10px;
352- }
353-
354- ::-webkit-scrollbar-track {
355- background: #f1f1f1;
356- border-radius: 2px;
357- }
358-
359- ::-webkit-scrollbar-thumb {
360- background: #888;
361- border-radius: 2px;
362- }
363351` ;
364352
365353const NoData = styled . div `
@@ -392,10 +380,6 @@ const EditableCell = ({
392380
393381 const [ errorMessage , setErrorMessage ] = useState < string > ( '' ) ;
394382
395- const ref = useRef ( null ) ;
396-
397- const hasOverflow = useIsOverflow ( ref , editableRowIndex ) ;
398-
399383 async function validateInput ( value :string ) {
400384 const nameIsNotUnique : string = 'Name is not unique' ;
401385 const nameIsTooShort : string = 'Name is too short' ;
@@ -541,7 +525,9 @@ const EditableCell = ({
541525 </ CellInputSuffixContainer >
542526 </ CellInputContainer >
543527 ) : (
544- < CellValue hasOverflow = { hasOverflow } ref = { ref } > { value } </ CellValue >
528+ < CellValue >
529+ { value }
530+ </ CellValue >
545531 ) ;
546532} ;
547533
@@ -575,7 +561,7 @@ function GlobalFilter({
575561 } , 200 ) ;
576562
577563 return (
578- < SearchContainer loading = { loading } reloadDisabled = { editableRowIndex !== null } >
564+ < SearchContainer loading = { loading ? 1 : 0 } reloadDisabled = { editableRowIndex !== null ? 1 : 0 } >
579565 < Button disabled = { editableRowIndex !== null } loading = { loading } onClick = { ( ) => loadVariables ( ) } > Reload</ Button >
580566 < HeaderSeparator />
581567 < SearchLabel > Search:{ ' ' } </ SearchLabel >
@@ -734,7 +720,7 @@ export function Table(tableProps: React.PropsWithChildren<ITableProps>) {
734720 Header ( props ) {
735721 const [ indeterminateCheckboxProps , setIndeterminateCheckboxProps ] = useState ( getConditionalSelectHeaderCheckboxProps ( {
736722 headerProps : props ,
737- checkIfRowIsSelectable : ( row : Row ) => row . cells [ 5 ] . value !== true ,
723+ checkIfRowIsSelectable : ( row : Row ) => row . cells [ 5 ] . value !== 1 ,
738724 shouldSelectPage : true
739725 } ) ) ;
740726
@@ -765,7 +751,7 @@ export function Table(tableProps: React.PropsWithChildren<ITableProps>) {
765751 case 'unlocked' :
766752 newProps = {
767753 headerProps : props ,
768- checkIfRowIsSelectable : ( row : Row ) => row . cells [ 5 ] . value !== true ,
754+ checkIfRowIsSelectable : ( row : Row ) => row . cells [ 5 ] . value !== 1 ,
769755 shouldSelectPage : true
770756 } ;
771757 setIndeterminateCheckboxProps ( getConditionalSelectHeaderCheckboxProps ( { ...newProps } ) ) ;
@@ -774,7 +760,7 @@ export function Table(tableProps: React.PropsWithChildren<ITableProps>) {
774760 case 'locked' :
775761 newProps = {
776762 headerProps : props ,
777- checkIfRowIsSelectable : ( row : Row ) => row . cells [ 5 ] . value === true ,
763+ checkIfRowIsSelectable : ( row : Row ) => row . cells [ 5 ] . value === 1 ,
778764 shouldSelectPage : true
779765 } ;
780766 setIndeterminateCheckboxProps ( getConditionalSelectHeaderCheckboxProps ( { ...newProps } ) ) ;
@@ -814,8 +800,8 @@ export function Table(tableProps: React.PropsWithChildren<ITableProps>) {
814800 Header : 'Actions' ,
815801 disableFilters : true ,
816802 disableSortBy : true ,
817- width : 320 ,
818- minWidth : 320 ,
803+ width : 338 ,
804+ minWidth : 338 ,
819805 maxWidth : undefined ,
820806 Cell : ( { row, setEditableRowIndex, editableRowIndex, validationError, rowIndexToKey, editVariable, deleteVariable, initialRowData, setInitialRowData, modifyTableData } ) => (
821807 < CellActionContainer >
@@ -826,7 +812,7 @@ export function Table(tableProps: React.PropsWithChildren<ITableProps>) {
826812 const updatedRow = row . values ;
827813 editVariable ( id . toString ( ) , updatedRow . name , updatedRow . value , ! updatedRow . preventDeletion ) ;
828814 } }
829- style = { { minWidth : 96.69 } }
815+ style = { { minWidth : 104 } }
830816 >
831817 { row . values . preventDeletion ? 'Unlock' : 'Lock' }
832818 </ ActionButton >
@@ -847,13 +833,13 @@ export function Table(tableProps: React.PropsWithChildren<ITableProps>) {
847833 setInitialRowData ( null ) ;
848834 }
849835 } }
850- style = { { minWidth : 82.71 } }
836+ style = { { minWidth : 89 } }
851837 >
852838 { editableRowIndex !== row . index ? 'Edit' : 'Save' }
853839 </ ActionButton >
854840 < ActionButton
855841 danger = { true }
856- disabled = { ( validationError && validationError . row !== row . index ) || ( editableRowIndex !== null && editableRowIndex !== row . index ) || ( row . values . preventDeletion === true && editableRowIndex !== row . index ) }
842+ disabled = { ( validationError && validationError . row !== row . index ) || ( editableRowIndex !== null && editableRowIndex !== row . index ) || ( row . values . preventDeletion === 1 && editableRowIndex !== row . index ) }
857843 onClick = { ( ) => {
858844 const currentIndex = row . index ;
859845 if ( editableRowIndex !== currentIndex ) {
@@ -872,7 +858,7 @@ export function Table(tableProps: React.PropsWithChildren<ITableProps>) {
872858 loadVariables ( ) ;
873859 }
874860 } }
875- style = { { minWidth : 96 } }
861+ style = { { minWidth : 103 } }
876862 >
877863 { editableRowIndex !== row . index ? 'Delete' : 'Cancel' }
878864 </ ActionButton >
@@ -993,7 +979,7 @@ export function Table(tableProps: React.PropsWithChildren<ITableProps>) {
993979 title : undefined ,
994980 style : {
995981 width : column . width !== undefined ? column . width : '' ,
996- minWidth : column . minWidth !== undefined ? column . width : '' ,
982+ minWidth : column . minWidth !== undefined ? column . minWidth : '' ,
997983 maxWidth : column . maxWidth !== undefined ? column . maxWidth : '' ,
998984 } ,
999985 } )
0 commit comments