@acvl/frontend-components 0.0.8 → 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 +14 -11
- 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 +2 -1
- package/dist/esm/index.js +14 -11
- 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 +2 -1
- package/dist/index.d.ts +72 -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;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Base } from './Base';
|
|
2
2
|
export * from './cells';
|
|
3
3
|
export * from './columns';
|
|
4
|
-
export { GridColDefPropsOverrides } from './types';
|
|
4
|
+
export { GridColDefPropsOverrides, GridArgs, MyDataGridProps, MyGridFilterModel } from './types';
|
|
5
|
+
export { CustomToolbarProps } from './custom_slots/CustomToolbar';
|
package/dist/esm/index.js
CHANGED
|
@@ -26576,12 +26576,10 @@ const DeleteButton = (props) => {
|
|
|
26576
26576
|
};
|
|
26577
26577
|
|
|
26578
26578
|
const SaveCancelButton = (props) => {
|
|
26579
|
-
|
|
26580
|
-
const handleCancel =
|
|
26581
|
-
|
|
26582
|
-
}
|
|
26583
|
-
//useNavigate
|
|
26584
|
-
]);
|
|
26579
|
+
const navigate = useNavigate();
|
|
26580
|
+
const handleCancel = () => {
|
|
26581
|
+
navigate(-1);
|
|
26582
|
+
};
|
|
26585
26583
|
// ===== || KEYDOWN || ===== //
|
|
26586
26584
|
const handleKeyPress = useCallback((event) => {
|
|
26587
26585
|
if (event.key === 'Escape') {
|
|
@@ -26825,21 +26823,25 @@ const SelectedRowsButton = (props) => {
|
|
|
26825
26823
|
const apiRef = useGridApiContext();
|
|
26826
26824
|
const [settingsMenuOpen, setSettingsMenuOpen] = useState(false);
|
|
26827
26825
|
const triggerRef = useRef(null);
|
|
26828
|
-
|
|
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)
|
|
26829
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: {
|
|
26830
26833
|
list: {
|
|
26831
26834
|
'aria-labelledby': 'settings-menu-trigger',
|
|
26832
26835
|
},
|
|
26833
26836
|
}, sx: {
|
|
26834
26837
|
zIndex: 1200
|
|
26835
|
-
}, children:
|
|
26838
|
+
}, children: extraActions?.map((option, index) => {
|
|
26836
26839
|
return (jsx(MenuItem, { onClick: () => {
|
|
26837
26840
|
setSettingsMenuOpen(false);
|
|
26838
26841
|
option.onClick(props.selection);
|
|
26839
26842
|
apiRef.current.setRowSelectionModel({ type: 'include', ids: new Set() });
|
|
26840
26843
|
}, children: jsx(ListItemText, { children: option.label }) }, index));
|
|
26841
26844
|
}) })] }));
|
|
26842
|
-
return null;
|
|
26843
26845
|
};
|
|
26844
26846
|
|
|
26845
26847
|
const StyledQuickFilter = styled(QuickFilter)({
|
|
@@ -30850,6 +30852,7 @@ const Base = (props) => {
|
|
|
30850
30852
|
const navigate = useNavigate();
|
|
30851
30853
|
useImperativeHandle(props.ref, () => ({
|
|
30852
30854
|
getApi: () => apiRef.current,
|
|
30855
|
+
setFilterModel: setFilterModel,
|
|
30853
30856
|
}));
|
|
30854
30857
|
// ========================= || PAGINADO || ========================= //
|
|
30855
30858
|
const [paginationModel, setPaginationModel] = useState({ page: 0, pageSize: 50 });
|
|
@@ -31587,7 +31590,7 @@ function DetailPage(props) {
|
|
|
31587
31590
|
// ==============================|| RENDER SECTIONS ||============================== //
|
|
31588
31591
|
const renderContent = () => {
|
|
31589
31592
|
let displayed_sections = -1;
|
|
31590
|
-
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) => {
|
|
31591
31594
|
if (!section.display)
|
|
31592
31595
|
return null;
|
|
31593
31596
|
if (typeof section.display == 'object') {
|
|
@@ -31626,7 +31629,7 @@ function DetailPage(props) {
|
|
|
31626
31629
|
return (jsx(SaveCancelButton, { slotProps: {
|
|
31627
31630
|
saveBtn: {
|
|
31628
31631
|
loading: mutationIsLoading,
|
|
31629
|
-
disabled: form.formState.isDirty,
|
|
31632
|
+
disabled: !form.formState.isDirty,
|
|
31630
31633
|
...(props.slotProps?.button?.save?.type == 'onClick' ? {
|
|
31631
31634
|
type: 'button',
|
|
31632
31635
|
onClick: onSubmitHandler,
|