@ansible/ansible-ui-framework 0.0.508 → 0.0.510
Sign up to get free protection for your applications and to get access to all the features.
@@ -15,12 +15,14 @@ export interface IPageActionSeperator {
|
|
15
15
|
type IPageActionWithLink = IPageActionCommon & {
|
16
16
|
type: PageActionType.button;
|
17
17
|
variant?: ButtonVariant;
|
18
|
+
isDisabled?: string | undefined;
|
18
19
|
href: string;
|
19
20
|
onClick?: never;
|
20
21
|
};
|
21
22
|
type IPageActionWithOnClick = IPageActionCommon & {
|
22
23
|
type: PageActionType.button;
|
23
24
|
variant?: ButtonVariant;
|
25
|
+
isDisabled?: string | undefined;
|
24
26
|
onClick: () => void;
|
25
27
|
href?: never;
|
26
28
|
};
|
@@ -22,7 +22,8 @@ function PageButtonAction(props) {
|
|
22
22
|
var Wrapper = wrapper !== null && wrapper !== void 0 ? wrapper : react_1.Fragment;
|
23
23
|
var Icon = action.icon;
|
24
24
|
var tooltip = ((_a = action.tooltip) !== null && _a !== void 0 ? _a : props.iconOnly) ? props.action.label : undefined;
|
25
|
-
var isDisabled = false;
|
25
|
+
var isDisabled = action.isDisabled !== undefined ? action.isDisabled : false;
|
26
|
+
tooltip = isDisabled ? isDisabled : tooltip;
|
26
27
|
var variant = (_b = action.variant) !== null && _b !== void 0 ? _b : react_core_1.ButtonVariant.secondary;
|
27
28
|
if (isSecondary && [react_core_1.ButtonVariant.primary, react_core_1.ButtonVariant.danger].includes(variant)) {
|
28
29
|
variant = react_core_1.ButtonVariant.secondary;
|
@@ -35,6 +36,6 @@ function PageButtonAction(props) {
|
|
35
36
|
}
|
36
37
|
var id = props.action.label.toLowerCase().split(' ').join('-');
|
37
38
|
var content = props.iconOnly && Icon ? (0, jsx_runtime_1.jsx)(Icon, {}) : action.shortLabel ? action.shortLabel : action.label;
|
38
|
-
return ((0, jsx_runtime_1.jsx)(Wrapper, { children: (0, jsx_runtime_1.jsx)(react_core_1.Tooltip, __assign({ content: tooltip, trigger: tooltip ? undefined : 'manual' }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ id: id, variant: variant, isDanger: action.isDanger, icon: Icon ? ((0, jsx_runtime_1.jsx)("span", __assign({ style: { paddingRight: 4 } }, { children: (0, jsx_runtime_1.jsx)(Icon, {}) }))) : undefined, isAriaDisabled: isDisabled, onClick: action.onClick ? action.onClick : undefined, component: action.href ? function (props) { return (0, jsx_runtime_1.jsx)(react_router_dom_1.Link, __assign({}, props, { to: action.href })); } : undefined }, { children: content })) })) }));
|
39
|
+
return ((0, jsx_runtime_1.jsx)(Wrapper, { children: (0, jsx_runtime_1.jsx)(react_core_1.Tooltip, __assign({ content: tooltip, trigger: tooltip ? undefined : 'manual' }, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, __assign({ id: id, variant: variant, isDanger: action.isDanger, icon: Icon ? ((0, jsx_runtime_1.jsx)("span", __assign({ style: { paddingRight: 4 } }, { children: (0, jsx_runtime_1.jsx)(Icon, {}) }))) : undefined, isAriaDisabled: Boolean(isDisabled), onClick: action.onClick ? action.onClick : undefined, component: action.href ? function (props) { return (0, jsx_runtime_1.jsx)(react_router_dom_1.Link, __assign({}, props, { to: action.href })); } : undefined }, { children: content })) })) }));
|
39
40
|
}
|
40
41
|
exports.PageButtonAction = PageButtonAction;
|