@progress/kendo-react-layout 5.12.0-dev.202303130940 → 5.12.0-dev.202303141413
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-layout.js +1 -1
- package/dist/es/actionsheet/ActionSheet.d.ts +8 -0
- package/dist/es/actionsheet/ActionSheet.js +14 -13
- package/dist/es/actionsheet/ActionSheetHeader.js +1 -1
- package/dist/es/contextmenu/ContextMenu.d.ts +27 -0
- package/dist/es/contextmenu/ContextMenu.js +35 -0
- package/dist/es/main.d.ts +1 -0
- package/dist/es/main.js +1 -0
- package/dist/es/menu/MenuProps.d.ts +8 -0
- package/dist/es/menu/components/Menu.d.ts +2 -1
- package/dist/es/menu/components/Menu.js +28 -12
- package/dist/es/menu/components/MenuItemInternal.js +2 -4
- package/dist/es/menu/components/MenuItemInternalsList.d.ts +1 -0
- package/dist/es/menu/components/MenuItemInternalsList.js +1 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/actionsheet/ActionSheet.d.ts +8 -0
- package/dist/npm/actionsheet/ActionSheet.js +14 -13
- package/dist/npm/actionsheet/ActionSheetHeader.js +1 -1
- package/dist/npm/contextmenu/ContextMenu.d.ts +27 -0
- package/dist/npm/contextmenu/ContextMenu.js +39 -0
- package/dist/npm/main.d.ts +1 -0
- package/dist/npm/main.js +1 -0
- package/dist/npm/menu/MenuProps.d.ts +8 -0
- package/dist/npm/menu/components/Menu.d.ts +2 -1
- package/dist/npm/menu/components/Menu.js +28 -12
- package/dist/npm/menu/components/MenuItemInternal.js +2 -4
- package/dist/npm/menu/components/MenuItemInternalsList.d.ts +1 -0
- package/dist/npm/menu/components/MenuItemInternalsList.js +1 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-layout.js +1 -1
- package/package.json +13 -13
|
@@ -66,6 +66,14 @@ export interface ActionSheetProps {
|
|
|
66
66
|
* Controls the popup animation. By default, the open and close animations are disabled.
|
|
67
67
|
*/
|
|
68
68
|
animation?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* @hidden
|
|
71
|
+
*/
|
|
72
|
+
animationStyles?: React.CSSProperties;
|
|
73
|
+
/**
|
|
74
|
+
* Specifies the duration of the transition for the entering and closing Animation. Defaults to `300ms`.
|
|
75
|
+
*/
|
|
76
|
+
animationDuration?: number;
|
|
69
77
|
/**
|
|
70
78
|
* The CSS classes that will be rendered on the inner ActionSheet element.
|
|
71
79
|
*/
|
|
@@ -187,7 +187,7 @@ var ActionSheet = /** @class */ (function (_super) {
|
|
|
187
187
|
], [
|
|
188
188
|
'.k-actionsheet-footer',
|
|
189
189
|
'.k-actionsheet-content',
|
|
190
|
-
'.k-actionsheet-
|
|
190
|
+
'.k-actionsheet-titlebar'
|
|
191
191
|
].map(function (selector) {
|
|
192
192
|
return FOCUSABLE_ELEMENTS.concat(_this.props.navigatableElements).map(function (focusableSelector) { return "".concat(selector, " ").concat(focusableSelector); });
|
|
193
193
|
}).flat(), true),
|
|
@@ -207,33 +207,34 @@ var ActionSheet = /** @class */ (function (_super) {
|
|
|
207
207
|
/** @hidden */
|
|
208
208
|
ActionSheet.prototype.render = function () {
|
|
209
209
|
var _this = this;
|
|
210
|
-
var _a,
|
|
211
|
-
var topGroupItems =
|
|
212
|
-
var bottomGroupItems =
|
|
210
|
+
var _a = this.props, title = _a.title, subTitle = _a.subTitle, animationStyles = _a.animationStyles, animation = _a.animation, expand = _a.expand, tabIndex = _a.tabIndex, items = _a.items;
|
|
211
|
+
var topGroupItems = items === null || items === void 0 ? void 0 : items.filter(function (item) { return !item.group || item.group === 'top'; });
|
|
212
|
+
var bottomGroupItems = items === null || items === void 0 ? void 0 : items.filter(function (item) { return item.group === 'bottom'; });
|
|
213
213
|
var shouldRenderSeparator = (topGroupItems && topGroupItems.length > 0) && (bottomGroupItems && bottomGroupItems.length > 0);
|
|
214
214
|
var children = this.children(this.props.children);
|
|
215
|
+
var animationDuration = this.props.animationDuration || this.animationDuration;
|
|
215
216
|
var actionSheetPanel = this.state.slide && React.createElement("div", { className: classNames('k-actionsheet', this.props.className, {
|
|
216
217
|
'k-actionsheet-bottom': !this.props.className
|
|
217
218
|
}), role: "dialog", "aria-modal": "true", "aria-hidden": false, "aria-labelledby": this.ariaLabeledBy, ref: this.actionSheetRef, onKeyDown: this.handleKeyDown },
|
|
218
|
-
(children[headerDisplayName]
|
|
219
|
+
(children[headerDisplayName] && !title && !subTitle) && children[headerDisplayName],
|
|
220
|
+
(title || subTitle) && (React.createElement("div", { className: "k-actionsheet-titlebar k-text-center" },
|
|
219
221
|
React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
|
|
220
|
-
React.createElement("div", { className: this.actionSheetTitleClass, id: this.ariaLabeledBy },
|
|
221
|
-
React.createElement(
|
|
222
|
-
|
|
223
|
-
this.props.subTitle && React.createElement("div", { className: "k-actionsheet-subtitle k-text-center" }, this.props.subTitle)))))),
|
|
222
|
+
React.createElement("div", { className: this.actionSheetTitleClass, id: this.ariaLabeledBy },
|
|
223
|
+
title && React.createElement("div", null, title),
|
|
224
|
+
subTitle && React.createElement("div", { className: "k-actionsheet-subtitle" }, subTitle))))),
|
|
224
225
|
children[contentDisplayName] || React.createElement("div", { className: "k-actionsheet-content" },
|
|
225
226
|
React.createElement("div", { className: "k-list-ul", role: "group" }, topGroupItems && topGroupItems.map(function (item, idx) {
|
|
226
|
-
return (React.createElement(ActionSheetItem, __assign({}, item, { id: idx, key: idx, item: item, tabIndex:
|
|
227
|
+
return (React.createElement(ActionSheetItem, __assign({}, item, { id: idx, key: idx, item: item, tabIndex: tabIndex || 0, onClick: _this.handleItemClick })));
|
|
227
228
|
})),
|
|
228
229
|
shouldRenderSeparator && React.createElement("hr", { className: "k-hr" }),
|
|
229
230
|
React.createElement("div", { className: "k-list-ul", role: "group" }, bottomGroupItems && bottomGroupItems.map(function (item, idx) {
|
|
230
|
-
return (React.createElement(ActionSheetItem, __assign({}, item, { id: idx + ((topGroupItems === null || topGroupItems === void 0 ? void 0 : topGroupItems.length) || 0), key: idx, item: item, tabIndex:
|
|
231
|
+
return (React.createElement(ActionSheetItem, __assign({}, item, { id: idx + ((topGroupItems === null || topGroupItems === void 0 ? void 0 : topGroupItems.length) || 0), key: idx, item: item, tabIndex: tabIndex || 0, onClick: _this.handleItemClick })));
|
|
231
232
|
}))),
|
|
232
233
|
children[footerDisplayName]);
|
|
233
|
-
return (React.createElement(React.Fragment, null,
|
|
234
|
+
return (React.createElement(React.Fragment, null, expand || this.state.show ? (React.createElement(React.Fragment, null,
|
|
234
235
|
React.createElement("div", { className: "k-actionsheet-container" },
|
|
235
236
|
React.createElement("div", { className: "k-overlay", onClick: this.handleOverlayClick }),
|
|
236
|
-
|
|
237
|
+
animation ? React.createElement(Animation, { transitionName: this.state.slide ? 'slide-up' : 'slide-down', onExited: this.hideActionSheet, transitionEnterDuration: animationDuration, transitionExitDuration: animationDuration, animationEnteringStyle: animationStyles || this.bottomPosition, animationEnteredStyle: animationStyles || this.bottomPosition, animationExitingStyle: animationStyles || this.bottomPosition, exit: true, enter: true, appear: false }, actionSheetPanel)
|
|
237
238
|
: actionSheetPanel)))
|
|
238
239
|
: null));
|
|
239
240
|
};
|
|
@@ -9,7 +9,7 @@ export var headerDisplayName = 'ActionSheetHeader';
|
|
|
9
9
|
* The KendoReact ActionSheetHeader component.
|
|
10
10
|
*/
|
|
11
11
|
export var ActionSheetHeader = function (props) {
|
|
12
|
-
return (React.createElement("div", { className: classNames('k-actionsheet-
|
|
12
|
+
return (React.createElement("div", { className: classNames('k-actionsheet-titlebar', props.className) }, props.children));
|
|
13
13
|
};
|
|
14
14
|
ActionSheetHeader.propTypes = {
|
|
15
15
|
className: PropTypes.string
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Offset } from '@progress/kendo-react-popup';
|
|
3
|
+
import { MenuProps } from '../menu/MenuProps';
|
|
4
|
+
/**
|
|
5
|
+
* The props of the [KendoReact ContextMenu component]({% slug overview_contextmenu %}).
|
|
6
|
+
*/
|
|
7
|
+
export interface ContextMenuProps extends Omit<MenuProps, 'onClose' | 'openOnClick' | 'hoverOpenDelay' | 'hoverCloseDelay'> {
|
|
8
|
+
/**
|
|
9
|
+
* Controls the Popup visibility of the ContextMenu.
|
|
10
|
+
*/
|
|
11
|
+
show: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Specifies the absolute position of the ContextMenu. The Popover opens next to that point.
|
|
14
|
+
*/
|
|
15
|
+
offset: Offset;
|
|
16
|
+
/**
|
|
17
|
+
* Triggers when the ContextMenu needs to hide.
|
|
18
|
+
*/
|
|
19
|
+
onClose: (event: React.SyntheticEvent<HTMLElement>) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Represents the [KendoReact ContextMenu component]({% slug overview_contextmenu %}).
|
|
23
|
+
*/
|
|
24
|
+
export declare const ContextMenu: {
|
|
25
|
+
(props: ContextMenuProps): JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
import * as React from 'react';
|
|
13
|
+
import { classNames } from '@progress/kendo-react-common';
|
|
14
|
+
import { Popup } from '@progress/kendo-react-popup';
|
|
15
|
+
import { Menu } from '../menu/components/Menu';
|
|
16
|
+
/**
|
|
17
|
+
* Represents the [KendoReact ContextMenu component]({% slug overview_contextmenu %}).
|
|
18
|
+
*/
|
|
19
|
+
export var ContextMenu = function (props) {
|
|
20
|
+
var menuRef = React.useRef(null);
|
|
21
|
+
React.useEffect(function () {
|
|
22
|
+
if (props.show) {
|
|
23
|
+
setTimeout(function () {
|
|
24
|
+
var element = menuRef.current && menuRef.current.element;
|
|
25
|
+
var menuItem = element && element.querySelector('.k-menu-item');
|
|
26
|
+
if (menuItem && menuItem !== menuItem.ownerDocument.activeElement) {
|
|
27
|
+
menuItem.focus();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, [props.show]);
|
|
32
|
+
return (React.createElement(Popup, { show: props.show, offset: props.offset, popupClass: 'k-menu-popup', animate: false },
|
|
33
|
+
React.createElement(Menu, __assign({ vertical: true }, props, { ref: menuRef, className: classNames('k-context-menu', props.className), onClose: props.onClose, role: 'menu' }), props.children)));
|
|
34
|
+
};
|
|
35
|
+
ContextMenu.displayName = 'KendoReactContextMenu';
|
package/dist/es/main.d.ts
CHANGED
|
@@ -84,4 +84,5 @@ export * from './actionsheet/interfaces/ActionSheetItemProps';
|
|
|
84
84
|
export * from './actionsheet/ActionSheetHeader';
|
|
85
85
|
export * from './actionsheet/ActionSheetContent';
|
|
86
86
|
export * from './actionsheet/ActionSheetFooter';
|
|
87
|
+
export * from './contextmenu/ContextMenu';
|
|
87
88
|
export * from './expansionpanel';
|
package/dist/es/main.js
CHANGED
|
@@ -84,4 +84,5 @@ export * from './actionsheet/interfaces/ActionSheetItemProps';
|
|
|
84
84
|
export * from './actionsheet/ActionSheetHeader';
|
|
85
85
|
export * from './actionsheet/ActionSheetContent';
|
|
86
86
|
export * from './actionsheet/ActionSheetFooter';
|
|
87
|
+
export * from './contextmenu/ContextMenu';
|
|
87
88
|
export * from './expansionpanel';
|
|
@@ -53,8 +53,16 @@ export interface MenuProps {
|
|
|
53
53
|
* Adds a custom className to the Menu top element.
|
|
54
54
|
*/
|
|
55
55
|
className?: string;
|
|
56
|
+
/**
|
|
57
|
+
* @hidden
|
|
58
|
+
*/
|
|
59
|
+
role?: string;
|
|
56
60
|
/**
|
|
57
61
|
* Fires when a Menu item is selected.
|
|
58
62
|
*/
|
|
59
63
|
onSelect?: (event: MenuSelectEvent) => void;
|
|
64
|
+
/**
|
|
65
|
+
* @hidden
|
|
66
|
+
*/
|
|
67
|
+
onClose?: (event: React.SyntheticEvent<HTMLElement>) => void;
|
|
60
68
|
}
|
|
@@ -48,6 +48,7 @@ export declare class Menu extends React.Component<MenuProps, MenuState> {
|
|
|
48
48
|
linkRender: PropTypes.Requireable<any>;
|
|
49
49
|
customCloseItemIds: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
50
50
|
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
|
+
role: PropTypes.Requireable<string>;
|
|
51
52
|
};
|
|
52
53
|
/**
|
|
53
54
|
* @hidden
|
|
@@ -67,6 +68,7 @@ export declare class Menu extends React.Component<MenuProps, MenuState> {
|
|
|
67
68
|
private inputItems;
|
|
68
69
|
private items;
|
|
69
70
|
private mouseOverHandler;
|
|
71
|
+
get element(): HTMLDivElement | null;
|
|
70
72
|
constructor(props: MenuProps);
|
|
71
73
|
/**
|
|
72
74
|
* @hidden
|
|
@@ -98,7 +100,6 @@ export declare class Menu extends React.Component<MenuProps, MenuState> {
|
|
|
98
100
|
private getInputItem;
|
|
99
101
|
private setFocusedItemId;
|
|
100
102
|
private setHoveredItemId;
|
|
101
|
-
private getMenuWrapperClassName;
|
|
102
103
|
private getMenuClassName;
|
|
103
104
|
private clearItemHoverAndLeaveRequestsIfApplicable;
|
|
104
105
|
private isItemWithDefaultClose;
|
|
@@ -56,6 +56,7 @@ var Menu = /** @class */ (function (_super) {
|
|
|
56
56
|
__extends(Menu, _super);
|
|
57
57
|
function Menu(props) {
|
|
58
58
|
var _this = _super.call(this, props) || this;
|
|
59
|
+
_this.menuWrapperEl = null;
|
|
59
60
|
_this.guid = guid();
|
|
60
61
|
_this.directionHolder = new DirectionHolder();
|
|
61
62
|
_this.inputItems = [];
|
|
@@ -85,6 +86,9 @@ var Menu = /** @class */ (function (_super) {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
}
|
|
89
|
+
if (event.keyCode === Keys.esc && _this.props.onClose) {
|
|
90
|
+
_this.props.onClose.call(undefined, event);
|
|
91
|
+
}
|
|
88
92
|
};
|
|
89
93
|
_this.onItemMouseOver = function (itemId) {
|
|
90
94
|
if (_this.mouseOverHandler.IsMouseOverEnabled) {
|
|
@@ -126,10 +130,19 @@ var Menu = /** @class */ (function (_super) {
|
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
132
|
};
|
|
129
|
-
_this.onItemBlur = function (itemId) {
|
|
133
|
+
_this.onItemBlur = function (itemId, event) {
|
|
130
134
|
if (_this.isItemWithDefaultClose(itemId)) {
|
|
131
135
|
_this.setFocusedItemId(EMPTY_ID);
|
|
132
136
|
}
|
|
137
|
+
if (event.relatedTarget && event.relatedTarget.nodeName === 'LI') {
|
|
138
|
+
var activeElementId = event.relatedTarget.getAttribute('id');
|
|
139
|
+
if (activeElementId && activeElementId.includes(_this.guid)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (_this.props.onClose) {
|
|
144
|
+
_this.props.onClose.call(undefined, event);
|
|
145
|
+
}
|
|
133
146
|
};
|
|
134
147
|
_this.getInputItem = function (itemId) {
|
|
135
148
|
return getItemById(itemId, _this.inputItems);
|
|
@@ -139,6 +152,13 @@ var Menu = /** @class */ (function (_super) {
|
|
|
139
152
|
_this.state = Object.assign({}, initialItemsIds, { isFirstRender: true });
|
|
140
153
|
return _this;
|
|
141
154
|
}
|
|
155
|
+
Object.defineProperty(Menu.prototype, "element", {
|
|
156
|
+
get: function () {
|
|
157
|
+
return this.menuWrapperEl;
|
|
158
|
+
},
|
|
159
|
+
enumerable: false,
|
|
160
|
+
configurable: true
|
|
161
|
+
});
|
|
142
162
|
/**
|
|
143
163
|
* @hidden
|
|
144
164
|
*/
|
|
@@ -151,8 +171,8 @@ var Menu = /** @class */ (function (_super) {
|
|
|
151
171
|
var lastItemIdToBeOpened = this.state.hoveredItemId ?
|
|
152
172
|
this.state.hoveredItemId :
|
|
153
173
|
this.state.focusedItemId ? getDirectParentId(this.state.focusedItemId) : EMPTY_ID;
|
|
154
|
-
return (React.createElement("div", { onKeyDown: this.onKeyDown, style: this.props.style, className: this.
|
|
155
|
-
React.createElement(MenuItemInternalsList, { className: this.getMenuClassName(), "aria-orientation": this.props.vertical ? 'vertical' : undefined, items: this.items, isMenuVertical: this.props.vertical, isDirectionRightToLeft: this.directionHolder.getIsDirectionRightToLeft(), focusedItemId: this.state.focusedItemId, lastItemIdToBeOpened: lastItemIdToBeOpened, tabbableItemId: this.state.tabbableItemId, itemRender: this.props.itemRender, linkRender: this.props.linkRender, menuGuid: this.guid, onMouseLeave: this.onItemMouseLeave, onMouseOver: this.onItemMouseOver, onMouseDown: this.onItemMouseDown, onFocus: this.onItemFocus, onClick: this.onItemClick, onBlur: this.onItemBlur, onOriginalItemNeeded: this.getInputItem })));
|
|
174
|
+
return (React.createElement("div", { onKeyDown: this.onKeyDown, style: this.props.style, className: this.directionHolder.getIsDirectionRightToLeft() ? 'k-rtl' : undefined, ref: function (el) { return _this.menuWrapperEl = el; } },
|
|
175
|
+
React.createElement(MenuItemInternalsList, { className: this.getMenuClassName(), "aria-orientation": this.props.vertical ? 'vertical' : undefined, items: this.items, isMenuVertical: this.props.vertical, isDirectionRightToLeft: this.directionHolder.getIsDirectionRightToLeft(), focusedItemId: this.state.focusedItemId, lastItemIdToBeOpened: lastItemIdToBeOpened, tabbableItemId: this.state.tabbableItemId, itemRender: this.props.itemRender, linkRender: this.props.linkRender, menuGuid: this.guid, onMouseLeave: this.onItemMouseLeave, onMouseOver: this.onItemMouseOver, onMouseDown: this.onItemMouseDown, onFocus: this.onItemFocus, onClick: this.onItemClick, onBlur: this.onItemBlur, onOriginalItemNeeded: this.getInputItem, role: this.props.role })));
|
|
156
176
|
};
|
|
157
177
|
/**
|
|
158
178
|
* @hidden
|
|
@@ -203,13 +223,8 @@ var Menu = /** @class */ (function (_super) {
|
|
|
203
223
|
}
|
|
204
224
|
});
|
|
205
225
|
};
|
|
206
|
-
Menu.prototype.getMenuWrapperClassName = function () {
|
|
207
|
-
return classNames({
|
|
208
|
-
'k-rtl': this.directionHolder.getIsDirectionRightToLeft()
|
|
209
|
-
}, this.props.className);
|
|
210
|
-
};
|
|
211
226
|
Menu.prototype.getMenuClassName = function () {
|
|
212
|
-
return classNames('k-
|
|
227
|
+
return classNames('k-reset', 'k-header', 'k-menu', { 'k-menu-horizontal': !this.props.vertical }, { 'k-menu-vertical': this.props.vertical }, this.props.className);
|
|
213
228
|
};
|
|
214
229
|
Menu.prototype.clearItemHoverAndLeaveRequestsIfApplicable = function () {
|
|
215
230
|
if (this.itemHoverRequest) {
|
|
@@ -225,8 +240,8 @@ var Menu = /** @class */ (function (_super) {
|
|
|
225
240
|
return !this.props.customCloseItemIds || this.props.customCloseItemIds.indexOf(itemId) === -1;
|
|
226
241
|
};
|
|
227
242
|
Menu.prototype.checkIsDirectionRightToLeft = function () {
|
|
228
|
-
return this.props.dir !== undefined ? this.props.dir === 'rtl' :
|
|
229
|
-
this.menuWrapperEl && getComputedStyle(this.menuWrapperEl).direction === 'rtl';
|
|
243
|
+
return Boolean(this.props.dir !== undefined ? this.props.dir === 'rtl' :
|
|
244
|
+
this.menuWrapperEl && getComputedStyle(this.menuWrapperEl).direction === 'rtl');
|
|
230
245
|
};
|
|
231
246
|
Menu.prototype.prepareItems = function () {
|
|
232
247
|
var _a = prepareInputItemsForInternalWork(this.props.items, this.props.children), items = _a.items, inputItems = _a.inputItems;
|
|
@@ -250,7 +265,8 @@ var Menu = /** @class */ (function (_super) {
|
|
|
250
265
|
itemRender: PropTypes.any,
|
|
251
266
|
linkRender: PropTypes.any,
|
|
252
267
|
customCloseItemIds: PropTypes.arrayOf(PropTypes.string),
|
|
253
|
-
onSelect: PropTypes.func
|
|
268
|
+
onSelect: PropTypes.func,
|
|
269
|
+
role: PropTypes.string
|
|
254
270
|
};
|
|
255
271
|
/**
|
|
256
272
|
* @hidden
|
|
@@ -65,16 +65,14 @@ var MenuItemInternal = /** @class */ (function (_super) {
|
|
|
65
65
|
this.itemElement.focus();
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
else if (document.activeElement === this.itemElement) {
|
|
69
|
-
this.itemElement.blur();
|
|
70
|
-
}
|
|
71
68
|
};
|
|
72
69
|
MenuItemInternal.prototype.render = function () {
|
|
73
70
|
var _this = this;
|
|
74
71
|
var item = this.props.item;
|
|
75
72
|
var itemId = item.id;
|
|
73
|
+
var menuItemId = getDOMElementId(this.props.menuGuid, itemId);
|
|
76
74
|
return (React.createElement(React.Fragment, null,
|
|
77
|
-
React.createElement("li", { className: this.getMenuItemClassName(item), style: item.cssStyle, tabIndex: itemId === this.props.tabbableItemId ? 0 : -1, onMouseOver: this.onMouseOver, onMouseLeave: this.onMouseLeave, onMouseDown: function (event) { return _this.props.onMouseDown(event); }, onBlur: function () { return _this.props.onBlur(itemId); }, onFocus: function () { return _this.props.onFocus(itemId); }, onClick: function (event) { return _this.props.onClick(event, itemId); }, role: "menuitem", "aria-disabled": item.disabled ? true : undefined, "aria-haspopup": item.items.length > 0 ? true : undefined, "aria-expanded": item.items.length > 0 ? this.Opened : undefined, "aria-label": item.text, "aria-owns": this.Opened ?
|
|
75
|
+
React.createElement("li", { id: getDOMElementId(this.props.menuGuid, itemId), className: this.getMenuItemClassName(item), style: item.cssStyle, tabIndex: itemId === this.props.tabbableItemId ? 0 : -1, onMouseOver: this.onMouseOver, onMouseLeave: this.onMouseLeave, onMouseDown: function (event) { return _this.props.onMouseDown(event); }, onBlur: function (e) { return _this.props.onBlur(itemId, e); }, onFocus: function () { return _this.props.onFocus(itemId); }, onClick: function (event) { return _this.props.onClick(event, itemId); }, role: "menuitem", "aria-disabled": item.disabled ? true : undefined, "aria-haspopup": item.items.length > 0 ? true : undefined, "aria-expanded": item.items.length > 0 ? this.Opened : undefined, "aria-label": item.text, "aria-owns": this.Opened ? menuItemId : undefined, ref: function (el) { return _this.itemElement = el; }, key: "0" }, this.contentRender ? this.renderContent() : this.renderMenuItemLink()),
|
|
78
76
|
this.renderPopupIfOpened()));
|
|
79
77
|
};
|
|
80
78
|
MenuItemInternal.prototype.renderContent = function () {
|
|
@@ -35,7 +35,7 @@ var MenuItemInternalsList = /** @class */ (function (_super) {
|
|
|
35
35
|
}
|
|
36
36
|
MenuItemInternalsList.prototype.render = function () {
|
|
37
37
|
var parentItemId = this.props.parentItemId;
|
|
38
|
-
return (React.createElement("ul", { className: this.props.className, role: parentItemId !== undefined ? 'menu' : 'menubar', id: parentItemId !== undefined ? getDOMElementId(this.props.menuGuid, parentItemId) : undefined, onMouseOver: parentItemId !== undefined ? this.onMouseOver : undefined, onMouseLeave: parentItemId !== undefined ? this.onMouseLeave : undefined, "aria-orientation": this.props['aria-orientation'] }, this.renderChildItems()));
|
|
38
|
+
return (React.createElement("ul", { className: this.props.className, role: this.props.role ? this.props.role : (parentItemId !== undefined ? 'menu' : 'menubar'), id: parentItemId !== undefined ? getDOMElementId(this.props.menuGuid, parentItemId) : undefined, onMouseOver: parentItemId !== undefined ? this.onMouseOver : undefined, onMouseLeave: parentItemId !== undefined ? this.onMouseLeave : undefined, "aria-orientation": this.props['aria-orientation'] }, this.renderChildItems()));
|
|
39
39
|
};
|
|
40
40
|
MenuItemInternalsList.prototype.renderChildItems = function () {
|
|
41
41
|
var _this = this;
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-layout',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1678801943,
|
|
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
|
};
|
|
@@ -66,6 +66,14 @@ export interface ActionSheetProps {
|
|
|
66
66
|
* Controls the popup animation. By default, the open and close animations are disabled.
|
|
67
67
|
*/
|
|
68
68
|
animation?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* @hidden
|
|
71
|
+
*/
|
|
72
|
+
animationStyles?: React.CSSProperties;
|
|
73
|
+
/**
|
|
74
|
+
* Specifies the duration of the transition for the entering and closing Animation. Defaults to `300ms`.
|
|
75
|
+
*/
|
|
76
|
+
animationDuration?: number;
|
|
69
77
|
/**
|
|
70
78
|
* The CSS classes that will be rendered on the inner ActionSheet element.
|
|
71
79
|
*/
|
|
@@ -190,7 +190,7 @@ var ActionSheet = /** @class */ (function (_super) {
|
|
|
190
190
|
], [
|
|
191
191
|
'.k-actionsheet-footer',
|
|
192
192
|
'.k-actionsheet-content',
|
|
193
|
-
'.k-actionsheet-
|
|
193
|
+
'.k-actionsheet-titlebar'
|
|
194
194
|
].map(function (selector) {
|
|
195
195
|
return kendo_react_common_1.FOCUSABLE_ELEMENTS.concat(_this.props.navigatableElements).map(function (focusableSelector) { return "".concat(selector, " ").concat(focusableSelector); });
|
|
196
196
|
}).flat(), true),
|
|
@@ -210,33 +210,34 @@ var ActionSheet = /** @class */ (function (_super) {
|
|
|
210
210
|
/** @hidden */
|
|
211
211
|
ActionSheet.prototype.render = function () {
|
|
212
212
|
var _this = this;
|
|
213
|
-
var _a,
|
|
214
|
-
var topGroupItems =
|
|
215
|
-
var bottomGroupItems =
|
|
213
|
+
var _a = this.props, title = _a.title, subTitle = _a.subTitle, animationStyles = _a.animationStyles, animation = _a.animation, expand = _a.expand, tabIndex = _a.tabIndex, items = _a.items;
|
|
214
|
+
var topGroupItems = items === null || items === void 0 ? void 0 : items.filter(function (item) { return !item.group || item.group === 'top'; });
|
|
215
|
+
var bottomGroupItems = items === null || items === void 0 ? void 0 : items.filter(function (item) { return item.group === 'bottom'; });
|
|
216
216
|
var shouldRenderSeparator = (topGroupItems && topGroupItems.length > 0) && (bottomGroupItems && bottomGroupItems.length > 0);
|
|
217
217
|
var children = this.children(this.props.children);
|
|
218
|
+
var animationDuration = this.props.animationDuration || this.animationDuration;
|
|
218
219
|
var actionSheetPanel = this.state.slide && React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-actionsheet', this.props.className, {
|
|
219
220
|
'k-actionsheet-bottom': !this.props.className
|
|
220
221
|
}), role: "dialog", "aria-modal": "true", "aria-hidden": false, "aria-labelledby": this.ariaLabeledBy, ref: this.actionSheetRef, onKeyDown: this.handleKeyDown },
|
|
221
|
-
(children[ActionSheetHeader_1.headerDisplayName]
|
|
222
|
+
(children[ActionSheetHeader_1.headerDisplayName] && !title && !subTitle) && children[ActionSheetHeader_1.headerDisplayName],
|
|
223
|
+
(title || subTitle) && (React.createElement("div", { className: "k-actionsheet-titlebar k-text-center" },
|
|
222
224
|
React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
|
|
223
|
-
React.createElement("div", { className: this.actionSheetTitleClass, id: this.ariaLabeledBy },
|
|
224
|
-
React.createElement(
|
|
225
|
-
|
|
226
|
-
this.props.subTitle && React.createElement("div", { className: "k-actionsheet-subtitle k-text-center" }, this.props.subTitle)))))),
|
|
225
|
+
React.createElement("div", { className: this.actionSheetTitleClass, id: this.ariaLabeledBy },
|
|
226
|
+
title && React.createElement("div", null, title),
|
|
227
|
+
subTitle && React.createElement("div", { className: "k-actionsheet-subtitle" }, subTitle))))),
|
|
227
228
|
children[ActionSheetContent_1.contentDisplayName] || React.createElement("div", { className: "k-actionsheet-content" },
|
|
228
229
|
React.createElement("div", { className: "k-list-ul", role: "group" }, topGroupItems && topGroupItems.map(function (item, idx) {
|
|
229
|
-
return (React.createElement(ActionSheetItem_1.ActionSheetItem, __assign({}, item, { id: idx, key: idx, item: item, tabIndex:
|
|
230
|
+
return (React.createElement(ActionSheetItem_1.ActionSheetItem, __assign({}, item, { id: idx, key: idx, item: item, tabIndex: tabIndex || 0, onClick: _this.handleItemClick })));
|
|
230
231
|
})),
|
|
231
232
|
shouldRenderSeparator && React.createElement("hr", { className: "k-hr" }),
|
|
232
233
|
React.createElement("div", { className: "k-list-ul", role: "group" }, bottomGroupItems && bottomGroupItems.map(function (item, idx) {
|
|
233
|
-
return (React.createElement(ActionSheetItem_1.ActionSheetItem, __assign({}, item, { id: idx + ((topGroupItems === null || topGroupItems === void 0 ? void 0 : topGroupItems.length) || 0), key: idx, item: item, tabIndex:
|
|
234
|
+
return (React.createElement(ActionSheetItem_1.ActionSheetItem, __assign({}, item, { id: idx + ((topGroupItems === null || topGroupItems === void 0 ? void 0 : topGroupItems.length) || 0), key: idx, item: item, tabIndex: tabIndex || 0, onClick: _this.handleItemClick })));
|
|
234
235
|
}))),
|
|
235
236
|
children[ActionSheetFooter_1.footerDisplayName]);
|
|
236
|
-
return (React.createElement(React.Fragment, null,
|
|
237
|
+
return (React.createElement(React.Fragment, null, expand || this.state.show ? (React.createElement(React.Fragment, null,
|
|
237
238
|
React.createElement("div", { className: "k-actionsheet-container" },
|
|
238
239
|
React.createElement("div", { className: "k-overlay", onClick: this.handleOverlayClick }),
|
|
239
|
-
|
|
240
|
+
animation ? React.createElement(kendo_react_animation_1.Animation, { transitionName: this.state.slide ? 'slide-up' : 'slide-down', onExited: this.hideActionSheet, transitionEnterDuration: animationDuration, transitionExitDuration: animationDuration, animationEnteringStyle: animationStyles || this.bottomPosition, animationEnteredStyle: animationStyles || this.bottomPosition, animationExitingStyle: animationStyles || this.bottomPosition, exit: true, enter: true, appear: false }, actionSheetPanel)
|
|
240
241
|
: actionSheetPanel)))
|
|
241
242
|
: null));
|
|
242
243
|
};
|
|
@@ -12,7 +12,7 @@ exports.headerDisplayName = 'ActionSheetHeader';
|
|
|
12
12
|
* The KendoReact ActionSheetHeader component.
|
|
13
13
|
*/
|
|
14
14
|
var ActionSheetHeader = function (props) {
|
|
15
|
-
return (React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-actionsheet-
|
|
15
|
+
return (React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-actionsheet-titlebar', props.className) }, props.children));
|
|
16
16
|
};
|
|
17
17
|
exports.ActionSheetHeader = ActionSheetHeader;
|
|
18
18
|
exports.ActionSheetHeader.propTypes = {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Offset } from '@progress/kendo-react-popup';
|
|
3
|
+
import { MenuProps } from '../menu/MenuProps';
|
|
4
|
+
/**
|
|
5
|
+
* The props of the [KendoReact ContextMenu component]({% slug overview_contextmenu %}).
|
|
6
|
+
*/
|
|
7
|
+
export interface ContextMenuProps extends Omit<MenuProps, 'onClose' | 'openOnClick' | 'hoverOpenDelay' | 'hoverCloseDelay'> {
|
|
8
|
+
/**
|
|
9
|
+
* Controls the Popup visibility of the ContextMenu.
|
|
10
|
+
*/
|
|
11
|
+
show: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Specifies the absolute position of the ContextMenu. The Popover opens next to that point.
|
|
14
|
+
*/
|
|
15
|
+
offset: Offset;
|
|
16
|
+
/**
|
|
17
|
+
* Triggers when the ContextMenu needs to hide.
|
|
18
|
+
*/
|
|
19
|
+
onClose: (event: React.SyntheticEvent<HTMLElement>) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Represents the [KendoReact ContextMenu component]({% slug overview_contextmenu %}).
|
|
23
|
+
*/
|
|
24
|
+
export declare const ContextMenu: {
|
|
25
|
+
(props: ContextMenuProps): JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ContextMenu = void 0;
|
|
15
|
+
var React = require("react");
|
|
16
|
+
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
17
|
+
var kendo_react_popup_1 = require("@progress/kendo-react-popup");
|
|
18
|
+
var Menu_1 = require("../menu/components/Menu");
|
|
19
|
+
/**
|
|
20
|
+
* Represents the [KendoReact ContextMenu component]({% slug overview_contextmenu %}).
|
|
21
|
+
*/
|
|
22
|
+
var ContextMenu = function (props) {
|
|
23
|
+
var menuRef = React.useRef(null);
|
|
24
|
+
React.useEffect(function () {
|
|
25
|
+
if (props.show) {
|
|
26
|
+
setTimeout(function () {
|
|
27
|
+
var element = menuRef.current && menuRef.current.element;
|
|
28
|
+
var menuItem = element && element.querySelector('.k-menu-item');
|
|
29
|
+
if (menuItem && menuItem !== menuItem.ownerDocument.activeElement) {
|
|
30
|
+
menuItem.focus();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}, [props.show]);
|
|
35
|
+
return (React.createElement(kendo_react_popup_1.Popup, { show: props.show, offset: props.offset, popupClass: 'k-menu-popup', animate: false },
|
|
36
|
+
React.createElement(Menu_1.Menu, __assign({ vertical: true }, props, { ref: menuRef, className: (0, kendo_react_common_1.classNames)('k-context-menu', props.className), onClose: props.onClose, role: 'menu' }), props.children)));
|
|
37
|
+
};
|
|
38
|
+
exports.ContextMenu = ContextMenu;
|
|
39
|
+
exports.ContextMenu.displayName = 'KendoReactContextMenu';
|
package/dist/npm/main.d.ts
CHANGED
|
@@ -84,4 +84,5 @@ export * from './actionsheet/interfaces/ActionSheetItemProps';
|
|
|
84
84
|
export * from './actionsheet/ActionSheetHeader';
|
|
85
85
|
export * from './actionsheet/ActionSheetContent';
|
|
86
86
|
export * from './actionsheet/ActionSheetFooter';
|
|
87
|
+
export * from './contextmenu/ContextMenu';
|
|
87
88
|
export * from './expansionpanel';
|
package/dist/npm/main.js
CHANGED
|
@@ -100,4 +100,5 @@ __exportStar(require("./actionsheet/interfaces/ActionSheetItemProps"), exports);
|
|
|
100
100
|
__exportStar(require("./actionsheet/ActionSheetHeader"), exports);
|
|
101
101
|
__exportStar(require("./actionsheet/ActionSheetContent"), exports);
|
|
102
102
|
__exportStar(require("./actionsheet/ActionSheetFooter"), exports);
|
|
103
|
+
__exportStar(require("./contextmenu/ContextMenu"), exports);
|
|
103
104
|
__exportStar(require("./expansionpanel"), exports);
|
|
@@ -53,8 +53,16 @@ export interface MenuProps {
|
|
|
53
53
|
* Adds a custom className to the Menu top element.
|
|
54
54
|
*/
|
|
55
55
|
className?: string;
|
|
56
|
+
/**
|
|
57
|
+
* @hidden
|
|
58
|
+
*/
|
|
59
|
+
role?: string;
|
|
56
60
|
/**
|
|
57
61
|
* Fires when a Menu item is selected.
|
|
58
62
|
*/
|
|
59
63
|
onSelect?: (event: MenuSelectEvent) => void;
|
|
64
|
+
/**
|
|
65
|
+
* @hidden
|
|
66
|
+
*/
|
|
67
|
+
onClose?: (event: React.SyntheticEvent<HTMLElement>) => void;
|
|
60
68
|
}
|
|
@@ -48,6 +48,7 @@ export declare class Menu extends React.Component<MenuProps, MenuState> {
|
|
|
48
48
|
linkRender: PropTypes.Requireable<any>;
|
|
49
49
|
customCloseItemIds: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
50
50
|
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
|
+
role: PropTypes.Requireable<string>;
|
|
51
52
|
};
|
|
52
53
|
/**
|
|
53
54
|
* @hidden
|
|
@@ -67,6 +68,7 @@ export declare class Menu extends React.Component<MenuProps, MenuState> {
|
|
|
67
68
|
private inputItems;
|
|
68
69
|
private items;
|
|
69
70
|
private mouseOverHandler;
|
|
71
|
+
get element(): HTMLDivElement | null;
|
|
70
72
|
constructor(props: MenuProps);
|
|
71
73
|
/**
|
|
72
74
|
* @hidden
|
|
@@ -98,7 +100,6 @@ export declare class Menu extends React.Component<MenuProps, MenuState> {
|
|
|
98
100
|
private getInputItem;
|
|
99
101
|
private setFocusedItemId;
|
|
100
102
|
private setHoveredItemId;
|
|
101
|
-
private getMenuWrapperClassName;
|
|
102
103
|
private getMenuClassName;
|
|
103
104
|
private clearItemHoverAndLeaveRequestsIfApplicable;
|
|
104
105
|
private isItemWithDefaultClose;
|