grep-components 1.26.0 → 1.26.1
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/index.js +11 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3255,29 +3255,27 @@ var DropdownMenu = function (_a) {
|
|
|
3255
3255
|
var _a;
|
|
3256
3256
|
var label = item.label, children = item.children, handleClick = item.handleClick, disabled = item.disabled, props = __rest$1(item, ["label", "children", "handleClick", "disabled"]);
|
|
3257
3257
|
var itemOrParentDisabled = (_a = (parentDisabled || disabled)) !== null && _a !== void 0 ? _a : false;
|
|
3258
|
+
var isDisabled = typeof itemOrParentDisabled === 'function'
|
|
3259
|
+
? itemOrParentDisabled(context)
|
|
3260
|
+
: itemOrParentDisabled;
|
|
3261
|
+
var style = isDisabled
|
|
3262
|
+
? { paddingLeft: "".concat(level * 0.5, "rem"), opacity: 0.4 }
|
|
3263
|
+
: {
|
|
3264
|
+
paddingLeft: "".concat(level * 0.5, "rem"),
|
|
3265
|
+
};
|
|
3258
3266
|
props.key = "child-item-".concat(index);
|
|
3259
3267
|
props.classes = { selected: classes.selected };
|
|
3260
3268
|
// ninja way, since rewriting existing code on lpu and admin is daunting
|
|
3261
3269
|
props.onClick = function (e) {
|
|
3262
|
-
if (
|
|
3270
|
+
if (isDisabled) {
|
|
3263
3271
|
e.preventDefault();
|
|
3264
3272
|
e.stopPropagation();
|
|
3265
3273
|
return;
|
|
3266
3274
|
}
|
|
3267
3275
|
menuProps.onClose && menuProps.onClose(e, 'backdropClick');
|
|
3268
|
-
!
|
|
3276
|
+
!isDisabled && handleClick && handleClick(context);
|
|
3269
3277
|
};
|
|
3270
|
-
|
|
3271
|
-
? { paddingLeft: "".concat(level * 0.5, "rem") }
|
|
3272
|
-
: {
|
|
3273
|
-
paddingLeft: "".concat(level * 0.5, "rem"),
|
|
3274
|
-
opacity: 0.4,
|
|
3275
|
-
};
|
|
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
|
+
return (React__default.createElement(CollapsableMenuItem, __assign({ sx: isDisabled && !children ? { cursor: 'not-allowed' } : {}, level: level, id: label, disabled: isDisabled, items: children === null || children === void 0 ? void 0 : children.map(renderChild(level + 1, isDisabled)) }, props),
|
|
3281
3279
|
React__default.createElement("span", { style: style }, label)));
|
|
3282
3280
|
};
|
|
3283
3281
|
};
|