2 lines
3.3 KiB
JavaScript
2 lines
3.3 KiB
JavaScript
import e,{Component as t}from"react";import{ObjectUtils as n}from"primereact/utils";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var f,y,d,h=function(i){c(v,t);var a,l,f,y,d,h=(a=v,l=p(),function(){var e,t=u(a);if(l){var n=u(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return s(this,e)});function v(){return r(this,v),h.apply(this,arguments)}return f=v,(y=[{key:"componentDidMount",value:function(){if(console.warn("FullCalendar component is deprecated. Use FullCalendar component of '@fullcalendar/react' package."),this.config={theme:!0},this.props.options)for(var e in this.props.options)this.config[e]=this.props.options[e];this.initialize()}},{key:"componentDidUpdate",value:function(e){if(this.calendar){if(n.equals(e.events,this.props.events)||(this.calendar.removeAllEventSources(),this.calendar.addEventSource(this.props.events)),!n.equals(e.options,this.props.options))for(var t in this.props.options){var r=this.props.options[t];this.config[t]=r,this.calendar.setOption(t,r)}}else this.initialize()}},{key:"initialize",value:function(){var e=this;import("@fullcalendar/core").then((function(t){t&&t.Calendar&&(e.calendar=new t.Calendar(e.element,e.config),e.calendar.render(),e.props.events&&(e.calendar.removeAllEventSources(),e.calendar.addEventSource(e.props.events)))}))}},{key:"componentWillUnmount",value:function(){this.calendar&&this.calendar.destroy()}},{key:"render",value:function(){var t=this;return e.createElement("div",{id:this.props.id,ref:function(e){return t.element=e},style:this.props.style,className:this.props.className})}}])&&o(f.prototype,y),d&&o(f,d),Object.defineProperty(f,"prototype",{writable:!1}),v}();d={id:null,events:[],style:null,className:null,options:null},(y="defaultProps")in(f=h)?Object.defineProperty(f,y,{value:d,enumerable:!0,configurable:!0,writable:!0}):f[y]=d;export{h as FullCalendar};
|