@progress/kendo-react-scheduler 5.14.0-dev.202306020002 → 5.14.0-dev.202306022036

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.
@@ -1,11 +1,11 @@
1
- import * as React from 'react';
2
1
  /** @hidden */
3
2
  export interface RowSyncArgs {
4
- element: React.RefObject<Element>;
3
+ element: HTMLElement;
5
4
  selector: string;
6
5
  horizontalAttribute: string;
7
6
  verticalAttribute: string;
8
7
  applyTo: string;
8
+ syncHeight?: boolean;
9
9
  }
10
10
  /** @hidden */
11
11
  export declare const useRowSync: (args: RowSyncArgs, inputs?: any[]) => void;
@@ -6,12 +6,12 @@ var stripSelectorSymbol = function (str) { return str.slice(1, str.length); };
6
6
  export var useRowSync = function (args, inputs) {
7
7
  var element = args.element;
8
8
  var syncHeight = function () {
9
- if (!element || !element.current) {
9
+ if (!element || !args.syncHeight) {
10
10
  return;
11
11
  }
12
12
  var highest = [[]];
13
13
  var elements = Array
14
- .from(element.current.querySelectorAll(args.selector))
14
+ .from(element.querySelectorAll(args.selector))
15
15
  .filter(function (el) { return !el.classList.contains(stripSelectorSymbol(args.applyTo)); });
16
16
  elements.forEach(function (el) {
17
17
  var height = el.clientHeight;
@@ -27,7 +27,7 @@ export var useRowSync = function (args, inputs) {
27
27
  highest[x][y] = height - BORDER_WIDTH;
28
28
  }
29
29
  });
30
- var targets = Array.from(element.current.querySelectorAll(args.applyTo));
30
+ var targets = Array.from(element.querySelectorAll(args.applyTo));
31
31
  targets.forEach(function (el) {
32
32
  var x = el.getAttribute(args.horizontalAttribute);
33
33
  var y = el.getAttribute(args.verticalAttribute);
@@ -56,6 +56,10 @@ export interface SchedulerItemProps extends Item {
56
56
  * Specifies the orientation of the SchedulerItem.
57
57
  */
58
58
  vertical?: boolean;
59
+ /**
60
+ * Returns true if it is the last item rendered in the current view.
61
+ */
62
+ isLast?: boolean;
59
63
  /**
60
64
  * Specifies if the current SchedulerItem is used as a DragHint.
61
65
  */
@@ -30,7 +30,7 @@ import { useInternationalization } from '@progress/kendo-react-intl';
30
30
  import { SchedulerItemContent } from './SchedulerItemContent';
31
31
  import { IconWrap, useDir } from '@progress/kendo-react-common';
32
32
  import { caretAltLeftIcon, arrowRotateCwIcon, arrowsNoRepeatIcon, caretAltRightIcon } from '@progress/kendo-svg-icons';
33
- import { useEditable } from '../hooks';
33
+ import { useEditable, useRowSync } from '../hooks';
34
34
  var ITEMS_SPACING = 1;
35
35
  /* eslint-disable max-len */
36
36
  /**
@@ -193,6 +193,16 @@ export var SchedulerViewItem = React.forwardRef(function (props, ref) {
193
193
  }, [align, position]);
194
194
  React.useEffect(align);
195
195
  React.useEffect(position);
196
+ var schedulerElement = item.current && item.current.element
197
+ ? item.current.element.closest('.k-scheduler-layout') : null;
198
+ useRowSync({
199
+ element: schedulerElement,
200
+ selector: '.k-resource-row',
201
+ horizontalAttribute: 'data-depth-index',
202
+ verticalAttribute: 'data-resource-index',
203
+ applyTo: '.k-resource-cell',
204
+ syncHeight: props.isLast
205
+ });
196
206
  React.useEffect(function () {
197
207
  if (!scheduler.current) {
198
208
  return;
@@ -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: 1685663076,
8
+ publishDate: 1685736636,
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
  };
@@ -128,12 +128,15 @@ export var MultiDayTimelineView = function (props) {
128
128
  attribute: 'data-depth-index',
129
129
  explicitDepth: true
130
130
  });
131
+ var schedulerElement = element.current
132
+ ? element.current.closest('.k-scheduler-layout') : null;
131
133
  useRowSync({
132
- element: element,
134
+ element: schedulerElement,
133
135
  selector: '.k-resource-row',
134
136
  horizontalAttribute: 'data-depth-index',
135
137
  verticalAttribute: 'data-resource-index',
136
- applyTo: '.k-resource-cell'
138
+ applyTo: '.k-resource-cell',
139
+ syncHeight: items && !items.length
137
140
  });
138
141
  return (React.createElement(React.Fragment, null,
139
142
  React.createElement(BaseView, { ref: element, id: props.id, style: (__assign({}, props.style)), className: className, props: props, slots: slots, ranges: ranges },
@@ -157,9 +160,9 @@ export var MultiDayTimelineView = function (props) {
157
160
  && (React.createElement(CurrentTimeMarker, { attachArrow: timeRef, vertical: true })),
158
161
  items
159
162
  .sort(orderSort)
160
- .map(function (item) { return (React.createElement(EditItem, __assign({ key: item.isRecurring
163
+ .map(function (item, itemIndex) { return (React.createElement(EditItem, __assign({ key: item.isRecurring
161
164
  ? "".concat(item.uid, ":").concat(item.group.index, ":").concat(item.range.index, ":").concat(item.originalStart)
162
- : "".concat(item.uid, ":").concat(item.group.index, ":").concat(item.range.index) }, item, { format: 't', form: props.form, onDataAction: props.onDataAction, item: props.item, viewItem: props.viewItem, editable: props.editable, ignoreIsAllDay: true, vertical: false }))); })))));
165
+ : "".concat(item.uid, ":").concat(item.group.index, ":").concat(item.range.index) }, item, { format: 't', form: props.form, onDataAction: props.onDataAction, item: props.item, viewItem: props.viewItem, editable: props.editable, ignoreIsAllDay: true, vertical: false, isLast: (itemIndex === items.length - 1) }))); })))));
163
166
  };
164
167
  var multiDayTimelineDateRange = function (_a) {
165
168
  var date = _a.date, _b = _a.numberOfDays, numberOfDays = _b === void 0 ? 1 : _b, timezone = _a.timezone;
@@ -1,11 +1,11 @@
1
- import * as React from 'react';
2
1
  /** @hidden */
3
2
  export interface RowSyncArgs {
4
- element: React.RefObject<Element>;
3
+ element: HTMLElement;
5
4
  selector: string;
6
5
  horizontalAttribute: string;
7
6
  verticalAttribute: string;
8
7
  applyTo: string;
8
+ syncHeight?: boolean;
9
9
  }
10
10
  /** @hidden */
11
11
  export declare const useRowSync: (args: RowSyncArgs, inputs?: any[]) => void;
@@ -9,12 +9,12 @@ var stripSelectorSymbol = function (str) { return str.slice(1, str.length); };
9
9
  var useRowSync = function (args, inputs) {
10
10
  var element = args.element;
11
11
  var syncHeight = function () {
12
- if (!element || !element.current) {
12
+ if (!element || !args.syncHeight) {
13
13
  return;
14
14
  }
15
15
  var highest = [[]];
16
16
  var elements = Array
17
- .from(element.current.querySelectorAll(args.selector))
17
+ .from(element.querySelectorAll(args.selector))
18
18
  .filter(function (el) { return !el.classList.contains(stripSelectorSymbol(args.applyTo)); });
19
19
  elements.forEach(function (el) {
20
20
  var height = el.clientHeight;
@@ -30,7 +30,7 @@ var useRowSync = function (args, inputs) {
30
30
  highest[x][y] = height - constants_1.BORDER_WIDTH;
31
31
  }
32
32
  });
33
- var targets = Array.from(element.current.querySelectorAll(args.applyTo));
33
+ var targets = Array.from(element.querySelectorAll(args.applyTo));
34
34
  targets.forEach(function (el) {
35
35
  var x = el.getAttribute(args.horizontalAttribute);
36
36
  var y = el.getAttribute(args.verticalAttribute);
@@ -56,6 +56,10 @@ export interface SchedulerItemProps extends Item {
56
56
  * Specifies the orientation of the SchedulerItem.
57
57
  */
58
58
  vertical?: boolean;
59
+ /**
60
+ * Returns true if it is the last item rendered in the current view.
61
+ */
62
+ isLast?: boolean;
59
63
  /**
60
64
  * Specifies if the current SchedulerItem is used as a DragHint.
61
65
  */
@@ -196,6 +196,16 @@ exports.SchedulerViewItem = React.forwardRef(function (props, ref) {
196
196
  }, [align, position]);
197
197
  React.useEffect(align);
198
198
  React.useEffect(position);
199
+ var schedulerElement = item.current && item.current.element
200
+ ? item.current.element.closest('.k-scheduler-layout') : null;
201
+ (0, hooks_1.useRowSync)({
202
+ element: schedulerElement,
203
+ selector: '.k-resource-row',
204
+ horizontalAttribute: 'data-depth-index',
205
+ verticalAttribute: 'data-resource-index',
206
+ applyTo: '.k-resource-cell',
207
+ syncHeight: props.isLast
208
+ });
199
209
  React.useEffect(function () {
200
210
  if (!scheduler.current) {
201
211
  return;
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-react-scheduler',
9
9
  productName: 'KendoReact',
10
10
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
11
- publishDate: 1685663076,
11
+ publishDate: 1685736636,
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
  };
@@ -131,12 +131,15 @@ var MultiDayTimelineView = function (props) {
131
131
  attribute: 'data-depth-index',
132
132
  explicitDepth: true
133
133
  });
134
+ var schedulerElement = element.current
135
+ ? element.current.closest('.k-scheduler-layout') : null;
134
136
  (0, hooks_1.useRowSync)({
135
- element: element,
137
+ element: schedulerElement,
136
138
  selector: '.k-resource-row',
137
139
  horizontalAttribute: 'data-depth-index',
138
140
  verticalAttribute: 'data-resource-index',
139
- applyTo: '.k-resource-cell'
141
+ applyTo: '.k-resource-cell',
142
+ syncHeight: items && !items.length
140
143
  });
141
144
  return (React.createElement(React.Fragment, null,
142
145
  React.createElement(BaseView_1.BaseView, { ref: element, id: props.id, style: (__assign({}, props.style)), className: className, props: props, slots: slots, ranges: ranges },
@@ -160,9 +163,9 @@ var MultiDayTimelineView = function (props) {
160
163
  && (React.createElement(CurrentTimeMarket_1.CurrentTimeMarker, { attachArrow: timeRef, vertical: true })),
161
164
  items
162
165
  .sort(utils_1.orderSort)
163
- .map(function (item) { return (React.createElement(EditItem, __assign({ key: item.isRecurring
166
+ .map(function (item, itemIndex) { return (React.createElement(EditItem, __assign({ key: item.isRecurring
164
167
  ? "".concat(item.uid, ":").concat(item.group.index, ":").concat(item.range.index, ":").concat(item.originalStart)
165
- : "".concat(item.uid, ":").concat(item.group.index, ":").concat(item.range.index) }, item, { format: 't', form: props.form, onDataAction: props.onDataAction, item: props.item, viewItem: props.viewItem, editable: props.editable, ignoreIsAllDay: true, vertical: false }))); })))));
168
+ : "".concat(item.uid, ":").concat(item.group.index, ":").concat(item.range.index) }, item, { format: 't', form: props.form, onDataAction: props.onDataAction, item: props.item, viewItem: props.viewItem, editable: props.editable, ignoreIsAllDay: true, vertical: false, isLast: (itemIndex === items.length - 1) }))); })))));
166
169
  };
167
170
  exports.MultiDayTimelineView = MultiDayTimelineView;
168
171
  var multiDayTimelineDateRange = function (_a) {