@acvl/frontend-components 0.0.7 → 0.0.9

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.
@@ -1,4 +1,4 @@
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';
@@ -1,4 +1,5 @@
1
1
  import { JSX } from "react";
2
+ import { JSONParserProps } from "../../forms";
2
3
  import { GridColDefPropsOverrides } from "../types";
3
4
  import { BaseGridProps } from "../Base";
4
5
  import { EditGridColumnsProps } from "../columns";
@@ -9,14 +10,7 @@ export interface EditGridAPIProps {
9
10
  options?: {
10
11
  [key: string]: unknown[] | undefined;
11
12
  };
12
- parser?: {
13
- [key: string]: {
14
- ignore?: boolean;
15
- format?: string;
16
- extra_validation?: (value: string) => boolean;
17
- alter_key?: (key: string) => string;
18
- };
19
- };
13
+ parser?: JSONParserProps;
20
14
  dnd?: {
21
15
  field: string;
22
16
  args?: {
package/dist/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import { useTheme, useMediaQuery, Tooltip, IconButton, Button, Grid, FormGroup,
4
4
  import EditIcon from '@mui/icons-material/Edit';
5
5
  import * as React from 'react';
6
6
  import React__default, { useCallback, useEffect, isValidElement, cloneElement, Children, createContext, useContext, useState, useMemo, useRef, memo, useReducer, useImperativeHandle, useLayoutEffect, Suspense, forwardRef } from 'react';
7
- import { useNavigate } from 'react-router-dom';
7
+ import { useNavigate, useLocation } from 'react-router-dom';
8
8
  import DeleteIcon from '@mui/icons-material/Delete';
9
9
  import { Controller, useForm, useWatch, useFieldArray, FormProvider } from 'react-hook-form';
10
10
  import { useSession, PageHeader, useNotifications } from '@toolpad/core';
@@ -25648,7 +25648,7 @@ const typeSwitch = ({ base_object, base_key, response, submitData, useLabel, dat
25648
25648
  return;
25649
25649
  const altered_key = invoke(props, `${base_key}.alter_key`, base_key);
25650
25650
  const key = altered_key || base_key;
25651
- const altered_obj = invoke(props, `${base_key}.alter_value`, base_object, get$1(submitData, 'base_key'));
25651
+ const altered_obj = invoke(props, `${base_key}.alter_value`, base_object, submitData);
25652
25652
  const object = altered_obj || base_object;
25653
25653
  switch (typeof object) {
25654
25654
  case "string":
@@ -25837,8 +25837,7 @@ const LoadingComponent = (props) => {
25837
25837
  };
25838
25838
 
25839
25839
  const _HistorialDrawer = (props) => {
25840
- // const {pathname} = useLocation();
25841
- const pathname = 'temp';
25840
+ const { pathname } = useLocation();
25842
25841
  const api = useAPI();
25843
25842
  const [getHistorial, { data, isLoading, isFetching }] = api.useLazyGetHistorialQuery();
25844
25843
  useEffect(() => {
@@ -26577,12 +26576,10 @@ const DeleteButton = (props) => {
26577
26576
  };
26578
26577
 
26579
26578
  const SaveCancelButton = (props) => {
26580
- // const nav = useNavigation();
26581
- const handleCancel = useCallback(() => {
26582
- // nav.useNavigate(-1);
26583
- }, [
26584
- //useNavigate
26585
- ]);
26579
+ const navigate = useNavigate();
26580
+ const handleCancel = () => {
26581
+ navigate(-1);
26582
+ };
26586
26583
  // ===== || KEYDOWN || ===== //
26587
26584
  const handleKeyPress = useCallback((event) => {
26588
26585
  if (event.key === 'Escape') {
@@ -30687,7 +30684,7 @@ const editColumn = (props) => {
30687
30684
  width: 80,
30688
30685
  cellClassName: 'actions',
30689
30686
  getActions: ({ id, row }) => {
30690
- const canEdit = get$1(row, 'obj_permissions.can_edit');
30687
+ const canEdit = get$1(row, 'obj_permissions.edit');
30691
30688
  const isInEditMode = props.rowModesModel[id]?.mode === GridRowModes.Edit;
30692
30689
  if (isInEditMode) {
30693
30690
  return [
@@ -30696,7 +30693,7 @@ const editColumn = (props) => {
30696
30693
  ];
30697
30694
  }
30698
30695
  return [
30699
- jsx(GridActionsCellItem, { icon: jsx(EditIcon, { sx: { color: 'black' } }), label: 'Editar', className: 'textPrimary', onClick: handleEditClick(id), disabled: !canEdit }, 'edit'),
30696
+ jsx(GridActionsCellItem, { icon: jsx(EditIcon, { sx: { color: canEdit ? 'black' : 'inherit' } }), label: 'Editar', className: 'textPrimary', onClick: handleEditClick(id), disabled: !canEdit }, 'edit'),
30700
30697
  ];
30701
30698
  }
30702
30699
  }];
@@ -30851,6 +30848,7 @@ const Base = (props) => {
30851
30848
  const navigate = useNavigate();
30852
30849
  useImperativeHandle(props.ref, () => ({
30853
30850
  getApi: () => apiRef.current,
30851
+ setFilterModel: setFilterModel,
30854
30852
  }));
30855
30853
  // ========================= || PAGINADO || ========================= //
30856
30854
  const [paginationModel, setPaginationModel] = useState({ page: 0, pageSize: 50 });
@@ -31627,7 +31625,7 @@ function DetailPage(props) {
31627
31625
  return (jsx(SaveCancelButton, { slotProps: {
31628
31626
  saveBtn: {
31629
31627
  loading: mutationIsLoading,
31630
- disabled: form.formState.isDirty,
31628
+ disabled: !form.formState.isDirty,
31631
31629
  ...(props.slotProps?.button?.save?.type == 'onClick' ? {
31632
31630
  type: 'button',
31633
31631
  onClick: onSubmitHandler,