@acvl/frontend-components 0.0.9 → 0.0.10
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 +8 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/v1/datagrids/custom_slots/CustomToolbar/slots/SelectedRowsButton.d.ts +1 -0
- package/dist/cjs/types/src/components/v1/datagrids/index.d.ts +1 -0
- package/dist/esm/index.js +8 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/v1/datagrids/custom_slots/CustomToolbar/slots/SelectedRowsButton.d.ts +1 -0
- package/dist/esm/types/src/components/v1/datagrids/index.d.ts +1 -0
- package/dist/index.d.ts +65 -2
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
interface ExtraActions {
|
|
4
4
|
label: string;
|
|
5
5
|
onClick: (rowSelectionModel: GridRowSelectionModel) => void;
|
|
6
|
+
validation?: (rowSelectionModel: GridRowSelectionModel) => boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface SelectedRowsButtonProps {
|
|
8
9
|
selection: GridRowSelectionModel;
|
package/dist/esm/index.js
CHANGED
|
@@ -26823,21 +26823,25 @@ const SelectedRowsButton = (props) => {
|
|
|
26823
26823
|
const apiRef = useGridApiContext();
|
|
26824
26824
|
const [settingsMenuOpen, setSettingsMenuOpen] = useState(false);
|
|
26825
26825
|
const triggerRef = useRef(null);
|
|
26826
|
-
|
|
26826
|
+
const extraActions = props.extraActions?.filter(action => {
|
|
26827
|
+
if (action.validation && !action.validation(props.selection))
|
|
26828
|
+
return null;
|
|
26829
|
+
return action;
|
|
26830
|
+
});
|
|
26831
|
+
if ((props.selection.ids.size || props.selection.type == 'exclude') && extraActions && extraActions.length > 0)
|
|
26827
26832
|
return (jsxs(Fragment, { children: [jsx(Divider$1, { orientation: "vertical", variant: "middle", flexItem: true, sx: { mx: 0.5 } }), jsx(Tooltip$1, { title: "Acciones", children: jsx(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: jsx(MoreVertIcon, { fontSize: "small", sx: { ml: 'auto' } }) }) }), jsx(Menu$1, { id: "settings-menu", anchorEl: triggerRef.current, open: settingsMenuOpen, onClose: () => setSettingsMenuOpen(false), anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, transformOrigin: { vertical: 'top', horizontal: 'right' }, slotProps: {
|
|
26828
26833
|
list: {
|
|
26829
26834
|
'aria-labelledby': 'settings-menu-trigger',
|
|
26830
26835
|
},
|
|
26831
26836
|
}, sx: {
|
|
26832
26837
|
zIndex: 1200
|
|
26833
|
-
}, children:
|
|
26838
|
+
}, children: extraActions?.map((option, index) => {
|
|
26834
26839
|
return (jsx(MenuItem, { onClick: () => {
|
|
26835
26840
|
setSettingsMenuOpen(false);
|
|
26836
26841
|
option.onClick(props.selection);
|
|
26837
26842
|
apiRef.current.setRowSelectionModel({ type: 'include', ids: new Set() });
|
|
26838
26843
|
}, children: jsx(ListItemText, { children: option.label }) }, index));
|
|
26839
26844
|
}) })] }));
|
|
26840
|
-
return null;
|
|
26841
26845
|
};
|
|
26842
26846
|
|
|
26843
26847
|
const StyledQuickFilter = styled(QuickFilter)({
|
|
@@ -31586,7 +31590,7 @@ function DetailPage(props) {
|
|
|
31586
31590
|
// ==============================|| RENDER SECTIONS ||============================== //
|
|
31587
31591
|
const renderContent = () => {
|
|
31588
31592
|
let displayed_sections = -1;
|
|
31589
|
-
return (jsxs(Grid, { size: 12, container: true, direction: 'column', position: 'relative', pb: 2, children: [props.pageType == 'detail' && jsx(HistorialDrawer, { ...props.slotProps?.historial }), props.sections.map((section, index) => {
|
|
31593
|
+
return (jsxs(Grid, { size: 12, container: true, direction: 'column', position: 'relative', pb: 2, children: [props.pageType == 'detail' && data.has_history && jsx(HistorialDrawer, { ...props.slotProps?.historial }), props.sections.map((section, index) => {
|
|
31590
31594
|
if (!section.display)
|
|
31591
31595
|
return null;
|
|
31592
31596
|
if (typeof section.display == 'object') {
|