@progress/kendo-vue-scheduler 3.1.4 → 3.1.5-dev.202204110939

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.
Files changed (72) hide show
  1. package/dist/cdn/js/kendo-vue-scheduler.js +2 -2
  2. package/dist/es/components/SchedulerForm.js +6 -0
  3. package/dist/es/components/SchedulerOccurrenceDialog.js +52 -7
  4. package/dist/es/components/SchedulerRemoveDialog.js +52 -7
  5. package/dist/es/editors/ResourceEditor.js +13 -11
  6. package/dist/es/editors/SchedulerFormEditor.js +11 -10
  7. package/dist/es/editors/ZonedDateTime.d.ts +1 -0
  8. package/dist/es/editors/ZonedDateTime.js +5 -2
  9. package/dist/es/items/SchedulerEditItem.js +401 -211
  10. package/dist/es/items/SchedulerItem.js +104 -95
  11. package/dist/es/items/SchedulerViewItem.js +8 -2
  12. package/dist/es/items/hooks/use-drag-item.d.ts +2 -6
  13. package/dist/es/items/hooks/use-drag-item.js +228 -153
  14. package/dist/es/items/hooks/use-show-occurrence-dialog.d.ts +1 -0
  15. package/dist/es/items/hooks/use-show-occurrence-dialog.js +1 -2
  16. package/dist/es/items/hooks/use-show-remove-item-dialog.d.ts +1 -0
  17. package/dist/es/items/hooks/use-show-remove-item-dialog.js +1 -2
  18. package/dist/es/package-metadata.js +1 -1
  19. package/dist/es/recurrence/RecurrenceEditor.d.ts +1 -0
  20. package/dist/es/recurrence/RecurrenceEditor.js +5 -0
  21. package/dist/es/recurrence/RecurrenceFrequencyEditor.js +4 -0
  22. package/dist/es/recurrence/RecurrenceRepeatOnWeekEditor.js +4 -0
  23. package/dist/es/tasks/SchedulerEditTask.d.ts +9 -0
  24. package/dist/es/tasks/SchedulerEditTask.js +118 -35
  25. package/dist/es/tasks/SchedulerTask.js +3 -2
  26. package/dist/es/tasks/SchedulerViewTask.js +15 -3
  27. package/dist/es/views/agenda/AgendaView.js +21 -9
  28. package/dist/es/views/agenda/AgendaViewBody.d.ts +1 -0
  29. package/dist/es/views/agenda/AgendaViewBody.js +6 -1
  30. package/dist/es/views/common/SchedulerDrag.js +62 -11
  31. package/dist/es/views/day/DayView.js +4 -0
  32. package/dist/es/views/month/MonthView.js +5 -1
  33. package/dist/es/views/time/MultiDayTimelineView.js +28 -9
  34. package/dist/es/views/time/TimelineView.js +4 -0
  35. package/dist/es/views/week/WeekView.js +12 -2
  36. package/dist/es/views/week/WorkWeekView.js +12 -2
  37. package/dist/npm/components/SchedulerForm.js +6 -0
  38. package/dist/npm/components/SchedulerOccurrenceDialog.js +52 -7
  39. package/dist/npm/components/SchedulerRemoveDialog.js +52 -7
  40. package/dist/npm/editors/ResourceEditor.js +12 -10
  41. package/dist/npm/editors/SchedulerFormEditor.js +11 -11
  42. package/dist/npm/editors/ZonedDateTime.d.ts +1 -0
  43. package/dist/npm/editors/ZonedDateTime.js +4 -1
  44. package/dist/npm/items/SchedulerEditItem.js +400 -207
  45. package/dist/npm/items/SchedulerItem.js +104 -95
  46. package/dist/npm/items/SchedulerViewItem.js +8 -2
  47. package/dist/npm/items/hooks/use-drag-item.d.ts +2 -6
  48. package/dist/npm/items/hooks/use-drag-item.js +231 -153
  49. package/dist/npm/items/hooks/use-show-occurrence-dialog.d.ts +1 -0
  50. package/dist/npm/items/hooks/use-show-occurrence-dialog.js +2 -2
  51. package/dist/npm/items/hooks/use-show-remove-item-dialog.d.ts +1 -0
  52. package/dist/npm/items/hooks/use-show-remove-item-dialog.js +2 -2
  53. package/dist/npm/package-metadata.js +1 -1
  54. package/dist/npm/recurrence/RecurrenceEditor.d.ts +1 -0
  55. package/dist/npm/recurrence/RecurrenceEditor.js +5 -0
  56. package/dist/npm/recurrence/RecurrenceFrequencyEditor.js +4 -0
  57. package/dist/npm/recurrence/RecurrenceRepeatOnWeekEditor.js +4 -0
  58. package/dist/npm/tasks/SchedulerEditTask.d.ts +9 -0
  59. package/dist/npm/tasks/SchedulerEditTask.js +120 -35
  60. package/dist/npm/tasks/SchedulerTask.js +3 -2
  61. package/dist/npm/tasks/SchedulerViewTask.js +15 -3
  62. package/dist/npm/views/agenda/AgendaView.js +21 -9
  63. package/dist/npm/views/agenda/AgendaViewBody.d.ts +1 -0
  64. package/dist/npm/views/agenda/AgendaViewBody.js +6 -1
  65. package/dist/npm/views/common/SchedulerDrag.js +62 -11
  66. package/dist/npm/views/day/DayView.js +4 -0
  67. package/dist/npm/views/month/MonthView.js +5 -1
  68. package/dist/npm/views/time/MultiDayTimelineView.js +27 -8
  69. package/dist/npm/views/time/TimelineView.js +4 -0
  70. package/dist/npm/views/week/WeekView.js +12 -2
  71. package/dist/npm/views/week/WorkWeekView.js +12 -2
  72. package/package.json +12 -12
@@ -217,110 +217,119 @@ var SchedulerItemVue2 = {
217
217
  // onRelease: this.handleResizeRelease
218
218
  // });
219
219
 
220
- return h("div", {
221
- id: this.$props.id,
222
- attrs: this.v3 ? undefined : {
220
+ return (// <Draggable
221
+ // onPress={this.handlePress}
222
+ // onDrag={this.handleDrag}
223
+ // onRelease={this.handleRelease}
224
+ // ref={'draggable'}
225
+ // >
226
+ // @ts-ignore function children
227
+ h("div", {
223
228
  id: this.$props.id,
229
+ attrs: this.v3 ? undefined : {
230
+ id: this.$props.id,
231
+ tabIndex: this.currentTabIndex,
232
+ // Aria
233
+ "aria-label": this.eventLabel,
234
+ "aria-selected": this.$props.selected // Focus
235
+ ,
236
+ "data-group-index": this.$props.group.index,
237
+ "data-range-index": this.$props.range.index
238
+ },
239
+ style: this.computedStyle,
224
240
  tabIndex: this.currentTabIndex,
225
- // Aria
241
+ "class": this.itemClassName,
226
242
  "aria-label": this.eventLabel,
227
- "aria-selected": this.$props.selected // Focus
243
+ "aria-selected": this.$props.selected,
244
+ onFocus: this.handleFocus,
245
+ on: this.v3 ? undefined : {
246
+ "focus": this.handleFocus,
247
+ "blur": this.handleBlur,
248
+ "mouseup": this.handleMouseUp,
249
+ "mousedown": this.handleMouseDown,
250
+ "click": this.handleClick,
251
+ "mouseover": this.handleMouseOver,
252
+ "mouseout": this.handleMouseOut,
253
+ "mouseenter": this.handleMouseEnter,
254
+ "mouseleave": this.handleMouseLeave,
255
+ "dblclick": this.handleDoubleClick,
256
+ "keydown": this.handleKeyDown,
257
+ "keypress": this.handleKeyPress,
258
+ "keyup": this.handleKeyUp
259
+ },
260
+ onBlur: this.handleBlur // Mouse
228
261
  ,
262
+ onMouseup: this.handleMouseUp,
263
+ onMousedown: this.handleMouseDown,
264
+ onClick: this.handleClick,
265
+ onMouseover: this.handleMouseOver,
266
+ onMouseout: this.handleMouseOut,
267
+ onMouseenter: this.handleMouseEnter,
268
+ onMouseleave: this.handleMouseLeave,
269
+ onDblclick: this.handleDoubleClick // Keyboard
270
+ ,
271
+ onKeydown: this.handleKeyDown,
272
+ onKeypress: this.handleKeyPress,
273
+ onKeyup: this.handleKeyUp,
229
274
  "data-group-index": this.$props.group.index,
230
275
  "data-range-index": this.$props.range.index
231
- },
232
- style: this.computedStyle,
233
- tabIndex: this.currentTabIndex,
234
- "class": this.itemClassName,
235
- "aria-label": this.eventLabel,
236
- "aria-selected": this.$props.selected,
237
- onFocus: this.handleFocus,
238
- on: this.v3 ? undefined : {
239
- "focus": this.handleFocus,
240
- "blur": this.handleBlur,
241
- "mouseup": this.handleMouseUp,
242
- "mousedown": this.handleMouseDown,
243
- "click": this.handleClick,
244
- "mouseover": this.handleMouseOver,
245
- "mouseout": this.handleMouseOut,
246
- "mouseenter": this.handleMouseEnter,
247
- "mouseleave": this.handleMouseLeave,
248
- "dblclick": this.handleDoubleClick,
249
- "keydown": this.handleKeyDown,
250
- "keypress": this.handleKeyPress,
251
- "keyup": this.handleKeyUp
252
- },
253
- onBlur: this.handleBlur // Mouse
254
- ,
255
- onMouseup: this.handleMouseUp,
256
- onMousedown: this.handleMouseDown,
257
- onClick: this.handleClick,
258
- onMouseover: this.handleMouseOver,
259
- onMouseout: this.handleMouseOut,
260
- onMouseenter: this.handleMouseEnter,
261
- onMouseleave: this.handleMouseLeave,
262
- onDblclick: this.handleDoubleClick // Keyboard
263
- ,
264
- onKeydown: this.handleKeyDown,
265
- onKeypress: this.handleKeyPress,
266
- onKeyup: this.handleKeyUp,
267
- "data-group-index": this.$props.group.index,
268
- "data-range-index": this.$props.range.index
269
- }, [!this.$props.resizeHint && h("span", {
270
- "class": "k-event-actions"
271
- }, [this.$props.tail && h("span", {
272
- "class": "k-icon k-i-arrow-60-left"
273
- }), this.$props.isRecurring && !this.$props.isException && h("span", {
274
- "class": "k-icon k-i-reload"
275
- }), !this.$props.isRecurring && this.$props.isException && h("span", {
276
- "class": "k-icon k-i-non-recurrence"
277
- })]), defaultSlot, !this.$props.resizeHint && h("span", {
278
- "class": "k-event-actions"
279
- }, [editable.remove && h("a", {
280
- tabIndex: -1,
281
- attrs: this.v3 ? undefined : {
276
+ }, [!this.$props.resizeHint && h("span", {
277
+ "class": "k-event-actions"
278
+ }, [this.$props.tail && h("span", {
279
+ "class": "k-icon k-i-arrow-60-left"
280
+ }), this.$props.isRecurring && !this.$props.isException && h("span", {
281
+ "class": "k-icon k-i-reload"
282
+ }), !this.$props.isRecurring && this.$props.isException && h("span", {
283
+ "class": "k-icon k-i-non-recurrence"
284
+ })]), defaultSlot, !this.$props.resizeHint && h("span", {
285
+ "class": "k-event-actions"
286
+ }, [editable.remove && h("a", {
282
287
  tabIndex: -1,
288
+ attrs: this.v3 ? undefined : {
289
+ tabIndex: -1,
290
+ "aria-hidden": "true",
291
+ title: deleteMessage,
292
+ "aria-label": deleteMessage
293
+ },
283
294
  "aria-hidden": "true",
295
+ "class": "k-link k-event-delete",
284
296
  title: deleteMessage,
285
- "aria-label": deleteMessage
286
- },
287
- "aria-hidden": "true",
288
- "class": "k-link k-event-delete",
289
- title: deleteMessage,
290
- "aria-label": deleteMessage,
291
- onClick: this.handleRemoveClick,
292
- on: this.v3 ? undefined : {
293
- "click": this.handleRemoveClick
294
- }
295
- }, [h("span", {
296
- "class": "k-icon k-i-close"
297
- })]), this.$props.head && h("span", {
298
- "class": "k-icon k-i-arrow-60-right"
299
- })]), editable.resize && this.$props.vertical && [h("span", {
300
- "class": "k-resize-handle k-resize-n",
301
- ref: this.resizeNorth
302
- }), h("span", {
303
- "class": "k-resize-handle k-resize-s",
304
- ref: this.resizeSouth
305
- })], editable.resize && !this.$props.vertical && [h("span", {
306
- "class": "k-resize-handle k-resize-w",
307
- ref: this.resizeWest
308
- }), h("span", {
309
- "class": "k-resize-handle k-resize-e",
310
- ref: this.resizeEast
311
- })], this.$props.resizeHint && [h("div", {
312
- "class": "k-marquee-color",
313
- style: {
314
- borderColor: this.color,
315
- backgroundColor: this.color
316
- }
317
- }), h("div", {
318
- "class": "k-marquee-text"
319
- }, [!this.$props.tail && h("div", {
320
- "class": "k-label-top"
321
- }, [this.intl.formatDate(this.$props.zonedStart, this.$props.format)]), !this.$props.head && h("div", {
322
- "class": "k-label-bottom"
323
- }, [this.intl.formatDate(this.$props.zonedEnd, this.$props.format)])])]]);
297
+ "aria-label": deleteMessage,
298
+ onClick: this.handleRemoveClick,
299
+ on: this.v3 ? undefined : {
300
+ "click": this.handleRemoveClick
301
+ }
302
+ }, [h("span", {
303
+ "class": "k-icon k-i-close"
304
+ })]), this.$props.head && h("span", {
305
+ "class": "k-icon k-i-arrow-60-right"
306
+ })]), editable.resize && this.$props.vertical && [h("span", {
307
+ "class": "k-resize-handle k-resize-n",
308
+ ref: this.resizeNorth
309
+ }), h("span", {
310
+ "class": "k-resize-handle k-resize-s",
311
+ ref: this.resizeSouth
312
+ })], editable.resize && !this.$props.vertical && [h("span", {
313
+ "class": "k-resize-handle k-resize-w",
314
+ ref: this.resizeWest
315
+ }), h("span", {
316
+ "class": "k-resize-handle k-resize-e",
317
+ ref: this.resizeEast
318
+ })], this.$props.resizeHint && [h("div", {
319
+ "class": "k-marquee-color",
320
+ style: {
321
+ borderColor: this.color,
322
+ backgroundColor: this.color
323
+ }
324
+ }), h("div", {
325
+ "class": "k-marquee-text"
326
+ }, [!this.$props.tail && h("div", {
327
+ "class": "k-label-top"
328
+ }, [this.intl.formatDate(this.$props.zonedStart, this.$props.format)]), !this.$props.head && h("div", {
329
+ "class": "k-label-bottom"
330
+ }, [this.intl.formatDate(this.$props.zonedEnd, this.$props.format)])])]]) // </Draggable>
331
+
332
+ );
324
333
  },
325
334
  methods: {
326
335
  // Focus Handlers
@@ -422,6 +422,12 @@ var SchedulerViewItemVue2 = {
422
422
  align: function align() {
423
423
  var _this = this;
424
424
 
425
+ var element = this.$el.nodeType === 8 ? this.$el.parentElement : this.$el;
426
+
427
+ if (!element) {
428
+ return;
429
+ }
430
+
425
431
  var slots = (this.bv.slots || []).filter(function (slot) {
426
432
  return slot && _this.inSlot(slot.$props, _this.$props);
427
433
  });
@@ -444,12 +450,12 @@ var SchedulerViewItemVue2 = {
444
450
  }
445
451
 
446
452
  var rect = getRect(firstSlot.$el);
447
- setRect(this.$el, rect);
453
+ setRect(element, rect);
448
454
  },
449
455
  position: function position() {
450
456
  var _this = this;
451
457
 
452
- var element = this.$el;
458
+ var element = this.$el.nodeType === 8 ? this.$el.parentElement : this.$el;
453
459
 
454
460
  if (!element) {
455
461
  return;
@@ -1,4 +1,5 @@
1
1
  import { DataItem } from '../../models';
2
+ import { SchedulerEditItemAll } from '../SchedulerEditItem';
2
3
  /**
3
4
  * Represents the available `action` types for the `SchedulerItemDragItemAction` objects.
4
5
  *
@@ -30,9 +31,4 @@ export interface SchedulerItemDragItemAction {
30
31
  payload?: DataItem;
31
32
  }
32
33
  /** @hidden */
33
- export declare const useDragItem: (_config: {
34
- dataItem: DataItem;
35
- ignoreIsAllDay?: boolean;
36
- isAllDay?: boolean;
37
- onDataaction?: any;
38
- }, _state: [DataItem, DataItem, any]) => any[];
34
+ export declare const useDragItem: (this: SchedulerEditItemAll, action: SchedulerItemDragItemAction) => void;
@@ -1,3 +1,23 @@
1
+ var __spreadArrays = this && this.__spreadArrays || function () {
2
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
3
+ s += arguments[i].length;
4
+ }
5
+
6
+ for (var r = Array(s), k = 0, i = 0; i < il; i++) {
7
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
8
+ r[k] = a[j];
9
+ }
10
+ }
11
+
12
+ return r;
13
+ };
14
+
15
+ import { clone } from '@progress/kendo-vue-common'; // import { useSchedulerFieldsContext, useSchedulerGroupsContext,
16
+ // useSchedulerViewSelectedItemsContext } from '../../context';
17
+ // import { useControlledState } from '../../hooks/useControlledState';
18
+
19
+ import { DATA_ACTION } from '../../main';
20
+ import { getField, setField, slotDive } from '../../utils';
1
21
  /**
2
22
  * Represents the available `action` types for the `SchedulerItemDragItemAction` objects.
3
23
  *
@@ -11,6 +31,7 @@
11
31
  * - `DRAG_ITEM_RESET'`
12
32
  * - `DRAG_ITEM_DRAG_SELECTED`
13
33
  */
34
+
14
35
  export var DRAG_ITEM_ACTION;
15
36
 
16
37
  (function (DRAG_ITEM_ACTION) {
@@ -23,160 +44,214 @@ export var DRAG_ITEM_ACTION;
23
44
  DRAG_ITEM_ACTION["reset"] = "DRAG_ITEM_RESET";
24
45
  DRAG_ITEM_ACTION["dragSelected"] = "DRAG_ITEM_DRAG_SELECTED";
25
46
  })(DRAG_ITEM_ACTION || (DRAG_ITEM_ACTION = {}));
47
+
48
+ var offset = 0;
49
+ var initialXRef = 0;
50
+ var initialYRef = 0;
51
+ var oldSlot = null;
26
52
  /** @hidden */
27
53
 
54
+ export var useDragItem = function useDragItem(action) {
55
+ var _this = this;
56
+
57
+ var dataItem = clone(this.dataItem);
58
+
59
+ switch (action.type) {
60
+ case DRAG_ITEM_ACTION.set:
61
+ {
62
+ this.currentDragItem = action.payload;
63
+ break;
64
+ }
65
+
66
+ case DRAG_ITEM_ACTION.reset:
67
+ {
68
+ this.currentDragItem = null;
69
+ break;
70
+ }
71
+
72
+ case DRAG_ITEM_ACTION.dragSelected:
73
+ {
74
+ if (Math.abs(initialXRef - action.payload.x) < 10 && Math.abs(initialYRef - action.payload.y) < 10) {
75
+ return;
76
+ }
77
+
78
+ var slot = slotDive(action.payload.x, action.payload.y, 7);
79
+
80
+ if (!slot) {
81
+ return;
82
+ }
83
+
84
+ if (slot === oldSlot) {
85
+ return;
86
+ }
87
+
88
+ var slotStart = slot.getAttribute('data-slot-start');
89
+ var slotIsAllDay = slot.getAttribute('data-slot-allday') === 'true';
90
+
91
+ if (!this.ignoreIsAllDay && slotIsAllDay !== this.isAllDay) {
92
+ return;
93
+ }
94
+
95
+ var itemStart = new Date(getField(dataItem, this.ks.fields.start));
96
+ var distance_1 = Number(slotStart) - itemStart.getTime();
97
+ var newDragItems = this.bv.selectedItems.map(function (si) {
98
+ if (!si) {
99
+ return null;
100
+ }
101
+
102
+ var selectedDataItem = clone(si.props.dataItem);
103
+ var selectedStart = new Date(si.props.start.getTime() + distance_1);
104
+ var selectedEnd = new Date(si.props.end.getTime() + distance_1);
105
+ setField(selectedDataItem, _this.ks.fields.start, selectedStart);
106
+ setField(selectedDataItem, _this.ks.fields.end, selectedEnd);
107
+ return selectedDataItem;
108
+ }).filter(Boolean);
109
+ oldSlot = slot;
110
+ this.currentDragItem = __spreadArrays(newDragItems);
111
+ break;
112
+ }
113
+
114
+ case DRAG_ITEM_ACTION.start:
115
+ {
116
+ var clientX = action.payload.x;
117
+ var clientY = action.payload.y;
118
+ initialXRef = clientX;
119
+ initialYRef = clientY;
120
+ var slot = slotDive(clientX, clientY, 7);
121
+
122
+ if (!slot) {
123
+ return;
124
+ }
125
+
126
+ var slotStart = slot.getAttribute('data-slot-start');
127
+ var itemStart = getField(dataItem, this.ks.fields.start);
128
+
129
+ if (slotStart === null) {
130
+ return;
131
+ }
132
+
133
+ offset = Number(slotStart) - new Date(itemStart).getTime();
134
+ break;
135
+ }
136
+
137
+ case DRAG_ITEM_ACTION.drag:
138
+ {
139
+ if (Math.abs(initialXRef - action.payload.x) < 10 && Math.abs(initialYRef - action.payload.y) < 10) {
140
+ return;
141
+ }
142
+
143
+ var slot = slotDive(action.payload.x, action.payload.y, 7);
144
+
145
+ if (!slot) {
146
+ return;
147
+ }
148
+
149
+ if (slot === oldSlot) {
150
+ return;
151
+ }
152
+
153
+ var slotStart = slot.getAttribute('data-slot-start');
154
+ var slotGroupIndex_1 = slot.getAttribute('data-slot-group');
155
+ var slotIsAllDay = slot.getAttribute('data-slot-allday') === 'true';
156
+
157
+ if (!this.ignoreIsAllDay && slotIsAllDay !== this.isAllDay) {
158
+ return;
159
+ }
160
+
161
+ var itemStart = new Date(getField(dataItem, this.ks.fields.start));
162
+ var itemEnd = new Date(getField(dataItem, this.ks.fields.end));
163
+ var duration = itemEnd.getTime() - itemStart.getTime();
164
+ var start = new Date(Number(slotStart) - Number(offset));
165
+ var end = new Date(Number(slotStart) - Number(offset) + duration);
166
+ var group = this.ks.groups.find(function (g) {
167
+ return g.index === Number(slotGroupIndex_1);
168
+ });
169
+ setField(dataItem, this.ks.fields.start, start);
170
+ setField(dataItem, this.ks.fields.end, end);
171
+
172
+ if (group && this.ks.groups.length > 1) {
173
+ group.resources.forEach(function (resource) {
174
+ if (!resource.multiple) {
175
+ setField(dataItem, resource.field, resource[resource.valueField]);
176
+ }
177
+ });
178
+ }
179
+
180
+ oldSlot = slot;
181
+
182
+ if (dataItem) {
183
+ this.currentDragItem = dataItem;
184
+ }
185
+
186
+ break;
187
+ }
188
+
189
+ case DRAG_ITEM_ACTION.complete:
190
+ {
191
+ this.currentDragItem = null;
192
+
193
+ if (this.compDragItem) {
194
+ this.$emit('dataaction', {
195
+ type: DATA_ACTION.update,
196
+ series: false,
197
+ dataItem: this.compDragItem
198
+ });
199
+ }
200
+
201
+ break;
202
+ }
203
+
204
+ case DRAG_ITEM_ACTION.completeOccurrence:
205
+ {
206
+ var newDataItem = Array.isArray(this.compDragItem) ? this.compDragItem.slice() : clone(this.compDragItem);
207
+ this.currentDragItem = null;
208
+
209
+ if (this.compDragItem) {
210
+ this.$emit('dataaction', {
211
+ type: DATA_ACTION.update,
212
+ series: false,
213
+ dataItem: newDataItem
214
+ });
215
+ }
216
+
217
+ break;
218
+ }
219
+
220
+ case DRAG_ITEM_ACTION.completeSeries:
221
+ {
222
+ var newDataItems = void 0;
223
+
224
+ if (Array.isArray(this.compDragItem)) {
225
+ newDataItems = this.compDragItem.map(function (di) {
226
+ var updated = clone(di);
227
+ setField(updated, _this.ks.fields.start, getField(di, _this.ks.fields.start));
228
+ setField(updated, _this.ks.fields.end, getField(di, _this.ks.fields.end));
229
+ return updated;
230
+ });
231
+ } else {
232
+ var updated = clone(this.compDragItem);
233
+ setField(updated, this.ks.fields.start, getField(this.compDragItem, this.ks.fields.start));
234
+ setField(updated, this.ks.fields.end, getField(this.compDragItem, this.ks.fields.end));
235
+ newDataItems = updated;
236
+ }
237
+
238
+ this.currentDragItem = null;
239
+
240
+ if (newDataItems) {
241
+ this.$emit('dataaction', {
242
+ type: DATA_ACTION.update,
243
+ series: true,
244
+ dataItem: newDataItems
245
+ });
246
+ }
247
+
248
+ break;
249
+ }
250
+
251
+ default:
252
+ this.currentDragItem = this.compDragItem;
253
+ break;
254
+ }
28
255
 
29
- export var useDragItem = function useDragItem(_config, _state) {
30
- // const offset = React.useRef<number>(0);
31
- // const initialXRef = React.useRef<number>(0);
32
- // const initialYRef = React.useRef<number>(0);
33
- // const oldSlot = React.useRef<HTMLElement | null>(null);
34
- // const [dragItem, setDragItem] = useControlledState<DataItem | null | (DataItem | null)[]>(...state);
35
- // const [selectedItems] = useSchedulerViewSelectedItemsContext();
36
- // const fields = useSchedulerFieldsContext();
37
- // const groups = useSchedulerGroupsContext();
38
- // const handleDragItemAction = (action: SchedulerItemDragItemAction) => {
39
- // switch(action.type) {
40
- // case DRAG_ITEM_ACTION.set:{
41
- // setDragItem(action.payload);
42
- // break;
43
- // }
44
- // case DRAG_ITEM_ACTION.reset:{
45
- // setDragItem(null);
46
- // break;
47
- // }
48
- // case DRAG_ITEM_ACTION.dragSelected: {
49
- // if (
50
- // Math.abs(initialXRef.current - action.payload.x) < 10
51
- // && Math.abs(initialYRef.current - action.payload.y) < 10
52
- // ) {
53
- // return;
54
- // }
55
- // const slot: HTMLElement | null = slotDive(action.payload.x, action.payload.y, 7);
56
- // if (!slot) { return; }
57
- // if (slot === oldSlot.current) { return; }
58
- // const dataItem = clone(config.dataItem);
59
- // const slotStart = slot.getAttribute('data-slot-start');
60
- // const slotIsAllDay = slot.getAttribute('data-slot-allday') === 'true';
61
- // if (!config.ignoreIsAllDay && slotIsAllDay !== config.isAllDay) { return; }
62
- // const itemStart = new Date(getField(dataItem, fields.start));
63
- // const distance = Number(slotStart) - itemStart.getTime();
64
- // const newDragItems = selectedItems.map((si) => {
65
- // if(!si.current) {return null;}
66
- // const selectedDataItem = clone(si.current.props.dataItem);
67
- // const selectedStart = new Date(si.current.props.start.getTime() + distance);
68
- // const selectedEnd = new Date(si.current.props.end.getTime() + distance);
69
- // setField(selectedDataItem, fields.start, selectedStart);
70
- // setField(selectedDataItem, fields.end, selectedEnd);
71
- // return selectedDataItem;
72
- // }).filter(Boolean);
73
- // oldSlot.current = slot;
74
- // setDragItem([...newDragItems]);
75
- // break;
76
- // }
77
- // case DRAG_ITEM_ACTION.start: {
78
- // const clientX = action.payload.x;
79
- // const clientY = action.payload.y;
80
- // initialXRef.current = clientX;
81
- // initialYRef.current = clientY;
82
- // const slot: HTMLElement | null = slotDive(clientX, clientY, 7);
83
- // if (!slot) { return; }
84
- // const dataItem = clone(config.dataItem);
85
- // const slotStart = slot.getAttribute('data-slot-start');
86
- // const itemStart = getField(dataItem, fields.start);
87
- // if (slotStart === null) { return; }
88
- // offset.current = Number(slotStart) - new Date(itemStart).getTime();
89
- // break;
90
- // }
91
- // case DRAG_ITEM_ACTION.drag: {
92
- // if (
93
- // Math.abs(initialXRef.current - action.payload.x) < 10
94
- // && Math.abs(initialYRef.current - action.payload.y) < 10
95
- // ) {
96
- // return;
97
- // }
98
- // const slot: HTMLElement | null = slotDive(action.payload.x, action.payload.y, 7);
99
- // if (!slot) { return; }
100
- // if (slot === oldSlot.current) { return; }
101
- // const dataItem = clone(config.dataItem);
102
- // const slotStart = slot.getAttribute('data-slot-start');
103
- // const slotGroupIndex = slot.getAttribute('data-slot-group');
104
- // const slotIsAllDay = slot.getAttribute('data-slot-allday') === 'true';
105
- // if (!config.ignoreIsAllDay && slotIsAllDay !== config.isAllDay) { return; }
106
- // const itemStart = new Date(getField(dataItem, fields.start));
107
- // const itemEnd = new Date(getField(dataItem, fields.end));
108
- // const duration = itemEnd.getTime() - itemStart.getTime();
109
- // const start = new Date(Number(slotStart) - Number(offset.current));
110
- // const end = new Date(Number(slotStart) - Number(offset.current) + duration);
111
- // const group = groups.find((g) => g.index === Number(slotGroupIndex));
112
- // setField(dataItem, fields.start, start);
113
- // setField(dataItem, fields.end, end);
114
- // if (group && groups.length > 1) {
115
- // group.resources.forEach((resource) => {
116
- // if (!resource.multiple) {
117
- // setField(dataItem, resource.field, resource[resource.valueField]);
118
- // }
119
- // });
120
- // }
121
- // oldSlot.current = slot;
122
- // if (dataItem) {
123
- // setDragItem(dataItem);
124
- // }
125
- // break;
126
- // }
127
- // case DRAG_ITEM_ACTION.complete: {
128
- // setDragItem(null);
129
- // if(config.onDataAction && dragItem) {
130
- // config.onDataAction.call(undefined,{
131
- // type: DATA_ACTION.update,
132
- // series: false,
133
- // dataItem: dragItem
134
- // });
135
- // }
136
- // break;
137
- // }
138
- // case DRAG_ITEM_ACTION.completeOccurrence: {
139
- // const newDataItem = Array.isArray(dragItem) ? dragItem.slice() : clone(dragItem);
140
- // setDragItem(null);
141
- // if(config.onDataAction && dragItem) {
142
- // config.onDataAction.call(undefined,{
143
- // type: DATA_ACTION.update,
144
- // series: false,
145
- // dataItem: newDataItem
146
- // });
147
- // }
148
- // break;
149
- // }
150
- // case DRAG_ITEM_ACTION.completeSeries: {
151
- // let newDataItems;
152
- // if(Array.isArray(dragItem)) {
153
- // newDataItems = dragItem.map((di) => {
154
- // const updated = clone(di);
155
- // setField(updated, fields.start, getField(di, fields.start));
156
- // setField(updated, fields.end, getField(di, fields.end));
157
- // return updated;
158
- // });
159
- // } else {
160
- // const updated = clone(dragItem);
161
- // setField(updated, fields.start, getField(dragItem, fields.start));
162
- // setField(updated, fields.end, getField(dragItem, fields.end));
163
- // newDataItems = updated;
164
- // }
165
- // setDragItem(null);
166
- // if(config.onDataAction && newDataItems) {
167
- // config.onDataAction.call(undefined,{
168
- // type: DATA_ACTION.update,
169
- // series: true,
170
- // dataItem: newDataItems
171
- // });
172
- // }
173
- // break;
174
- // }
175
- // default:
176
- // setDragItem(dragItem);
177
- // break;
178
- // }
179
- // };
180
- // return [dragItem, setDragItem, handleDragItemAction];
181
- return [];
256
+ this.$emit('dragitemchange', this.currentDragItem);
182
257
  };
@@ -23,5 +23,6 @@ export declare type SchedulerItemShowOccurrenceDialogAction = {
23
23
  type: SHOW_OCCURRENCE_DIALOG_ACTION;
24
24
  payload?: boolean;
25
25
  };
26
+ export declare const showOccurrenceDialogReducer: (state: any, action: SchedulerItemShowOccurrenceDialogAction) => any;
26
27
  /** @hidden */
27
28
  export declare const useShowOccurrenceDialog: (_defaultProp: DataItem, _prop?: DataItem, _callback?: any) => any[];