修正 entityActionBtn组件
This commit is contained in:
parent
6dc9457070
commit
4027677a8a
|
|
@ -33,7 +33,14 @@ function Render(props) {
|
|||
var items = data.items, oakLegalActions = data.oakLegalActions, spaceProps = data.spaceProps, entity = data.entity;
|
||||
return ((0, jsx_runtime_1.jsx)(antd_1.Space, tslib_1.__assign({}, spaceProps, { children: items && items.map(function (ele, index) {
|
||||
var _a = ele.auth, auth = _a === void 0 ? true : _a;
|
||||
if (auth || (oakLegalActions === null || oakLegalActions === void 0 ? void 0 : oakLegalActions.includes(ele.action))) {
|
||||
if (
|
||||
!auth ||
|
||||
(auth && (
|
||||
oakLegalActions === null || oakLegalActions === void 0
|
||||
? void 0
|
||||
: oakLegalActions.includes(ele.action)
|
||||
))
|
||||
) {
|
||||
var onClick = function () {
|
||||
if (ele.onClick) {
|
||||
ele.onClick();
|
||||
|
|
@ -57,11 +64,18 @@ function Render(props) {
|
|||
if (ele.callBack) {
|
||||
ele.callBack(index);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
return ((0, jsx_runtime_1.jsx)(ItemComponent, tslib_1.__assign({}, ele, { entity: entity, t: t, onClick: onClick })));
|
||||
return (0, jsx_runtime_1.jsx)(
|
||||
ItemComponent,
|
||||
tslib_1.__assign({}, ele, {
|
||||
entity: entity,
|
||||
t: t,
|
||||
onClick: onClick,
|
||||
})
|
||||
);
|
||||
}
|
||||
}) })));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,13 +79,21 @@ export default function Render(
|
|||
<Space {...spaceProps}>
|
||||
{items && items.map((ele, index: number) => {
|
||||
const { auth = true} = ele;
|
||||
if (auth || oakLegalActions?.includes(ele.action as EntityDict[keyof EntityDict]['Action'])) {
|
||||
if (
|
||||
!auth ||
|
||||
(auth &&
|
||||
oakLegalActions?.includes(
|
||||
ele.action as EntityDict[keyof EntityDict]['Action']
|
||||
))
|
||||
) {
|
||||
let onClick = () => {
|
||||
if (ele.onClick) {
|
||||
ele.onClick();
|
||||
return;
|
||||
}
|
||||
methods.execute(ele.action as EntityDict[keyof EntityDict]['Action'])
|
||||
methods.execute(
|
||||
ele.action as EntityDict[keyof EntityDict]['Action']
|
||||
);
|
||||
};
|
||||
if (ele.alerted) {
|
||||
onClick = () => {
|
||||
|
|
@ -99,17 +107,24 @@ export default function Render(
|
|||
ele.onClick();
|
||||
return;
|
||||
}
|
||||
methods.execute(ele.action as EntityDict[keyof EntityDict]['Action'])
|
||||
methods.execute(
|
||||
ele.action as EntityDict[keyof EntityDict]['Action']
|
||||
);
|
||||
if (ele.callBack) {
|
||||
ele.callBack(index);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
return (
|
||||
<ItemComponent {...ele} entity={entity} t={t} onClick={onClick} />
|
||||
)
|
||||
<ItemComponent
|
||||
{...ele}
|
||||
entity={entity}
|
||||
t={t}
|
||||
onClick={onClick}
|
||||
/>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</Space>
|
||||
|
|
|
|||
Loading…
Reference in New Issue