+ {list.length > 0 ? (
+ list.map((item) => {
+ const isActive = value === item.value;
+ const menuItems = [];
+ if (item.allowEdit && onEdit) {
+ menuItems.push({
+ key: 'edit',
+ label: dict('PC.Common.Global.edit'),
+ icon:
,
+ onClick: (info: any) => {
+ info.domEvent.stopPropagation();
+ onEdit(item, info.domEvent);
+ },
+ });
+ }
+ if (item.allowDelete && onDelete) {
+ menuItems.push({
+ key: 'delete',
+ label: dict('PC.Common.Global.delete'),
+ danger: true,
+ icon:
,
+ onClick: (info: any) => {
+ info.domEvent.stopPropagation();
+ onDelete(item, info.domEvent);
+ },
+ });
+ }
+
+ return (
+
onChange(item.value)}
+ >
+
+ {typeof item.icon === 'string' ? (
+

+ ) : (
+ item.icon
+ )}
+
+
+
+
+ {item.label}
+
+ {item.extra && (
+
{item.extra}
+ )}
+
+ {(item.description || menuItems.length > 0) && (
+
+
+ {item.description || ' '}
+
+ {menuItems.length > 0 && (
+
+ e.stopPropagation()}
+ >
+
+
+
+ )}
+
+ )}
+
+
+ );
+ })
+ ) : (
+
+
+
+ )}
+