moose-remote-components
Version:
Figuring out how to export components onto npm, to be used in other projects
109 lines (79 loc) • 9.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = _interopRequireWildcard(require("react"));
var _WeekView = _interopRequireDefault(require("./WeekView"));
var _dateFns = _interopRequireDefault(require("date-fns"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
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); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Calendar =
/*#__PURE__*/
function (_Component) {
_inherits(Calendar, _Component);
function Calendar() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, Calendar);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Calendar)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "state", {
currentMonth: new Date()
});
_defineProperty(_assertThisInitialized(_this), "movePrevWeek", function () {
_this.setState({
currentMonth: _dateFns["default"].subWeeks(_this.state.currentMonth, 1)
});
});
_defineProperty(_assertThisInitialized(_this), "moveNextWeek", function () {
_this.setState({
currentMonth: _dateFns["default"].addWeeks(_this.state.currentMonth, 1)
});
});
_defineProperty(_assertThisInitialized(_this), "genView", function () {
if (_this.props.view === "day") {
return null;
} else if (_this.props.view === "week") {
return _react["default"].createElement(_WeekView["default"], {
employee_view: _this.props.employee_view,
editable: _this.props.editable,
currentMonth: _this.state.currentMonth,
movePrevWeek: _this.movePrevWeek,
moveNextWeek: _this.moveNextWeek,
interval: 15,
availability: _this.props.availability,
appointments: _this.props.appointments,
serviceLength: _this.props.serviceLength,
setAppointment: _this.props.setAppointment,
showAppointment: _this.props.showAppointment
});
}
});
return _this;
}
_createClass(Calendar, [{
key: "render",
value: function render() {
return _react["default"].createElement("div", {
className: "calendar-wrapper"
}, this.genView());
}
}]);
return Calendar;
}(_react.Component);
var _default = Calendar;
exports["default"] = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL0NhbGVuZGFyL0NhbGVuZGFyLmpzIl0sIm5hbWVzIjpbIkNhbGVuZGFyIiwiY3VycmVudE1vbnRoIiwiRGF0ZSIsInNldFN0YXRlIiwiZGF0ZUZucyIsInN1YldlZWtzIiwic3RhdGUiLCJhZGRXZWVrcyIsInByb3BzIiwidmlldyIsImVtcGxveWVlX3ZpZXciLCJlZGl0YWJsZSIsIm1vdmVQcmV2V2VlayIsIm1vdmVOZXh0V2VlayIsImF2YWlsYWJpbGl0eSIsImFwcG9pbnRtZW50cyIsInNlcnZpY2VMZW5ndGgiLCJzZXRBcHBvaW50bWVudCIsInNob3dBcHBvaW50bWVudCIsImdlblZpZXciLCJDb21wb25lbnQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7QUFDQTs7QUFDQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7SUFFTUEsUTs7Ozs7Ozs7Ozs7Ozs7Ozs7OzREQUVHO0FBQ1BDLE1BQUFBLFlBQVksRUFBRSxJQUFJQyxJQUFKO0FBRFAsSzs7bUVBSU8sWUFBTTtBQUNwQixZQUFLQyxRQUFMLENBQWM7QUFBRUYsUUFBQUEsWUFBWSxFQUFFRyxvQkFBUUMsUUFBUixDQUFpQixNQUFLQyxLQUFMLENBQVdMLFlBQTVCLEVBQTBDLENBQTFDO0FBQWhCLE9BQWQ7QUFDQSxLOzttRUFDYyxZQUFNO0FBQ3BCLFlBQUtFLFFBQUwsQ0FBYztBQUFFRixRQUFBQSxZQUFZLEVBQUVHLG9CQUFRRyxRQUFSLENBQWlCLE1BQUtELEtBQUws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