|
@@ -28,6 +28,12 @@ class AutoField extends React.Component {
|
|
|
let dataKey = fieldOption.key;
|
|
|
this.props.onChange && this.props.onChange(dataKey, value);
|
|
|
}
|
|
|
+
|
|
|
+ onClick(value) {
|
|
|
+ let fieldOption = this.props.fieldOption;
|
|
|
+ let dataKey = fieldOption.key;
|
|
|
+ this.props.onClick && this.props.onClick(dataKey, value);
|
|
|
+ }
|
|
|
|
|
|
getValueTag(field,fieldData) {
|
|
|
let self = this;
|
|
@@ -43,6 +49,7 @@ class AutoField extends React.Component {
|
|
|
return <Input {...{
|
|
|
value: field.value,
|
|
|
onChange: e => self.onChange(e.target.value),
|
|
|
+ onClick: e => self.onClick(e.target.value),
|
|
|
disabled: field.disabled,
|
|
|
placeholder: field.placeholder,
|
|
|
...innerProps
|
|
@@ -51,6 +58,7 @@ class AutoField extends React.Component {
|
|
|
return <TextArea {...{
|
|
|
value: field.value,
|
|
|
onChange: e => self.onChange(e.target.value),
|
|
|
+ onClick: e => self.onClick(e.target.value),
|
|
|
disabled: field.disabled,
|
|
|
placeholder: field.placeholder,
|
|
|
autosize: { minRows: 4, maxRows: 8 },
|
|
@@ -60,6 +68,7 @@ class AutoField extends React.Component {
|
|
|
return <InputNumber {...{
|
|
|
value: field.value || 0,
|
|
|
onChange: value => self.onChange(util.string.isEmpty(value) ? 0 : value),
|
|
|
+ onClick: value => self.onClick(util.string.isEmpty(value) ? 0 : value),
|
|
|
disabled: field.disabled,
|
|
|
placeholder: field.placeholder,
|
|
|
min: 0,
|
|
@@ -72,6 +81,7 @@ class AutoField extends React.Component {
|
|
|
return <InputNumber {...{
|
|
|
value: field.value || 0,
|
|
|
onChange: value => self.onChange(util.string.isEmpty(value) ? 0 : value),
|
|
|
+ onClick: value => self.onClick(util.string.isEmpty(value) ? 0 : value),
|
|
|
disabled: field.disabled,
|
|
|
placeholder: field.placeholder,
|
|
|
min: 0,
|
|
@@ -86,6 +96,7 @@ class AutoField extends React.Component {
|
|
|
return <Switch {...{
|
|
|
checked: field.value + '' === "1" || field.value + '' === 'true',
|
|
|
onChange: value => self.onChange(value ? "1" : "0"),
|
|
|
+ onClick: value => self.onClick(value ? "1" : "0"),
|
|
|
disabled: field.disabled,
|
|
|
checkedChildren: <Icon type="check" />,
|
|
|
unCheckedChildren: <Icon type="cross" />,
|
|
@@ -127,6 +138,7 @@ class AutoField extends React.Component {
|
|
|
return <BirdSelector {...{
|
|
|
selectedValue: field.value,
|
|
|
onChange: value => self.onChange(value),
|
|
|
+ onClick: value => self.onClick(value ? "1" : "0"),
|
|
|
disabled: field.disabled,
|
|
|
data: sourcedata || [],
|
|
|
url: field.source.url,
|
|
@@ -142,6 +154,7 @@ class AutoField extends React.Component {
|
|
|
return <BirdMulti {...{
|
|
|
selectedValue: field.value,
|
|
|
onChange: value => self.onChange(value),
|
|
|
+ onClick: value => self.onClick(value),
|
|
|
disabled: field.disabled,
|
|
|
options: field.source.data || [],
|
|
|
url: field.source.url,
|
|
@@ -156,6 +169,7 @@ class AutoField extends React.Component {
|
|
|
return <BirdCascader {...{
|
|
|
value: field.value,
|
|
|
onChange: value => self.onChange(value),
|
|
|
+ onClick: value => self.onClick(value),
|
|
|
disabled: field.disabled,
|
|
|
data: field.source.data || [],
|
|
|
url: field.source.url,
|
|
@@ -174,7 +188,8 @@ class AutoField extends React.Component {
|
|
|
disabled: field.disabled,
|
|
|
listType: field.fieldType === 'img' || field.fieldType === 'imgs' ? 'picture' : 'text',
|
|
|
value: field.value,
|
|
|
- onChange: value => self.onChange(value)
|
|
|
+ onChange: value => self.onChange(value),
|
|
|
+ onClick: value => self.onClick(value),
|
|
|
};
|
|
|
if (field.fieldType === 'img' || field.fieldType === 'imgs') {
|
|
|
fileProps.accept = "image/png,image/jpeg,image/jpg,image/gif,image/bmp";
|
|
@@ -185,6 +200,7 @@ class AutoField extends React.Component {
|
|
|
return <DatePicker {...{
|
|
|
value: field.value ? moment(field.value) : null,
|
|
|
onChange: (date, dateString) => self.onChange(dateString),
|
|
|
+ onClick: (date, dateString) => self.onClick(dateString),
|
|
|
disabled: field.disabled,
|
|
|
format: "YYYY-MM-DD",
|
|
|
style: { width: '100%' },
|
|
@@ -194,6 +210,7 @@ class AutoField extends React.Component {
|
|
|
return <DatePicker {...{
|
|
|
value: field.value ? moment(field.value) : null,
|
|
|
onChange: (date, dateString) => self.onChange(dateString),
|
|
|
+ onClick: (date, dateString) => self.onClick(dateString),
|
|
|
disabled: field.disabled,
|
|
|
showTime: true,
|
|
|
format: "YYYY-MM-DD HH:mm:ss",
|
|
@@ -205,13 +222,15 @@ class AutoField extends React.Component {
|
|
|
initValue: field.value,
|
|
|
contentId: field.key,
|
|
|
onChange: value => self.onChange(value),
|
|
|
+ onClick: value => self.onClick(value),
|
|
|
innerProps: innerProps
|
|
|
}} />;
|
|
|
case "input":
|
|
|
return <InputNumber {...{
|
|
|
defaultValue:field.value,
|
|
|
contentId: field.key,
|
|
|
- onChange: value=>self.onChange(value)
|
|
|
+ onChange: value=>self.onChange(value),
|
|
|
+ onClick: value=>self.onClick(value)
|
|
|
}} />
|
|
|
default:
|
|
|
return <span />;
|
|
@@ -249,6 +268,7 @@ AutoField.propTypes = {
|
|
|
fieldData: PropTypes.array,
|
|
|
labelColSpan: PropTypes.number,
|
|
|
onChange: PropTypes.func,
|
|
|
+ onClick: PropTypes.func,
|
|
|
initOption:PropTypes.func,
|
|
|
inline:PropTypes.bool,
|
|
|
}
|