@progress/kendo-react-scheduler 5.5.0-dev.202206271315 → 5.5.0-dev.202206280851
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/dist/cdn/js/kendo-react-scheduler.js +1 -1
- package/dist/es/items/SchedulerProportionalViewItem.d.ts +8 -0
- package/dist/es/items/SchedulerProportionalViewItem.js +224 -0
- package/dist/es/items/SchedulerViewItem.js +1 -1
- package/dist/es/main.d.ts +2 -1
- package/dist/es/main.js +2 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/items/SchedulerProportionalViewItem.d.ts +8 -0
- package/dist/npm/items/SchedulerProportionalViewItem.js +227 -0
- package/dist/npm/items/SchedulerViewItem.js +1 -1
- package/dist/npm/main.d.ts +2 -1
- package/dist/npm/main.js +4 -2
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-scheduler.js +1 -1
- package/package.json +14 -12
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SchedulerViewItemHandle, SchedulerViewItemProps } from './SchedulerViewItem';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a customized `viewItem` component which position itself proportionally to the duration of the item.
|
|
5
|
+
*
|
|
6
|
+
* This is a composite component of the [`SchedulerItem`]({% slug api_scheduler_scheduleritem %}), extending it to provide extended positioning inside a view.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SchedulerProportionalViewItem: React.ForwardRefExoticComponent<SchedulerViewItemProps & React.RefAttributes<SchedulerViewItemHandle>>;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import * as React from 'react';
|
|
24
|
+
import { SchedulerItem } from './SchedulerItem';
|
|
25
|
+
import { intersects, first, calculateOrder, last } from '../utils';
|
|
26
|
+
import { useSchedulerElementContext, useSchedulerViewItemsContext, useSchedulerViewSlotsContext } from '../context';
|
|
27
|
+
import { getRect, setRect } from '../views/common/utils';
|
|
28
|
+
import { BORDER_WIDTH } from '../constants';
|
|
29
|
+
import { useInternationalization } from '@progress/kendo-react-intl';
|
|
30
|
+
import { SchedulerItemContent } from './SchedulerItemContent';
|
|
31
|
+
var ITEMS_SPACING = 1;
|
|
32
|
+
/* eslint-disable max-len */
|
|
33
|
+
/**
|
|
34
|
+
* Represents a customized `viewItem` component which position itself proportionally to the duration of the item.
|
|
35
|
+
*
|
|
36
|
+
* This is a composite component of the [`SchedulerItem`]({% slug api_scheduler_scheduleritem %}), extending it to provide extended positioning inside a view.
|
|
37
|
+
*/
|
|
38
|
+
export var SchedulerProportionalViewItem = React.forwardRef(function (props, ref) {
|
|
39
|
+
// tslint:enable:max-line-length
|
|
40
|
+
var itemProp = props.item, _ref = props._ref, itemRef = props.itemRef, itemProps = __rest(props, ["item", "_ref", "itemRef"]);
|
|
41
|
+
var timeout = React.useRef();
|
|
42
|
+
var item = React.useRef(null);
|
|
43
|
+
var viewItem = React.useRef(null);
|
|
44
|
+
var schedulerRect = React.useRef(null);
|
|
45
|
+
React.useImperativeHandle(viewItem, function () { return ({ props: props, element: item.current && item.current.element }); });
|
|
46
|
+
React.useImperativeHandle(ref, function () { return viewItem.current; });
|
|
47
|
+
React.useImperativeHandle(_ref, function () { return item.current; });
|
|
48
|
+
React.useImperativeHandle(itemRef, function () { return item.current; });
|
|
49
|
+
var Item = itemProp || defaultProps.item;
|
|
50
|
+
var intl = useInternationalization();
|
|
51
|
+
var viewItems = useSchedulerViewItemsContext()[0];
|
|
52
|
+
var viewSlots = useSchedulerViewSlotsContext()[0];
|
|
53
|
+
var scheduler = useSchedulerElementContext();
|
|
54
|
+
var _a = React.useState(true), display = _a[0], setDisplay = _a[1];
|
|
55
|
+
var _b = React.useState(false), visible = _b[0], setVisible = _b[1];
|
|
56
|
+
var _c = React.useState(0), maxSiblingsPerSlot = _c[0], setMaxSiblingsPerSlot = _c[1];
|
|
57
|
+
var itemTime = React.useMemo(function () { return props.isAllDay
|
|
58
|
+
? intl.toString(props.zonedStart, 't')
|
|
59
|
+
: intl.format('{0:t} - {1:t}', props.zonedStart, props.zonedEnd); }, [intl, props.isAllDay, props.zonedEnd, props.zonedStart]);
|
|
60
|
+
var itemTitle = React.useMemo(function () { return "(".concat(itemTime, "): ").concat(props.title); }, [itemTime, props.title]);
|
|
61
|
+
var calculateMostSiblings = function (slots, items) {
|
|
62
|
+
var most = 1;
|
|
63
|
+
slots.forEach(function (slot) {
|
|
64
|
+
var itemsInSlot = items.filter(function (i) { return inSlot(slot.current.props, i.props); });
|
|
65
|
+
if (itemsInSlot.length > most) {
|
|
66
|
+
most = itemsInSlot.length;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return most;
|
|
70
|
+
};
|
|
71
|
+
var getSiblingsInAllSlots = function (slots, items) {
|
|
72
|
+
var siblings = slots.map(function (slot) {
|
|
73
|
+
return items.filter(function (i) { return inSlot(slot.current.props, i.props); });
|
|
74
|
+
});
|
|
75
|
+
return siblings;
|
|
76
|
+
};
|
|
77
|
+
var inSlot = function (slot, current) {
|
|
78
|
+
return intersects(slot.start, slot.end, current.start, current.end)
|
|
79
|
+
&& slot.group.index === current.group.index
|
|
80
|
+
&& slot.range.index === current.range.index
|
|
81
|
+
&& (props.ignoreIsAllDay || slot.isAllDay === current.isAllDay);
|
|
82
|
+
};
|
|
83
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
+
var align = function () {
|
|
85
|
+
var slots = (viewSlots || []).filter(function (slot) { return slot.current && inSlot(slot.current.props, props); });
|
|
86
|
+
if (slots.length === 0) {
|
|
87
|
+
setDisplay(false);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
var firstSlot = first(slots);
|
|
91
|
+
if (!firstSlot.current || !item.current) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
var rect = getRect(firstSlot.current.element);
|
|
95
|
+
setRect(item.current.element, rect);
|
|
96
|
+
};
|
|
97
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
|
+
var position = function () {
|
|
99
|
+
var slots = (viewSlots || []).filter(function (slot) { return slot.current && inSlot(slot.current.props, props); });
|
|
100
|
+
var element = item.current && item.current.element;
|
|
101
|
+
if (!element) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
var firstSlot = first(slots);
|
|
105
|
+
var lastSlot = last(slots);
|
|
106
|
+
if (!firstSlot.current || !item.current || !lastSlot.current) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
var items = [];
|
|
110
|
+
var dragItems = [];
|
|
111
|
+
var resizeItems = [];
|
|
112
|
+
var slotRect = getRect(firstSlot.current.element);
|
|
113
|
+
var pxPerMillisecond = (props.vertical ? slotRect.height : slotRect.width) /
|
|
114
|
+
(firstSlot.current.props.end.getTime() - firstSlot.current.props.start.getTime());
|
|
115
|
+
var offset = (props.start.getTime() - firstSlot.current.props.start.getTime()) * pxPerMillisecond;
|
|
116
|
+
var total = (Math.min(props.end.getTime(), lastSlot.current.props.end.getTime()) - Math.max(props.start.getTime(), firstSlot.current.props.start.getTime())) * pxPerMillisecond;
|
|
117
|
+
(viewItems || []).forEach(function (i) {
|
|
118
|
+
if (!i.current) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (i.current.props.dragHint) {
|
|
122
|
+
dragItems.push(i.current);
|
|
123
|
+
}
|
|
124
|
+
else if (i.current.props.resizeHint) {
|
|
125
|
+
resizeItems.push(i.current);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
items.push(i.current);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
var order = (props.dragHint || props.resizeHint)
|
|
132
|
+
? calculateOrder(item.current, props.dragHint ? dragItems : resizeItems, slots, props.ignoreIsAllDay)
|
|
133
|
+
: (props.order || 0);
|
|
134
|
+
var mostSiblingsInSlot = props.dragHint || props.resizeHint
|
|
135
|
+
? calculateMostSiblings(slots, props.dragHint ? dragItems : resizeItems)
|
|
136
|
+
: calculateMostSiblings(slots, items);
|
|
137
|
+
var siblingsPerSlot = getSiblingsInAllSlots(slots, items);
|
|
138
|
+
var topOffset = 0;
|
|
139
|
+
var rect = getRect(element);
|
|
140
|
+
siblingsPerSlot.forEach(function (slot) {
|
|
141
|
+
var currentOffset = 0;
|
|
142
|
+
slot.forEach(function (current) {
|
|
143
|
+
if (intersects(current.props.start, current.props.end, props.start, props.end)
|
|
144
|
+
&& !(props.dragHint || props.resizeHint)
|
|
145
|
+
&& current.props._maxSiblingsPerSlot
|
|
146
|
+
&& current.props._maxSiblingsPerSlot > mostSiblingsInSlot
|
|
147
|
+
&& current.element !== element) {
|
|
148
|
+
mostSiblingsInSlot = current.props._maxSiblingsPerSlot;
|
|
149
|
+
}
|
|
150
|
+
var currentRect = getRect(current.element);
|
|
151
|
+
if (current.props.order !== null && current.props.order < order) {
|
|
152
|
+
currentOffset = ((currentRect.top + currentRect.height) - rect.top) - (BORDER_WIDTH * order) + ITEMS_SPACING;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
if (currentOffset > topOffset) {
|
|
156
|
+
topOffset = currentOffset;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
if (slots.length === 0) {
|
|
160
|
+
setDisplay(false);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
var OFFSET = 20;
|
|
164
|
+
rect.width = (props.vertical
|
|
165
|
+
? ((rect.width / mostSiblingsInSlot) - BORDER_WIDTH - (OFFSET / mostSiblingsInSlot))
|
|
166
|
+
: ((total) + (BORDER_WIDTH)));
|
|
167
|
+
rect.height = props.vertical
|
|
168
|
+
? (total - (BORDER_WIDTH))
|
|
169
|
+
: ((props.resizeHint || props.dragHint) && mostSiblingsInSlot <= 1)
|
|
170
|
+
? rect.height
|
|
171
|
+
: (props.style && props.style.height ? props.style.height : 25);
|
|
172
|
+
rect.left = props.vertical
|
|
173
|
+
? (rect.left + (order * rect.width) + (BORDER_WIDTH * order))
|
|
174
|
+
: rect.left + (offset < 0 ? 0 : offset);
|
|
175
|
+
rect.top = props.vertical
|
|
176
|
+
? rect.top + (offset < 0 ? 0 : offset)
|
|
177
|
+
: (rect.top + topOffset + (BORDER_WIDTH * order));
|
|
178
|
+
setMaxSiblingsPerSlot(mostSiblingsInSlot);
|
|
179
|
+
setRect(element, rect);
|
|
180
|
+
setVisible(true);
|
|
181
|
+
setDisplay(true);
|
|
182
|
+
};
|
|
183
|
+
var handleResize = React.useCallback(function (entries) {
|
|
184
|
+
var entry = entries && entries[0];
|
|
185
|
+
var rect = schedulerRect.current;
|
|
186
|
+
if (timeout.current !== undefined) {
|
|
187
|
+
window.cancelAnimationFrame(timeout.current);
|
|
188
|
+
}
|
|
189
|
+
if (rect && entry &&
|
|
190
|
+
(rect.width !== entry.contentRect.width ||
|
|
191
|
+
rect.height !== entry.contentRect.height)) {
|
|
192
|
+
timeout.current = window.requestAnimationFrame(function () {
|
|
193
|
+
align();
|
|
194
|
+
position();
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
schedulerRect.current = { width: entry.contentRect.width, height: entry.contentRect.height };
|
|
198
|
+
}, [align, position]);
|
|
199
|
+
React.useEffect(align);
|
|
200
|
+
React.useEffect(position);
|
|
201
|
+
React.useEffect(function () {
|
|
202
|
+
if (!scheduler.current) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
var observer = new window.ResizeObserver(handleResize);
|
|
206
|
+
observer.observe(scheduler.current);
|
|
207
|
+
return function () {
|
|
208
|
+
observer.disconnect();
|
|
209
|
+
};
|
|
210
|
+
}, [handleResize, scheduler]);
|
|
211
|
+
return (React.createElement(Item, __assign({}, itemProps, { _ref: item, _maxSiblingsPerSlot: maxSiblingsPerSlot, itemRef: item, style: __assign({ visibility: visible ? undefined : 'hidden', display: display ? undefined : 'none' }, props.style) }),
|
|
212
|
+
(!props.resizeHint) && React.createElement("span", { className: "k-event-actions" },
|
|
213
|
+
props.tail && React.createElement("span", { className: "k-icon k-i-arrow-60-left" }),
|
|
214
|
+
(props.isRecurring && !props.isException) && React.createElement("span", { className: "k-icon k-i-reload" }),
|
|
215
|
+
(!props.isRecurring && props.isException) && React.createElement("span", { className: "k-icon k-i-non-recurrence" })),
|
|
216
|
+
(!props.resizeHint) && (React.createElement("div", { title: itemTitle },
|
|
217
|
+
!props.isAllDay && (React.createElement(SchedulerItemContent, { className: "k-event-template k-event-time " }, itemTitle)),
|
|
218
|
+
React.createElement(SchedulerItemContent, { className: "k-event-template" }, props.title)))));
|
|
219
|
+
});
|
|
220
|
+
var defaultProps = {
|
|
221
|
+
item: SchedulerItem
|
|
222
|
+
};
|
|
223
|
+
SchedulerProportionalViewItem.defaultProps = defaultProps;
|
|
224
|
+
SchedulerProportionalViewItem.displayName = 'KendoReactSchedulerProportionalViewItem';
|
|
@@ -153,7 +153,7 @@ export var SchedulerViewItem = React.forwardRef(function (props, ref) {
|
|
|
153
153
|
var OFFSET = 20;
|
|
154
154
|
rect.width = (props.vertical
|
|
155
155
|
? ((rect.width / mostSiblingsInSlot) - BORDER_WIDTH - (OFFSET / mostSiblingsInSlot))
|
|
156
|
-
: ((rect.width * slots.length) - (BORDER_WIDTH))
|
|
156
|
+
: ((rect.width * slots.length) - (BORDER_WIDTH)));
|
|
157
157
|
rect.height = props.vertical
|
|
158
158
|
? ((rect.height * slots.length) - (BORDER_WIDTH))
|
|
159
159
|
: ((props.resizeHint || props.dragHint) && mostSiblingsInSlot <= 1)
|
package/dist/es/main.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { MonthView } from './views/month/MonthView';
|
|
|
8
8
|
import { SchedulerItem, SchedulerItemProps, SchedulerItemHandle } from './items/SchedulerItem';
|
|
9
9
|
import { SchedulerItemContent, SchedulerItemContentProps } from './items/SchedulerItemContent';
|
|
10
10
|
import { SchedulerViewItem, SchedulerViewItemProps, SchedulerViewItemHandle } from './items/SchedulerViewItem';
|
|
11
|
+
import { SchedulerProportionalViewItem } from './items/SchedulerProportionalViewItem';
|
|
11
12
|
import { SchedulerEditItem, SchedulerEditItemProps, SchedulerEditItemHandle, SchedulerEditItemAction, SchedulerEditItemState } from './items/SchedulerEditItem';
|
|
12
13
|
import { SchedulerSlot, SchedulerSlotProps, SchedulerSlotHandle } from './slots/SchedulerSlot';
|
|
13
14
|
import { SchedulerViewSlot, SchedulerViewSlotProps, SchedulerSlotExpandableConfig, SchedulerViewSlotHandle } from './slots/SchedulerViewSlot';
|
|
@@ -36,4 +37,4 @@ import { SchedulerItemShowOccurrenceDialogAction, SHOW_OCCURRENCE_DIALOG_ACTION
|
|
|
36
37
|
import { SchedulerItemShowRemoveDialogAction, SHOW_REMOVE_DIALOG_ACTION } from './items/hooks/use-show-remove-item-dialog';
|
|
37
38
|
import { SchedulerSlotsSelectAction, SLOTS_SELECT_ACTION } from './hooks/use-slots-selection';
|
|
38
39
|
import { SchedulerGroup, SchedulerResource } from './models';
|
|
39
|
-
export { Scheduler, SchedulerProps, AgendaView, TimelineView, DayView, WeekView, WorkWeekView, MonthView, SchedulerDataChangeEvent, SchedulerDateChangeEvent, SchedulerViewChangeEvent, DataAction, DATA_ACTION, SchedulerPropsContext, useSchedulerPropsContext, SchedulerPropsContextType, SchedulerViewsContext, useSchedulerViewsContext, SchedulerViewsContextType, SchedulerFieldsContext, useSchedulerFieldsContext, SchedulerFieldsContextType, SchedulerGroupsContext, useSchedulerGroupsContext, SchedulerGroupsContextType, SchedulerDateRangeContext, useSchedulerDateRangeContext, SchedulerDateRangeContextType, SchedulerOrientationContext, useSchedulerOrientationContext, SchedulerOrientationContextType, SchedulerDateContext, useSchedulerDateContext, SchedulerDateContextType, SchedulerActiveViewContext, useSchedulerActiveViewContext, SchedulerActiveViewContextType, SchedulerDataContext, useSchedulerDataContext, SchedulerDataContextType, SchedulerItem, SchedulerItemProps, SchedulerItemHandle, SchedulerItemContent, SchedulerItemContentProps, SchedulerViewItem, SchedulerViewItemProps, SchedulerViewItemHandle, SchedulerEditItem, SchedulerEditItemProps, SchedulerEditItemState, SchedulerEditItemAction, SchedulerEditItemHandle, SchedulerSlot, SchedulerSlotProps, SchedulerSlotHandle, SchedulerViewSlot, SchedulerViewSlotProps, SchedulerViewSlotHandle, SchedulerSlotExpandableConfig, SchedulerEditSlot, SchedulerEditSlotProps, SchedulerEditSlotHandle, SchedulerTask, SchedulerTaskProps, SchedulerTaskHandle, SchedulerViewTask, SchedulerViewTaskProps, SchedulerViewTaskHandle, SchedulerEditTask, SchedulerEditTaskProps, SchedulerEditTaskHandle, SchedulerDrag, SchedulerDragProps, SchedulerResize, SchedulerResizeProps, SchedulerForm, SchedulerFormHandle, SchedulerFormProps, SchedulerFormEditor, SchedulerFormEditorProps, SchedulerFormEditorHandle, SchedulerOccurrenceDialog, SchedulerOccurrenceDialogProps, SchedulerOccurrenceDialogHandle, SchedulerRemoveDialog, SchedulerRemoveDialogProps, SchedulerRemoveDialogHandle, SchedulerEditItemFormItemContext, useSchedulerEditItemFormItemContext, SchedulerEditItemFormItemContextType, SchedulerEditItemDragItemContext, useSchedulerEditItemDragItemContext, SchedulerEditItemDragItemContextType, SchedulerEditItemRemoveItemContext, useSchedulerEditItemRemoveItemContext, SchedulerEditItemRemoveItemContextType, SchedulerEditItemResizeItemContext, useSchedulerEditItemResizeItemContext, SchedulerEditItemResizeItemContextType, SchedulerEditItemShowRemoveDialogContext, useSchedulerEditItemShowRemoveDialogContext, SchedulerEditItemShowRemoveDialogContextType, SchedulerEditItemShowOccurrenceDialogContext, useSchedulerEditItemShowOccurrenceDialogContext, SchedulerEditItemShowOccurrenceDialogContextType, SchedulerEditItemPropsContext, useSchedulerEditItemPropsContext, SchedulerEditItemPropsContextType, SchedulerEditSlotFormItemContext, useSchedulerEditSlotFormItemContext, SchedulerEditSlotFormItemContextType, SchedulerEditSlotPropsContext, useSchedulerEditSlotPropsContext, SchedulerEditSlotPropsContextType, SchedulerHeader, SchedulerHeaderProps, SchedulerHeaderHandle, SchedulerFooter, SchedulerFooterProps, SchedulerFooterHandle, DateHeaderCell, DateHeaderCellHandle, DateHeaderCellProps, TimeHeaderCell, TimeHeaderCellHandle, TimeHeaderCellProps, DRAG_ITEM_ACTION, SchedulerItemDragItemAction, ITEMS_FOCUS_ACTION, SchedulerItemsFocusAction, ITEMS_SELECT_ACTION, SchedulerItemsSelectAction, REMOVE_ITEM_ACTION, SchedulerItemRemoveItemAction, RESIZE_ITEM_ACTION, SchedulerItemResizeItemAction, SERIES_ACTION, SchedulerItemSeriesAction, SHOW_OCCURRENCE_DIALOG_ACTION, SchedulerItemShowOccurrenceDialogAction, SHOW_REMOVE_DIALOG_ACTION, SchedulerItemShowRemoveDialogAction, SLOTS_FOCUS_ACTION, SchedulerSlotsFocusAction, SLOTS_SELECT_ACTION, SchedulerSlotsSelectAction, SchedulerResource, SchedulerGroup };
|
|
40
|
+
export { Scheduler, SchedulerProps, AgendaView, TimelineView, DayView, WeekView, WorkWeekView, MonthView, SchedulerDataChangeEvent, SchedulerDateChangeEvent, SchedulerViewChangeEvent, DataAction, DATA_ACTION, SchedulerPropsContext, useSchedulerPropsContext, SchedulerPropsContextType, SchedulerViewsContext, useSchedulerViewsContext, SchedulerViewsContextType, SchedulerFieldsContext, useSchedulerFieldsContext, SchedulerFieldsContextType, SchedulerGroupsContext, useSchedulerGroupsContext, SchedulerGroupsContextType, SchedulerDateRangeContext, useSchedulerDateRangeContext, SchedulerDateRangeContextType, SchedulerOrientationContext, useSchedulerOrientationContext, SchedulerOrientationContextType, SchedulerDateContext, useSchedulerDateContext, SchedulerDateContextType, SchedulerActiveViewContext, useSchedulerActiveViewContext, SchedulerActiveViewContextType, SchedulerDataContext, useSchedulerDataContext, SchedulerDataContextType, SchedulerItem, SchedulerItemProps, SchedulerItemHandle, SchedulerItemContent, SchedulerItemContentProps, SchedulerViewItem, SchedulerViewItemProps, SchedulerViewItemHandle, SchedulerEditItem, SchedulerEditItemProps, SchedulerEditItemState, SchedulerEditItemAction, SchedulerEditItemHandle, SchedulerSlot, SchedulerSlotProps, SchedulerSlotHandle, SchedulerViewSlot, SchedulerViewSlotProps, SchedulerViewSlotHandle, SchedulerSlotExpandableConfig, SchedulerProportionalViewItem, SchedulerEditSlot, SchedulerEditSlotProps, SchedulerEditSlotHandle, SchedulerTask, SchedulerTaskProps, SchedulerTaskHandle, SchedulerViewTask, SchedulerViewTaskProps, SchedulerViewTaskHandle, SchedulerEditTask, SchedulerEditTaskProps, SchedulerEditTaskHandle, SchedulerDrag, SchedulerDragProps, SchedulerResize, SchedulerResizeProps, SchedulerForm, SchedulerFormHandle, SchedulerFormProps, SchedulerFormEditor, SchedulerFormEditorProps, SchedulerFormEditorHandle, SchedulerOccurrenceDialog, SchedulerOccurrenceDialogProps, SchedulerOccurrenceDialogHandle, SchedulerRemoveDialog, SchedulerRemoveDialogProps, SchedulerRemoveDialogHandle, SchedulerEditItemFormItemContext, useSchedulerEditItemFormItemContext, SchedulerEditItemFormItemContextType, SchedulerEditItemDragItemContext, useSchedulerEditItemDragItemContext, SchedulerEditItemDragItemContextType, SchedulerEditItemRemoveItemContext, useSchedulerEditItemRemoveItemContext, SchedulerEditItemRemoveItemContextType, SchedulerEditItemResizeItemContext, useSchedulerEditItemResizeItemContext, SchedulerEditItemResizeItemContextType, SchedulerEditItemShowRemoveDialogContext, useSchedulerEditItemShowRemoveDialogContext, SchedulerEditItemShowRemoveDialogContextType, SchedulerEditItemShowOccurrenceDialogContext, useSchedulerEditItemShowOccurrenceDialogContext, SchedulerEditItemShowOccurrenceDialogContextType, SchedulerEditItemPropsContext, useSchedulerEditItemPropsContext, SchedulerEditItemPropsContextType, SchedulerEditSlotFormItemContext, useSchedulerEditSlotFormItemContext, SchedulerEditSlotFormItemContextType, SchedulerEditSlotPropsContext, useSchedulerEditSlotPropsContext, SchedulerEditSlotPropsContextType, SchedulerHeader, SchedulerHeaderProps, SchedulerHeaderHandle, SchedulerFooter, SchedulerFooterProps, SchedulerFooterHandle, DateHeaderCell, DateHeaderCellHandle, DateHeaderCellProps, TimeHeaderCell, TimeHeaderCellHandle, TimeHeaderCellProps, DRAG_ITEM_ACTION, SchedulerItemDragItemAction, ITEMS_FOCUS_ACTION, SchedulerItemsFocusAction, ITEMS_SELECT_ACTION, SchedulerItemsSelectAction, REMOVE_ITEM_ACTION, SchedulerItemRemoveItemAction, RESIZE_ITEM_ACTION, SchedulerItemResizeItemAction, SERIES_ACTION, SchedulerItemSeriesAction, SHOW_OCCURRENCE_DIALOG_ACTION, SchedulerItemShowOccurrenceDialogAction, SHOW_REMOVE_DIALOG_ACTION, SchedulerItemShowRemoveDialogAction, SLOTS_FOCUS_ACTION, SchedulerSlotsFocusAction, SLOTS_SELECT_ACTION, SchedulerSlotsSelectAction, SchedulerResource, SchedulerGroup };
|
package/dist/es/main.js
CHANGED
|
@@ -8,6 +8,7 @@ import { MonthView } from './views/month/MonthView';
|
|
|
8
8
|
import { SchedulerItem } from './items/SchedulerItem';
|
|
9
9
|
import { SchedulerItemContent } from './items/SchedulerItemContent';
|
|
10
10
|
import { SchedulerViewItem } from './items/SchedulerViewItem';
|
|
11
|
+
import { SchedulerProportionalViewItem } from './items/SchedulerProportionalViewItem';
|
|
11
12
|
import { SchedulerEditItem } from './items/SchedulerEditItem';
|
|
12
13
|
import { SchedulerSlot } from './slots/SchedulerSlot';
|
|
13
14
|
import { SchedulerViewSlot } from './slots/SchedulerViewSlot';
|
|
@@ -45,7 +46,7 @@ import { SERIES_ACTION } from './items/hooks/use-series';
|
|
|
45
46
|
import { SHOW_OCCURRENCE_DIALOG_ACTION } from './items/hooks/use-show-occurrence-dialog';
|
|
46
47
|
import { SHOW_REMOVE_DIALOG_ACTION } from './items/hooks/use-show-remove-item-dialog';
|
|
47
48
|
import { SLOTS_SELECT_ACTION } from './hooks/use-slots-selection';
|
|
48
|
-
export { Scheduler, AgendaView, TimelineView, DayView, WeekView, WorkWeekView, MonthView, DATA_ACTION, SchedulerPropsContext, useSchedulerPropsContext, SchedulerViewsContext, useSchedulerViewsContext, SchedulerFieldsContext, useSchedulerFieldsContext, SchedulerGroupsContext, useSchedulerGroupsContext, SchedulerDateRangeContext, useSchedulerDateRangeContext, SchedulerOrientationContext, useSchedulerOrientationContext, SchedulerDateContext, useSchedulerDateContext, SchedulerActiveViewContext, useSchedulerActiveViewContext, SchedulerDataContext, useSchedulerDataContext, SchedulerItem, SchedulerItemContent, SchedulerViewItem, SchedulerEditItem, SchedulerSlot, SchedulerViewSlot, SchedulerEditSlot, SchedulerTask, SchedulerViewTask, SchedulerEditTask, SchedulerDrag, SchedulerResize, SchedulerForm, SchedulerFormEditor, SchedulerOccurrenceDialog, SchedulerRemoveDialog, SchedulerEditItemFormItemContext, useSchedulerEditItemFormItemContext, SchedulerEditItemDragItemContext, useSchedulerEditItemDragItemContext, SchedulerEditItemRemoveItemContext, useSchedulerEditItemRemoveItemContext, SchedulerEditItemResizeItemContext, useSchedulerEditItemResizeItemContext, SchedulerEditItemShowRemoveDialogContext, useSchedulerEditItemShowRemoveDialogContext, SchedulerEditItemShowOccurrenceDialogContext, useSchedulerEditItemShowOccurrenceDialogContext, SchedulerEditItemPropsContext, useSchedulerEditItemPropsContext, SchedulerEditSlotFormItemContext, useSchedulerEditSlotFormItemContext, SchedulerEditSlotPropsContext, useSchedulerEditSlotPropsContext, SchedulerHeader,
|
|
49
|
+
export { Scheduler, AgendaView, TimelineView, DayView, WeekView, WorkWeekView, MonthView, DATA_ACTION, SchedulerPropsContext, useSchedulerPropsContext, SchedulerViewsContext, useSchedulerViewsContext, SchedulerFieldsContext, useSchedulerFieldsContext, SchedulerGroupsContext, useSchedulerGroupsContext, SchedulerDateRangeContext, useSchedulerDateRangeContext, SchedulerOrientationContext, useSchedulerOrientationContext, SchedulerDateContext, useSchedulerDateContext, SchedulerActiveViewContext, useSchedulerActiveViewContext, SchedulerDataContext, useSchedulerDataContext, SchedulerItem, SchedulerItemContent, SchedulerViewItem, SchedulerEditItem, SchedulerSlot, SchedulerViewSlot, SchedulerProportionalViewItem, SchedulerEditSlot, SchedulerTask, SchedulerViewTask, SchedulerEditTask, SchedulerDrag, SchedulerResize, SchedulerForm, SchedulerFormEditor, SchedulerOccurrenceDialog, SchedulerRemoveDialog, SchedulerEditItemFormItemContext, useSchedulerEditItemFormItemContext, SchedulerEditItemDragItemContext, useSchedulerEditItemDragItemContext, SchedulerEditItemRemoveItemContext, useSchedulerEditItemRemoveItemContext, SchedulerEditItemResizeItemContext, useSchedulerEditItemResizeItemContext, SchedulerEditItemShowRemoveDialogContext, useSchedulerEditItemShowRemoveDialogContext, SchedulerEditItemShowOccurrenceDialogContext, useSchedulerEditItemShowOccurrenceDialogContext, SchedulerEditItemPropsContext, useSchedulerEditItemPropsContext, SchedulerEditSlotFormItemContext, useSchedulerEditSlotFormItemContext, SchedulerEditSlotPropsContext, useSchedulerEditSlotPropsContext, SchedulerHeader,
|
|
49
50
|
// SchedulerNavigation,
|
|
50
51
|
// SchedulerNavigationProps,
|
|
51
52
|
// SchedulerNavigationHandle,
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-scheduler',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1656405909,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
11
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SchedulerViewItemHandle, SchedulerViewItemProps } from './SchedulerViewItem';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a customized `viewItem` component which position itself proportionally to the duration of the item.
|
|
5
|
+
*
|
|
6
|
+
* This is a composite component of the [`SchedulerItem`]({% slug api_scheduler_scheduleritem %}), extending it to provide extended positioning inside a view.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SchedulerProportionalViewItem: React.ForwardRefExoticComponent<SchedulerViewItemProps & React.RefAttributes<SchedulerViewItemHandle>>;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.SchedulerProportionalViewItem = void 0;
|
|
26
|
+
var React = require("react");
|
|
27
|
+
var SchedulerItem_1 = require("./SchedulerItem");
|
|
28
|
+
var utils_1 = require("../utils");
|
|
29
|
+
var context_1 = require("../context");
|
|
30
|
+
var utils_2 = require("../views/common/utils");
|
|
31
|
+
var constants_1 = require("../constants");
|
|
32
|
+
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
33
|
+
var SchedulerItemContent_1 = require("./SchedulerItemContent");
|
|
34
|
+
var ITEMS_SPACING = 1;
|
|
35
|
+
/* eslint-disable max-len */
|
|
36
|
+
/**
|
|
37
|
+
* Represents a customized `viewItem` component which position itself proportionally to the duration of the item.
|
|
38
|
+
*
|
|
39
|
+
* This is a composite component of the [`SchedulerItem`]({% slug api_scheduler_scheduleritem %}), extending it to provide extended positioning inside a view.
|
|
40
|
+
*/
|
|
41
|
+
exports.SchedulerProportionalViewItem = React.forwardRef(function (props, ref) {
|
|
42
|
+
// tslint:enable:max-line-length
|
|
43
|
+
var itemProp = props.item, _ref = props._ref, itemRef = props.itemRef, itemProps = __rest(props, ["item", "_ref", "itemRef"]);
|
|
44
|
+
var timeout = React.useRef();
|
|
45
|
+
var item = React.useRef(null);
|
|
46
|
+
var viewItem = React.useRef(null);
|
|
47
|
+
var schedulerRect = React.useRef(null);
|
|
48
|
+
React.useImperativeHandle(viewItem, function () { return ({ props: props, element: item.current && item.current.element }); });
|
|
49
|
+
React.useImperativeHandle(ref, function () { return viewItem.current; });
|
|
50
|
+
React.useImperativeHandle(_ref, function () { return item.current; });
|
|
51
|
+
React.useImperativeHandle(itemRef, function () { return item.current; });
|
|
52
|
+
var Item = itemProp || defaultProps.item;
|
|
53
|
+
var intl = (0, kendo_react_intl_1.useInternationalization)();
|
|
54
|
+
var viewItems = (0, context_1.useSchedulerViewItemsContext)()[0];
|
|
55
|
+
var viewSlots = (0, context_1.useSchedulerViewSlotsContext)()[0];
|
|
56
|
+
var scheduler = (0, context_1.useSchedulerElementContext)();
|
|
57
|
+
var _a = React.useState(true), display = _a[0], setDisplay = _a[1];
|
|
58
|
+
var _b = React.useState(false), visible = _b[0], setVisible = _b[1];
|
|
59
|
+
var _c = React.useState(0), maxSiblingsPerSlot = _c[0], setMaxSiblingsPerSlot = _c[1];
|
|
60
|
+
var itemTime = React.useMemo(function () { return props.isAllDay
|
|
61
|
+
? intl.toString(props.zonedStart, 't')
|
|
62
|
+
: intl.format('{0:t} - {1:t}', props.zonedStart, props.zonedEnd); }, [intl, props.isAllDay, props.zonedEnd, props.zonedStart]);
|
|
63
|
+
var itemTitle = React.useMemo(function () { return "(".concat(itemTime, "): ").concat(props.title); }, [itemTime, props.title]);
|
|
64
|
+
var calculateMostSiblings = function (slots, items) {
|
|
65
|
+
var most = 1;
|
|
66
|
+
slots.forEach(function (slot) {
|
|
67
|
+
var itemsInSlot = items.filter(function (i) { return inSlot(slot.current.props, i.props); });
|
|
68
|
+
if (itemsInSlot.length > most) {
|
|
69
|
+
most = itemsInSlot.length;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return most;
|
|
73
|
+
};
|
|
74
|
+
var getSiblingsInAllSlots = function (slots, items) {
|
|
75
|
+
var siblings = slots.map(function (slot) {
|
|
76
|
+
return items.filter(function (i) { return inSlot(slot.current.props, i.props); });
|
|
77
|
+
});
|
|
78
|
+
return siblings;
|
|
79
|
+
};
|
|
80
|
+
var inSlot = function (slot, current) {
|
|
81
|
+
return (0, utils_1.intersects)(slot.start, slot.end, current.start, current.end)
|
|
82
|
+
&& slot.group.index === current.group.index
|
|
83
|
+
&& slot.range.index === current.range.index
|
|
84
|
+
&& (props.ignoreIsAllDay || slot.isAllDay === current.isAllDay);
|
|
85
|
+
};
|
|
86
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
|
+
var align = function () {
|
|
88
|
+
var slots = (viewSlots || []).filter(function (slot) { return slot.current && inSlot(slot.current.props, props); });
|
|
89
|
+
if (slots.length === 0) {
|
|
90
|
+
setDisplay(false);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
var firstSlot = (0, utils_1.first)(slots);
|
|
94
|
+
if (!firstSlot.current || !item.current) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
var rect = (0, utils_2.getRect)(firstSlot.current.element);
|
|
98
|
+
(0, utils_2.setRect)(item.current.element, rect);
|
|
99
|
+
};
|
|
100
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
|
+
var position = function () {
|
|
102
|
+
var slots = (viewSlots || []).filter(function (slot) { return slot.current && inSlot(slot.current.props, props); });
|
|
103
|
+
var element = item.current && item.current.element;
|
|
104
|
+
if (!element) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
var firstSlot = (0, utils_1.first)(slots);
|
|
108
|
+
var lastSlot = (0, utils_1.last)(slots);
|
|
109
|
+
if (!firstSlot.current || !item.current || !lastSlot.current) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
var items = [];
|
|
113
|
+
var dragItems = [];
|
|
114
|
+
var resizeItems = [];
|
|
115
|
+
var slotRect = (0, utils_2.getRect)(firstSlot.current.element);
|
|
116
|
+
var pxPerMillisecond = (props.vertical ? slotRect.height : slotRect.width) /
|
|
117
|
+
(firstSlot.current.props.end.getTime() - firstSlot.current.props.start.getTime());
|
|
118
|
+
var offset = (props.start.getTime() - firstSlot.current.props.start.getTime()) * pxPerMillisecond;
|
|
119
|
+
var total = (Math.min(props.end.getTime(), lastSlot.current.props.end.getTime()) - Math.max(props.start.getTime(), firstSlot.current.props.start.getTime())) * pxPerMillisecond;
|
|
120
|
+
(viewItems || []).forEach(function (i) {
|
|
121
|
+
if (!i.current) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (i.current.props.dragHint) {
|
|
125
|
+
dragItems.push(i.current);
|
|
126
|
+
}
|
|
127
|
+
else if (i.current.props.resizeHint) {
|
|
128
|
+
resizeItems.push(i.current);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
items.push(i.current);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
var order = (props.dragHint || props.resizeHint)
|
|
135
|
+
? (0, utils_1.calculateOrder)(item.current, props.dragHint ? dragItems : resizeItems, slots, props.ignoreIsAllDay)
|
|
136
|
+
: (props.order || 0);
|
|
137
|
+
var mostSiblingsInSlot = props.dragHint || props.resizeHint
|
|
138
|
+
? calculateMostSiblings(slots, props.dragHint ? dragItems : resizeItems)
|
|
139
|
+
: calculateMostSiblings(slots, items);
|
|
140
|
+
var siblingsPerSlot = getSiblingsInAllSlots(slots, items);
|
|
141
|
+
var topOffset = 0;
|
|
142
|
+
var rect = (0, utils_2.getRect)(element);
|
|
143
|
+
siblingsPerSlot.forEach(function (slot) {
|
|
144
|
+
var currentOffset = 0;
|
|
145
|
+
slot.forEach(function (current) {
|
|
146
|
+
if ((0, utils_1.intersects)(current.props.start, current.props.end, props.start, props.end)
|
|
147
|
+
&& !(props.dragHint || props.resizeHint)
|
|
148
|
+
&& current.props._maxSiblingsPerSlot
|
|
149
|
+
&& current.props._maxSiblingsPerSlot > mostSiblingsInSlot
|
|
150
|
+
&& current.element !== element) {
|
|
151
|
+
mostSiblingsInSlot = current.props._maxSiblingsPerSlot;
|
|
152
|
+
}
|
|
153
|
+
var currentRect = (0, utils_2.getRect)(current.element);
|
|
154
|
+
if (current.props.order !== null && current.props.order < order) {
|
|
155
|
+
currentOffset = ((currentRect.top + currentRect.height) - rect.top) - (constants_1.BORDER_WIDTH * order) + ITEMS_SPACING;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
if (currentOffset > topOffset) {
|
|
159
|
+
topOffset = currentOffset;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
if (slots.length === 0) {
|
|
163
|
+
setDisplay(false);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
var OFFSET = 20;
|
|
167
|
+
rect.width = (props.vertical
|
|
168
|
+
? ((rect.width / mostSiblingsInSlot) - constants_1.BORDER_WIDTH - (OFFSET / mostSiblingsInSlot))
|
|
169
|
+
: ((total) + (constants_1.BORDER_WIDTH)));
|
|
170
|
+
rect.height = props.vertical
|
|
171
|
+
? (total - (constants_1.BORDER_WIDTH))
|
|
172
|
+
: ((props.resizeHint || props.dragHint) && mostSiblingsInSlot <= 1)
|
|
173
|
+
? rect.height
|
|
174
|
+
: (props.style && props.style.height ? props.style.height : 25);
|
|
175
|
+
rect.left = props.vertical
|
|
176
|
+
? (rect.left + (order * rect.width) + (constants_1.BORDER_WIDTH * order))
|
|
177
|
+
: rect.left + (offset < 0 ? 0 : offset);
|
|
178
|
+
rect.top = props.vertical
|
|
179
|
+
? rect.top + (offset < 0 ? 0 : offset)
|
|
180
|
+
: (rect.top + topOffset + (constants_1.BORDER_WIDTH * order));
|
|
181
|
+
setMaxSiblingsPerSlot(mostSiblingsInSlot);
|
|
182
|
+
(0, utils_2.setRect)(element, rect);
|
|
183
|
+
setVisible(true);
|
|
184
|
+
setDisplay(true);
|
|
185
|
+
};
|
|
186
|
+
var handleResize = React.useCallback(function (entries) {
|
|
187
|
+
var entry = entries && entries[0];
|
|
188
|
+
var rect = schedulerRect.current;
|
|
189
|
+
if (timeout.current !== undefined) {
|
|
190
|
+
window.cancelAnimationFrame(timeout.current);
|
|
191
|
+
}
|
|
192
|
+
if (rect && entry &&
|
|
193
|
+
(rect.width !== entry.contentRect.width ||
|
|
194
|
+
rect.height !== entry.contentRect.height)) {
|
|
195
|
+
timeout.current = window.requestAnimationFrame(function () {
|
|
196
|
+
align();
|
|
197
|
+
position();
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
schedulerRect.current = { width: entry.contentRect.width, height: entry.contentRect.height };
|
|
201
|
+
}, [align, position]);
|
|
202
|
+
React.useEffect(align);
|
|
203
|
+
React.useEffect(position);
|
|
204
|
+
React.useEffect(function () {
|
|
205
|
+
if (!scheduler.current) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
var observer = new window.ResizeObserver(handleResize);
|
|
209
|
+
observer.observe(scheduler.current);
|
|
210
|
+
return function () {
|
|
211
|
+
observer.disconnect();
|
|
212
|
+
};
|
|
213
|
+
}, [handleResize, scheduler]);
|
|
214
|
+
return (React.createElement(Item, __assign({}, itemProps, { _ref: item, _maxSiblingsPerSlot: maxSiblingsPerSlot, itemRef: item, style: __assign({ visibility: visible ? undefined : 'hidden', display: display ? undefined : 'none' }, props.style) }),
|
|
215
|
+
(!props.resizeHint) && React.createElement("span", { className: "k-event-actions" },
|
|
216
|
+
props.tail && React.createElement("span", { className: "k-icon k-i-arrow-60-left" }),
|
|
217
|
+
(props.isRecurring && !props.isException) && React.createElement("span", { className: "k-icon k-i-reload" }),
|
|
218
|
+
(!props.isRecurring && props.isException) && React.createElement("span", { className: "k-icon k-i-non-recurrence" })),
|
|
219
|
+
(!props.resizeHint) && (React.createElement("div", { title: itemTitle },
|
|
220
|
+
!props.isAllDay && (React.createElement(SchedulerItemContent_1.SchedulerItemContent, { className: "k-event-template k-event-time " }, itemTitle)),
|
|
221
|
+
React.createElement(SchedulerItemContent_1.SchedulerItemContent, { className: "k-event-template" }, props.title)))));
|
|
222
|
+
});
|
|
223
|
+
var defaultProps = {
|
|
224
|
+
item: SchedulerItem_1.SchedulerItem
|
|
225
|
+
};
|
|
226
|
+
exports.SchedulerProportionalViewItem.defaultProps = defaultProps;
|
|
227
|
+
exports.SchedulerProportionalViewItem.displayName = 'KendoReactSchedulerProportionalViewItem';
|
|
@@ -156,7 +156,7 @@ exports.SchedulerViewItem = React.forwardRef(function (props, ref) {
|
|
|
156
156
|
var OFFSET = 20;
|
|
157
157
|
rect.width = (props.vertical
|
|
158
158
|
? ((rect.width / mostSiblingsInSlot) - constants_1.BORDER_WIDTH - (OFFSET / mostSiblingsInSlot))
|
|
159
|
-
: ((rect.width * slots.length) - (constants_1.BORDER_WIDTH))
|
|
159
|
+
: ((rect.width * slots.length) - (constants_1.BORDER_WIDTH)));
|
|
160
160
|
rect.height = props.vertical
|
|
161
161
|
? ((rect.height * slots.length) - (constants_1.BORDER_WIDTH))
|
|
162
162
|
: ((props.resizeHint || props.dragHint) && mostSiblingsInSlot <= 1)
|
package/dist/npm/main.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { MonthView } from './views/month/MonthView';
|
|
|
8
8
|
import { SchedulerItem, SchedulerItemProps, SchedulerItemHandle } from './items/SchedulerItem';
|
|
9
9
|
import { SchedulerItemContent, SchedulerItemContentProps } from './items/SchedulerItemContent';
|
|
10
10
|
import { SchedulerViewItem, SchedulerViewItemProps, SchedulerViewItemHandle } from './items/SchedulerViewItem';
|
|
11
|
+
import { SchedulerProportionalViewItem } from './items/SchedulerProportionalViewItem';
|
|
11
12
|
import { SchedulerEditItem, SchedulerEditItemProps, SchedulerEditItemHandle, SchedulerEditItemAction, SchedulerEditItemState } from './items/SchedulerEditItem';
|
|
12
13
|
import { SchedulerSlot, SchedulerSlotProps, SchedulerSlotHandle } from './slots/SchedulerSlot';
|
|
13
14
|
import { SchedulerViewSlot, SchedulerViewSlotProps, SchedulerSlotExpandableConfig, SchedulerViewSlotHandle } from './slots/SchedulerViewSlot';
|
|
@@ -36,4 +37,4 @@ import { SchedulerItemShowOccurrenceDialogAction, SHOW_OCCURRENCE_DIALOG_ACTION
|
|
|
36
37
|
import { SchedulerItemShowRemoveDialogAction, SHOW_REMOVE_DIALOG_ACTION } from './items/hooks/use-show-remove-item-dialog';
|
|
37
38
|
import { SchedulerSlotsSelectAction, SLOTS_SELECT_ACTION } from './hooks/use-slots-selection';
|
|
38
39
|
import { SchedulerGroup, SchedulerResource } from './models';
|
|
39
|
-
export { Scheduler, SchedulerProps, AgendaView, TimelineView, DayView, WeekView, WorkWeekView, MonthView, SchedulerDataChangeEvent, SchedulerDateChangeEvent, SchedulerViewChangeEvent, DataAction, DATA_ACTION, SchedulerPropsContext, useSchedulerPropsContext, SchedulerPropsContextType, SchedulerViewsContext, useSchedulerViewsContext, SchedulerViewsContextType, SchedulerFieldsContext, useSchedulerFieldsContext, SchedulerFieldsContextType, SchedulerGroupsContext, useSchedulerGroupsContext, SchedulerGroupsContextType, SchedulerDateRangeContext, useSchedulerDateRangeContext, SchedulerDateRangeContextType, SchedulerOrientationContext, useSchedulerOrientationContext, SchedulerOrientationContextType, SchedulerDateContext, useSchedulerDateContext, SchedulerDateContextType, SchedulerActiveViewContext, useSchedulerActiveViewContext, SchedulerActiveViewContextType, SchedulerDataContext, useSchedulerDataContext, SchedulerDataContextType, SchedulerItem, SchedulerItemProps, SchedulerItemHandle, SchedulerItemContent, SchedulerItemContentProps, SchedulerViewItem, SchedulerViewItemProps, SchedulerViewItemHandle, SchedulerEditItem, SchedulerEditItemProps, SchedulerEditItemState, SchedulerEditItemAction, SchedulerEditItemHandle, SchedulerSlot, SchedulerSlotProps, SchedulerSlotHandle, SchedulerViewSlot, SchedulerViewSlotProps, SchedulerViewSlotHandle, SchedulerSlotExpandableConfig, SchedulerEditSlot, SchedulerEditSlotProps, SchedulerEditSlotHandle, SchedulerTask, SchedulerTaskProps, SchedulerTaskHandle, SchedulerViewTask, SchedulerViewTaskProps, SchedulerViewTaskHandle, SchedulerEditTask, SchedulerEditTaskProps, SchedulerEditTaskHandle, SchedulerDrag, SchedulerDragProps, SchedulerResize, SchedulerResizeProps, SchedulerForm, SchedulerFormHandle, SchedulerFormProps, SchedulerFormEditor, SchedulerFormEditorProps, SchedulerFormEditorHandle, SchedulerOccurrenceDialog, SchedulerOccurrenceDialogProps, SchedulerOccurrenceDialogHandle, SchedulerRemoveDialog, SchedulerRemoveDialogProps, SchedulerRemoveDialogHandle, SchedulerEditItemFormItemContext, useSchedulerEditItemFormItemContext, SchedulerEditItemFormItemContextType, SchedulerEditItemDragItemContext, useSchedulerEditItemDragItemContext, SchedulerEditItemDragItemContextType, SchedulerEditItemRemoveItemContext, useSchedulerEditItemRemoveItemContext, SchedulerEditItemRemoveItemContextType, SchedulerEditItemResizeItemContext, useSchedulerEditItemResizeItemContext, SchedulerEditItemResizeItemContextType, SchedulerEditItemShowRemoveDialogContext, useSchedulerEditItemShowRemoveDialogContext, SchedulerEditItemShowRemoveDialogContextType, SchedulerEditItemShowOccurrenceDialogContext, useSchedulerEditItemShowOccurrenceDialogContext, SchedulerEditItemShowOccurrenceDialogContextType, SchedulerEditItemPropsContext, useSchedulerEditItemPropsContext, SchedulerEditItemPropsContextType, SchedulerEditSlotFormItemContext, useSchedulerEditSlotFormItemContext, SchedulerEditSlotFormItemContextType, SchedulerEditSlotPropsContext, useSchedulerEditSlotPropsContext, SchedulerEditSlotPropsContextType, SchedulerHeader, SchedulerHeaderProps, SchedulerHeaderHandle, SchedulerFooter, SchedulerFooterProps, SchedulerFooterHandle, DateHeaderCell, DateHeaderCellHandle, DateHeaderCellProps, TimeHeaderCell, TimeHeaderCellHandle, TimeHeaderCellProps, DRAG_ITEM_ACTION, SchedulerItemDragItemAction, ITEMS_FOCUS_ACTION, SchedulerItemsFocusAction, ITEMS_SELECT_ACTION, SchedulerItemsSelectAction, REMOVE_ITEM_ACTION, SchedulerItemRemoveItemAction, RESIZE_ITEM_ACTION, SchedulerItemResizeItemAction, SERIES_ACTION, SchedulerItemSeriesAction, SHOW_OCCURRENCE_DIALOG_ACTION, SchedulerItemShowOccurrenceDialogAction, SHOW_REMOVE_DIALOG_ACTION, SchedulerItemShowRemoveDialogAction, SLOTS_FOCUS_ACTION, SchedulerSlotsFocusAction, SLOTS_SELECT_ACTION, SchedulerSlotsSelectAction, SchedulerResource, SchedulerGroup };
|
|
40
|
+
export { Scheduler, SchedulerProps, AgendaView, TimelineView, DayView, WeekView, WorkWeekView, MonthView, SchedulerDataChangeEvent, SchedulerDateChangeEvent, SchedulerViewChangeEvent, DataAction, DATA_ACTION, SchedulerPropsContext, useSchedulerPropsContext, SchedulerPropsContextType, SchedulerViewsContext, useSchedulerViewsContext, SchedulerViewsContextType, SchedulerFieldsContext, useSchedulerFieldsContext, SchedulerFieldsContextType, SchedulerGroupsContext, useSchedulerGroupsContext, SchedulerGroupsContextType, SchedulerDateRangeContext, useSchedulerDateRangeContext, SchedulerDateRangeContextType, SchedulerOrientationContext, useSchedulerOrientationContext, SchedulerOrientationContextType, SchedulerDateContext, useSchedulerDateContext, SchedulerDateContextType, SchedulerActiveViewContext, useSchedulerActiveViewContext, SchedulerActiveViewContextType, SchedulerDataContext, useSchedulerDataContext, SchedulerDataContextType, SchedulerItem, SchedulerItemProps, SchedulerItemHandle, SchedulerItemContent, SchedulerItemContentProps, SchedulerViewItem, SchedulerViewItemProps, SchedulerViewItemHandle, SchedulerEditItem, SchedulerEditItemProps, SchedulerEditItemState, SchedulerEditItemAction, SchedulerEditItemHandle, SchedulerSlot, SchedulerSlotProps, SchedulerSlotHandle, SchedulerViewSlot, SchedulerViewSlotProps, SchedulerViewSlotHandle, SchedulerSlotExpandableConfig, SchedulerProportionalViewItem, SchedulerEditSlot, SchedulerEditSlotProps, SchedulerEditSlotHandle, SchedulerTask, SchedulerTaskProps, SchedulerTaskHandle, SchedulerViewTask, SchedulerViewTaskProps, SchedulerViewTaskHandle, SchedulerEditTask, SchedulerEditTaskProps, SchedulerEditTaskHandle, SchedulerDrag, SchedulerDragProps, SchedulerResize, SchedulerResizeProps, SchedulerForm, SchedulerFormHandle, SchedulerFormProps, SchedulerFormEditor, SchedulerFormEditorProps, SchedulerFormEditorHandle, SchedulerOccurrenceDialog, SchedulerOccurrenceDialogProps, SchedulerOccurrenceDialogHandle, SchedulerRemoveDialog, SchedulerRemoveDialogProps, SchedulerRemoveDialogHandle, SchedulerEditItemFormItemContext, useSchedulerEditItemFormItemContext, SchedulerEditItemFormItemContextType, SchedulerEditItemDragItemContext, useSchedulerEditItemDragItemContext, SchedulerEditItemDragItemContextType, SchedulerEditItemRemoveItemContext, useSchedulerEditItemRemoveItemContext, SchedulerEditItemRemoveItemContextType, SchedulerEditItemResizeItemContext, useSchedulerEditItemResizeItemContext, SchedulerEditItemResizeItemContextType, SchedulerEditItemShowRemoveDialogContext, useSchedulerEditItemShowRemoveDialogContext, SchedulerEditItemShowRemoveDialogContextType, SchedulerEditItemShowOccurrenceDialogContext, useSchedulerEditItemShowOccurrenceDialogContext, SchedulerEditItemShowOccurrenceDialogContextType, SchedulerEditItemPropsContext, useSchedulerEditItemPropsContext, SchedulerEditItemPropsContextType, SchedulerEditSlotFormItemContext, useSchedulerEditSlotFormItemContext, SchedulerEditSlotFormItemContextType, SchedulerEditSlotPropsContext, useSchedulerEditSlotPropsContext, SchedulerEditSlotPropsContextType, SchedulerHeader, SchedulerHeaderProps, SchedulerHeaderHandle, SchedulerFooter, SchedulerFooterProps, SchedulerFooterHandle, DateHeaderCell, DateHeaderCellHandle, DateHeaderCellProps, TimeHeaderCell, TimeHeaderCellHandle, TimeHeaderCellProps, DRAG_ITEM_ACTION, SchedulerItemDragItemAction, ITEMS_FOCUS_ACTION, SchedulerItemsFocusAction, ITEMS_SELECT_ACTION, SchedulerItemsSelectAction, REMOVE_ITEM_ACTION, SchedulerItemRemoveItemAction, RESIZE_ITEM_ACTION, SchedulerItemResizeItemAction, SERIES_ACTION, SchedulerItemSeriesAction, SHOW_OCCURRENCE_DIALOG_ACTION, SchedulerItemShowOccurrenceDialogAction, SHOW_REMOVE_DIALOG_ACTION, SchedulerItemShowRemoveDialogAction, SLOTS_FOCUS_ACTION, SchedulerSlotsFocusAction, SLOTS_SELECT_ACTION, SchedulerSlotsSelectAction, SchedulerResource, SchedulerGroup };
|
package/dist/npm/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.SLOTS_SELECT_ACTION = exports.SLOTS_FOCUS_ACTION = exports.SHOW_REMOVE_DIALOG_ACTION = exports.SHOW_OCCURRENCE_DIALOG_ACTION = exports.SERIES_ACTION = exports.RESIZE_ITEM_ACTION = exports.REMOVE_ITEM_ACTION = exports.ITEMS_SELECT_ACTION = exports.ITEMS_FOCUS_ACTION = exports.DRAG_ITEM_ACTION = exports.TimeHeaderCell = exports.DateHeaderCell = exports.SchedulerFooter = exports.SchedulerHeader = exports.useSchedulerEditSlotPropsContext = exports.SchedulerEditSlotPropsContext = exports.useSchedulerEditSlotFormItemContext = exports.SchedulerEditSlotFormItemContext = exports.useSchedulerEditItemPropsContext = exports.SchedulerEditItemPropsContext = exports.useSchedulerEditItemShowOccurrenceDialogContext = exports.SchedulerEditItemShowOccurrenceDialogContext = exports.useSchedulerEditItemShowRemoveDialogContext = exports.SchedulerEditItemShowRemoveDialogContext = void 0;
|
|
3
|
+
exports.SchedulerEditItemResizeItemContext = exports.useSchedulerEditItemRemoveItemContext = exports.SchedulerEditItemRemoveItemContext = exports.useSchedulerEditItemDragItemContext = exports.SchedulerEditItemDragItemContext = exports.useSchedulerEditItemFormItemContext = exports.SchedulerEditItemFormItemContext = exports.SchedulerRemoveDialog = exports.SchedulerOccurrenceDialog = exports.SchedulerFormEditor = exports.SchedulerForm = exports.SchedulerResize = exports.SchedulerDrag = exports.SchedulerEditTask = exports.SchedulerViewTask = exports.SchedulerTask = exports.SchedulerEditSlot = exports.SchedulerProportionalViewItem = exports.SchedulerViewSlot = exports.SchedulerSlot = exports.SchedulerEditItem = exports.SchedulerViewItem = exports.SchedulerItemContent = exports.SchedulerItem = exports.useSchedulerDataContext = exports.SchedulerDataContext = exports.useSchedulerActiveViewContext = exports.SchedulerActiveViewContext = exports.useSchedulerDateContext = exports.SchedulerDateContext = exports.useSchedulerOrientationContext = exports.SchedulerOrientationContext = exports.useSchedulerDateRangeContext = exports.SchedulerDateRangeContext = exports.useSchedulerGroupsContext = exports.SchedulerGroupsContext = exports.useSchedulerFieldsContext = exports.SchedulerFieldsContext = exports.useSchedulerViewsContext = exports.SchedulerViewsContext = exports.useSchedulerPropsContext = exports.SchedulerPropsContext = exports.DATA_ACTION = exports.MonthView = exports.WorkWeekView = exports.WeekView = exports.DayView = exports.TimelineView = exports.AgendaView = exports.Scheduler = void 0;
|
|
4
|
+
exports.SLOTS_SELECT_ACTION = exports.SLOTS_FOCUS_ACTION = exports.SHOW_REMOVE_DIALOG_ACTION = exports.SHOW_OCCURRENCE_DIALOG_ACTION = exports.SERIES_ACTION = exports.RESIZE_ITEM_ACTION = exports.REMOVE_ITEM_ACTION = exports.ITEMS_SELECT_ACTION = exports.ITEMS_FOCUS_ACTION = exports.DRAG_ITEM_ACTION = exports.TimeHeaderCell = exports.DateHeaderCell = exports.SchedulerFooter = exports.SchedulerHeader = exports.useSchedulerEditSlotPropsContext = exports.SchedulerEditSlotPropsContext = exports.useSchedulerEditSlotFormItemContext = exports.SchedulerEditSlotFormItemContext = exports.useSchedulerEditItemPropsContext = exports.SchedulerEditItemPropsContext = exports.useSchedulerEditItemShowOccurrenceDialogContext = exports.SchedulerEditItemShowOccurrenceDialogContext = exports.useSchedulerEditItemShowRemoveDialogContext = exports.SchedulerEditItemShowRemoveDialogContext = exports.useSchedulerEditItemResizeItemContext = void 0;
|
|
5
5
|
var Scheduler_1 = require("./Scheduler");
|
|
6
6
|
Object.defineProperty(exports, "Scheduler", { enumerable: true, get: function () { return Scheduler_1.Scheduler; } });
|
|
7
7
|
Object.defineProperty(exports, "DATA_ACTION", { enumerable: true, get: function () { return Scheduler_1.DATA_ACTION; } });
|
|
@@ -23,6 +23,8 @@ var SchedulerItemContent_1 = require("./items/SchedulerItemContent");
|
|
|
23
23
|
Object.defineProperty(exports, "SchedulerItemContent", { enumerable: true, get: function () { return SchedulerItemContent_1.SchedulerItemContent; } });
|
|
24
24
|
var SchedulerViewItem_1 = require("./items/SchedulerViewItem");
|
|
25
25
|
Object.defineProperty(exports, "SchedulerViewItem", { enumerable: true, get: function () { return SchedulerViewItem_1.SchedulerViewItem; } });
|
|
26
|
+
var SchedulerProportionalViewItem_1 = require("./items/SchedulerProportionalViewItem");
|
|
27
|
+
Object.defineProperty(exports, "SchedulerProportionalViewItem", { enumerable: true, get: function () { return SchedulerProportionalViewItem_1.SchedulerProportionalViewItem; } });
|
|
26
28
|
var SchedulerEditItem_1 = require("./items/SchedulerEditItem");
|
|
27
29
|
Object.defineProperty(exports, "SchedulerEditItem", { enumerable: true, get: function () { return SchedulerEditItem_1.SchedulerEditItem; } });
|
|
28
30
|
var SchedulerSlot_1 = require("./slots/SchedulerSlot");
|
|
@@ -8,7 +8,7 @@ exports.packageMetadata = {
|
|
|
8
8
|
name: '@progress/kendo-react-scheduler',
|
|
9
9
|
productName: 'KendoReact',
|
|
10
10
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate:
|
|
11
|
+
publishDate: 1656405909,
|
|
12
12
|
version: '',
|
|
13
13
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
14
14
|
};
|