AddressBox.js 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _react = _interopRequireDefault(require("react"));
  7. var _modularityFront = _interopRequireDefault(require("modularity-front"));
  8. var _reactMaterialize = require("react-materialize");
  9. require("./AddressBox.css");
  10. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  12. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  14. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  15. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  16. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  17. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  18. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  20. var Module = _modularityFront.default.Module;
  21. var AddressBox =
  22. /*#__PURE__*/
  23. function (_Modularity$Module) {
  24. _inherits(AddressBox, _Modularity$Module);
  25. function AddressBox(props) {
  26. _classCallCheck(this, AddressBox);
  27. return _possibleConstructorReturn(this, _getPrototypeOf(AddressBox).call(this, props));
  28. }
  29. _createClass(AddressBox, [{
  30. key: "render",
  31. value: function render() {
  32. var _this = this;
  33. var address = this.Address.value;
  34. return _react.default.createElement(_reactMaterialize.Collection, {
  35. header: _react.default.createElement("div", null, _react.default.createElement("div", {
  36. className: "AddressName"
  37. }, address.name), _react.default.createElement("div", {
  38. className: "icons"
  39. }, this.props.onEdit && _react.default.createElement("i", {
  40. className: "fa fa-edit",
  41. onClick: function onClick(e) {
  42. return _this.props.onEdit && e.stopPropagation() || _this.props.onEdit(_this.Address.value);
  43. }
  44. }), this.props.onDelete && _react.default.createElement("i", {
  45. className: "fa fa-trash",
  46. onClick: function onClick(e) {
  47. return _this.props.onDelete && e.stopPropagation() || _this.props.onDelete(_this.Address.value);
  48. }
  49. }))),
  50. className: "AddressBox " + (this.Selected.value ? 'selected' : ''),
  51. onClick: function onClick() {
  52. return _this.onSelect.set(address);
  53. }
  54. }, _react.default.createElement(_reactMaterialize.CollectionItem, null, address.address), _react.default.createElement(_reactMaterialize.CollectionItem, null, address.postalcode), _react.default.createElement(_reactMaterialize.CollectionItem, null, address.city, " "), _react.default.createElement(_reactMaterialize.CollectionItem, null, address.state));
  55. }
  56. }]);
  57. return AddressBox;
  58. }(_modularityFront.default.Module);
  59. AddressBox.Inputs = {
  60. Address: {
  61. type: Module.Types.Object
  62. },
  63. Selected: {
  64. type: Module.Types.Boolean
  65. }
  66. };
  67. AddressBox.Outputs = {
  68. onSelect: {}
  69. };
  70. AddressBox.Category = "Nikatlas";
  71. var _default = AddressBox;
  72. exports.default = _default;