Repository URL to install this package:
|
Version:
4.0.21 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const exotic_1 = require("exotic");
const forms_1 = require("../../..");
const fixture_1 = require("./fixture");
class FormStateCard extends forms_1.FormState {
constructor() {
super(...arguments);
this.inputsList = fixture_1.inputList;
}
}
class Form extends forms_1.ObserverForm {
constructor(props) {
super(props);
this.isSubmitButtonNeeded = false;
this.handleSearch = () => {
const {
onSearch
} = this.props;
console.log('[Search form] state value', this.state.toSerialized());
if (exotic_1.isFunction(onSearch)) {
onSearch(this.state);
}
};
this.onInputInit = inputState => {
if (inputState.name === 'search') {
inputState.onIconClick = this.handleSearch;
}
};
this.onSubmit = event => {
event.preventDefault();
const {
onSearch
} = this.props;
if (exotic_1.isFunction(onSearch)) {
onSearch(this.state);
}
};
this.state = new FormStateCard(props);
}
componentWillMount() {
const {
searchAdditionalProps
} = this.props;
const searchInputList = this.state.get('search');
if (exotic_1.isObj(searchAdditionalProps)) {
Object.keys(searchAdditionalProps).forEach(key => searchInputList[key] = searchAdditionalProps[key]);
}
}
}
Form.defaultProps = {
state: new FormStateCard()
};
exports.Form = Form;
exports.default = Form; //# sourceMappingURL=Form.js.map