UNPKG

lml-main

Version:

This is now a mono repository published into many standalone packages.

32 lines 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const react_redux_1 = require("react-redux"); const constants_1 = require("../../constants"); const selectors_1 = require("../../selectors"); const cosmoui_1 = require("cosmoui"); class SearchPlaceFormComponent extends React.Component { constructor() { super(...arguments); this.submitSelection = (name, formName, field) => { this.props.submitForm(field.value.value); }; } componentDidMount() { this.props.setFormField(constants_1.SEARCH_PLACE_PARTNER_SELECT_KEY, constants_1.SEARCH_PLACE_BY_PARTNER_FORM_KEY, Object.assign({}, this.props.searchField, { value: this.props.partners[0] })); } render() { return (React.createElement(cosmoui_1.Form, { name: constants_1.SEARCH_PLACE_BY_PARTNER_FORM_KEY, style: { width: '200px' } }, React.createElement(cosmoui_1.FormGroup, { label: "Choose Partner *" }, React.createElement(cosmoui_1.Select, { name: constants_1.SEARCH_PLACE_PARTNER_SELECT_KEY, options: this.props.partners, onChange: this.submitSelection })))); } } const mapStateToProps = (state, ownProps) => ({ partners: selectors_1.getPartners(), searchField: cosmoui_1.getFormField(state, constants_1.SEARCH_PLACE_BY_PARTNER_FORM_KEY, constants_1.SEARCH_PLACE_PARTNER_SELECT_KEY), }); const mapDispatchToProps = { setFormField: cosmoui_1.setFormField, }; exports.SearchPlaceForm = react_redux_1.connect(mapStateToProps, mapDispatchToProps)(SearchPlaceFormComponent); //# sourceMappingURL=search-place-form.js.map