meraproject/lib/js/bws/react/form/contact.js

138 lines
3.9 KiB
JavaScript
Raw Normal View History

var Contact;
export default window.Contact = Contact = class Contact extends React.Component {
constructor(props) {
var data, i, j, len, ref, ref1, ref2, ref3, ref4, t, type;
super(props);
data = (ref = props.data) != null ? ref : {};
type = Contacts.TYPES[0];
if (data.type != null) {
t = parseInt(data.type);
ref1 = Contacts.TYPES;
for (j = 0, len = ref1.length; j < len; j++) {
i = ref1[j];
if (i.id === t) {
type = i;
}
}
}
this.state = {
type: type,
removed: false
};
this.select = /*#__PURE__*/React.createElement(Select, {
data: Contacts.TYPES,
id: 1,
titleClass: "code code-arrow",
onSelect: this.setType.bind(this)
});
this.remove = this.remove.bind(this);
this.getValue = this.getValue.bind(this);
this.value = null;
this.comment = null;
this.valueValue = (ref2 = data.value) != null ? ref2 : '';
this.commentValue = (ref3 = data.comment) != null ? ref3 : '';
this.id = (ref4 = data.id) != null ? ref4 : '';
}
remove() {
return this.setState({
removed: true
});
}
setType(x) {
return this.setState({
type: x
});
}
getValue() {
return {
id: this.id,
value: this.value.value,
comment: this.comment.value,
type: this.state.type.id
};
}
render() {
var _this = this;
var type;
if (this.state.removed) {
return null;
}
type = this.state.type;
return /*#__PURE__*/React.createElement("div", {
className: "label l-big",
key: new Date().getTime()
}, /*#__PURE__*/React.createElement("div", {
className: "row r6"
}, /*#__PURE__*/React.createElement("div", {
className: "c c-10 pt-9"
}, /*#__PURE__*/React.createElement("div", {
className: "hind h-left"
}, /*#__PURE__*/React.createElement("div", {
className: "h-title"
}, /*#__PURE__*/React.createElement(Select, {
data: Contacts.TYPES,
id: this.state.type.id,
titleClass: "code code-arrow",
onSelect: this.setType.bind(this)
})), /*#__PURE__*/React.createElement("div", {
className: "h-body"
}, "\u041F\u043E\u043C\u0435\u043D\u044F\u0442\u044C \u0442\u0438\u043F \u043A\u043E\u043D\u0442\u0430\u043A\u0442\u0430"))), /*#__PURE__*/React.createElement("div", {
className: "c c-90"
}, /*#__PURE__*/React.createElement("div", {
className: "label l-min"
}, /*#__PURE__*/React.createElement("div", {
className: "row r6 flex f-middle"
}, /*#__PURE__*/React.createElement("div", {
className: "c c-91"
}, /*#__PURE__*/React.createElement("input", {
type: "text",
placeholder: type.placeholder,
className: "text c-100",
ref: function (i) {
return _this.value = i;
},
defaultValue: this.valueValue,
onKeyUp: function (e) {
return _this.valueValue = e.target.value;
}
})), /*#__PURE__*/React.createElement("div", {
className: "c c-9"
}, /*#__PURE__*/React.createElement("div", {
className: "hind h-left",
onClick: this.remove
}, /*#__PURE__*/React.createElement("div", {
className: "h-title"
}, /*#__PURE__*/React.createElement("div", {
className: "icon ic-del-gray pointer db"
})), /*#__PURE__*/React.createElement("div", {
className: "h-body h-auto"
}, "\u0423\u0434\u0430\u043B\u0438\u0442\u044C"))))), /*#__PURE__*/React.createElement("div", {
className: "label l-min"
}, /*#__PURE__*/React.createElement("input", {
type: "text",
placeholder: "\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439",
className: "text c-100",
ref: function (i) {
return _this.comment = i;
},
defaultValue: this.commentValue,
onKeyUp: function (e) {
return _this.commentValue = e.target.value;
}
})))));
}
};
//# sourceMappingURL=contact.js.map