@progress/kendo-vue-scheduler 3.8.3 → 3.8.4-dev.202302151437

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 (56) hide show
  1. package/dist/cdn/js/kendo-vue-scheduler.js +1 -1
  2. package/dist/es/components/BaseView.js +1 -2
  3. package/dist/es/components/CurrentTimeMarker.js +4 -3
  4. package/dist/es/components/CurrentTimeMarkerArrow.js +4 -3
  5. package/dist/es/hooks/useSlotExpand.js +1 -2
  6. package/dist/es/items/SchedulerEditItem.js +4 -4
  7. package/dist/es/items/SchedulerViewItem.js +15 -14
  8. package/dist/es/package-metadata.js +1 -1
  9. package/dist/es/slots/SchedulerEditSlot.js +17 -11
  10. package/dist/es/slots/SchedulerSlot.js +32 -40
  11. package/dist/es/slots/SchedulerViewSlot.js +8 -0
  12. package/dist/es/views/agenda/AgendaViewBody.js +45 -23
  13. package/dist/es/views/day/DayViewAllDaySlots.js +72 -41
  14. package/dist/es/views/day/DayViewMiddleRow.js +73 -43
  15. package/dist/es/views/day/DayViewVerticalRow.js +70 -43
  16. package/dist/es/views/day/DayViewVerticalSlotsRow.js +74 -44
  17. package/dist/es/views/month/MonthViewBody.js +50 -23
  18. package/dist/es/views/month/MonthViewHead.js +29 -4
  19. package/dist/es/views/time/TimelineViewBody.js +71 -43
  20. package/dist/esm/components/BaseView.js +1 -2
  21. package/dist/esm/components/CurrentTimeMarker.js +4 -3
  22. package/dist/esm/components/CurrentTimeMarkerArrow.js +4 -3
  23. package/dist/esm/hooks/useSlotExpand.js +1 -2
  24. package/dist/esm/items/SchedulerEditItem.js +4 -4
  25. package/dist/esm/items/SchedulerViewItem.js +15 -14
  26. package/dist/esm/package-metadata.js +1 -1
  27. package/dist/esm/slots/SchedulerEditSlot.js +17 -11
  28. package/dist/esm/slots/SchedulerSlot.js +32 -40
  29. package/dist/esm/slots/SchedulerViewSlot.js +8 -0
  30. package/dist/esm/views/agenda/AgendaViewBody.js +45 -23
  31. package/dist/esm/views/day/DayViewAllDaySlots.js +72 -41
  32. package/dist/esm/views/day/DayViewMiddleRow.js +73 -43
  33. package/dist/esm/views/day/DayViewVerticalRow.js +70 -43
  34. package/dist/esm/views/day/DayViewVerticalSlotsRow.js +74 -44
  35. package/dist/esm/views/month/MonthViewBody.js +50 -23
  36. package/dist/esm/views/month/MonthViewHead.js +29 -4
  37. package/dist/esm/views/time/TimelineViewBody.js +71 -43
  38. package/dist/npm/components/BaseView.js +1 -2
  39. package/dist/npm/components/CurrentTimeMarker.js +4 -3
  40. package/dist/npm/components/CurrentTimeMarkerArrow.js +4 -3
  41. package/dist/npm/hooks/useSlotExpand.js +1 -2
  42. package/dist/npm/items/SchedulerEditItem.js +4 -4
  43. package/dist/npm/items/SchedulerViewItem.js +15 -14
  44. package/dist/npm/package-metadata.js +1 -1
  45. package/dist/npm/slots/SchedulerEditSlot.js +17 -11
  46. package/dist/npm/slots/SchedulerSlot.js +32 -40
  47. package/dist/npm/slots/SchedulerViewSlot.js +8 -0
  48. package/dist/npm/views/agenda/AgendaViewBody.js +48 -26
  49. package/dist/npm/views/day/DayViewAllDaySlots.js +72 -41
  50. package/dist/npm/views/day/DayViewMiddleRow.js +75 -45
  51. package/dist/npm/views/day/DayViewVerticalRow.js +70 -43
  52. package/dist/npm/views/day/DayViewVerticalSlotsRow.js +76 -46
  53. package/dist/npm/views/month/MonthViewBody.js +50 -23
  54. package/dist/npm/views/month/MonthViewHead.js +29 -4
  55. package/dist/npm/views/time/TimelineViewBody.js +73 -45
  56. package/package.json +12 -12
@@ -76,6 +76,9 @@ var SchedulerSlotVue2 = {
76
76
  formItem: Object
77
77
  },
78
78
  computed: {
79
+ cSlot: function cSlot() {
80
+ return this.ksSlots.cSlots ? this.ksSlots.cSlots[this.index] : {};
81
+ },
79
82
  currentTabIndex: function currentTabIndex() {
80
83
  return this.$props.tabIndex !== undefined ? this.$props.tabIndex === null ? undefined : this.$props.tabIndex : this.$props.selected ? 0 : -1;
81
84
  },
@@ -111,14 +114,11 @@ var SchedulerSlotVue2 = {
111
114
  },
112
115
  ksEditFormClose: {
113
116
  default: null
117
+ },
118
+ ksSlots: {
119
+ default: {}
114
120
  }
115
121
  },
116
- created: function created() {
117
- this.setSlots({
118
- type: COLLECTION_ACTION.add,
119
- item: this
120
- });
121
- },
122
122
  data: function data() {
123
123
  return {
124
124
  hasMounted: false
@@ -126,17 +126,8 @@ var SchedulerSlotVue2 = {
126
126
  },
127
127
  mounted: function mounted() {
128
128
  this.hasMounted = true;
129
- },
130
- destroyed: !!isV3 ? undefined : function () {
131
129
  this.setSlots({
132
- type: COLLECTION_ACTION.remove,
133
- item: this
134
- });
135
- },
136
- // @ts-ignore
137
- unmounted: function unmounted() {
138
- this.setSlots({
139
- type: COLLECTION_ACTION.remove,
130
+ type: COLLECTION_ACTION.add,
140
131
  item: this
141
132
  });
142
133
  },
@@ -153,6 +144,7 @@ var SchedulerSlotVue2 = {
153
144
  this.intl = provideIntlService(this);
154
145
  var defaultSlot = getDefaultSlots(this);
155
146
  return h("div", {
147
+ // key={`${this.cSlot.start.getTime()}:${this.cSlot.group.index}`}
156
148
  id: this.$props.id,
157
149
  attrs: this.v3 ? undefined : {
158
150
  id: this.$props.id,
@@ -161,12 +153,12 @@ var SchedulerSlotVue2 = {
161
153
  ,
162
154
 
163
155
  "data-slot": true,
164
- "data-slot-allday": this.$props.isAllDay,
165
- "data-slot-start": this.$props.start.getTime(),
166
- "data-slot-end": this.$props.end.getTime(),
167
- "data-slot-group": this.$props.group.index,
168
- "data-slot-range": this.$props.range.index,
169
- "data-slot-index": this.$props.index
156
+ "data-slot-allday": this.cSlot.isAllDay,
157
+ "data-slot-start": this.cSlot.start.getTime(),
158
+ "data-slot-end": this.cSlot.end.getTime(),
159
+ "data-slot-group": this.cSlot.group.index,
160
+ "data-slot-range": this.cSlot.range.index,
161
+ "data-slot-index": this.cSlot.index
170
162
  },
171
163
  style: {
172
164
  userSelect: 'none'
@@ -202,15 +194,15 @@ var SchedulerSlotVue2 = {
202
194
  onKeypress: this.handleKeyPress,
203
195
  onKeyup: this.handleKeyUp,
204
196
  "data-slot": true,
205
- "data-slot-allday": this.$props.isAllDay,
206
- "data-slot-start": this.$props.start.getTime(),
207
- "data-slot-end": this.$props.end.getTime(),
208
- "data-slot-group": this.$props.group.index,
209
- "data-slot-range": this.$props.range.index,
210
- "data-slot-index": this.$props.index
197
+ "data-slot-allday": this.cSlot.isAllDay,
198
+ "data-slot-start": this.cSlot.start.getTime(),
199
+ "data-slot-end": this.cSlot.end.getTime(),
200
+ "data-slot-group": this.cSlot.group.index,
201
+ "data-slot-range": this.cSlot.range.index,
202
+ "data-slot-index": this.cSlot.index
211
203
  }, [this.navDay && h("span", {
212
204
  "class": "k-link k-nav-day"
213
- }, [this.intl.formatDate(new Date(this.end.getTime() - (this.end.getTime() - this.start.getTime()) / 2), DAY_FORMAT)]), this.hasMounted && this.itemsPerSlot < this.items.length && h(ShowMoreItemsButton, {
205
+ }, [this.intl.formatDate(new Date(this.cSlot.end.getTime() - (this.cSlot.end.getTime() - this.cSlot.start.getTime()) / 2), DAY_FORMAT)]), this.hasMounted && this.itemsPerSlot < this.cSlot.items.length && h(ShowMoreItemsButton, {
214
206
  onClick: this.handleShowMoreItemsClick,
215
207
  on: this.v3 ? undefined : {
216
208
  "click": this.handleShowMoreItemsClick
@@ -238,7 +230,7 @@ var SchedulerSlotVue2 = {
238
230
  this.$emit('focus', {
239
231
  event: event,
240
232
  target: {
241
- props: __assign({}, this.$props),
233
+ props: __assign({}, this.cSlot),
242
234
  element: this.$el
243
235
  }
244
236
  });
@@ -247,7 +239,7 @@ var SchedulerSlotVue2 = {
247
239
  this.$emit('blur', {
248
240
  event: event,
249
241
  target: {
250
- props: __assign({}, this.$props),
242
+ props: __assign({}, this.cSlot),
251
243
  element: this.$el
252
244
  }
253
245
  });
@@ -256,7 +248,7 @@ var SchedulerSlotVue2 = {
256
248
  var args = {
257
249
  event: event,
258
250
  target: {
259
- props: __assign({}, this.$props),
251
+ props: __assign({}, this.cSlot),
260
252
  element: this.$el
261
253
  }
262
254
  };
@@ -267,7 +259,7 @@ var SchedulerSlotVue2 = {
267
259
  this.$emit('mouseover', {
268
260
  event: event,
269
261
  target: {
270
- props: __assign({}, this.$props),
262
+ props: __assign({}, this.cSlot),
271
263
  element: this.$el
272
264
  }
273
265
  });
@@ -276,7 +268,7 @@ var SchedulerSlotVue2 = {
276
268
  this.$emit('mouseout', {
277
269
  event: event,
278
270
  target: {
279
- props: __assign({}, this.$props),
271
+ props: __assign({}, this.cSlot),
280
272
  element: this.$el
281
273
  }
282
274
  });
@@ -285,7 +277,7 @@ var SchedulerSlotVue2 = {
285
277
  this.$emit('mouseenter', {
286
278
  event: event,
287
279
  target: {
288
- props: __assign({}, this.$props),
280
+ props: __assign({}, this.cSlot),
289
281
  element: this.$el
290
282
  }
291
283
  });
@@ -294,7 +286,7 @@ var SchedulerSlotVue2 = {
294
286
  this.$emit('mouseleave', {
295
287
  event: event,
296
288
  target: {
297
- props: __assign({}, this.$props),
289
+ props: __assign({}, this.cSlot),
298
290
  element: this.$el
299
291
  }
300
292
  });
@@ -303,7 +295,7 @@ var SchedulerSlotVue2 = {
303
295
  var args = {
304
296
  event: event,
305
297
  target: {
306
- props: __assign({}, this.$props),
298
+ props: __assign({}, this.cSlot),
307
299
  element: this.$el
308
300
  }
309
301
  };
@@ -314,7 +306,7 @@ var SchedulerSlotVue2 = {
314
306
  this.$emit('keydown', {
315
307
  event: event,
316
308
  target: {
317
- props: __assign({}, this.$props),
309
+ props: __assign({}, this.cSlot),
318
310
  element: this.$el
319
311
  }
320
312
  });
@@ -323,7 +315,7 @@ var SchedulerSlotVue2 = {
323
315
  this.$emit('keypress', {
324
316
  event: event,
325
317
  target: {
326
- props: __assign({}, this.$props),
318
+ props: __assign({}, this.cSlot),
327
319
  element: this.$el
328
320
  }
329
321
  });
@@ -332,7 +324,7 @@ var SchedulerSlotVue2 = {
332
324
  this.$emit('keyup', {
333
325
  event: event,
334
326
  target: {
335
- props: __assign({}, this.$props),
327
+ props: __assign({}, this.cSlot),
336
328
  element: this.$el
337
329
  }
338
330
  });
@@ -63,6 +63,9 @@ var SchedulerViewSlotVue2 = {
63
63
  },
64
64
  bv: {
65
65
  default: null
66
+ },
67
+ ksSlots: {
68
+ default: {}
66
69
  }
67
70
  },
68
71
  data: function data() {
@@ -70,6 +73,11 @@ var SchedulerViewSlotVue2 = {
70
73
  timeout: undefined
71
74
  };
72
75
  },
76
+ computed: {
77
+ cSlot: function cSlot() {
78
+ return this.ksSlots.cSlots ? this.ksSlots.cSlots[this.index] : {};
79
+ }
80
+ },
73
81
  updated: function updated() {
74
82
  var that = this;
75
83
  this.$nextTick(function () {
@@ -3,6 +3,7 @@ import * as Vue from 'vue';
3
3
  var allVue = Vue;
4
4
  var gh = allVue.h;
5
5
  var isV3 = allVue.version && allVue.version[0] === '3';
6
+ import { COLLECTION_ACTION } from '../../utils/main.js';
6
7
  import { SchedulerEditSlot } from '../../slots/SchedulerEditSlot.js';
7
8
  import { provideIntlService, provideLocalizationService } from '@progress/kendo-vue-intl';
8
9
  import { SchedulerEditTask } from '../../tasks/SchedulerEditTask.js';
@@ -34,13 +35,53 @@ var AgendaViewBodyVue2 = {
34
35
  },
35
36
  kendoLocalizationService: {
36
37
  default: null
38
+ },
39
+ setSlots: {
40
+ default: null
37
41
  }
38
42
  },
43
+ provide: function provide() {
44
+ return {
45
+ ksSlots: this.ksSlots
46
+ };
47
+ },
39
48
  data: function data() {
49
+ var _this = this;
40
50
  return {
41
- hasMounted: false
51
+ hasMounted: false,
52
+ ksSlots: {
53
+ cSlots: this.agendaSlots.filter(function (slot) {
54
+ return slot.group.index === (_this.ri.groupIndex || 0);
55
+ })
56
+ }
42
57
  };
43
58
  },
59
+ watch: {
60
+ currentCellSlots: function currentCellSlots(newValue) {
61
+ this.ksSlots.cSlots = newValue;
62
+ }
63
+ },
64
+ computed: {
65
+ currentCellSlots: function currentCellSlots() {
66
+ var _this = this;
67
+ return this.agendaSlots.filter(function (slot) {
68
+ return slot.group.index === (_this.ri.groupIndex || 0);
69
+ });
70
+ }
71
+ },
72
+ destroyed: !!isV3 ? undefined : function () {
73
+ this.setSlots({
74
+ type: COLLECTION_ACTION.remove,
75
+ item: this
76
+ });
77
+ },
78
+ // @ts-ignore
79
+ unmounted: function unmounted() {
80
+ this.setSlots({
81
+ type: COLLECTION_ACTION.remove,
82
+ item: this
83
+ });
84
+ },
44
85
  mounted: function mounted() {
45
86
  this.hasMounted = true;
46
87
  },
@@ -53,7 +94,6 @@ var AgendaViewBodyVue2 = {
53
94
  },
54
95
  // @ts-ignore
55
96
  render: function render(createElement) {
56
- var _this = this;
57
97
  var h = gh || createElement;
58
98
  this.intl = provideIntlService(this);
59
99
  var EditSlot = this.$props.editSlot || SchedulerEditSlot;
@@ -61,9 +101,7 @@ var AgendaViewBodyVue2 = {
61
101
  var localization = provideLocalizationService(this);
62
102
  return h("div", {
63
103
  "class": "k-scheduler-body"
64
- }, [this.items.length && this.agendaSlots.filter(function (slot) {
65
- return slot.group.index === (_this.ri.groupIndex || 0);
66
- }).map(function (slot, slotIndex, filtered) {
104
+ }, [this.currentCellSlots.map(function (slot, slotIndex, filtered) {
67
105
  var _this2 = this;
68
106
  return h("div", {
69
107
  "class": "k-scheduler-row k-scheduler-content",
@@ -71,30 +109,14 @@ var AgendaViewBodyVue2 = {
71
109
  }, [
72
110
  // @ts-ignore function children
73
111
  h(EditSlot, {
74
- index: slot.index,
112
+ index: slotIndex,
75
113
  attrs: this.v3 ? undefined : {
76
- index: slot.index,
77
- start: slot.start,
78
- end: slot.end,
79
- zonedStart: slot.zonedStart,
80
- zonedEnd: slot.zonedEnd,
81
- items: slot.items,
82
- group: slot.group,
83
- range: slot.range,
84
- isAllDay: slot.isAllDay,
114
+ index: slotIndex,
85
115
  editable: this.$props.editable,
86
116
  row: filtered.length * (this.ri.groupIndex || 0) + slotIndex,
87
117
  col: 0,
88
118
  viewSlot: this.$props.viewSlot
89
119
  },
90
- start: slot.start,
91
- end: slot.end,
92
- zonedStart: slot.zonedStart,
93
- zonedEnd: slot.zonedEnd,
94
- items: slot.items,
95
- group: slot.group,
96
- range: slot.range,
97
- isAllDay: slot.isAllDay,
98
120
  editable: this.$props.editable,
99
121
  row: filtered.length * (this.ri.groupIndex || 0) + slotIndex,
100
122
  col: 0,
@@ -4,6 +4,7 @@ var allVue = Vue;
4
4
  var gh = allVue.h;
5
5
  var isV3 = allVue.version && allVue.version[0] === '3';
6
6
  var inject = allVue.inject;
7
+ import { COLLECTION_ACTION } from '../../utils/main.js';
7
8
  import { SchedulerEditSlot } from '../../slots/SchedulerEditSlot.js';
8
9
  /** @hidden */
9
10
  var DayViewAllDaySlotsVue2 = {
@@ -27,8 +28,50 @@ var DayViewAllDaySlotsVue2 = {
27
28
  },
28
29
  ks: {
29
30
  default: null
31
+ },
32
+ setSlots: {
33
+ default: null
34
+ }
35
+ },
36
+ provide: function provide() {
37
+ return {
38
+ ksSlots: this.ksSlots
39
+ };
40
+ },
41
+ data: function data() {
42
+ var daySlots = this.daySlots;
43
+ var groupIndex = this.groupIndex !== undefined ? this.groupIndex : this.ri.groupIndex;
44
+ return {
45
+ ksSlots: {
46
+ cSlots: this.calculateRanges(daySlots, groupIndex, this.dayRanges)
47
+ }
48
+ };
49
+ },
50
+ watch: {
51
+ currentCellSlots: function currentCellSlots(newValue) {
52
+ this.ksSlots.cSlots = newValue;
53
+ }
54
+ },
55
+ computed: {
56
+ currentCellSlots: function currentCellSlots() {
57
+ var daySlots = this.daySlots;
58
+ var groupIndex = this.groupIndex !== undefined ? this.groupIndex : this.ri.groupIndex;
59
+ return this.calculateRanges(daySlots, groupIndex, this.dayRanges);
30
60
  }
31
61
  },
62
+ destroyed: !!isV3 ? undefined : function () {
63
+ this.setSlots({
64
+ type: COLLECTION_ACTION.remove,
65
+ item: this
66
+ });
67
+ },
68
+ // @ts-ignore
69
+ unmounted: function unmounted() {
70
+ this.setSlots({
71
+ type: COLLECTION_ACTION.remove,
72
+ item: this
73
+ });
74
+ },
32
75
  // @ts-ignore
33
76
  setup: !isV3 ? undefined : function () {
34
77
  var v3 = !!isV3;
@@ -47,59 +90,47 @@ var DayViewAllDaySlotsVue2 = {
47
90
  return h("div", {
48
91
  key: groupIndex,
49
92
  "class": "k-scheduler-row"
50
- }, [this.dayRanges.map(function (_, rangeIndex) {
51
- return this.daySlots.filter(function (s) {
52
- return s.group.index === groupIndex && s.range.index === rangeIndex;
53
- }).map(function (slot, slotIndex, filtered) {
54
- return h(SchedulerEditSlot, {
55
- index: slot.index,
56
- attrs: this.v3 ? undefined : {
57
- index: slot.index,
58
- start: slot.start,
59
- end: slot.end,
60
- zonedStart: slot.zonedStart,
61
- zonedEnd: slot.zonedEnd,
62
- items: slot.items,
63
- group: slot.group,
64
- range: slot.range,
65
- isAllDay: slot.isAllDay,
66
- form: this.$props.form,
67
- slotRender: this.$props.slotRender,
68
- viewSlot: this.$props.viewSlot,
69
- row: 0,
70
- col: this.ks.orientation === 'horizontal' ? filtered.length * (groupIndex || 0) + slotIndex : slotIndex,
71
- isWorkDay: 0 <= slot.zonedStart.getDay() + (numberOfDays - workWeekStart) && (slot.zonedStart.getDay() + (numberOfDays - workWeekStart)) % numberOfDays <= workWeekEnd + (numberOfDays - workWeekStart),
72
- expandable: true,
73
- editable: this.$props.editable
74
- },
75
- start: slot.start,
76
- end: slot.end,
77
- zonedStart: slot.zonedStart,
78
- zonedEnd: slot.zonedEnd,
79
- items: slot.items,
80
- group: slot.group,
81
- range: slot.range,
82
- isAllDay: slot.isAllDay,
83
- onDataaction: this.handleDataAction,
84
- on: this.v3 ? undefined : {
85
- "dataaction": this.handleDataAction
86
- },
93
+ }, [this.currentCellSlots.map(function (slot, slotIndex, filtered) {
94
+ return h(SchedulerEditSlot, {
95
+ index: slotIndex,
96
+ attrs: this.v3 ? undefined : {
97
+ index: slotIndex,
87
98
  form: this.$props.form,
88
99
  slotRender: this.$props.slotRender,
89
- viewSlot: this.$props.viewSlot,
90
- key: "".concat(slot.start.getTime(), ":").concat(slot.group.index),
100
+ viewSlot: this.$props.viewSlot
101
+ // key={`${slot.start.getTime()}:${slot.group.index}`}
102
+ ,
91
103
  row: 0,
92
104
  col: this.ks.orientation === 'horizontal' ? filtered.length * (groupIndex || 0) + slotIndex : slotIndex,
93
105
  isWorkDay: 0 <= slot.zonedStart.getDay() + (numberOfDays - workWeekStart) && (slot.zonedStart.getDay() + (numberOfDays - workWeekStart)) % numberOfDays <= workWeekEnd + (numberOfDays - workWeekStart),
94
106
  expandable: true,
95
107
  editable: this.$props.editable
96
- });
97
- }, this);
108
+ },
109
+ onDataaction: this.handleDataAction,
110
+ on: this.v3 ? undefined : {
111
+ "dataaction": this.handleDataAction
112
+ },
113
+ form: this.$props.form,
114
+ slotRender: this.$props.slotRender,
115
+ viewSlot: this.$props.viewSlot,
116
+ row: 0,
117
+ col: this.ks.orientation === 'horizontal' ? filtered.length * (groupIndex || 0) + slotIndex : slotIndex,
118
+ isWorkDay: 0 <= slot.zonedStart.getDay() + (numberOfDays - workWeekStart) && (slot.zonedStart.getDay() + (numberOfDays - workWeekStart)) % numberOfDays <= workWeekEnd + (numberOfDays - workWeekStart),
119
+ expandable: true,
120
+ editable: this.$props.editable
121
+ });
98
122
  }, this)]);
99
123
  },
100
124
  methods: {
101
125
  handleDataAction: function handleDataAction(action) {
102
126
  this.$emit('dataaction', action);
127
+ },
128
+ calculateRanges: function calculateRanges(daySlots, groupIndex, dayRanges) {
129
+ return dayRanges.map(function (_, rangeIndex) {
130
+ return daySlots.filter(function (s) {
131
+ return s.group.index === groupIndex && s.range.index === rangeIndex;
132
+ });
133
+ }).flat();
103
134
  }
104
135
  }
105
136
  };
@@ -4,6 +4,7 @@ var allVue = Vue;
4
4
  var gh = allVue.h;
5
5
  var isV3 = allVue.version && allVue.version[0] === '3';
6
6
  var inject = allVue.inject;
7
+ import { COLLECTION_ACTION } from '../../utils/main.js';
7
8
  import { classNames } from '@progress/kendo-vue-common';
8
9
  import { GRID_OFFSET } from './MultiDayView.js';
9
10
  import { SchedulerEditSlot } from '../../slots/SchedulerEditSlot.js';
@@ -34,8 +35,52 @@ var DayViewMiddleRowVue2 = {
34
35
  inject: {
35
36
  ri: {
36
37
  default: null
38
+ },
39
+ setSlots: {
40
+ default: null
41
+ }
42
+ },
43
+ provide: function provide() {
44
+ return {
45
+ ksSlots: this.ksSlots
46
+ };
47
+ },
48
+ data: function data() {
49
+ var timeSlots = this.timeSlots;
50
+ var groupIndex = this.ri.groupIndex;
51
+ var root = this.root;
52
+ return {
53
+ ksSlots: {
54
+ cSlots: this.calculateRanges(timeSlots, groupIndex, this.timeRanges, root)
55
+ }
56
+ };
57
+ },
58
+ watch: {
59
+ currentCellSlots: function currentCellSlots(newValue) {
60
+ this.ksSlots.cSlots = newValue;
61
+ }
62
+ },
63
+ computed: {
64
+ currentCellSlots: function currentCellSlots() {
65
+ var timeSlots = this.timeSlots;
66
+ var groupIndex = this.ri.groupIndex;
67
+ var root = this.root;
68
+ return this.calculateRanges(timeSlots, groupIndex, this.timeRanges, root);
37
69
  }
38
70
  },
71
+ destroyed: !!isV3 ? undefined : function () {
72
+ this.setSlots({
73
+ type: COLLECTION_ACTION.remove,
74
+ item: this
75
+ });
76
+ },
77
+ // @ts-ignore
78
+ unmounted: function unmounted() {
79
+ this.setSlots({
80
+ type: COLLECTION_ACTION.remove,
81
+ item: this
82
+ });
83
+ },
39
84
  // @ts-ignore
40
85
  setup: !isV3 ? undefined : function () {
41
86
  var v3 = !!isV3;
@@ -53,60 +98,45 @@ var DayViewMiddleRowVue2 = {
53
98
  "class": classNames('k-scheduler-row', {
54
99
  'k-middle-row': !((this.rootIndex + 1) % this.slotDivisions === 0)
55
100
  })
56
- }, [this.timeRanges.map(function (_range, rangeIndex) {
57
- var _this = this;
58
- return this.timeSlots.filter(function (s) {
59
- return s.index === _this.root.index && s.range.index === rangeIndex && s.group.index === _this.ri.groupIndex;
60
- }).map(function (slot) {
61
- return h(EditSlot, {
62
- key: "".concat(slot.start.getTime(), ":").concat(slot.group.index),
63
- index: slot.index,
64
- attrs: this.v3 ? undefined : {
65
- index: slot.index,
66
- start: slot.start,
67
- end: slot.end,
68
- zonedStart: slot.zonedStart,
69
- zonedEnd: slot.zonedEnd,
70
- items: slot.items,
71
- group: slot.group,
72
- range: slot.range,
73
- isAllDay: slot.isAllDay,
74
- slotRender: this.$props.slotRender,
75
- viewSlot: this.$props.viewSlot,
76
- form: this.$props.form,
77
- row: this.rootIndex + GRID_OFFSET,
78
- col: this.timeRanges.length * (this.ri.groupIndex || 0) + rangeIndex,
79
- isWorkHour: isInTimeRange(slot.zonedStart, that.workDayStart, that.workDayEnd),
80
- isWorkDay: 0 <= slot.zonedStart.getDay() + (that.numberOfDays - workWeekStart) && (slot.zonedStart.getDay() + (that.numberOfDays - workWeekStart)) % that.numberOfDays <= that.workWeekEnd + (that.numberOfDays - workWeekStart),
81
- editable: that.$props.editable
82
- },
83
- start: slot.start,
84
- end: slot.end,
85
- zonedStart: slot.zonedStart,
86
- zonedEnd: slot.zonedEnd,
87
- items: slot.items,
88
- group: slot.group,
89
- range: slot.range,
90
- isAllDay: slot.isAllDay,
91
- onDataaction: this.handleDataAction,
92
- on: this.v3 ? undefined : {
93
- "dataaction": this.handleDataAction
94
- },
101
+ }, [this.currentCellSlots.map(function (slot, slotIndex) {
102
+ return h(EditSlot, {
103
+ index: slotIndex,
104
+ attrs: this.v3 ? undefined : {
105
+ index: slotIndex,
95
106
  slotRender: this.$props.slotRender,
96
107
  viewSlot: this.$props.viewSlot,
97
108
  form: this.$props.form,
98
109
  row: this.rootIndex + GRID_OFFSET,
99
- col: this.timeRanges.length * (this.ri.groupIndex || 0) + rangeIndex,
110
+ col: this.timeRanges.length * (this.ri.groupIndex || 0) + slot.range.index,
100
111
  isWorkHour: isInTimeRange(slot.zonedStart, that.workDayStart, that.workDayEnd),
101
112
  isWorkDay: 0 <= slot.zonedStart.getDay() + (that.numberOfDays - workWeekStart) && (slot.zonedStart.getDay() + (that.numberOfDays - workWeekStart)) % that.numberOfDays <= that.workWeekEnd + (that.numberOfDays - workWeekStart),
102
113
  editable: that.$props.editable
103
- });
104
- }, that);
105
- }, this)]);
114
+ },
115
+ onDataaction: this.handleDataAction,
116
+ on: this.v3 ? undefined : {
117
+ "dataaction": this.handleDataAction
118
+ },
119
+ slotRender: this.$props.slotRender,
120
+ viewSlot: this.$props.viewSlot,
121
+ form: this.$props.form,
122
+ row: this.rootIndex + GRID_OFFSET,
123
+ col: this.timeRanges.length * (this.ri.groupIndex || 0) + slot.range.index,
124
+ isWorkHour: isInTimeRange(slot.zonedStart, that.workDayStart, that.workDayEnd),
125
+ isWorkDay: 0 <= slot.zonedStart.getDay() + (that.numberOfDays - workWeekStart) && (slot.zonedStart.getDay() + (that.numberOfDays - workWeekStart)) % that.numberOfDays <= that.workWeekEnd + (that.numberOfDays - workWeekStart),
126
+ editable: that.$props.editable
127
+ });
128
+ }, that)]);
106
129
  },
107
130
  methods: {
108
131
  handleDataAction: function handleDataAction(action) {
109
132
  this.$emit('dataaction', action);
133
+ },
134
+ calculateRanges: function calculateRanges(timeSlots, groupIndex, timeRanges, root) {
135
+ return timeRanges.map(function (_range, rangeIndex) {
136
+ return timeSlots.filter(function (s) {
137
+ return s.index === root.index && s.range.index === rangeIndex && s.group.index === groupIndex;
138
+ });
139
+ }).flat();
110
140
  }
111
141
  }
112
142
  };