@fullcalendar/resource-timegrid 6.1.15 → 7.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +5 -4
- package/index.global.js +110 -47
- package/index.global.min.js +2 -2
- package/index.js +6 -5
- package/internal.cjs +108 -44
- package/internal.d.ts +24 -40
- package/internal.js +110 -45
- package/package.json +7 -6
package/index.cjs
CHANGED
|
@@ -9,9 +9,10 @@ var timeGridPlugin = require('@fullcalendar/timegrid/index.cjs');
|
|
|
9
9
|
var internalCommon = require('./internal.cjs');
|
|
10
10
|
require('@fullcalendar/core/internal.cjs');
|
|
11
11
|
require('@fullcalendar/core/preact.cjs');
|
|
12
|
-
require('@fullcalendar/
|
|
13
|
-
require('@fullcalendar/resource/internal.cjs');
|
|
12
|
+
require('@fullcalendar/daygrid/internal.cjs');
|
|
14
13
|
require('@fullcalendar/resource-daygrid/internal.cjs');
|
|
14
|
+
require('@fullcalendar/resource/internal.cjs');
|
|
15
|
+
require('@fullcalendar/timegrid/internal.cjs');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
18
|
|
|
@@ -21,7 +22,7 @@ var timeGridPlugin__default = /*#__PURE__*/_interopDefaultLegacy(timeGridPlugin)
|
|
|
21
22
|
|
|
22
23
|
var index = index_cjs.createPlugin({
|
|
23
24
|
name: '@fullcalendar/resource-timegrid',
|
|
24
|
-
premiumReleaseDate: '2024-
|
|
25
|
+
premiumReleaseDate: '2024-10-01',
|
|
25
26
|
deps: [
|
|
26
27
|
premiumCommonPlugin__default["default"],
|
|
27
28
|
resourcePlugin__default["default"],
|
|
@@ -31,7 +32,7 @@ var index = index_cjs.createPlugin({
|
|
|
31
32
|
views: {
|
|
32
33
|
resourceTimeGrid: {
|
|
33
34
|
type: 'timeGrid',
|
|
34
|
-
component: internalCommon.
|
|
35
|
+
component: internalCommon.ResourceTimeGridView,
|
|
35
36
|
needsResourceData: true,
|
|
36
37
|
},
|
|
37
38
|
resourceTimeGridDay: {
|
package/index.global.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar Resource Time Grid Plugin
|
|
2
|
+
FullCalendar Resource Time Grid Plugin v7.0.0-beta.0
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/vertical-resource-view
|
|
4
4
|
(c) 2024 Adam Shaw
|
|
5
5
|
*/
|
|
6
|
-
FullCalendar.ResourceTimeGrid = (function (exports, core, premiumCommonPlugin, resourcePlugin, timeGridPlugin, internal$2, preact, internal$
|
|
6
|
+
FullCalendar.ResourceTimeGrid = (function (exports, core, premiumCommonPlugin, resourcePlugin, timeGridPlugin, internal$2, preact, internal$5, internal$4, internal$1, internal$3) {
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -20,65 +20,129 @@ FullCalendar.ResourceTimeGrid = (function (exports, core, premiumCommonPlugin, r
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
class
|
|
23
|
+
class ResourceTimeGridView extends internal$2.DateComponent {
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments);
|
|
26
|
+
this.flattenResources = internal$2.memoize(internal$1.flattenResources);
|
|
27
|
+
this.buildResourceTimeColsModel = internal$2.memoize(buildResourceTimeColsModel);
|
|
28
|
+
this.allDaySplitter = new internal$3.AllDaySplitter();
|
|
29
|
+
// for all-day-resource props
|
|
30
|
+
this.allDayResourceSplitter = new internal$1.VResourceSplitter();
|
|
31
|
+
this.allDayResourceSlicers = {};
|
|
32
|
+
this.allDayResourceJoiner = new internal$4.ResourceDayTableJoiner();
|
|
33
|
+
// for timed resource props
|
|
26
34
|
this.buildDayRanges = internal$2.memoize(internal$3.buildDayRanges);
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
|
|
35
|
+
this.timedResourceSplitter = new internal$1.VResourceSplitter();
|
|
36
|
+
this.timedResourceSlicers = {};
|
|
37
|
+
this.timedResourceJoiner = new ResourceDayTimeColsJoiner();
|
|
38
|
+
// timed-only column splitting
|
|
39
|
+
this.splitFgEventSegs = internal$2.memoize(internal$3.splitSegsByCol);
|
|
40
|
+
this.splitBgEventSegs = internal$2.memoize(internal$3.splitSegsByCol);
|
|
41
|
+
this.splitBusinessHourSegs = internal$2.memoize(internal$3.splitSegsByCol);
|
|
42
|
+
this.splitNowIndicatorSegs = internal$2.memoize(internal$3.splitSegsByCol);
|
|
43
|
+
this.splitDateSelectionSegs = internal$2.memoize(internal$3.splitSegsByCol);
|
|
44
|
+
this.splitEventDrag = internal$2.memoize(internal$3.splitInteractionByCol);
|
|
45
|
+
this.splitEventResize = internal$2.memoize(internal$3.splitInteractionByCol);
|
|
46
|
+
// other memo
|
|
47
|
+
this.createDayHeaderFormatter = internal$2.memoize(internal$5.createDayHeaderFormatter);
|
|
31
48
|
this.isHitComboAllowed = (hit0, hit1) => {
|
|
32
49
|
let allowAcrossResources = this.dayRanges.length === 1;
|
|
33
50
|
return allowAcrossResources || hit0.dateSpan.resourceId === hit1.dateSpan.resourceId;
|
|
34
51
|
};
|
|
35
52
|
}
|
|
36
|
-
render() {
|
|
37
|
-
let { props, context } = this;
|
|
38
|
-
let { dateEnv, options } = context;
|
|
39
|
-
let { dateProfile, resourceDayTableModel } = props;
|
|
40
|
-
let dayRanges = this.dayRanges = this.buildDayRanges(resourceDayTableModel.dayTableModel, dateProfile, dateEnv);
|
|
41
|
-
let splitProps = this.splitter.splitProps(props);
|
|
42
|
-
this.slicers = internal$2.mapHash(splitProps, (split, resourceId) => this.slicers[resourceId] || new internal$3.DayTimeColsSlicer());
|
|
43
|
-
let slicedProps = internal$2.mapHash(this.slicers, (slicer, resourceId) => slicer.sliceProps(splitProps[resourceId], dateProfile, null, context, dayRanges));
|
|
44
|
-
return ( // TODO: would move this further down hierarchy, but sliceNowDate needs it
|
|
45
|
-
preact.createElement(internal$2.NowTimer, { unit: options.nowIndicator ? 'minute' : 'day' }, (nowDate, todayRange) => (preact.createElement(internal$3.TimeCols, Object.assign({ ref: this.timeColsRef }, this.joiner.joinProps(slicedProps, resourceDayTableModel), { dateProfile: dateProfile, axis: props.axis, slotDuration: props.slotDuration, slatMetas: props.slatMetas, cells: resourceDayTableModel.cells[0], tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, clientWidth: props.clientWidth, clientHeight: props.clientHeight, expandRows: props.expandRows, nowDate: nowDate, nowIndicatorSegs: options.nowIndicator && this.buildNowIndicatorSegs(nowDate), todayRange: todayRange, onScrollTopRequest: props.onScrollTopRequest, forPrint: props.forPrint, onSlatCoords: props.onSlatCoords, isHitComboAllowed: this.isHitComboAllowed })))));
|
|
46
|
-
}
|
|
47
|
-
buildNowIndicatorSegs(date) {
|
|
48
|
-
let nonResourceSegs = this.slicers[''].sliceNowDate(date, this.props.dateProfile, this.context.options.nextDayThreshold, this.context, this.dayRanges);
|
|
49
|
-
return this.joiner.expandSegs(this.props.resourceDayTableModel, nonResourceSegs);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
class ResourceDayTimeColsView extends internal$3.TimeColsView {
|
|
54
|
-
constructor() {
|
|
55
|
-
super(...arguments);
|
|
56
|
-
this.flattenResources = internal$2.memoize(internal$1.flattenResources);
|
|
57
|
-
this.buildResourceTimeColsModel = internal$2.memoize(buildResourceTimeColsModel);
|
|
58
|
-
this.buildSlatMetas = internal$2.memoize(internal$3.buildSlatMetas);
|
|
59
|
-
}
|
|
60
53
|
render() {
|
|
61
54
|
let { props, context } = this;
|
|
62
55
|
let { options, dateEnv } = context;
|
|
63
56
|
let { dateProfile } = props;
|
|
64
|
-
let splitProps = this.allDaySplitter.splitProps(props);
|
|
65
57
|
let resourceOrderSpecs = options.resourceOrder || internal$1.DEFAULT_RESOURCE_ORDER;
|
|
66
58
|
let resources = this.flattenResources(props.resourceStore, resourceOrderSpecs);
|
|
67
59
|
let resourceDayTableModel = this.buildResourceTimeColsModel(dateProfile, context.dateProfileGenerator, resources, options.datesAboveResources, context);
|
|
68
|
-
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
:
|
|
60
|
+
// split seg by all-day/timed
|
|
61
|
+
let splitProps = this.allDaySplitter.splitProps(props);
|
|
62
|
+
// split the all-day segs by resource
|
|
63
|
+
let allDayResourceSplitProps = this.allDayResourceSplitter.splitProps({
|
|
64
|
+
businessHours: splitProps.allDay.businessHours,
|
|
65
|
+
dateSelection: splitProps.allDay.dateSelection,
|
|
66
|
+
eventStore: splitProps.allDay.eventStore,
|
|
67
|
+
eventUiBases: splitProps.allDay.eventUiBases,
|
|
68
|
+
eventSelection: splitProps.allDay.eventSelection,
|
|
69
|
+
eventDrag: splitProps.allDay.eventDrag,
|
|
70
|
+
eventResize: splitProps.allDay.eventResize,
|
|
71
|
+
resourceDayTableModel,
|
|
72
|
+
});
|
|
73
|
+
this.allDayResourceSlicers = internal$2.mapHash(allDayResourceSplitProps, (split, resourceId) => this.allDayResourceSlicers[resourceId] || new internal$5.DayTableSlicer());
|
|
74
|
+
let allDayResourceSlicedProps = internal$2.mapHash(this.allDayResourceSlicers, (slicer, resourceId) => slicer.sliceProps(allDayResourceSplitProps[resourceId], dateProfile, options.nextDayThreshold, context, resourceDayTableModel.dayTableModel));
|
|
75
|
+
let allDayResourceJoinedProps = this.allDayResourceJoiner.joinProps(allDayResourceSlicedProps, resourceDayTableModel);
|
|
76
|
+
// split the timed segs by resource
|
|
77
|
+
let dayRanges = this.dayRanges = this.buildDayRanges(resourceDayTableModel.dayTableModel, dateProfile, dateEnv);
|
|
78
|
+
let timedResourceSplitProps = this.timedResourceSplitter.splitProps({
|
|
79
|
+
businessHours: splitProps.timed.businessHours,
|
|
80
|
+
dateSelection: splitProps.timed.dateSelection,
|
|
81
|
+
eventStore: splitProps.timed.eventStore,
|
|
82
|
+
eventUiBases: splitProps.timed.eventUiBases,
|
|
83
|
+
eventSelection: splitProps.timed.eventSelection,
|
|
84
|
+
eventDrag: splitProps.timed.eventDrag,
|
|
85
|
+
eventResize: splitProps.timed.eventResize,
|
|
86
|
+
resourceDayTableModel,
|
|
87
|
+
});
|
|
88
|
+
this.timedResourceSlicers = internal$2.mapHash(timedResourceSplitProps, (split, resourceId) => this.timedResourceSlicers[resourceId] || new internal$3.DayTimeColsSlicer());
|
|
89
|
+
let timedResourceSlicedProps = internal$2.mapHash(this.timedResourceSlicers, (slicer, resourceId) => slicer.sliceProps(timedResourceSplitProps[resourceId], dateProfile, null, context, dayRanges));
|
|
90
|
+
let timedResourceJoinedProps = this.timedResourceJoiner.joinProps(timedResourceSlicedProps, resourceDayTableModel);
|
|
91
|
+
let datesRepDistinctDays = resourceDayTableModel.dayTableModel.rowCnt === 1;
|
|
92
|
+
let headerTiers = internal$4.buildResourceHeaderTiers(// TODO: memoize
|
|
93
|
+
resources, resourceDayTableModel.dayTableModel.headerDates, options.datesAboveResources, datesRepDistinctDays, context);
|
|
94
|
+
let dayHeaderFormat = this.createDayHeaderFormatter(context.options.dayHeaderFormat, datesRepDistinctDays, resourceDayTableModel.colCnt);
|
|
95
|
+
return (preact.createElement(internal$2.NowTimer, { unit: options.nowIndicator ? 'minute' : 'day' /* hacky */ }, (nowDate, todayRange) => {
|
|
96
|
+
// timed-only column splitting
|
|
97
|
+
let colCnt = resourceDayTableModel.colCnt;
|
|
98
|
+
let fgEventSegsByCol = this.splitFgEventSegs(timedResourceJoinedProps.fgEventSegs, colCnt);
|
|
99
|
+
let bgEventSegsByCol = this.splitBgEventSegs(timedResourceJoinedProps.bgEventSegs, colCnt);
|
|
100
|
+
let businessHourSegsByCol = this.splitBusinessHourSegs(timedResourceJoinedProps.businessHourSegs, colCnt);
|
|
101
|
+
let nowIndicatorSegsByCol = this.splitNowIndicatorSegs((() => {
|
|
102
|
+
// was buildNowIndicatorSegs
|
|
103
|
+
let nonResourceSegs = this.timedResourceSlicers[''].sliceNowDate(nowDate, this.props.dateProfile, this.context.options.nextDayThreshold, this.context, this.dayRanges);
|
|
104
|
+
return this.timedResourceJoiner.expandSegs(resourceDayTableModel, nonResourceSegs);
|
|
105
|
+
})(), colCnt);
|
|
106
|
+
let dateSelectionSegsByCol = this.splitDateSelectionSegs(timedResourceJoinedProps.dateSelectionSegs, colCnt);
|
|
107
|
+
let eventDragByCol = this.splitEventDrag(timedResourceJoinedProps.eventDrag, colCnt);
|
|
108
|
+
let eventResizeByCol = this.splitEventResize(timedResourceJoinedProps.eventResize, colCnt);
|
|
109
|
+
return (preact.createElement(internal$3.TimeGridLayout, { dateProfile: dateProfile, nowDate: nowDate, todayRange: todayRange, cells: resourceDayTableModel.cells[0], forPrint: props.forPrint, isHitComboAllowed: this.isHitComboAllowed, className: 'fc-resource-timegrid-view',
|
|
110
|
+
// header content
|
|
111
|
+
headerTiers: headerTiers, renderHeaderLabel: (tierNum, innerWidthRef, innerHeightRef, width) => ((options.weekNumbers && tierNum === headerTiers.length - 1) ? (preact.createElement(internal$3.TimeGridWeekNumber // .fc-cell
|
|
112
|
+
, { dateProfile: dateProfile, innerWidthRef: innerWidthRef, innerHeightRef: innerHeightRef, width: width })) : (preact.createElement("div", { className: 'fc-cell', style: { width } }))),
|
|
113
|
+
// TODO: DRY
|
|
114
|
+
renderHeaderContent: (model, tierNum, innerHeightRef, colWidth) => {
|
|
115
|
+
if (model.resource) {
|
|
116
|
+
return (preact.createElement(internal$4.ResourceHeaderCell, Object.assign({}, model, { innerHeightRef: innerHeightRef, colSpan: model.colSpan, colWidth: colWidth, isSticky: tierNum < headerTiers.length - 1 })));
|
|
117
|
+
}
|
|
118
|
+
else if (model.date) {
|
|
119
|
+
return (preact.createElement(internal$5.DateHeaderCell, Object.assign({}, model, { navLink: resourceDayTableModel.dayTableModel.colCnt > 1, dateProfile: props.dateProfile, todayRange: todayRange, dayHeaderFormat: dayHeaderFormat, innerHeightRef: innerHeightRef, colSpan: model.colSpan, colWidth: colWidth })));
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
preact.createElement(internal$5.DayOfWeekHeaderCell, Object.assign({}, model, { dayHeaderFormat: dayHeaderFormat, innerHeightRef: innerHeightRef, colSpan: model.colSpan, colWidth: colWidth }));
|
|
123
|
+
}
|
|
124
|
+
}, getHeaderModelKey: (model) => (model.resource
|
|
125
|
+
? model.resource.id
|
|
126
|
+
: model.date
|
|
127
|
+
? model.date.toISOString()
|
|
128
|
+
: model.dow),
|
|
129
|
+
// all-day content
|
|
130
|
+
fgEventSegs: allDayResourceJoinedProps.fgEventSegs, bgEventSegs: allDayResourceJoinedProps.bgEventSegs, businessHourSegs: allDayResourceJoinedProps.businessHourSegs, dateSelectionSegs: allDayResourceJoinedProps.dateSelectionSegs, eventDrag: allDayResourceJoinedProps.eventDrag, eventResize: allDayResourceJoinedProps.eventResize,
|
|
131
|
+
// timed content
|
|
132
|
+
fgEventSegsByCol: fgEventSegsByCol, bgEventSegsByCol: bgEventSegsByCol, businessHourSegsByCol: businessHourSegsByCol, nowIndicatorSegsByCol: nowIndicatorSegsByCol, dateSelectionSegsByCol: dateSelectionSegsByCol, eventDragByCol: eventDragByCol, eventResizeByCol: eventResizeByCol,
|
|
133
|
+
// universal content
|
|
134
|
+
eventSelection: allDayResourceJoinedProps.eventSelection }));
|
|
135
|
+
}));
|
|
78
136
|
}
|
|
79
137
|
}
|
|
138
|
+
/*
|
|
139
|
+
TODO: kill this and DayResourceTableModel/ResourceDayTableModel
|
|
140
|
+
*/
|
|
80
141
|
function buildResourceTimeColsModel(dateProfile, dateProfileGenerator, resources, datesAboveResources, context) {
|
|
81
142
|
let dayTable = internal$3.buildTimeColsModel(dateProfile, dateProfileGenerator);
|
|
143
|
+
if (!resources.length) {
|
|
144
|
+
return new internal$1.ResourcelessDayTableModel(dayTable);
|
|
145
|
+
}
|
|
82
146
|
return datesAboveResources ?
|
|
83
147
|
new internal$1.DayResourceTableModel(dayTable, resources, context) :
|
|
84
148
|
new internal$1.ResourceDayTableModel(dayTable, resources, context);
|
|
@@ -86,7 +150,7 @@ FullCalendar.ResourceTimeGrid = (function (exports, core, premiumCommonPlugin, r
|
|
|
86
150
|
|
|
87
151
|
var plugin = core.createPlugin({
|
|
88
152
|
name: '@fullcalendar/resource-timegrid',
|
|
89
|
-
premiumReleaseDate: '2024-
|
|
153
|
+
premiumReleaseDate: '2024-10-01',
|
|
90
154
|
deps: [
|
|
91
155
|
premiumCommonPlugin__default["default"],
|
|
92
156
|
resourcePlugin__default["default"],
|
|
@@ -96,7 +160,7 @@ FullCalendar.ResourceTimeGrid = (function (exports, core, premiumCommonPlugin, r
|
|
|
96
160
|
views: {
|
|
97
161
|
resourceTimeGrid: {
|
|
98
162
|
type: 'timeGrid',
|
|
99
|
-
component:
|
|
163
|
+
component: ResourceTimeGridView,
|
|
100
164
|
needsResourceData: true,
|
|
101
165
|
},
|
|
102
166
|
resourceTimeGridDay: {
|
|
@@ -112,8 +176,7 @@ FullCalendar.ResourceTimeGrid = (function (exports, core, premiumCommonPlugin, r
|
|
|
112
176
|
|
|
113
177
|
var internal = {
|
|
114
178
|
__proto__: null,
|
|
115
|
-
|
|
116
|
-
ResourceDayTimeCols: ResourceDayTimeCols
|
|
179
|
+
ResourceTimeGridView: ResourceTimeGridView
|
|
117
180
|
};
|
|
118
181
|
|
|
119
182
|
core.globalPlugins.push(plugin);
|
|
@@ -125,4 +188,4 @@ FullCalendar.ResourceTimeGrid = (function (exports, core, premiumCommonPlugin, r
|
|
|
125
188
|
|
|
126
189
|
return exports;
|
|
127
190
|
|
|
128
|
-
})({}, FullCalendar, FullCalendar.PremiumCommon, FullCalendar.Resource, FullCalendar.TimeGrid, FullCalendar.Internal, FullCalendar.Preact, FullCalendar.
|
|
191
|
+
})({}, FullCalendar, FullCalendar.PremiumCommon, FullCalendar.Resource, FullCalendar.TimeGrid, FullCalendar.Internal, FullCalendar.Preact, FullCalendar.DayGrid.Internal, FullCalendar.ResourceDayGrid.Internal, FullCalendar.Resource.Internal, FullCalendar.TimeGrid.Internal);
|
package/index.global.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar Resource Time Grid Plugin
|
|
2
|
+
FullCalendar Resource Time Grid Plugin v7.0.0-beta.0
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/vertical-resource-view
|
|
4
4
|
(c) 2024 Adam Shaw
|
|
5
5
|
*/
|
|
6
|
-
FullCalendar.ResourceTimeGrid=function(e,t,l,
|
|
6
|
+
FullCalendar.ResourceTimeGrid=function(e,t,s,i,l,r,a,o,n,d,c){"use strict";function u(e){return e&&e.__esModule?e:{default:e}}var m=u(s),S=u(i),g=u(l);class h extends d.VResourceJoiner{transformSeg(e,t,s){return[Object.assign(Object.assign({},e),{col:t.computeCol(e.col,s)})]}}class y extends r.DateComponent{constructor(){super(...arguments),this.flattenResources=r.memoize(d.flattenResources),this.buildResourceTimeColsModel=r.memoize(p),this.allDaySplitter=new c.AllDaySplitter,this.allDayResourceSplitter=new d.VResourceSplitter,this.allDayResourceSlicers={},this.allDayResourceJoiner=new n.ResourceDayTableJoiner,this.buildDayRanges=r.memoize(c.buildDayRanges),this.timedResourceSplitter=new d.VResourceSplitter,this.timedResourceSlicers={},this.timedResourceJoiner=new h,this.splitFgEventSegs=r.memoize(c.splitSegsByCol),this.splitBgEventSegs=r.memoize(c.splitSegsByCol),this.splitBusinessHourSegs=r.memoize(c.splitSegsByCol),this.splitNowIndicatorSegs=r.memoize(c.splitSegsByCol),this.splitDateSelectionSegs=r.memoize(c.splitSegsByCol),this.splitEventDrag=r.memoize(c.splitInteractionByCol),this.splitEventResize=r.memoize(c.splitInteractionByCol),this.createDayHeaderFormatter=r.memoize(o.createDayHeaderFormatter),this.isHitComboAllowed=(e,t)=>1===this.dayRanges.length||e.dateSpan.resourceId===t.dateSpan.resourceId}render(){let{props:e,context:t}=this,{options:s,dateEnv:i}=t,{dateProfile:l}=e,u=s.resourceOrder||d.DEFAULT_RESOURCE_ORDER,m=this.flattenResources(e.resourceStore,u),S=this.buildResourceTimeColsModel(l,t.dateProfileGenerator,m,s.datesAboveResources,t),g=this.allDaySplitter.splitProps(e),h=this.allDayResourceSplitter.splitProps({businessHours:g.allDay.businessHours,dateSelection:g.allDay.dateSelection,eventStore:g.allDay.eventStore,eventUiBases:g.allDay.eventUiBases,eventSelection:g.allDay.eventSelection,eventDrag:g.allDay.eventDrag,eventResize:g.allDay.eventResize,resourceDayTableModel:S});this.allDayResourceSlicers=r.mapHash(h,(e,t)=>this.allDayResourceSlicers[t]||new o.DayTableSlicer);let y=r.mapHash(this.allDayResourceSlicers,(e,i)=>e.sliceProps(h[i],l,s.nextDayThreshold,t,S.dayTableModel)),p=this.allDayResourceJoiner.joinProps(y,S),R=this.dayRanges=this.buildDayRanges(S.dayTableModel,l,i),D=this.timedResourceSplitter.splitProps({businessHours:g.timed.businessHours,dateSelection:g.timed.dateSelection,eventStore:g.timed.eventStore,eventUiBases:g.timed.eventUiBases,eventSelection:g.timed.eventSelection,eventDrag:g.timed.eventDrag,eventResize:g.timed.eventResize,resourceDayTableModel:S});this.timedResourceSlicers=r.mapHash(D,(e,t)=>this.timedResourceSlicers[t]||new c.DayTimeColsSlicer);let v=r.mapHash(this.timedResourceSlicers,(e,s)=>e.sliceProps(D[s],l,null,t,R)),b=this.timedResourceJoiner.joinProps(v,S),C=1===S.dayTableModel.rowCnt,f=n.buildResourceHeaderTiers(m,S.dayTableModel.headerDates,s.datesAboveResources,C,t),H=this.createDayHeaderFormatter(t.options.dayHeaderFormat,C,S.colCnt);return a.createElement(r.NowTimer,{unit:s.nowIndicator?"minute":"day"},(t,i)=>{let r=S.colCnt,d=this.splitFgEventSegs(b.fgEventSegs,r),u=this.splitBgEventSegs(b.bgEventSegs,r),m=this.splitBusinessHourSegs(b.businessHourSegs,r),g=this.splitNowIndicatorSegs((()=>{let e=this.timedResourceSlicers[""].sliceNowDate(t,this.props.dateProfile,this.context.options.nextDayThreshold,this.context,this.dayRanges);return this.timedResourceJoiner.expandSegs(S,e)})(),r),h=this.splitDateSelectionSegs(b.dateSelectionSegs,r),y=this.splitEventDrag(b.eventDrag,r),R=this.splitEventResize(b.eventResize,r);return a.createElement(c.TimeGridLayout,{dateProfile:l,nowDate:t,todayRange:i,cells:S.cells[0],forPrint:e.forPrint,isHitComboAllowed:this.isHitComboAllowed,className:"fc-resource-timegrid-view",headerTiers:f,renderHeaderLabel:(e,t,i,r)=>s.weekNumbers&&e===f.length-1?a.createElement(c.TimeGridWeekNumber,{dateProfile:l,innerWidthRef:t,innerHeightRef:i,width:r}):a.createElement("div",{className:"fc-cell",style:{width:r}}),renderHeaderContent:(t,s,l,r)=>t.resource?a.createElement(n.ResourceHeaderCell,Object.assign({},t,{innerHeightRef:l,colSpan:t.colSpan,colWidth:r,isSticky:s<f.length-1})):t.date?a.createElement(o.DateHeaderCell,Object.assign({},t,{navLink:S.dayTableModel.colCnt>1,dateProfile:e.dateProfile,todayRange:i,dayHeaderFormat:H,innerHeightRef:l,colSpan:t.colSpan,colWidth:r})):void a.createElement(o.DayOfWeekHeaderCell,Object.assign({},t,{dayHeaderFormat:H,innerHeightRef:l,colSpan:t.colSpan,colWidth:r})),getHeaderModelKey:e=>e.resource?e.resource.id:e.date?e.date.toISOString():e.dow,fgEventSegs:p.fgEventSegs,bgEventSegs:p.bgEventSegs,businessHourSegs:p.businessHourSegs,dateSelectionSegs:p.dateSelectionSegs,eventDrag:p.eventDrag,eventResize:p.eventResize,fgEventSegsByCol:d,bgEventSegsByCol:u,businessHourSegsByCol:m,nowIndicatorSegsByCol:g,dateSelectionSegsByCol:h,eventDragByCol:y,eventResizeByCol:R,eventSelection:p.eventSelection})})}}function p(e,t,s,i,l){let r=c.buildTimeColsModel(e,t);return s.length?i?new d.DayResourceTableModel(r,s,l):new d.ResourceDayTableModel(r,s,l):new d.ResourcelessDayTableModel(r)}var R=t.createPlugin({name:"@fullcalendar/resource-timegrid",premiumReleaseDate:"2024-10-01",deps:[m.default,S.default,g.default],initialView:"resourceTimeGridDay",views:{resourceTimeGrid:{type:"timeGrid",component:y,needsResourceData:!0},resourceTimeGridDay:{type:"resourceTimeGrid",duration:{days:1}},resourceTimeGridWeek:{type:"resourceTimeGrid",duration:{weeks:1}}}}),D={__proto__:null,ResourceTimeGridView:y};return t.globalPlugins.push(R),e.Internal=D,e.default=R,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,FullCalendar.PremiumCommon,FullCalendar.Resource,FullCalendar.TimeGrid,FullCalendar.Internal,FullCalendar.Preact,FullCalendar.DayGrid.Internal,FullCalendar.ResourceDayGrid.Internal,FullCalendar.Resource.Internal,FullCalendar.TimeGrid.Internal);
|
package/index.js
CHANGED
|
@@ -2,16 +2,17 @@ import { createPlugin } from '@fullcalendar/core/index.js';
|
|
|
2
2
|
import premiumCommonPlugin from '@fullcalendar/premium-common/index.js';
|
|
3
3
|
import resourcePlugin from '@fullcalendar/resource/index.js';
|
|
4
4
|
import timeGridPlugin from '@fullcalendar/timegrid/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { ResourceTimeGridView } from './internal.js';
|
|
6
6
|
import '@fullcalendar/core/internal.js';
|
|
7
7
|
import '@fullcalendar/core/preact.js';
|
|
8
|
-
import '@fullcalendar/
|
|
9
|
-
import '@fullcalendar/resource/internal.js';
|
|
8
|
+
import '@fullcalendar/daygrid/internal.js';
|
|
10
9
|
import '@fullcalendar/resource-daygrid/internal.js';
|
|
10
|
+
import '@fullcalendar/resource/internal.js';
|
|
11
|
+
import '@fullcalendar/timegrid/internal.js';
|
|
11
12
|
|
|
12
13
|
var index = createPlugin({
|
|
13
14
|
name: '@fullcalendar/resource-timegrid',
|
|
14
|
-
premiumReleaseDate: '2024-
|
|
15
|
+
premiumReleaseDate: '2024-10-01',
|
|
15
16
|
deps: [
|
|
16
17
|
premiumCommonPlugin,
|
|
17
18
|
resourcePlugin,
|
|
@@ -21,7 +22,7 @@ var index = createPlugin({
|
|
|
21
22
|
views: {
|
|
22
23
|
resourceTimeGrid: {
|
|
23
24
|
type: 'timeGrid',
|
|
24
|
-
component:
|
|
25
|
+
component: ResourceTimeGridView,
|
|
25
26
|
needsResourceData: true,
|
|
26
27
|
},
|
|
27
28
|
resourceTimeGridDay: {
|
package/internal.cjs
CHANGED
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var internal_cjs$1 = require('@fullcalendar/core/internal.cjs');
|
|
6
6
|
var preact_cjs = require('@fullcalendar/core/preact.cjs');
|
|
7
|
-
var internal_cjs$
|
|
8
|
-
var internal_cjs = require('@fullcalendar/resource/internal.cjs');
|
|
7
|
+
var internal_cjs$4 = require('@fullcalendar/daygrid/internal.cjs');
|
|
9
8
|
var internal_cjs$3 = require('@fullcalendar/resource-daygrid/internal.cjs');
|
|
9
|
+
var internal_cjs = require('@fullcalendar/resource/internal.cjs');
|
|
10
|
+
var internal_cjs$2 = require('@fullcalendar/timegrid/internal.cjs');
|
|
10
11
|
|
|
11
12
|
class ResourceDayTimeColsJoiner extends internal_cjs.VResourceJoiner {
|
|
12
13
|
transformSeg(seg, resourceDayTable, resourceI) {
|
|
@@ -16,69 +17,132 @@ class ResourceDayTimeColsJoiner extends internal_cjs.VResourceJoiner {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
class
|
|
20
|
+
class ResourceTimeGridView extends internal_cjs$1.DateComponent {
|
|
20
21
|
constructor() {
|
|
21
22
|
super(...arguments);
|
|
23
|
+
this.flattenResources = internal_cjs$1.memoize(internal_cjs.flattenResources);
|
|
24
|
+
this.buildResourceTimeColsModel = internal_cjs$1.memoize(buildResourceTimeColsModel);
|
|
25
|
+
this.allDaySplitter = new internal_cjs$2.AllDaySplitter();
|
|
26
|
+
// for all-day-resource props
|
|
27
|
+
this.allDayResourceSplitter = new internal_cjs.VResourceSplitter();
|
|
28
|
+
this.allDayResourceSlicers = {};
|
|
29
|
+
this.allDayResourceJoiner = new internal_cjs$3.ResourceDayTableJoiner();
|
|
30
|
+
// for timed resource props
|
|
22
31
|
this.buildDayRanges = internal_cjs$1.memoize(internal_cjs$2.buildDayRanges);
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
|
|
32
|
+
this.timedResourceSplitter = new internal_cjs.VResourceSplitter();
|
|
33
|
+
this.timedResourceSlicers = {};
|
|
34
|
+
this.timedResourceJoiner = new ResourceDayTimeColsJoiner();
|
|
35
|
+
// timed-only column splitting
|
|
36
|
+
this.splitFgEventSegs = internal_cjs$1.memoize(internal_cjs$2.splitSegsByCol);
|
|
37
|
+
this.splitBgEventSegs = internal_cjs$1.memoize(internal_cjs$2.splitSegsByCol);
|
|
38
|
+
this.splitBusinessHourSegs = internal_cjs$1.memoize(internal_cjs$2.splitSegsByCol);
|
|
39
|
+
this.splitNowIndicatorSegs = internal_cjs$1.memoize(internal_cjs$2.splitSegsByCol);
|
|
40
|
+
this.splitDateSelectionSegs = internal_cjs$1.memoize(internal_cjs$2.splitSegsByCol);
|
|
41
|
+
this.splitEventDrag = internal_cjs$1.memoize(internal_cjs$2.splitInteractionByCol);
|
|
42
|
+
this.splitEventResize = internal_cjs$1.memoize(internal_cjs$2.splitInteractionByCol);
|
|
43
|
+
// other memo
|
|
44
|
+
this.createDayHeaderFormatter = internal_cjs$1.memoize(internal_cjs$4.createDayHeaderFormatter);
|
|
27
45
|
this.isHitComboAllowed = (hit0, hit1) => {
|
|
28
46
|
let allowAcrossResources = this.dayRanges.length === 1;
|
|
29
47
|
return allowAcrossResources || hit0.dateSpan.resourceId === hit1.dateSpan.resourceId;
|
|
30
48
|
};
|
|
31
49
|
}
|
|
32
|
-
render() {
|
|
33
|
-
let { props, context } = this;
|
|
34
|
-
let { dateEnv, options } = context;
|
|
35
|
-
let { dateProfile, resourceDayTableModel } = props;
|
|
36
|
-
let dayRanges = this.dayRanges = this.buildDayRanges(resourceDayTableModel.dayTableModel, dateProfile, dateEnv);
|
|
37
|
-
let splitProps = this.splitter.splitProps(props);
|
|
38
|
-
this.slicers = internal_cjs$1.mapHash(splitProps, (split, resourceId) => this.slicers[resourceId] || new internal_cjs$2.DayTimeColsSlicer());
|
|
39
|
-
let slicedProps = internal_cjs$1.mapHash(this.slicers, (slicer, resourceId) => slicer.sliceProps(splitProps[resourceId], dateProfile, null, context, dayRanges));
|
|
40
|
-
return ( // TODO: would move this further down hierarchy, but sliceNowDate needs it
|
|
41
|
-
preact_cjs.createElement(internal_cjs$1.NowTimer, { unit: options.nowIndicator ? 'minute' : 'day' }, (nowDate, todayRange) => (preact_cjs.createElement(internal_cjs$2.TimeCols, Object.assign({ ref: this.timeColsRef }, this.joiner.joinProps(slicedProps, resourceDayTableModel), { dateProfile: dateProfile, axis: props.axis, slotDuration: props.slotDuration, slatMetas: props.slatMetas, cells: resourceDayTableModel.cells[0], tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, clientWidth: props.clientWidth, clientHeight: props.clientHeight, expandRows: props.expandRows, nowDate: nowDate, nowIndicatorSegs: options.nowIndicator && this.buildNowIndicatorSegs(nowDate), todayRange: todayRange, onScrollTopRequest: props.onScrollTopRequest, forPrint: props.forPrint, onSlatCoords: props.onSlatCoords, isHitComboAllowed: this.isHitComboAllowed })))));
|
|
42
|
-
}
|
|
43
|
-
buildNowIndicatorSegs(date) {
|
|
44
|
-
let nonResourceSegs = this.slicers[''].sliceNowDate(date, this.props.dateProfile, this.context.options.nextDayThreshold, this.context, this.dayRanges);
|
|
45
|
-
return this.joiner.expandSegs(this.props.resourceDayTableModel, nonResourceSegs);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
class ResourceDayTimeColsView extends internal_cjs$2.TimeColsView {
|
|
50
|
-
constructor() {
|
|
51
|
-
super(...arguments);
|
|
52
|
-
this.flattenResources = internal_cjs$1.memoize(internal_cjs.flattenResources);
|
|
53
|
-
this.buildResourceTimeColsModel = internal_cjs$1.memoize(buildResourceTimeColsModel);
|
|
54
|
-
this.buildSlatMetas = internal_cjs$1.memoize(internal_cjs$2.buildSlatMetas);
|
|
55
|
-
}
|
|
56
50
|
render() {
|
|
57
51
|
let { props, context } = this;
|
|
58
52
|
let { options, dateEnv } = context;
|
|
59
53
|
let { dateProfile } = props;
|
|
60
|
-
let splitProps = this.allDaySplitter.splitProps(props);
|
|
61
54
|
let resourceOrderSpecs = options.resourceOrder || internal_cjs.DEFAULT_RESOURCE_ORDER;
|
|
62
55
|
let resources = this.flattenResources(props.resourceStore, resourceOrderSpecs);
|
|
63
56
|
let resourceDayTableModel = this.buildResourceTimeColsModel(dateProfile, context.dateProfileGenerator, resources, options.datesAboveResources, context);
|
|
64
|
-
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
let
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
:
|
|
57
|
+
// split seg by all-day/timed
|
|
58
|
+
let splitProps = this.allDaySplitter.splitProps(props);
|
|
59
|
+
// split the all-day segs by resource
|
|
60
|
+
let allDayResourceSplitProps = this.allDayResourceSplitter.splitProps({
|
|
61
|
+
businessHours: splitProps.allDay.businessHours,
|
|
62
|
+
dateSelection: splitProps.allDay.dateSelection,
|
|
63
|
+
eventStore: splitProps.allDay.eventStore,
|
|
64
|
+
eventUiBases: splitProps.allDay.eventUiBases,
|
|
65
|
+
eventSelection: splitProps.allDay.eventSelection,
|
|
66
|
+
eventDrag: splitProps.allDay.eventDrag,
|
|
67
|
+
eventResize: splitProps.allDay.eventResize,
|
|
68
|
+
resourceDayTableModel,
|
|
69
|
+
});
|
|
70
|
+
this.allDayResourceSlicers = internal_cjs$1.mapHash(allDayResourceSplitProps, (split, resourceId) => this.allDayResourceSlicers[resourceId] || new internal_cjs$4.DayTableSlicer());
|
|
71
|
+
let allDayResourceSlicedProps = internal_cjs$1.mapHash(this.allDayResourceSlicers, (slicer, resourceId) => slicer.sliceProps(allDayResourceSplitProps[resourceId], dateProfile, options.nextDayThreshold, context, resourceDayTableModel.dayTableModel));
|
|
72
|
+
let allDayResourceJoinedProps = this.allDayResourceJoiner.joinProps(allDayResourceSlicedProps, resourceDayTableModel);
|
|
73
|
+
// split the timed segs by resource
|
|
74
|
+
let dayRanges = this.dayRanges = this.buildDayRanges(resourceDayTableModel.dayTableModel, dateProfile, dateEnv);
|
|
75
|
+
let timedResourceSplitProps = this.timedResourceSplitter.splitProps({
|
|
76
|
+
businessHours: splitProps.timed.businessHours,
|
|
77
|
+
dateSelection: splitProps.timed.dateSelection,
|
|
78
|
+
eventStore: splitProps.timed.eventStore,
|
|
79
|
+
eventUiBases: splitProps.timed.eventUiBases,
|
|
80
|
+
eventSelection: splitProps.timed.eventSelection,
|
|
81
|
+
eventDrag: splitProps.timed.eventDrag,
|
|
82
|
+
eventResize: splitProps.timed.eventResize,
|
|
83
|
+
resourceDayTableModel,
|
|
84
|
+
});
|
|
85
|
+
this.timedResourceSlicers = internal_cjs$1.mapHash(timedResourceSplitProps, (split, resourceId) => this.timedResourceSlicers[resourceId] || new internal_cjs$2.DayTimeColsSlicer());
|
|
86
|
+
let timedResourceSlicedProps = internal_cjs$1.mapHash(this.timedResourceSlicers, (slicer, resourceId) => slicer.sliceProps(timedResourceSplitProps[resourceId], dateProfile, null, context, dayRanges));
|
|
87
|
+
let timedResourceJoinedProps = this.timedResourceJoiner.joinProps(timedResourceSlicedProps, resourceDayTableModel);
|
|
88
|
+
let datesRepDistinctDays = resourceDayTableModel.dayTableModel.rowCnt === 1;
|
|
89
|
+
let headerTiers = internal_cjs$3.buildResourceHeaderTiers(// TODO: memoize
|
|
90
|
+
resources, resourceDayTableModel.dayTableModel.headerDates, options.datesAboveResources, datesRepDistinctDays, context);
|
|
91
|
+
let dayHeaderFormat = this.createDayHeaderFormatter(context.options.dayHeaderFormat, datesRepDistinctDays, resourceDayTableModel.colCnt);
|
|
92
|
+
return (preact_cjs.createElement(internal_cjs$1.NowTimer, { unit: options.nowIndicator ? 'minute' : 'day' /* hacky */ }, (nowDate, todayRange) => {
|
|
93
|
+
// timed-only column splitting
|
|
94
|
+
let colCnt = resourceDayTableModel.colCnt;
|
|
95
|
+
let fgEventSegsByCol = this.splitFgEventSegs(timedResourceJoinedProps.fgEventSegs, colCnt);
|
|
96
|
+
let bgEventSegsByCol = this.splitBgEventSegs(timedResourceJoinedProps.bgEventSegs, colCnt);
|
|
97
|
+
let businessHourSegsByCol = this.splitBusinessHourSegs(timedResourceJoinedProps.businessHourSegs, colCnt);
|
|
98
|
+
let nowIndicatorSegsByCol = this.splitNowIndicatorSegs((() => {
|
|
99
|
+
// was buildNowIndicatorSegs
|
|
100
|
+
let nonResourceSegs = this.timedResourceSlicers[''].sliceNowDate(nowDate, this.props.dateProfile, this.context.options.nextDayThreshold, this.context, this.dayRanges);
|
|
101
|
+
return this.timedResourceJoiner.expandSegs(resourceDayTableModel, nonResourceSegs);
|
|
102
|
+
})(), colCnt);
|
|
103
|
+
let dateSelectionSegsByCol = this.splitDateSelectionSegs(timedResourceJoinedProps.dateSelectionSegs, colCnt);
|
|
104
|
+
let eventDragByCol = this.splitEventDrag(timedResourceJoinedProps.eventDrag, colCnt);
|
|
105
|
+
let eventResizeByCol = this.splitEventResize(timedResourceJoinedProps.eventResize, colCnt);
|
|
106
|
+
return (preact_cjs.createElement(internal_cjs$2.TimeGridLayout, { dateProfile: dateProfile, nowDate: nowDate, todayRange: todayRange, cells: resourceDayTableModel.cells[0], forPrint: props.forPrint, isHitComboAllowed: this.isHitComboAllowed, className: 'fc-resource-timegrid-view',
|
|
107
|
+
// header content
|
|
108
|
+
headerTiers: headerTiers, renderHeaderLabel: (tierNum, innerWidthRef, innerHeightRef, width) => ((options.weekNumbers && tierNum === headerTiers.length - 1) ? (preact_cjs.createElement(internal_cjs$2.TimeGridWeekNumber // .fc-cell
|
|
109
|
+
, { dateProfile: dateProfile, innerWidthRef: innerWidthRef, innerHeightRef: innerHeightRef, width: width })) : (preact_cjs.createElement("div", { className: 'fc-cell', style: { width } }))),
|
|
110
|
+
// TODO: DRY
|
|
111
|
+
renderHeaderContent: (model, tierNum, innerHeightRef, colWidth) => {
|
|
112
|
+
if (model.resource) {
|
|
113
|
+
return (preact_cjs.createElement(internal_cjs$3.ResourceHeaderCell, Object.assign({}, model, { innerHeightRef: innerHeightRef, colSpan: model.colSpan, colWidth: colWidth, isSticky: tierNum < headerTiers.length - 1 })));
|
|
114
|
+
}
|
|
115
|
+
else if (model.date) {
|
|
116
|
+
return (preact_cjs.createElement(internal_cjs$4.DateHeaderCell, Object.assign({}, model, { navLink: resourceDayTableModel.dayTableModel.colCnt > 1, dateProfile: props.dateProfile, todayRange: todayRange, dayHeaderFormat: dayHeaderFormat, innerHeightRef: innerHeightRef, colSpan: model.colSpan, colWidth: colWidth })));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
preact_cjs.createElement(internal_cjs$4.DayOfWeekHeaderCell, Object.assign({}, model, { dayHeaderFormat: dayHeaderFormat, innerHeightRef: innerHeightRef, colSpan: model.colSpan, colWidth: colWidth }));
|
|
120
|
+
}
|
|
121
|
+
}, getHeaderModelKey: (model) => (model.resource
|
|
122
|
+
? model.resource.id
|
|
123
|
+
: model.date
|
|
124
|
+
? model.date.toISOString()
|
|
125
|
+
: model.dow),
|
|
126
|
+
// all-day content
|
|
127
|
+
fgEventSegs: allDayResourceJoinedProps.fgEventSegs, bgEventSegs: allDayResourceJoinedProps.bgEventSegs, businessHourSegs: allDayResourceJoinedProps.businessHourSegs, dateSelectionSegs: allDayResourceJoinedProps.dateSelectionSegs, eventDrag: allDayResourceJoinedProps.eventDrag, eventResize: allDayResourceJoinedProps.eventResize,
|
|
128
|
+
// timed content
|
|
129
|
+
fgEventSegsByCol: fgEventSegsByCol, bgEventSegsByCol: bgEventSegsByCol, businessHourSegsByCol: businessHourSegsByCol, nowIndicatorSegsByCol: nowIndicatorSegsByCol, dateSelectionSegsByCol: dateSelectionSegsByCol, eventDragByCol: eventDragByCol, eventResizeByCol: eventResizeByCol,
|
|
130
|
+
// universal content
|
|
131
|
+
eventSelection: allDayResourceJoinedProps.eventSelection }));
|
|
132
|
+
}));
|
|
74
133
|
}
|
|
75
134
|
}
|
|
135
|
+
/*
|
|
136
|
+
TODO: kill this and DayResourceTableModel/ResourceDayTableModel
|
|
137
|
+
*/
|
|
76
138
|
function buildResourceTimeColsModel(dateProfile, dateProfileGenerator, resources, datesAboveResources, context) {
|
|
77
139
|
let dayTable = internal_cjs$2.buildTimeColsModel(dateProfile, dateProfileGenerator);
|
|
140
|
+
if (!resources.length) {
|
|
141
|
+
return new internal_cjs.ResourcelessDayTableModel(dayTable);
|
|
142
|
+
}
|
|
78
143
|
return datesAboveResources ?
|
|
79
144
|
new internal_cjs.DayResourceTableModel(dayTable, resources, context) :
|
|
80
145
|
new internal_cjs.ResourceDayTableModel(dayTable, resources, context);
|
|
81
146
|
}
|
|
82
147
|
|
|
83
|
-
exports.
|
|
84
|
-
exports.ResourceDayTimeColsView = ResourceDayTimeColsView;
|
|
148
|
+
exports.ResourceTimeGridView = ResourceTimeGridView;
|
package/internal.d.ts
CHANGED
|
@@ -1,49 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ResourceViewProps
|
|
4
|
-
import { Duration, CssDimValue } from '@fullcalendar/core';
|
|
5
|
-
import { DateComponent, Hit, DateMarker, DateProfile, EventStore, EventUiHash, DateSpan, EventInteractionState } from '@fullcalendar/core/internal';
|
|
1
|
+
import { DateComponent, Hit } from '@fullcalendar/core/internal';
|
|
2
|
+
import { createElement } from '@fullcalendar/core/preact';
|
|
3
|
+
import { ResourceViewProps } from '@fullcalendar/resource/internal';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
interface ResourceTimeGridViewState {
|
|
6
|
+
axisWidth?: number;
|
|
7
|
+
slatHeight?: number;
|
|
8
|
+
}
|
|
9
|
+
declare class ResourceTimeGridView extends DateComponent<ResourceViewProps, ResourceTimeGridViewState> {
|
|
9
10
|
private flattenResources;
|
|
10
11
|
private buildResourceTimeColsModel;
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
interface ResourceDayTimeColsProps {
|
|
16
|
-
dateProfile: DateProfile;
|
|
17
|
-
resourceDayTableModel: AbstractResourceDayTableModel;
|
|
18
|
-
axis: boolean;
|
|
19
|
-
slotDuration: Duration;
|
|
20
|
-
slatMetas: TimeSlatMeta[];
|
|
21
|
-
businessHours: EventStore;
|
|
22
|
-
eventStore: EventStore;
|
|
23
|
-
eventUiBases: EventUiHash;
|
|
24
|
-
dateSelection: DateSpan | null;
|
|
25
|
-
eventSelection: string;
|
|
26
|
-
eventDrag: EventInteractionState | null;
|
|
27
|
-
eventResize: EventInteractionState | null;
|
|
28
|
-
tableColGroupNode: VNode;
|
|
29
|
-
tableMinWidth: CssDimValue;
|
|
30
|
-
clientWidth: number | null;
|
|
31
|
-
clientHeight: number | null;
|
|
32
|
-
expandRows: boolean;
|
|
33
|
-
onScrollTopRequest?: (scrollTop: number) => void;
|
|
34
|
-
forPrint: boolean;
|
|
35
|
-
onSlatCoords?: (slatCoords: TimeColsSlatsCoords) => void;
|
|
36
|
-
}
|
|
37
|
-
declare class ResourceDayTimeCols extends DateComponent<ResourceDayTimeColsProps> {
|
|
12
|
+
private allDaySplitter;
|
|
13
|
+
private allDayResourceSplitter;
|
|
14
|
+
private allDayResourceSlicers;
|
|
15
|
+
private allDayResourceJoiner;
|
|
38
16
|
private buildDayRanges;
|
|
39
17
|
private dayRanges;
|
|
40
|
-
private
|
|
41
|
-
private
|
|
42
|
-
private
|
|
43
|
-
private
|
|
18
|
+
private timedResourceSplitter;
|
|
19
|
+
private timedResourceSlicers;
|
|
20
|
+
private timedResourceJoiner;
|
|
21
|
+
private splitFgEventSegs;
|
|
22
|
+
private splitBgEventSegs;
|
|
23
|
+
private splitBusinessHourSegs;
|
|
24
|
+
private splitNowIndicatorSegs;
|
|
25
|
+
private splitDateSelectionSegs;
|
|
26
|
+
private splitEventDrag;
|
|
27
|
+
private splitEventResize;
|
|
28
|
+
private createDayHeaderFormatter;
|
|
44
29
|
render(): createElement.JSX.Element;
|
|
45
30
|
isHitComboAllowed: (hit0: Hit, hit1: Hit) => boolean;
|
|
46
|
-
buildNowIndicatorSegs(date: DateMarker): any[];
|
|
47
31
|
}
|
|
48
32
|
|
|
49
|
-
export {
|
|
33
|
+
export { ResourceTimeGridView };
|
package/internal.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DateComponent, memoize, mapHash, NowTimer } from '@fullcalendar/core/internal.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { createElement } from '@fullcalendar/core/preact.js';
|
|
3
|
+
import { createDayHeaderFormatter, DayTableSlicer, DateHeaderCell, DayOfWeekHeaderCell } from '@fullcalendar/daygrid/internal.js';
|
|
4
|
+
import { ResourceDayTableJoiner, buildResourceHeaderTiers, ResourceHeaderCell } from '@fullcalendar/resource-daygrid/internal.js';
|
|
5
|
+
import { VResourceJoiner, flattenResources, VResourceSplitter, DEFAULT_RESOURCE_ORDER, ResourcelessDayTableModel, DayResourceTableModel, ResourceDayTableModel } from '@fullcalendar/resource/internal.js';
|
|
6
|
+
import { AllDaySplitter, buildDayRanges, splitSegsByCol, splitInteractionByCol, DayTimeColsSlicer, TimeGridLayout, TimeGridWeekNumber, buildTimeColsModel } from '@fullcalendar/timegrid/internal.js';
|
|
6
7
|
|
|
7
8
|
class ResourceDayTimeColsJoiner extends VResourceJoiner {
|
|
8
9
|
transformSeg(seg, resourceDayTable, resourceI) {
|
|
@@ -12,68 +13,132 @@ class ResourceDayTimeColsJoiner extends VResourceJoiner {
|
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
class
|
|
16
|
+
class ResourceTimeGridView extends DateComponent {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
19
|
+
this.flattenResources = memoize(flattenResources);
|
|
20
|
+
this.buildResourceTimeColsModel = memoize(buildResourceTimeColsModel);
|
|
21
|
+
this.allDaySplitter = new AllDaySplitter();
|
|
22
|
+
// for all-day-resource props
|
|
23
|
+
this.allDayResourceSplitter = new VResourceSplitter();
|
|
24
|
+
this.allDayResourceSlicers = {};
|
|
25
|
+
this.allDayResourceJoiner = new ResourceDayTableJoiner();
|
|
26
|
+
// for timed resource props
|
|
18
27
|
this.buildDayRanges = memoize(buildDayRanges);
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
|
|
28
|
+
this.timedResourceSplitter = new VResourceSplitter();
|
|
29
|
+
this.timedResourceSlicers = {};
|
|
30
|
+
this.timedResourceJoiner = new ResourceDayTimeColsJoiner();
|
|
31
|
+
// timed-only column splitting
|
|
32
|
+
this.splitFgEventSegs = memoize(splitSegsByCol);
|
|
33
|
+
this.splitBgEventSegs = memoize(splitSegsByCol);
|
|
34
|
+
this.splitBusinessHourSegs = memoize(splitSegsByCol);
|
|
35
|
+
this.splitNowIndicatorSegs = memoize(splitSegsByCol);
|
|
36
|
+
this.splitDateSelectionSegs = memoize(splitSegsByCol);
|
|
37
|
+
this.splitEventDrag = memoize(splitInteractionByCol);
|
|
38
|
+
this.splitEventResize = memoize(splitInteractionByCol);
|
|
39
|
+
// other memo
|
|
40
|
+
this.createDayHeaderFormatter = memoize(createDayHeaderFormatter);
|
|
23
41
|
this.isHitComboAllowed = (hit0, hit1) => {
|
|
24
42
|
let allowAcrossResources = this.dayRanges.length === 1;
|
|
25
43
|
return allowAcrossResources || hit0.dateSpan.resourceId === hit1.dateSpan.resourceId;
|
|
26
44
|
};
|
|
27
45
|
}
|
|
28
|
-
render() {
|
|
29
|
-
let { props, context } = this;
|
|
30
|
-
let { dateEnv, options } = context;
|
|
31
|
-
let { dateProfile, resourceDayTableModel } = props;
|
|
32
|
-
let dayRanges = this.dayRanges = this.buildDayRanges(resourceDayTableModel.dayTableModel, dateProfile, dateEnv);
|
|
33
|
-
let splitProps = this.splitter.splitProps(props);
|
|
34
|
-
this.slicers = mapHash(splitProps, (split, resourceId) => this.slicers[resourceId] || new DayTimeColsSlicer());
|
|
35
|
-
let slicedProps = mapHash(this.slicers, (slicer, resourceId) => slicer.sliceProps(splitProps[resourceId], dateProfile, null, context, dayRanges));
|
|
36
|
-
return ( // TODO: would move this further down hierarchy, but sliceNowDate needs it
|
|
37
|
-
createElement(NowTimer, { unit: options.nowIndicator ? 'minute' : 'day' }, (nowDate, todayRange) => (createElement(TimeCols, Object.assign({ ref: this.timeColsRef }, this.joiner.joinProps(slicedProps, resourceDayTableModel), { dateProfile: dateProfile, axis: props.axis, slotDuration: props.slotDuration, slatMetas: props.slatMetas, cells: resourceDayTableModel.cells[0], tableColGroupNode: props.tableColGroupNode, tableMinWidth: props.tableMinWidth, clientWidth: props.clientWidth, clientHeight: props.clientHeight, expandRows: props.expandRows, nowDate: nowDate, nowIndicatorSegs: options.nowIndicator && this.buildNowIndicatorSegs(nowDate), todayRange: todayRange, onScrollTopRequest: props.onScrollTopRequest, forPrint: props.forPrint, onSlatCoords: props.onSlatCoords, isHitComboAllowed: this.isHitComboAllowed })))));
|
|
38
|
-
}
|
|
39
|
-
buildNowIndicatorSegs(date) {
|
|
40
|
-
let nonResourceSegs = this.slicers[''].sliceNowDate(date, this.props.dateProfile, this.context.options.nextDayThreshold, this.context, this.dayRanges);
|
|
41
|
-
return this.joiner.expandSegs(this.props.resourceDayTableModel, nonResourceSegs);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
class ResourceDayTimeColsView extends TimeColsView {
|
|
46
|
-
constructor() {
|
|
47
|
-
super(...arguments);
|
|
48
|
-
this.flattenResources = memoize(flattenResources);
|
|
49
|
-
this.buildResourceTimeColsModel = memoize(buildResourceTimeColsModel);
|
|
50
|
-
this.buildSlatMetas = memoize(buildSlatMetas);
|
|
51
|
-
}
|
|
52
46
|
render() {
|
|
53
47
|
let { props, context } = this;
|
|
54
48
|
let { options, dateEnv } = context;
|
|
55
49
|
let { dateProfile } = props;
|
|
56
|
-
let splitProps = this.allDaySplitter.splitProps(props);
|
|
57
50
|
let resourceOrderSpecs = options.resourceOrder || DEFAULT_RESOURCE_ORDER;
|
|
58
51
|
let resources = this.flattenResources(props.resourceStore, resourceOrderSpecs);
|
|
59
52
|
let resourceDayTableModel = this.buildResourceTimeColsModel(dateProfile, context.dateProfileGenerator, resources, options.datesAboveResources, context);
|
|
60
|
-
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
:
|
|
53
|
+
// split seg by all-day/timed
|
|
54
|
+
let splitProps = this.allDaySplitter.splitProps(props);
|
|
55
|
+
// split the all-day segs by resource
|
|
56
|
+
let allDayResourceSplitProps = this.allDayResourceSplitter.splitProps({
|
|
57
|
+
businessHours: splitProps.allDay.businessHours,
|
|
58
|
+
dateSelection: splitProps.allDay.dateSelection,
|
|
59
|
+
eventStore: splitProps.allDay.eventStore,
|
|
60
|
+
eventUiBases: splitProps.allDay.eventUiBases,
|
|
61
|
+
eventSelection: splitProps.allDay.eventSelection,
|
|
62
|
+
eventDrag: splitProps.allDay.eventDrag,
|
|
63
|
+
eventResize: splitProps.allDay.eventResize,
|
|
64
|
+
resourceDayTableModel,
|
|
65
|
+
});
|
|
66
|
+
this.allDayResourceSlicers = mapHash(allDayResourceSplitProps, (split, resourceId) => this.allDayResourceSlicers[resourceId] || new DayTableSlicer());
|
|
67
|
+
let allDayResourceSlicedProps = mapHash(this.allDayResourceSlicers, (slicer, resourceId) => slicer.sliceProps(allDayResourceSplitProps[resourceId], dateProfile, options.nextDayThreshold, context, resourceDayTableModel.dayTableModel));
|
|
68
|
+
let allDayResourceJoinedProps = this.allDayResourceJoiner.joinProps(allDayResourceSlicedProps, resourceDayTableModel);
|
|
69
|
+
// split the timed segs by resource
|
|
70
|
+
let dayRanges = this.dayRanges = this.buildDayRanges(resourceDayTableModel.dayTableModel, dateProfile, dateEnv);
|
|
71
|
+
let timedResourceSplitProps = this.timedResourceSplitter.splitProps({
|
|
72
|
+
businessHours: splitProps.timed.businessHours,
|
|
73
|
+
dateSelection: splitProps.timed.dateSelection,
|
|
74
|
+
eventStore: splitProps.timed.eventStore,
|
|
75
|
+
eventUiBases: splitProps.timed.eventUiBases,
|
|
76
|
+
eventSelection: splitProps.timed.eventSelection,
|
|
77
|
+
eventDrag: splitProps.timed.eventDrag,
|
|
78
|
+
eventResize: splitProps.timed.eventResize,
|
|
79
|
+
resourceDayTableModel,
|
|
80
|
+
});
|
|
81
|
+
this.timedResourceSlicers = mapHash(timedResourceSplitProps, (split, resourceId) => this.timedResourceSlicers[resourceId] || new DayTimeColsSlicer());
|
|
82
|
+
let timedResourceSlicedProps = mapHash(this.timedResourceSlicers, (slicer, resourceId) => slicer.sliceProps(timedResourceSplitProps[resourceId], dateProfile, null, context, dayRanges));
|
|
83
|
+
let timedResourceJoinedProps = this.timedResourceJoiner.joinProps(timedResourceSlicedProps, resourceDayTableModel);
|
|
84
|
+
let datesRepDistinctDays = resourceDayTableModel.dayTableModel.rowCnt === 1;
|
|
85
|
+
let headerTiers = buildResourceHeaderTiers(// TODO: memoize
|
|
86
|
+
resources, resourceDayTableModel.dayTableModel.headerDates, options.datesAboveResources, datesRepDistinctDays, context);
|
|
87
|
+
let dayHeaderFormat = this.createDayHeaderFormatter(context.options.dayHeaderFormat, datesRepDistinctDays, resourceDayTableModel.colCnt);
|
|
88
|
+
return (createElement(NowTimer, { unit: options.nowIndicator ? 'minute' : 'day' /* hacky */ }, (nowDate, todayRange) => {
|
|
89
|
+
// timed-only column splitting
|
|
90
|
+
let colCnt = resourceDayTableModel.colCnt;
|
|
91
|
+
let fgEventSegsByCol = this.splitFgEventSegs(timedResourceJoinedProps.fgEventSegs, colCnt);
|
|
92
|
+
let bgEventSegsByCol = this.splitBgEventSegs(timedResourceJoinedProps.bgEventSegs, colCnt);
|
|
93
|
+
let businessHourSegsByCol = this.splitBusinessHourSegs(timedResourceJoinedProps.businessHourSegs, colCnt);
|
|
94
|
+
let nowIndicatorSegsByCol = this.splitNowIndicatorSegs((() => {
|
|
95
|
+
// was buildNowIndicatorSegs
|
|
96
|
+
let nonResourceSegs = this.timedResourceSlicers[''].sliceNowDate(nowDate, this.props.dateProfile, this.context.options.nextDayThreshold, this.context, this.dayRanges);
|
|
97
|
+
return this.timedResourceJoiner.expandSegs(resourceDayTableModel, nonResourceSegs);
|
|
98
|
+
})(), colCnt);
|
|
99
|
+
let dateSelectionSegsByCol = this.splitDateSelectionSegs(timedResourceJoinedProps.dateSelectionSegs, colCnt);
|
|
100
|
+
let eventDragByCol = this.splitEventDrag(timedResourceJoinedProps.eventDrag, colCnt);
|
|
101
|
+
let eventResizeByCol = this.splitEventResize(timedResourceJoinedProps.eventResize, colCnt);
|
|
102
|
+
return (createElement(TimeGridLayout, { dateProfile: dateProfile, nowDate: nowDate, todayRange: todayRange, cells: resourceDayTableModel.cells[0], forPrint: props.forPrint, isHitComboAllowed: this.isHitComboAllowed, className: 'fc-resource-timegrid-view',
|
|
103
|
+
// header content
|
|
104
|
+
headerTiers: headerTiers, renderHeaderLabel: (tierNum, innerWidthRef, innerHeightRef, width) => ((options.weekNumbers && tierNum === headerTiers.length - 1) ? (createElement(TimeGridWeekNumber // .fc-cell
|
|
105
|
+
, { dateProfile: dateProfile, innerWidthRef: innerWidthRef, innerHeightRef: innerHeightRef, width: width })) : (createElement("div", { className: 'fc-cell', style: { width } }))),
|
|
106
|
+
// TODO: DRY
|
|
107
|
+
renderHeaderContent: (model, tierNum, innerHeightRef, colWidth) => {
|
|
108
|
+
if (model.resource) {
|
|
109
|
+
return (createElement(ResourceHeaderCell, Object.assign({}, model, { innerHeightRef: innerHeightRef, colSpan: model.colSpan, colWidth: colWidth, isSticky: tierNum < headerTiers.length - 1 })));
|
|
110
|
+
}
|
|
111
|
+
else if (model.date) {
|
|
112
|
+
return (createElement(DateHeaderCell, Object.assign({}, model, { navLink: resourceDayTableModel.dayTableModel.colCnt > 1, dateProfile: props.dateProfile, todayRange: todayRange, dayHeaderFormat: dayHeaderFormat, innerHeightRef: innerHeightRef, colSpan: model.colSpan, colWidth: colWidth })));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
createElement(DayOfWeekHeaderCell, Object.assign({}, model, { dayHeaderFormat: dayHeaderFormat, innerHeightRef: innerHeightRef, colSpan: model.colSpan, colWidth: colWidth }));
|
|
116
|
+
}
|
|
117
|
+
}, getHeaderModelKey: (model) => (model.resource
|
|
118
|
+
? model.resource.id
|
|
119
|
+
: model.date
|
|
120
|
+
? model.date.toISOString()
|
|
121
|
+
: model.dow),
|
|
122
|
+
// all-day content
|
|
123
|
+
fgEventSegs: allDayResourceJoinedProps.fgEventSegs, bgEventSegs: allDayResourceJoinedProps.bgEventSegs, businessHourSegs: allDayResourceJoinedProps.businessHourSegs, dateSelectionSegs: allDayResourceJoinedProps.dateSelectionSegs, eventDrag: allDayResourceJoinedProps.eventDrag, eventResize: allDayResourceJoinedProps.eventResize,
|
|
124
|
+
// timed content
|
|
125
|
+
fgEventSegsByCol: fgEventSegsByCol, bgEventSegsByCol: bgEventSegsByCol, businessHourSegsByCol: businessHourSegsByCol, nowIndicatorSegsByCol: nowIndicatorSegsByCol, dateSelectionSegsByCol: dateSelectionSegsByCol, eventDragByCol: eventDragByCol, eventResizeByCol: eventResizeByCol,
|
|
126
|
+
// universal content
|
|
127
|
+
eventSelection: allDayResourceJoinedProps.eventSelection }));
|
|
128
|
+
}));
|
|
70
129
|
}
|
|
71
130
|
}
|
|
131
|
+
/*
|
|
132
|
+
TODO: kill this and DayResourceTableModel/ResourceDayTableModel
|
|
133
|
+
*/
|
|
72
134
|
function buildResourceTimeColsModel(dateProfile, dateProfileGenerator, resources, datesAboveResources, context) {
|
|
73
135
|
let dayTable = buildTimeColsModel(dateProfile, dateProfileGenerator);
|
|
136
|
+
if (!resources.length) {
|
|
137
|
+
return new ResourcelessDayTableModel(dayTable);
|
|
138
|
+
}
|
|
74
139
|
return datesAboveResources ?
|
|
75
140
|
new DayResourceTableModel(dayTable, resources, context) :
|
|
76
141
|
new ResourceDayTableModel(dayTable, resources, context);
|
|
77
142
|
}
|
|
78
143
|
|
|
79
|
-
export {
|
|
144
|
+
export { ResourceTimeGridView };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullcalendar/resource-timegrid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-beta.0",
|
|
4
4
|
"title": "FullCalendar Resource Time Grid Plugin",
|
|
5
5
|
"description": "Displays events on a vertical resource view with time slots",
|
|
6
6
|
"keywords": [
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
],
|
|
16
16
|
"homepage": "https://fullcalendar.io/docs/vertical-resource-view",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@fullcalendar/
|
|
19
|
-
"@fullcalendar/
|
|
20
|
-
"@fullcalendar/
|
|
18
|
+
"@fullcalendar/daygrid": "7.0.0-beta.0",
|
|
19
|
+
"@fullcalendar/premium-common": "7.0.0-beta.0",
|
|
20
|
+
"@fullcalendar/resource-daygrid": "7.0.0-beta.0",
|
|
21
|
+
"@fullcalendar/timegrid": "7.0.0-beta.0"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
23
|
-
"@fullcalendar/core": "
|
|
24
|
-
"@fullcalendar/resource": "
|
|
24
|
+
"@fullcalendar/core": "7.0.0-beta.0",
|
|
25
|
+
"@fullcalendar/resource": "7.0.0-beta.0"
|
|
25
26
|
},
|
|
26
27
|
"type": "module",
|
|
27
28
|
"bugs": "https://fullcalendar.io/reporting-bugs",
|