vagusX on master
chore: update https://registry.… (compare)
Hi everyone!
I am try to write a unit test of biz components which is base on antd select.
I use @testing-library
to write unit test.
This is my unit test code:
it('filter by input', async () => {
const { getByRole, rerender, container } = render(<MySelect />);
await act(async () => {
fireEvent.mouseDown(getByRole('combobox'));
});
expect(screen.queryAllByRole('option')).toHaveLength(58); // received => 2
});
This is my biz component
const OPTOINS = [{ value: 'a', text: 'a' }, {value: 'b', text: ‘b'} ]; // There are 58 options.
const MySelect = forwardRef((props, ref) => {
const handleSelectFilter = useCallback(
(input, option) => option.children.includes(input),
[],
);
return (
<Select
showSearch
defaultActiveFirstOption
filterOption={handleSelectFilter}
{...props}
ref={ref}
>
{OPTIONS.map(({ value, text }) => (
<Select.Option key={value}>{text}</Select.Option>
))}
</Select>
);
});
What should i do to simulate open select option list?
In antd v4, select impl by virtual list.
So, what is the correct excepted value?
I made a Youtube playlist about AntD English tutorials.
You can watch the videos.
You can add videos, this is how:
Use this link
https://www.youtube.com/playlist?list=PL0JRSe9GT_lfNG_Ju6Wz1Xb5-gYUn3bZt&jct=XGlUR-NvEDkDdNXiJxXBBBG-YhkDJA
Click CONTINUE
Click the Haburger_Plus sign to Save playlist (You become an author of the playlist)
Each time you want to add a video: 3 dots, Save to playlist, choose AntD .
Let me know if you like this idea and how difficult it was to follow the steps.
I'm thinking which state management library to use in a new UMI project: DVA or Redux.
You might have some thoughts on this, or just find this info useful.
What's the connection with antd?
Antd uses UMI and DVA.
DVA
PROS (DVA is good because:)
There is a Chinese community behind it (I live in China), they have tutorials and groups for questions.
UMI is made for DVA, so future compatibility is granted.
Small size. Empty UMI project with DVA added is 0.5 MB.
CONS (DVA is bad because:)
Poorly documented.
Redux
PROS:
There is a much bigger English language community behind it.
Very complex, has Hooks and other features to cover special needs.
CONS:
Large size. Empty UMI project with Redux added is 2.6 MB.
Conclusion:
This is not final, but i might choose DVA because of the size. It won't be easy though, cause I don't understand the Chinese documentation and machine translation gives a poor result.
@emelerdem
Hi!
İ used filtered antd
but not working
{
title: t('columns.status'),
dataIndex: 'status',
key: 'status',
editable: true,
inputType:'status',
filters: [
{
text: 'ONLINE',
value: "ONLINE",
},
{
text: 'OFFLINE',
value: "OFFLINE",
},
],
filterMultiple: false,
onFilter: (value, record) => record.status.indexOf(value) === 0,
this is my code
Hi,
I am new to Ant-design though I have been doing some reading about it but still thinking how best to implement it with my REACT application. I am frustrated with MATERIAL-UI, just to implement Form Layout using MATERIAL-UI GRID and CONTAINER is taking me forever, my project is for 4 weeks and I have been trying this framework for 2 weeks now which is 50% of my productive working time wasted.
Please I will need anyone to bring me to SPEED, on how to implement ANT-DESIGN in my React Project so that I can meet up with the timeline.
Thank you in anticipation
Menu.SubMenu
and it Menu.Item
components in map
loop function? data = {
"Weldlog": [
{
"id": 1,
"title": "Weldlog",
"link": "/workspace/weldlog",
"icon": "MonitorOutlined",
"component": "Weldlog",
"is_root": true,
"parent": null
},
{
"id": 2,
"title": "Labs",
"link": "labs",
"icon": "MonitorOutlined",
"component": "Labs",
"is_root": false,
"parent": "Weldlog"
},
{
"id": 3,
"title": "Lab requests",
"link": "labrequest",
"icon": "FileProtectOutlined",
"component": "LabRequest",
"is_root": false,
"parent": "Weldlog"
}
]
}
render() {
const { navMenuData } = this.state;
console.log(navMenuData)
if(navMenuData === null){
return(
<Spin tip="Загружаем меню..."/>
)
} else {
return (
<div>
<Menu theme="dark" mode="horizontal" defaultSelectedKeys={this.props.activeKey} selectedKeys={this.props.activeKey}>
{
Object.entries(navMenuData).map(([menuRootItem, menuItems]) => (
<Menu.SubMenu title={menuRootItem}>
{
Object.values(menuItems).map((menuItem) => {
console.log(menuItem)
return(
<Menu.Item key={menuItem.link}>{menuItem.title}</Menu.Item>
)
})
}
</Menu.SubMenu>
))
}
<Menu.Item
key="user"
onClick={() => {this.setState({visible: true})}}
icon={Icon['UserOutlined'].render()}
style={{marginLeft: 'auto'}}
>
{`${this.state.auth.profile.first_name} ${this.state.auth.profile.second_name}`}
</Menu.Item>
</Menu>
<Drawer
width={640}
placement="right"
closable={true}
onClose={() => this.setState({visible: false})}
visible={this.state.visible}
// visible={true}
>
<UserControl/>
</Drawer>
</div>
);
}
}
So I have a table where I mark rows red if they have a status FAIL, this works nice, but now I want the hover color to have a stronger red color on the FAIL rows.
I cant find anyway to manipulate the hover color in the table.
To be clear, I want to change the hover color on the table depending on the data of the row.
<Table
dataSource={data}
rowClassName={(record, index) =>
record.status.includes("FAIL")
? "table-row-failed"
: ""
}
rowKey="reference"
columns={columns}
></Table>
Is this possible?