Skip to content

Commit

Permalink
🍰 fix formItem disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
weiq committed Feb 1, 2019
1 parent 6b522b3 commit f776ebd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/components/Form/model/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class TableControlled extends Component {
showNum,
placeholder,
getPopupContainer,
disabled,
...otherProps
} = this.props;
const { dataSource, value, rows, loading, visible } = this.state;
Expand All @@ -178,12 +179,13 @@ class TableControlled extends Component {
onChange: ({ pageNum, pageSize }) => this.onChange({ pageNum, pageSize }),
onSelect: (keys, rows) => this.onSelect(keys, rows)
};
if (modal) {
if (modal || disabled) {
return (
<div>
<div onClick={this.showModal}>
<div onClick={disabled ? () => {} : this.showModal}>
<Select
readOnly
disabled={!!disabled}
mode="multiple"
open={false}
value={titleKey ? value : value.length ? '_selected' : []}
Expand Down
5 changes: 3 additions & 2 deletions src/components/Form/model/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ class TransferControlled extends Component {
/>
);

if (modal) {
if (modal || otherProps.disabled) {
return (
<div>
<div onClick={this.showModal}>
<div onClick={otherProps.disabled ? () => {} : this.showModal}>
<Select
readOnly
disabled={!!otherProps.disabled}
mode="multiple"
open={false}
value={otherProps.value}
Expand Down
5 changes: 3 additions & 2 deletions src/components/Form/model/transfertree.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ class TransferTreeControlled extends Component {
/>
);

if (modal) {
if (modal || otherProps.disabled) {
return (
<div>
<div onClick={this.showModal}>
<div onClick={otherProps.disabled ? () => {} : this.showModal}>
<Select
readOnly
disabled={!!otherProps.disabled}
mode="multiple"
open={false}
value={otherProps.value}
Expand Down

0 comments on commit f776ebd

Please sign in to comment.