@fullcalendar/resource-common
Advanced tools
Comparing version 5.11.0 to 5.11.2
/*! | ||
FullCalendar Scheduler v5.10.2 | ||
FullCalendar Scheduler v5.11.2 | ||
Docs & License: https://fullcalendar.io/scheduler | ||
(c) 2021 Adam Shaw | ||
(c) 2022 Adam Shaw | ||
*/ | ||
var FullCalendarResourceCommon=function(e,r,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(FullCalendarPremiumCommon),s=function(e,r){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)};function i(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}s(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var u=function(){return(u=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function a(e,r,t){if(t||2===arguments.length)for(var n,o=0,s=r.length;o<s;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||r)}function c(e,r){var t=e.resourceEditable;if(null==t){var n=e.sourceId&&r.getCurrentData().eventSources[e.sourceId];n&&(t=n.extendedProps.resourceEditable),null==t&&null==(t=r.options.eventResourceEditable)&&(t=r.options.editable)}return t}var l=function(){function e(){this.filterResources=r.memoize(d)}return e.prototype.transform=function(e,r){return r.viewSpec.optionDefaults.needsResourceData?{resourceStore:this.filterResources(r.resourceStore,r.options.filterResourcesWithEvents,r.eventStore,r.dateProfile.activeRange),resourceEntityExpansions:r.resourceEntityExpansions}:null},e}();function d(e,t,n,o){if(t){var s=function(e,r){var t={};for(var n in e)for(var o=0,s=r[e[n].defId].resourceIds;o<s.length;o++){t[s[o]]=!0}return t}(function(e,t){return r.filterHash(e,(function(e){return r.rangesIntersect(e.range,t)}))}(n.instances,o),n.defs);return u(s,function(e,r){var t={};for(var n in e)for(var o=void 0;(o=r[n])&&(n=o.parentId);)t[n]=!0;return t}(s,e)),r.filterHash(e,(function(e,r){return s[r]}))}return e}var p=function(){function e(){this.buildResourceEventUis=r.memoize(f,r.isPropsEqual),this.injectResourceEventUis=r.memoize(h)}return e.prototype.transform=function(e,r){return r.viewSpec.optionDefaults.needsResourceData?null:{eventUiBases:this.injectResourceEventUis(e.eventUiBases,e.eventStore.defs,this.buildResourceEventUis(r.resourceStore))}},e}();function f(e){return r.mapHash(e,(function(e){return e.ui}))}function h(e,t,n){return r.mapHash(e,(function(e,o){return o?function(e,t,n){for(var o=[],s=0,i=t.resourceIds;s<i.length;s++){var u=i[s];n[u]&&o.unshift(n[u])}return o.unshift(e),r.combineEventUis(o)}(e,t[o],n):e}))}var v=[];function g(e){v.push(e)}function y(e){return v[e]}function m(){return v}var E={id:String,resources:r.identity,url:String,method:String,startParam:String,endParam:String,timeZoneParam:String,extraParams:r.identity};function R(e){var t;if("string"==typeof e?t={url:e}:"function"==typeof e||Array.isArray(e)?t={resources:e}:"object"==typeof e&&e&&(t=e),t){var n=r.refineProps(t,E),o=n.refined;!function(e){for(var r in e)console.warn("Unknown resource prop '"+r+"'")}(n.extra);var s=function(e){for(var r=m(),t=r.length-1;t>=0;t-=1){var n=r[t].parseMeta(e);if(n)return{meta:n,sourceDefId:t}}return null}(o);if(s)return{_raw:e,sourceId:r.guid(),sourceDefId:s.sourceDefId,meta:s.meta,publicId:o.id||"",isFetching:!1,latestFetchId:"",fetchRange:null}}return null}function S(e,t,n){var o=n.options,s=n.dateProfile;if(!e||!t)return C(o.initialResources||o.resources,s.activeRange,o.refetchResourcesOnNavigate,n);switch(t.type){case"RESET_RESOURCE_SOURCE":return C(t.resourceSourceInput,s.activeRange,o.refetchResourcesOnNavigate,n);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return function(e,t,n,o){if(n&&!function(e){return Boolean(y(e.sourceDefId).ignoreRange)}(e)&&(!e.fetchRange||!r.rangesEqual(e.fetchRange,t)))return b(e,t,o);return e}(e,s.activeRange,o.refetchResourcesOnNavigate,n);case"RECEIVE_RESOURCES":case"RECEIVE_RESOURCE_ERROR":return function(e,r,t){if(r===e.latestFetchId)return u(u({},e),{isFetching:!1,fetchRange:t});return e}(e,t.fetchId,t.fetchRange);case"REFETCH_RESOURCES":return b(e,s.activeRange,n);default:return e}}function C(e,r,t,n){if(e){var o=R(e);return o=b(o,t?r:null,n)}return null}function b(e,t,n){var o=y(e.sourceDefId),s=r.guid();return o.fetch({resourceSource:e,range:t,context:n},(function(e){n.dispatch({type:"RECEIVE_RESOURCES",fetchId:s,fetchRange:t,rawResources:e.rawResources})}),(function(e){n.dispatch({type:"RECEIVE_RESOURCE_ERROR",fetchId:s,fetchRange:t,error:e})})),u(u({},e),{isFetching:!0,latestFetchId:s})}var I="_fc:",D={id:String,parentId:String,children:r.identity,title:String,businessHours:r.identity,extendedProps:r.identity,eventEditable:Boolean,eventStartEditable:Boolean,eventDurationEditable:Boolean,eventConstraint:r.identity,eventOverlap:Boolean,eventAllow:r.identity,eventClassNames:r.parseClassNames,eventBackgroundColor:String,eventBorderColor:String,eventTextColor:String,eventColor:String};function P(e,t,n,o){void 0===t&&(t="");var s=r.refineProps(e,D),i=s.refined,a=s.extra,c={id:i.id||I+r.guid(),parentId:i.parentId||t,title:i.title||"",businessHours:i.businessHours?r.parseBusinessHours(i.businessHours,o):null,ui:r.createEventUi({editable:i.eventEditable,startEditable:i.eventStartEditable,durationEditable:i.eventDurationEditable,constraint:i.eventConstraint,overlap:i.eventOverlap,allow:i.eventAllow,classNames:i.eventClassNames,backgroundColor:i.eventBackgroundColor,borderColor:i.eventBorderColor,textColor:i.eventTextColor,color:i.eventColor},o),extendedProps:u(u({},a),i.extendedProps)};if(Object.freeze(c.ui.classNames),Object.freeze(c.extendedProps),n[c.id]);else if(n[c.id]=c,i.children)for(var l=0,d=i.children;l<d.length;l++){P(d[l],c.id,n,o)}return c}function _(e){return 0===e.indexOf(I)?"":e}function x(e,r,t,n){if(!e||!r)return{};switch(r.type){case"RECEIVE_RESOURCES":return function(e,r,t,n,o){if(n.latestFetchId===t){for(var s={},i=0,u=r;i<u.length;i++){P(u[i],"",s,o)}return s}return e}(e,r.rawResources,r.fetchId,t,n);case"ADD_RESOURCE":return o=e,s=r.resourceHash,u(u({},o),s);case"REMOVE_RESOURCE":return function(e,r){var t=u({},e);for(var n in delete t[r],t)t[n].parentId===r&&(t[n]=u(u({},t[n]),{parentId:""}));return t}(e,r.resourceId);case"SET_RESOURCE_PROP":return function(e,r,t,n){var o,s,i=e[r];if(i)return u(u({},e),((o={})[r]=u(u({},i),((s={})[t]=n,s)),o));return e}(e,r.resourceId,r.propName,r.propValue);case"SET_RESOURCE_EXTENDED_PROP":return function(e,r,t,n){var o,s,i=e[r];if(i)return u(u({},e),((o={})[r]=u(u({},i),{extendedProps:u(u({},i.extendedProps),(s={},s[t]=n,s))}),o));return e}(e,r.resourceId,r.propName,r.propValue);default:return e}var o,s}var O={resourceId:String,resourceIds:r.identity,resourceEditable:Boolean};var w=function(){function e(e,r){this._context=e,this._resource=r}return e.prototype.setProp=function(e,r){var t=this._resource;this._context.dispatch({type:"SET_RESOURCE_PROP",resourceId:t.id,propName:e,propValue:r}),this.sync(t)},e.prototype.setExtendedProp=function(e,r){var t=this._resource;this._context.dispatch({type:"SET_RESOURCE_EXTENDED_PROP",resourceId:t.id,propName:e,propValue:r}),this.sync(t)},e.prototype.sync=function(r){var t=this._context,n=r.id;this._resource=t.getCurrentData().resourceStore[n],t.emitter.trigger("resourceChange",{oldResource:new e(t,r),resource:this,revert:function(){var e;t.dispatch({type:"ADD_RESOURCE",resourceHash:(e={},e[n]=r,e)})}})},e.prototype.remove=function(){var e=this._context,r=this._resource,t=r.id;e.dispatch({type:"REMOVE_RESOURCE",resourceId:t}),e.emitter.trigger("resourceRemove",{resource:this,revert:function(){var n;e.dispatch({type:"ADD_RESOURCE",resourceHash:(n={},n[t]=r,n)})}})},e.prototype.getParent=function(){var r=this._context,t=this._resource.parentId;return t?new e(r,r.getCurrentData().resourceSource[t]):null},e.prototype.getChildren=function(){var r=this._resource.id,t=this._context,n=t.getCurrentData().resourceStore,o=[];for(var s in n)n[s].parentId===r&&o.push(new e(t,n[s]));return o},e.prototype.getEvents=function(){var e=this._resource.id,t=this._context,n=t.getCurrentData().eventStore,o=n.defs,s=n.instances,i=[];for(var u in s){var a=s[u],c=o[a.defId];-1!==c.resourceIds.indexOf(e)&&i.push(new r.EventApi(t,c,a))}return i},Object.defineProperty(e.prototype,"id",{get:function(){return _(this._resource.id)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this._resource.title},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventConstraint",{get:function(){return this._resource.ui.constraints[0]||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventOverlap",{get:function(){return this._resource.ui.overlap},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventAllow",{get:function(){return this._resource.ui.allows[0]||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventBackgroundColor",{get:function(){return this._resource.ui.backgroundColor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventBorderColor",{get:function(){return this._resource.ui.borderColor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventTextColor",{get:function(){return this._resource.ui.textColor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventClassNames",{get:function(){return this._resource.ui.classNames},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extendedProps",{get:function(){return this._resource.extendedProps},enumerable:!1,configurable:!0}),e.prototype.toPlainObject=function(e){void 0===e&&(e={});var r=this._resource,t=r.ui,n=this.id,o={};return n&&(o.id=n),r.title&&(o.title=r.title),e.collapseEventColor&&t.backgroundColor&&t.backgroundColor===t.borderColor?o.eventColor=t.backgroundColor:(t.backgroundColor&&(o.eventBackgroundColor=t.backgroundColor),t.borderColor&&(o.eventBorderColor=t.borderColor)),t.textColor&&(o.eventTextColor=t.textColor),t.classNames.length&&(o.eventClassNames=t.classNames),Object.keys(r.extendedProps).length&&(e.collapseExtendedProps?u(o,r.extendedProps):o.extendedProps=r.extendedProps),o},e.prototype.toJSON=function(){return this.toPlainObject()},e}();r.CalendarApi.prototype.addResource=function(e,r){var t,n=this;void 0===r&&(r=!0);var o,s,i=this.getCurrentData();e instanceof w?((t={})[(s=e._resource).id]=s,o=t):s=P(e,"",o={},i),this.dispatch({type:"ADD_RESOURCE",resourceHash:o}),r&&this.trigger("_scrollRequest",{resourceId:s.id});var u=new w(i,s);return i.emitter.trigger("resourceAdd",{resource:u,revert:function(){n.dispatch({type:"REMOVE_RESOURCE",resourceId:s.id})}}),u},r.CalendarApi.prototype.getResourceById=function(e){e=String(e);var r=this.getCurrentData();if(r.resourceStore){var t=r.resourceStore[e];if(t)return new w(r,t)}return null},r.CalendarApi.prototype.getResources=function(){var e=this.getCurrentData(),r=e.resourceStore,t=[];if(r)for(var n in r)t.push(new w(e,r[n]));return t},r.CalendarApi.prototype.getTopLevelResources=function(){var e=this.getCurrentData(),r=e.resourceStore,t=[];if(r)for(var n in r)r[n].parentId||t.push(new w(e,r[n]));return t},r.CalendarApi.prototype.refetchResources=function(){this.dispatch({type:"REFETCH_RESOURCES"})};var A=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return i(r,e),r.prototype.getKeyInfo=function(e){return u({"":{}},e.resourceStore)},r.prototype.getKeysForDateSpan=function(e){return[e.resourceId||""]},r.prototype.getKeysForEventDef=function(e){var r=e.resourceIds;return r.length?r:[""]},r}(r.Splitter);function T(e,r){return u(u({},r),{constraints:j(e,r.constraints)})}function j(e,r){return r.map((function(r){var t=r.defs;if(t)for(var n in t){var o=t[n].resourceIds;if(o.length&&-1===o.indexOf(e))return!1}return r}))}r.EventApi.prototype.getResources=function(){var e=this._context.calendarApi;return this._def.resourceIds.map((function(r){return e.getResourceById(r)}))},r.EventApi.prototype.setResources=function(e){for(var r=[],t=0,n=e;t<n.length;t++){var o=n[t],s=null;"string"==typeof o?s=o:"number"==typeof o?s=String(o):o instanceof w?s=o.id:console.warn("unknown resource type: "+o),s&&r.push(s)}this.mutate({standardProps:{resourceIds:r}})};var U={resources:function(e,r){r.getCurrentData().resourceSource._raw!==e&&r.dispatch({type:"RESET_RESOURCE_SOURCE",resourceSourceInput:e})}};var B=r.parseFieldSpecs("id,title");var F={initialResources:r.identity,resources:r.identity,eventResourceEditable:Boolean,refetchResourcesOnNavigate:Boolean,resourceOrder:r.parseFieldSpecs,filterResourcesWithEvents:Boolean,resourceGroupField:String,resourceAreaWidth:r.identity,resourceAreaColumns:r.identity,resourcesInitiallyExpanded:Boolean,datesAboveResources:Boolean,needsResourceData:Boolean,resourceAreaHeaderClassNames:r.identity,resourceAreaHeaderContent:r.identity,resourceAreaHeaderDidMount:r.identity,resourceAreaHeaderWillUnmount:r.identity,resourceGroupLabelClassNames:r.identity,resourceGroupLabelContent:r.identity,resourceGroupLabelDidMount:r.identity,resourceGroupLabelWillUnmount:r.identity,resourceLabelClassNames:r.identity,resourceLabelContent:r.identity,resourceLabelDidMount:r.identity,resourceLabelWillUnmount:r.identity,resourceLaneClassNames:r.identity,resourceLaneContent:r.identity,resourceLaneDidMount:r.identity,resourceLaneWillUnmount:r.identity,resourceGroupLaneClassNames:r.identity,resourceGroupLaneContent:r.identity,resourceGroupLaneDidMount:r.identity,resourceGroupLaneWillUnmount:r.identity},N={resourcesSet:r.identity,resourceAdd:r.identity,resourceChange:r.identity,resourceRemove:r.identity};function H(e){return r.createElement(r.ViewContextType.Consumer,null,(function(t){var n=t.options,o={resource:new w(t,e.resource),date:e.date?t.dateEnv.toDate(e.date):null,view:t.viewApi},s={"data-resource-id":e.resource.id,"data-date":e.date?r.formatDayString(e.date):void 0};return r.createElement(r.RenderHook,{hookProps:o,classNames:n.resourceLabelClassNames,content:n.resourceLabelContent,defaultContent:k,didMount:n.resourceLabelDidMount,willUnmount:n.resourceLabelWillUnmount},(function(r,t,n,o){return e.children(r,t,s,n,o)}))}))}function k(e){return e.resource.title||e.resource.id}g({ignoreRange:!0,parseMeta:function(e){return Array.isArray(e.resources)?e.resources:null},fetch:function(e,r){r({rawResources:e.resourceSource.meta})}}),g({parseMeta:function(e){return"function"==typeof e.resources?e.resources:null},fetch:function(e,t,n){var o=e.context.dateEnv,s=e.resourceSource.meta,i=e.range?{start:o.toDate(e.range.start),end:o.toDate(e.range.end),startStr:o.formatIso(e.range.start),endStr:o.formatIso(e.range.end),timeZone:o.timeZone}:{};r.unpromisify(s.bind(null,i),(function(e){t({rawResources:e})}),n)}}),g({parseMeta:function(e){return e.url?{url:e.url,method:(e.method||"GET").toUpperCase(),extraParams:e.extraParams}:null},fetch:function(e,t,n){var o=e.resourceSource.meta,s=function(e,r,t){var n,o,s,i,a=t.dateEnv,c=t.options,l={};r&&(null==(n=e.startParam)&&(n=c.startParam),null==(o=e.endParam)&&(o=c.endParam),null==(s=e.timeZoneParam)&&(s=c.timeZoneParam),l[n]=a.formatIso(r.start),l[o]=a.formatIso(r.end),"local"!==a.timeZone&&(l[s]=a.timeZone));i="function"==typeof e.extraParams?e.extraParams():e.extraParams||{};return u(l,i),l}(o,e.range,e.context);r.requestJson(o.method,o.url,s,(function(e,r){t({rawResources:e,xhr:r})}),(function(e,r){n({message:e,xhr:r})}))}});var M=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.render=function(){var e=this.props;return r.createElement(H,{resource:e.resource,date:e.date},(function(t,n,o,s,i){return r.createElement("th",u({ref:t,role:"columnheader",className:["fc-col-header-cell","fc-resource"].concat(n).join(" "),colSpan:e.colSpan},o),r.createElement("div",{className:"fc-scrollgrid-sync-inner"},r.createElement("span",{className:["fc-col-header-cell-cushion",e.isSticky?"fc-sticky":""].join(" "),ref:s},i)))}))},t}(r.BaseComponent),L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buildDateFormat=r.memoize(V),t}return i(t,e),t.prototype.render=function(){var e=this,t=this.props,n=this.context,o=this.buildDateFormat(n.options.dayHeaderFormat,t.datesRepDistinctDays,t.dates.length);return r.createElement(r.NowTimer,{unit:"day"},(function(r,s){return 1===t.dates.length?e.renderResourceRow(t.resources,t.dates[0]):n.options.datesAboveResources?e.renderDayAndResourceRows(t.dates,o,s,t.resources):e.renderResourceAndDayRows(t.resources,t.dates,o,s)}))},t.prototype.renderResourceRow=function(e,t){var n=e.map((function(e){return r.createElement(M,{key:e.id,resource:e,colSpan:1,date:t})}));return this.buildTr(n,"resources")},t.prototype.renderDayAndResourceRows=function(e,t,n,o){for(var s=[],i=[],u=0,a=e;u<a.length;u++){var c=a[u];s.push(this.renderDateCell(c,t,n,o.length,null,!0));for(var l=0,d=o;l<d.length;l++){var p=d[l];i.push(r.createElement(M,{key:p.id+":"+c.toISOString(),resource:p,colSpan:1,date:c}))}}return r.createElement(r.Fragment,null,this.buildTr(s,"day"),this.buildTr(i,"resources"))},t.prototype.renderResourceAndDayRows=function(e,t,n,o){for(var s=[],i=[],u=0,a=e;u<a.length;u++){var c=a[u];s.push(r.createElement(M,{key:c.id,resource:c,colSpan:t.length,isSticky:!0}));for(var l=0,d=t;l<d.length;l++){var p=d[l];i.push(this.renderDateCell(p,n,o,1,c))}}return r.createElement(r.Fragment,null,this.buildTr(s,"resources"),this.buildTr(i,"day"))},t.prototype.renderDateCell=function(e,t,n,o,s,i){var u=this.props,a=s?":"+s.id:"",c=s?{resource:new w(this.context,s)}:{},l=s?{"data-resource-id":s.id}:{};return u.datesRepDistinctDays?r.createElement(r.TableDateCell,{key:e.toISOString()+a,date:e,dateProfile:u.dateProfile,todayRange:n,colCnt:u.dates.length*u.resources.length,dayHeaderFormat:t,colSpan:o,isSticky:i,extraHookProps:c,extraDataAttrs:l}):r.createElement(r.TableDowCell,{key:e.getUTCDay()+a,dow:e.getUTCDay(),dayHeaderFormat:t,colSpan:o,isSticky:i,extraHookProps:c,extraDataAttrs:l})},t.prototype.buildTr=function(e,t){var n=this.props.renderIntro;return e.length||(e=[r.createElement("td",{key:0}," ")]),r.createElement("tr",{key:t,role:"row"},n&&n(t),e)},t}(r.BaseComponent);function V(e,t,n){return e||r.computeFallbackHeaderFormat(t,n)}var z=function(e){for(var r={},t=[],n=0;n<e.length;n+=1){var o=e[n].id;t.push(o),r[o]=n}this.ids=t,this.indicesById=r,this.length=e.length},G=function(){function e(e,r,t){this.dayTableModel=e,this.resources=r,this.context=t,this.resourceIndex=new z(r),this.rowCnt=e.rowCnt,this.colCnt=e.colCnt*r.length,this.cells=this.buildCells()}return e.prototype.buildCells=function(){for(var e=this,r=e.rowCnt,t=e.dayTableModel,n=e.resources,o=[],s=0;s<r;s+=1){for(var i=[],u=0;u<t.colCnt;u+=1)for(var a=0;a<n.length;a+=1){var c=n[a],l={resource:new w(this.context,c)},d={"data-resource-id":c.id},p={resourceId:c.id},f=t.cells[s][u].date;i[this.computeCol(u,a)]={key:c.id+":"+f.toISOString(),date:f,extraHookProps:l,extraDataAttrs:d,extraClassNames:["fc-resource"],extraDateSpan:p}}o.push(i)}return o},e}(),W=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return i(r,e),r.prototype.computeCol=function(e,r){return r*this.dayTableModel.colCnt+e},r.prototype.computeColRanges=function(e,r,t){return[{firstCol:this.computeCol(e,t),lastCol:this.computeCol(r,t),isStart:!0,isEnd:!0}]},r}(G),Z=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return i(r,e),r.prototype.computeCol=function(e,r){return e*this.resources.length+r},r.prototype.computeColRanges=function(e,r,t){for(var n=[],o=e;o<=r;o+=1){var s=this.computeCol(o,t);n.push({firstCol:s,lastCol:s,isStart:o===e,isEnd:o===r})}return n},r}(G),K=[],q=function(){function e(){this.joinDateSelection=r.memoize(this.joinSegs),this.joinBusinessHours=r.memoize(this.joinSegs),this.joinFgEvents=r.memoize(this.joinSegs),this.joinBgEvents=r.memoize(this.joinSegs),this.joinEventDrags=r.memoize(this.joinInteractions),this.joinEventResizes=r.memoize(this.joinInteractions)}return e.prototype.joinProps=function(e,r){for(var t=[],n=[],o=[],s=[],i=[],u=[],c="",l=0,d=r.resourceIndex.ids.concat([""]);l<d.length;l++){var p=d[l],f=e[p];t.push(f.dateSelectionSegs),n.push(p?f.businessHourSegs:K),o.push(p?f.fgEventSegs:K),s.push(f.bgEventSegs),i.push(f.eventDrag),u.push(f.eventResize),c=c||f.eventSelection}return{dateSelectionSegs:this.joinDateSelection.apply(this,a([r],t)),businessHourSegs:this.joinBusinessHours.apply(this,a([r],n)),fgEventSegs:this.joinFgEvents.apply(this,a([r],o)),bgEventSegs:this.joinBgEvents.apply(this,a([r],s)),eventDrag:this.joinEventDrags.apply(this,a([r],i)),eventResize:this.joinEventResizes.apply(this,a([r],u)),eventSelection:c}},e.prototype.joinSegs=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];for(var n=e.resources.length,o=[],s=0;s<n;s+=1){for(var i=0,u=r[s];i<u.length;i++){var a=u[i];o.push.apply(o,this.transformSeg(a,e,s))}for(var c=0,l=r[n];c<l.length;c++){a=l[c];o.push.apply(o,this.transformSeg(a,e,s))}}return o},e.prototype.expandSegs=function(e,r){for(var t=e.resources.length,n=[],o=0;o<t;o+=1)for(var s=0,i=r;s<i.length;s++){var u=i[s];n.push.apply(n,this.transformSeg(u,e,o))}return n},e.prototype.joinInteractions=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];for(var n=e.resources.length,o={},s=[],i=!1,a=!1,c=0;c<n;c+=1){var l=r[c];if(l){i=!0;for(var d=0,p=l.segs;d<p.length;d++){var f=p[d];s.push.apply(s,this.transformSeg(f,e,c))}u(o,l.affectedInstances),a=a||l.isEvent}if(r[n])for(var h=0,v=r[n].segs;h<v.length;h++){f=v[h];s.push.apply(s,this.transformSeg(f,e,c))}}return i?{affectedInstances:o,segs:s,isEvent:a}:null},e}(),X=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.getKeyInfo=function(e){var t=e.resourceDayTableModel,n=r.mapHash(t.resourceIndex.indicesById,(function(e){return t.resources[e]}));return n[""]={},n},t.prototype.getKeysForDateSpan=function(e){return[e.resourceId||""]},t.prototype.getKeysForEventDef=function(e){var r=e.resourceIds;return r.length?r:[""]},t}(r.Splitter);function J(e,r,t,n,o,s){var i=[];return Y(function(e,r,t,n){var o=function(e,r){var t={};for(var n in e){var o=e[n];t[n]={resource:o,resourceFields:ee(o),children:[]}}for(var n in e){if((o=e[n]).parentId){var s=t[o.parentId];s&&$(t[n],s.children,r)}}return t}(e,n),s=[];for(var i in o){var u=o[i];u.resource.parentId||Q(u,s,t,0,r,n)}return s}(e,n?-1:1,r,t),i,n,[],0,o,s),i}function Y(e,r,t,n,o,s,i){for(var u=0;u<e.length;u+=1){var a=e[u],c=a.group;if(c)if(t){var l=r.length,d=n.length;if(Y(a.children,r,t,n.concat(0),o,s,i),l<r.length){var p=r[l];(p.rowSpans=p.rowSpans.slice())[d]=r.length-l}}else{var f=null!=s[h=c.spec.field+":"+c.value]?s[h]:i;r.push({id:h,group:c,isExpanded:f}),f&&Y(a.children,r,t,n,o+1,s,i)}else if(a.resource){var h;f=null!=s[h=a.resource.id]?s[h]:i;r.push({id:h,rowSpans:n,depth:o,isExpanded:f,hasChildren:Boolean(a.children.length),resource:a.resource,resourceFields:a.resourceFields}),f&&Y(a.children,r,t,n,o+1,s,i)}}}function Q(e,t,n,o,s,i){n.length&&(-1===s||o<=s)?Q(e,function(e,t,n){var o,s,i=e.resourceFields[n.field];if(n.order)for(s=0;s<t.length;s+=1){if((a=t[s]).group){var u=r.flexibleCompare(i,a.group.value)*n.order;if(0===u){o=a;break}if(u<0)break}}else for(s=0;s<t.length;s+=1){var a;if((a=t[s]).group&&i===a.group.value){o=a;break}}o||(o={group:{value:i,spec:n},children:[]},t.splice(s,0,o));return o}(e,t,n[0]).children,n.slice(1),o+1,s,i):$(e,t,i)}function $(e,t,n){var o;for(o=0;o<t.length;o+=1){if(r.compareByFieldSpecs(t[o].resourceFields,e.resourceFields,n)>0)break}t.splice(o,0,e)}function ee(e){var r=u(u(u({},e.extendedProps),e.ui),e);return delete r.ui,delete r.extendedProps,r}var re=r.createPlugin({deps:[o.default],reducers:[function(e,r,t){var n=S(e&&e.resourceSource,r,t);return{resourceSource:n,resourceStore:x(e&&e.resourceStore,r,n,t),resourceEntityExpansions:function(e,r){var t;if(!e||!r)return{};switch(r.type){case"SET_RESOURCE_ENTITY_EXPANDED":return u(u({},e),((t={})[r.id]=r.isExpanded,t));default:return e}}(e&&e.resourceEntityExpansions,r)}}],isLoadingFuncs:[function(e){return e.resourceSource&&e.resourceSource.isFetching}],eventRefiners:O,eventDefMemberAdders:[function(e){return{resourceIds:(r=e.resourceIds,(r||[]).map((function(e){return String(e)}))).concat(e.resourceId?[e.resourceId]:[]),resourceEditable:e.resourceEditable};var r}],isDraggableTransformers:[function(e,r,t,n){if(!e){var o=n.getCurrentData();if(o.viewSpecs[o.currentViewType].optionDefaults.needsResourceData&&c(r,n))return!0}return e}],eventDragMutationMassagers:[function(e,r,t){var n=r.dateSpan.resourceId,o=t.dateSpan.resourceId;n&&o&&n!==o&&(e.resourceMutation={matchResourceId:n,setResourceId:o})}],eventDefMutationAppliers:[function(e,r,t){var n=r.resourceMutation;if(n&&c(e,t)){var o=e.resourceIds.indexOf(n.matchResourceId);if(-1!==o){var s=e.resourceIds.slice();s.splice(o,1),-1===s.indexOf(n.setResourceId)&&s.push(n.setResourceId),e.resourceIds=s}}}],dateSelectionTransformers:[function(e,r){var t=e.dateSpan.resourceId,n=r.dateSpan.resourceId;return t&&n?{resourceId:t}:null}],datePointTransforms:[function(e,r){return e.resourceId?{resource:r.calendarApi.getResourceById(e.resourceId)}:{}}],dateSpanTransforms:[function(e,r){return e.resourceId?{resource:r.calendarApi.getResourceById(e.resourceId)}:{}}],viewPropsTransformers:[l,p],isPropsValid:function(e,t){var n=(new A).splitProps(u(u({},e),{resourceStore:t.getCurrentData().resourceStore}));for(var o in n){var s=n[o];if(o&&n[""]&&(s=u(u({},s),{eventStore:r.mergeEventStores(n[""].eventStore,s.eventStore),eventUiBases:u(u({},n[""].eventUiBases),s.eventUiBases)})),!r.isPropsValid(s,t,{resourceId:o},T.bind(null,o)))return!1}return!0},externalDefTransforms:[function(e){return e.resourceId?{resourceId:e.resourceId}:{}}],eventDropTransformers:[function(e,r){var t=e.resourceMutation;if(t){var n=r.calendarApi;return{oldResource:n.getResourceById(t.matchResourceId),newResource:n.getResourceById(t.setResourceId)}}return{oldResource:null,newResource:null}}],optionChangeHandlers:U,optionRefiners:F,listenerRefiners:N,propSetHandlers:{resourceStore:function(e,r){var t=r.emitter;t.hasHandlers("resourcesSet")&&t.trigger("resourcesSet",function(e,r){var t=[];for(var n in e)t.push(new w(r,e[n]));return t}(e,r))}}});return r.globalPlugins.push(re),e.AbstractResourceDayTableModel=G,e.DEFAULT_RESOURCE_ORDER=B,e.DayResourceTableModel=Z,e.ResourceApi=w,e.ResourceDayHeader=L,e.ResourceDayTableModel=W,e.ResourceLabelRoot=H,e.ResourceSplitter=A,e.VResourceJoiner=q,e.VResourceSplitter=X,e.buildResourceFields=ee,e.buildRowNodes=J,e.default=re,e.flattenResources=function(e,r){return J(e,[],r,!1,{},!0).map((function(e){return e.resource}))},e.getPublicId=_,e.isGroupsEqual=function(e,r){return e.spec===r.spec&&e.value===r.value},Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar); |
{ | ||
"name": "@fullcalendar/resource-common", | ||
"version": "5.11.0", | ||
"version": "5.11.2", | ||
"title": "FullCalendar Resources Common Plugin", | ||
@@ -8,4 +8,4 @@ "description": "Offers base support for resources. Required for all resource-related plugins.", | ||
"dependencies": { | ||
"@fullcalendar/common": "~5.11.0", | ||
"@fullcalendar/premium-common": "~5.11.0", | ||
"@fullcalendar/common": "~5.11.2", | ||
"@fullcalendar/premium-common": "~5.11.2", | ||
"tslib": "^2.1.0" | ||
@@ -32,4 +32,4 @@ }, | ||
"devDependencies": { | ||
"@fullcalendar/core-preact": "5.11.0" | ||
"@fullcalendar/core-preact": "5.11.2" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package