antd

How to dynamically set a required rule to the Form.Item validation

眉间皱痕 提交于 2020-01-25 02:45:06
问题 I have a list of parameters that may be checked or not. Its correspondent fields are enabled/disabled in dependence of checkbox state. So I want to enable and validate field if parameter is checked, and disable field and turn off validation rule while checkbox is unchecked. But I can't switch required rule to false while toggling checkbox. As you see the registrations parameter is unchecked but the field still have a validation.. Here is how I've done it: <Row key={index} gutter={8}> <Col

Antd table - sort dosen't work with render

别说谁变了你拦得住时间么 提交于 2020-01-24 20:12:53
问题 I go problem with sorting data in table because when I using sorter with render function sort work only time { title: 'App', dataIndex: 'location', render: location => location.join(', '), sorter: true }, { title: 'Priority', dataIndex: 'priority', sorter: true } Sorter buttons in column dosen't change and i got the same data from table handle event function. I dont want write sorter function on frontend because i do this on backend 回答1: you can update antd-3.11.0 version 来源: https:/

Ant Design Calendar: How to Change the Day of Week Format

旧时模样 提交于 2020-01-24 19:22:49
问题 I'm using the Ant Design Calendar Component in my project and I have it set up as follows: Currently the Day of Week format is dd . Eg. Su , Mo , Tu , etc. Is it possible to change the format via props to ddd . Eg. Sun , Mon , Tue , etc.? 回答1: There is no support for changing that directly on ant design component, but Ant Design under the hood is using moment which is using locale.weekdaysMin , so you can import moment and change them: import moment from 'moment' moment.updateLocale('en', {

Can't sort Column in Ant Design Table in Gatsby site

若如初见. 提交于 2020-01-21 09:57:46
问题 I have implement an Ant Design Table in a Gatsby site. I am pulling in the data from graphql. So far everything has worked just fine. The data is displaying properly, pagination works, etc. Now I want to add the ability to sort the columns. To do so, I set up the table and columns as follows: <Table dataSource={data.allNewsFeed.edges} onChange={onChange} rowSelection={rowSelection} rowKey="id" > <Column title="Title" dataIndex="node.title" key="title" sorter={(a, b) => a.node.title - b.node

Can't sort Column in Ant Design Table in Gatsby site

穿精又带淫゛_ 提交于 2020-01-21 09:57:26
问题 I have implement an Ant Design Table in a Gatsby site. I am pulling in the data from graphql. So far everything has worked just fine. The data is displaying properly, pagination works, etc. Now I want to add the ability to sort the columns. To do so, I set up the table and columns as follows: <Table dataSource={data.allNewsFeed.edges} onChange={onChange} rowSelection={rowSelection} rowKey="id" > <Column title="Title" dataIndex="node.title" key="title" sorter={(a, b) => a.node.title - b.node

Is there a way to disable typing/pasting into the date input and only allowing users to select from the date picker in AntD?

时光怂恿深爱的人放手 提交于 2020-01-15 08:38:25
问题 Is there a way to disable typing/pasting into the date input and only allowing users to select from the date picker in AntD? disabling doesn't work either. I've gone through the documentation I tried this way import { DatePicker } from 'antd'; ... handleDateChange = (e) => { e.preventDefault(); } ... render() { ... <DatePicker onChange={this.handleDateChange} ... /> ... } This way it just stopped taking input values even through picker panel. 回答1: For antd date picker, you need to set dispaly

How to wrap up Ant Design with Styled Components and TypeScript?

给你一囗甜甜゛ 提交于 2020-01-12 18:37:11
问题 I want to wrap up my ant-design components with styled-components, I know that this is possible (https://gist.github.com/samuelcastro/0ff7db4fd54ce2b80cd1c34a85b40c08) however I'm having troubles to do the same with TypeScript. This is what I have so far: import { Button as AntButton } from 'antd'; import { ButtonProps } from 'antd/lib/button/button'; import styledComponents from 'styled-components'; interface IButtonProps extends ButtonProps { customProp: string; } export const Button =

How to use antd.Form.create in typescript?

老子叫甜甜 提交于 2020-01-09 19:17:18
问题 I have a login form created by Form.create(), but I can't pass any props to this form from parent component, compiler always notify a error like error TS2339: Property 'loading' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Compone nt<{}, ComponentState>> & Readonly<{ childr...'. LoginForm.tsx import * as React from 'react'; import { Form } from 'antd'; import { WrappedFormUtils } from 'antd/lib/form/Form'; interface Props { form: WrappedFormUtils; loading: boolean;

Can't bind to 'ngModelOptions' since it isn't a known property of 'input' in Angular 6

喜欢而已 提交于 2020-01-06 08:38:31
问题 Here is my HTML: <nz-form-item nzFlex [formGroup]="hulkForm"> <nz-form-label [nzSpan]="7" [nzFor]="hulkColumn.column" [nzRequired]="hulkColumn.require">{{hulkColumn.lable}}</nz-form-label> <nz-form-control [nzSpan]="17"> <input nz-input placeholder={{hulkColumn.placeholder}} [formControlName]="hulkColumn.name" [(ngModel)]="hulkColumn.model" [ngModelOptions]="{updateOn: 'blur'}" name="{{hulkColumn.name}}" *ngIf="hulkColumn.type!=='number'" > </nz-form-control> </nz-form-item> Here is the error

antd: error TS2339: Property 'centered' does not exist on type

倖福魔咒の 提交于 2020-01-06 05:27:25
问题 <Modal visible={this.state.showModel} title="添加代金券" centered okText="保存" cancelText="取消" onOk={() => this.okBtnClick} onCancel={() => this.cancelClick} > I use ANTD's modal to make it vertically centered, but I was wrongly told that centered does not exist and attribute 1. 来源: https://stackoverflow.com/questions/51943291/antd-error-ts2339-property-centered-does-not-exist-on-type