@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 CHANGED
@@ -26596,12 +26596,10 @@ const DeleteButton = (props) => {
26596
26596
  };
26597
26597
 
26598
26598
  const SaveCancelButton = (props) => {
26599
- // const nav = useNavigation();
26600
- const handleCancel = React.useCallback(() => {
26601
- // nav.useNavigate(-1);
26602
- }, [
26603
- //useNavigate
26604
- ]);
26599
+ const navigate = reactRouterDom.useNavigate();
26600
+ const handleCancel = () => {
26601
+ navigate(-1);
26602
+ };
26605
26603
  // ===== || KEYDOWN || ===== //
26606
26604
  const handleKeyPress = React.useCallback((event) => {
26607
26605
  if (event.key === 'Escape') {
@@ -26845,21 +26843,25 @@ const SelectedRowsButton = (props) => {
26845
26843
  const apiRef = xDataGrid.useGridApiContext();
26846
26844
  const [settingsMenuOpen, setSettingsMenuOpen] = React.useState(false);
26847
26845
  const triggerRef = React.useRef(null);
26848
- 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)
26849
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: {
26850
26853
  list: {
26851
26854
  'aria-labelledby': 'settings-menu-trigger',
26852
26855
  },
26853
26856
  }, sx: {
26854
26857
  zIndex: 1200
26855
- }, children: props.extraActions.map((option, index) => {
26858
+ }, children: extraActions?.map((option, index) => {
26856
26859
  return (jsxRuntime.jsx(MenuItem, { onClick: () => {
26857
26860
  setSettingsMenuOpen(false);
26858
26861
  option.onClick(props.selection);
26859
26862
  apiRef.current.setRowSelectionModel({ type: 'include', ids: new Set() });
26860
26863
  }, children: jsxRuntime.jsx(ListItemText, { children: option.label }) }, index));
26861
26864
  }) })] }));
26862
- return null;
26863
26865
  };
26864
26866
 
26865
26867
  const StyledQuickFilter = styles.styled(xDataGrid.QuickFilter)({
@@ -30870,6 +30872,7 @@ const Base = (props) => {
30870
30872
  const navigate = reactRouterDom.useNavigate();
30871
30873
  React.useImperativeHandle(props.ref, () => ({
30872
30874
  getApi: () => apiRef.current,
30875
+ setFilterModel: setFilterModel,
30873
30876
  }));
30874
30877
  // ========================= || PAGINADO || ========================= //
30875
30878
  const [paginationModel, setPaginationModel] = React.useState({ page: 0, pageSize: 50 });
@@ -31607,7 +31610,7 @@ function DetailPage(props) {
31607
31610
  // ==============================|| RENDER SECTIONS ||============================== //
31608
31611
  const renderContent = () => {
31609
31612
  let displayed_sections = -1;
31610
- 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) => {
31611
31614
  if (!section.display)
31612
31615
  return null;
31613
31616
  if (typeof section.display == 'object') {
@@ -31646,7 +31649,7 @@ function DetailPage(props) {
31646
31649
  return (jsxRuntime.jsx(SaveCancelButton, { slotProps: {
31647
31650
  saveBtn: {
31648
31651
  loading: mutationIsLoading,
31649
- disabled: form.formState.isDirty,
31652
+ disabled: !form.formState.isDirty,
31650
31653
  ...(props.slotProps?.button?.save?.type == 'onClick' ? {
31651
31654
  type: 'button',
31652
31655
  onClick: onSubmitHandler,