@acvl/frontend-components 0.0.13 → 0.0.14

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,2 +1,2 @@
1
- export { default as editColumn, EditGridColumnsProps } from './editColumn';
2
- export { default as deleteColumn, DeleteGridColumnsProps } from './deleteColumn';
1
+ export { default as editColumn, type EditGridColumnsProps } from './editColumn';
2
+ export { default as deleteColumn, type DeleteGridColumnsProps } from './deleteColumn';
@@ -1,5 +1,5 @@
1
1
  export { default as Base } from './Base';
2
2
  export * from './cells';
3
3
  export * from './columns';
4
- export { GridColDefPropsOverrides, GridArgs, MyDataGridProps, MyGridFilterModel } from './types';
5
- export { CustomToolbarProps } from './custom_slots/CustomToolbar';
4
+ export type { GridColDefPropsOverrides, GridArgs, MyDataGridProps, MyGridFilterModel } from './types';
5
+ export type { CustomToolbarProps } from './custom_slots/CustomToolbar';
@@ -1,4 +1,5 @@
1
- import { JSX } from "react";
1
+ import { JSX, RefObject } from "react";
2
+ import { GridApi } from "@mui/x-data-grid";
2
3
  import { JSONParserProps } from "../../forms";
3
4
  import { GridColDefPropsOverrides } from "../types";
4
5
  import { BaseGridProps } from "../Base";
@@ -25,6 +26,7 @@ export interface EditGridWrapperProps extends Pick<BaseGridProps, 'dataGridProps
25
26
  renderFunctionProps?: {
26
27
  [key: string]: any;
27
28
  };
29
+ baseGridRef?: RefObject<GridApi>;
28
30
  }
29
31
  declare const EditGridWrapper: (props: EditGridWrapperProps) => import("react/jsx-runtime").JSX.Element;
30
32
  export default EditGridWrapper;
@@ -1,5 +1,5 @@
1
1
  export { default as Loadable } from './Loadable';
2
2
  export { default as LoadingComponent } from './LoadingComponent';
3
3
  export { default as Logo } from './Logo';
4
- export { default as Tabs, MyTab, MyTabProps } from './Tabs';
4
+ export { default as Tabs, type MyTab, type MyTabProps } from './Tabs';
5
5
  export { default as Transitions } from './Transitions';
@@ -1,2 +1,2 @@
1
- export { APIProvider, default as APIContext, APIcontextProps } from './APIContext';
1
+ export { APIProvider, default as APIContext, type APIcontextProps } from './APIContext';
2
2
  export { NavigationProvider, default as NavigationContext } from './NavigationContext';
package/dist/esm/index.js CHANGED
@@ -26605,10 +26605,12 @@ const SaveCancelButton = (props) => {
26605
26605
  ...props.slotProps?.cancelBtn
26606
26606
  } }), jsx(NormalOrIcon, { buttonProps: {
26607
26607
  color: 'secondary',
26608
+ variant: 'contained',
26608
26609
  startIcon: jsx(SaveIcon, {}),
26609
26610
  type: 'submit',
26610
26611
  form: 'formulario',
26611
26612
  sx: { height: 1 },
26613
+ children: 'Guardar',
26612
26614
  ...props.slotProps?.saveBtn
26613
26615
  } })] }));
26614
26616
  };
@@ -30546,7 +30548,6 @@ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
30546
30548
 
30547
30549
  const EditGridWrapper = (props) => {
30548
30550
  const notifications = useNotifications();
30549
- const baseGridRef = useRef(null);
30550
30551
  // ======================|| EDIT ||====================== //
30551
30552
  const [edit, setEdit] = useState(false);
30552
30553
  const [editMutation, { isLoading: loadingMutation }] = props.mutation();
@@ -30603,7 +30604,7 @@ const EditGridWrapper = (props) => {
30603
30604
  };
30604
30605
  }, [handleKeyPress]);
30605
30606
  // ========================= || DRAG N DROP || ========================= //
30606
- const rowsIterator = baseGridRef?.current?.getApi()?.getRowModels()?.values();
30607
+ const rowsIterator = props.baseGridRef?.current?.getRowModels().values();
30607
30608
  const rows = useMemo(() => {
30608
30609
  return rowsIterator ? Array.from(rowsIterator) : [];
30609
30610
  }, [rowsIterator]);
@@ -30630,7 +30631,7 @@ const EditGridWrapper = (props) => {
30630
30631
  mutationErrors: errors,
30631
30632
  options: props.options,
30632
30633
  }),
30633
- ...(edit && props.dnd ? { slots: { row: DraggableRow } } : []),
30634
+ ...(edit && props.dnd ? { slots: { row: DraggableRow } } : {}),
30634
30635
  slotProps: {
30635
30636
  toolbar: {
30636
30637
  extraButtons: [
@@ -30969,6 +30970,11 @@ const Base = (props) => {
30969
30970
  const dataGridProps = mergeSettings({
30970
30971
  columns: [],
30971
30972
  loadingParams: [isLoading, isFetching],
30973
+ slots: {
30974
+ toolbar: CustomToolbar,
30975
+ pagination: CustomPagination,
30976
+ noRowsOverlay: CustomNoRows,
30977
+ },
30972
30978
  slotProps: {
30973
30979
  baseCheckbox: {
30974
30980
  size: 'small'
@@ -30997,15 +31003,12 @@ const Base = (props) => {
30997
31003
  },
30998
31004
  }, props.dataGridProps);
30999
31005
  const renderDataGrid = ({ dataGridProps: renderDataGridProps }) => {
31006
+ // console.log(dataGridProps)
31000
31007
  return (jsx(Box, { width: 1, minHeight: 300, height: 1,
31001
31008
  // maxHeight={'calc(100% - 30px)'}
31002
- display: 'flex', flexDirection: 'column', pb: 0, children: jsx(NoSsr, { children: jsx(DataGrid, { apiRef: apiRef, ref: props.ref, rows: data?.results || [], loading: some(get(renderDataGridProps, 'loadingParams', []), function (x) {
31009
+ display: 'flex', flexDirection: 'column', pb: 0, children: jsx(NoSsr, { children: jsx(DataGrid, { apiRef: apiRef, rows: data?.results || [], loading: some(get(renderDataGridProps, 'loadingParams', []), function (x) {
31003
31010
  return x;
31004
- }), slots: {
31005
- toolbar: CustomToolbar,
31006
- pagination: CustomPagination,
31007
- noRowsOverlay: CustomNoRows,
31008
- },
31011
+ }),
31009
31012
  // paginado //
31010
31013
  pagination: true, paginationMode: 'server', paginationModel: paginationModel, onPaginationModelChange: setPaginationModel, pageSizeOptions: [50, 100, { value: -1, label: 'Todos' }],
31011
31014
  // ordenado
@@ -31029,7 +31032,7 @@ const Base = (props) => {
31029
31032
  // row count
31030
31033
  rowCount: rowCount,
31031
31034
  // settings
31032
- rowHeight: 42,
31035
+ density: 'compact',
31033
31036
  // striping
31034
31037
  getRowClassName: (params) => params.indexRelativeToCurrentPage % 2 === 0 ? 'even' : 'odd', localeText: {
31035
31038
  columnHeaderSortIconLabel: 'Ordenar',
@@ -31058,6 +31061,7 @@ const Base = (props) => {
31058
31061
  renderFunction: renderFunction,
31059
31062
  renderFunctionProps: renderProps,
31060
31063
  dataGridProps: dataGridProps,
31064
+ baseGridRef: apiRef,
31061
31065
  ...props.api.edit
31062
31066
  };
31063
31067
  renderFunction = EditGridWrapper;