grep-components 1.24.0-GREPF-2126.4 → 1.24.0-GREPF-2126.5
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,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MenuItemProps, MenuProps } from '@mui/material';
|
|
3
|
+
declare type BooleanFunction<T> = (context?: T) => boolean;
|
|
3
4
|
export declare type DropdownMenuItem<T> = Omit<MenuItemProps, 'disabled'> & {
|
|
4
5
|
label: string;
|
|
5
6
|
tooltipText?: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
+
disabled?: BooleanFunction<T> | boolean;
|
|
7
8
|
children?: Array<DropdownMenuItem<T>>;
|
|
8
9
|
handleClick?: (context?: T) => void;
|
|
9
10
|
};
|
package/dist/index.js
CHANGED
|
@@ -3250,7 +3250,6 @@ var DropdownMenu = function (_a) {
|
|
|
3250
3250
|
var classes = useStyles$f().classes;
|
|
3251
3251
|
var renderChild = function (level, parentDisabled) {
|
|
3252
3252
|
if (level === void 0) { level = 0; }
|
|
3253
|
-
if (parentDisabled === void 0) { parentDisabled = false; }
|
|
3254
3253
|
// eslint-disable-next-line react/display-name
|
|
3255
3254
|
return function (item, index) {
|
|
3256
3255
|
var _a;
|
|
@@ -3274,7 +3273,11 @@ var DropdownMenu = function (_a) {
|
|
|
3274
3273
|
paddingLeft: "".concat(level * 0.5, "rem"),
|
|
3275
3274
|
opacity: 0.4,
|
|
3276
3275
|
};
|
|
3277
|
-
return (React__default.createElement(CollapsableMenuItem, __assign({ sx: itemOrParentDisabled && !children ? { cursor: 'not-allowed' } : {}, level: level, id: label, disabled: itemOrParentDisabled
|
|
3276
|
+
return (React__default.createElement(CollapsableMenuItem, __assign({ sx: itemOrParentDisabled && !children ? { cursor: 'not-allowed' } : {}, level: level, id: label, disabled: itemOrParentDisabled
|
|
3277
|
+
? true
|
|
3278
|
+
: typeof disabled === 'function'
|
|
3279
|
+
? disabled(context)
|
|
3280
|
+
: disabled, items: children === null || children === void 0 ? void 0 : children.map(renderChild(level + 1, itemOrParentDisabled)) }, props),
|
|
3278
3281
|
React__default.createElement("span", { style: style }, label)));
|
|
3279
3282
|
};
|
|
3280
3283
|
};
|