@acvl/frontend-components 0.0.9 → 0.0.11

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/cjs/index.js CHANGED
@@ -26843,21 +26843,25 @@ const SelectedRowsButton = (props) => {
26843
26843
  const apiRef = xDataGrid.useGridApiContext();
26844
26844
  const [settingsMenuOpen, setSettingsMenuOpen] = React.useState(false);
26845
26845
  const triggerRef = React.useRef(null);
26846
- if ((props.selection.ids.size || props.selection.type == 'exclude') && props.extraActions)
26846
+ const extraActions = props.extraActions?.filter(action => {
26847
+ if (action.validation && !action.validation(props.selection))
26848
+ return null;
26849
+ return action;
26850
+ });
26851
+ if ((props.selection.ids.size || props.selection.type == 'exclude') && extraActions && extraActions.length > 0)
26847
26852
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(material.Divider, { orientation: "vertical", variant: "middle", flexItem: true, sx: { mx: 0.5 } }), jsxRuntime.jsx(Tooltip, { title: "Acciones", children: jsxRuntime.jsx(xDataGrid.ToolbarButton, { ref: triggerRef, id: "settings-menu-trigger", "aria-controls": "settings-menu", "aria-haspopup": "true", "aria-expanded": settingsMenuOpen ? 'true' : undefined, onClick: () => setSettingsMenuOpen(true), className: 'my-icon-button', children: jsxRuntime.jsx(MoreVertIcon, { fontSize: "small", sx: { ml: 'auto' } }) }) }), jsxRuntime.jsx(Menu, { id: "settings-menu", anchorEl: triggerRef.current, open: settingsMenuOpen, onClose: () => setSettingsMenuOpen(false), anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, transformOrigin: { vertical: 'top', horizontal: 'right' }, slotProps: {
26848
26853
  list: {
26849
26854
  'aria-labelledby': 'settings-menu-trigger',
26850
26855
  },
26851
26856
  }, sx: {
26852
26857
  zIndex: 1200
26853
- }, children: props.extraActions.map((option, index) => {
26858
+ }, children: extraActions?.map((option, index) => {
26854
26859
  return (jsxRuntime.jsx(MenuItem, { onClick: () => {
26855
26860
  setSettingsMenuOpen(false);
26856
26861
  option.onClick(props.selection);
26857
26862
  apiRef.current.setRowSelectionModel({ type: 'include', ids: new Set() });
26858
26863
  }, children: jsxRuntime.jsx(ListItemText, { children: option.label }) }, index));
26859
26864
  }) })] }));
26860
- return null;
26861
26865
  };
26862
26866
 
26863
26867
  const StyledQuickFilter = styles.styled(xDataGrid.QuickFilter)({
@@ -31606,7 +31610,7 @@ function DetailPage(props) {
31606
31610
  // ==============================|| RENDER SECTIONS ||============================== //
31607
31611
  const renderContent = () => {
31608
31612
  let displayed_sections = -1;
31609
- return (jsxRuntime.jsxs(material.Grid, { size: 12, container: true, direction: 'column', position: 'relative', pb: 2, children: [props.pageType == 'detail' && jsxRuntime.jsx(HistorialDrawer, { ...props.slotProps?.historial }), props.sections.map((section, index) => {
31613
+ return (jsxRuntime.jsxs(material.Grid, { size: 12, container: true, direction: 'column', position: 'relative', pb: 2, children: [props.pageType == 'detail' && data?.has_history && jsxRuntime.jsx(HistorialDrawer, { ...props.slotProps?.historial }), props.sections.map((section, index) => {
31610
31614
  if (!section.display)
31611
31615
  return null;
31612
31616
  if (typeof section.display == 'object') {