React MUI multiple select overflow one line display the ellipsis - select

I developed a multiple select component that have checkbox can select all and search. The component used Autocomplete and TextField.
I hope the select input can display the ellipsis when selected overflow one line. I set styles but it didn't work. It display all selected options in input.
When I click the select input it can't wake up the options drop-down box If I set overflow scroll and maxHeight .result is I need click twice .Probably because of the cursor position.

I added this to the AutoComplete and it worked for me.
sx={{
"& > .MuiAutocomplete-root .MuiFormControl-root .MuiInputBase-root": {flexWrap: "nowrap"}
}}
renderTags={
(list) => {
let displayList = list.map((item) => item.label).join(' • ');
// Render <Typography> elements instead of <Chip> components. Residence 1, Version 1 • Residence 1, Version 5...
return <Typography
noWrap={true}
sx={{ pl: 1 }}
color="textPrimary"
>
{displayList}
</Typography>;
},
}

Related

Material-ui collapse with horizontal orientation does not work like expected

i am building an app targeted to tablet devices,
basically the main layout is :
Where the central area have three columns: navigation, header list, items details.
I want to give the user the possibility to horizontal collapse the header list
so then items details will expand.
Setting the prop orientation={'horizontal'}, it dont change the behaviour and keep collapsing in vertical.
Desired:
Reality:
Reading the code
https://github.com/mui-org/material-ui/blob/cce45deec3125c1f0dd6c1c74616b5e63b027026/packages/material-ui/src/Collapse/Collapse.js
Show that orientation can be horizontal:
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
Even there is a collapsedHeight, but not a collapsedWidth
function CollapsePanel(props) {
const [collapsed, setCollapse] = React.useState(true);//
//orientation: PropTypes.oneOf(['horizontal', 'vertical']),
return (
<Collapse in={collapsed} collapsedHeight={0} orientation={'horizontal'} >
<div style={{border:'5px solid blue',
display:"flex",flexDirection: "column", alignItems:"center",
minWidth:'180px', alignItems:"stretch", height:'calc(100vh - 40px)',}} >
<IconButton onClick={ ()=>setCollapse(!collapsed)}><ChevronLeftIcon/> Collapse</IconButton>
<div style={{display:"flex",flexDirection: "column", alignItems:"center", justifyContent: "space-around", flexGrow:'1', }} >
Headers List
</div>
</div>
</Collapse>
)
};
The package version is:
npm list --depth=0
#material-ui/core#4.11.3
What am i doing wrong?
4.11.3 doesn't have the orientation prop:
https://github.com/mui-org/material-ui/blob/v4.11.3/packages/material-ui/src/Collapse/Collapse.js
The link in your question points to the v5-alpha branch where orientation was added.

Ag-grid master/detail: custom row style when detail expanded

for my work I use angular 7 and ag-grid enterprise latest version. I have an ag-grid table configured with master / detail feature and I need to customize the style of the row when the detail is expanded. For example, I would like to change the background color of the row only when its detail is expanded. I tried with the CSS rule:
.ag-theme-material .ag-row-focus {
background-color: $dark-grey-blue !important;
}
but I don't get the correct behavior, because the row changes color clicking on it even without the detail being expanded, while I want it to change color only if the detail is expanded.
I tried to look at the official documentation of ag-grid, but I didn't find indications for this specific case.
Can you help me please?
Thank you
You can accomplish this with the grid callback getRowStyle and detect if the node is expanded or not:
gridOptions.getRowStyle = (params) => {
if (params.node.expanded) {
return { background: 'red' };
} else {
return { background: 'green' };
}
}

Remove tick on Bootstrap select with multiselect option

I have multi select box to which I am adding boostarp select plugin for styling, I want to remove tick i have tried options of boostarp select to remove it, But it doesn't seems like removing tick icon, I ended up 'data-tick-icon': '' with this option, Is there any other way to remove tick icon on the left of the option
<%= select_year(Date.today, { start_year: 2000, end_year: Time.current.year + 50 }, multiple: true, class: 'bs-lg', id: 'incidentOccurredYears', 'data-style': 'form-control','data-tick-icon': '', 'data-actions-box':"true", 'data-live-search': 'true') %>
I've tried many different ways as well but it seems by simply adding the data-tick-icon="" to the select element will do the trick

group selection & checkbox in ag-Grid

In my Angular application I have a grid that is almost identical to the Group Selection example in the ag-Grid docs: https://www.ag-grid.com/javascript-grid-selection/#gsc.tab=0
My requirement is slightly different in that my expand button needs to both expand the row and select the row. As you see in the plunker example selection and expansion are two separate click events, but I am looking to select the row and expand that same row in one click, without having the user click on the checkbox and the expand button. I have tried doing this with css by making the checkbox transparent and placing it over the expand icon, but the click is highjacked so only one event will fire...
Is this possible in ag-Grid?
In my component by columnDefs for the column that has my checkbox and expand icon looks like so:
...
this.gridOptions.columnDefs = [
{
headerName: '', width: 100, cellRenderer: 'group',
// for parent row selection - checkboxes for parent rows
checkboxSelection: function(params) {
return params.node.canFlower;
},
cellRendererParams: { value: ' ' }, colId: 'PlusIcon', pinned: 'left', cellClass: 'center'
},
...
Listen to the rowGroupOpened event and set the row to selected:
// inside the ag-grid tag
(gridReady)="onGridReady($event)"
// inside the AppComponent class
onGroupOpened(event){
event.node.setSelected(true)
console.log(event)
}
plnkr example

TextField styling in material-ui#next

I what to change color of label and text in TextField component.
I am using material-ui#next.
and docs from 0.15 does not work ( I have checked it) .
Can someone give me short example how to override floating label? ( not changing general theme ! )
thanks
From the documentation, when you have a TextField it is, in fact, an abstraction component of several smaller components
Advanced Configuration
It's important to understand that the text field is a simple
abstraction on top of the following components:
FormControl
- InputLabel
List item
Input
FormHelperText
Blockquote
If you wish to alter the properties applied to the native input, you can do as follow:...
In your TextField you can pass props for the Input and Label as follow:
<TextField
defaultValue="react-bootstrap"
label="Bootstrap"
InputProps={{
disableUnderline: true,
classes: {
root: classes.textFieldRoot,
input: classes.textFieldInput,
},
}}
InputLabelProps={{
shrink: true,
className: classes.textFieldFormLabel,
}}
/>
this is taken from the last example given in this page.