@dashadmin/dash-auto-admin 1.3.25 → 1.3.28
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/README.md +32 -6
- package/dist/DashAutoAdminComponentRegistry.js +64 -1
- package/dist/DashAutoAdminForm.js +137 -1
- package/dist/DashAutoAdminResizableDrawer.js +63 -1
- package/dist/DashAutoAdminSaveButton.js +57 -1
- package/dist/DashAutoCreate.js +102 -1
- package/dist/DashAutoDrawer.js +256 -1
- package/dist/DashAutoEdit.js +99 -1
- package/dist/DashAutoFiltersGenerator.js +193 -1
- package/dist/DashAutoFormGroups.js +118 -1
- package/dist/DashAutoFormLayout.js +68 -1
- package/dist/DashAutoFormMuiTabs.js +291 -1
- package/dist/DashAutoFormTabs.js +132 -1
- package/dist/DashAutoGroup.js +27 -1
- package/dist/DashAutoLayout.js +31 -1
- package/dist/DashAutoList.js +218 -1
- package/dist/DashAutoPostFilterForm.js +47 -1
- package/dist/DashAutoReferenceTab.js +10 -1
- package/dist/DashAutoResource.js +77 -1
- package/dist/DashAutoResourceLayout.js +16 -1
- package/dist/DashAutoShow.js +195 -1
- package/dist/DashAutoTabbedForm.js +244 -1
- package/dist/DashAutoTabbedForm.review.js +221 -1
- package/dist/DashAutoTabs.js +11 -1
- package/dist/DashFilterWrapper.js +62 -1
- package/dist/DashRedirect.js +56 -1
- package/dist/TabbedLayout.js +38 -1
- package/dist/common/DashAutoTitle.js +33 -1
- package/dist/common/components/FabButton.js +59 -1
- package/dist/common/components/TranslatedLabel.js +60 -1
- package/dist/common/settings/Settings.js +196 -1
- package/dist/common/settings/SettingsBarIcons.js +61 -1
- package/dist/context/DashAutoAdminFormContext.js +15 -1
- package/dist/hooks/useAutoAdminLoadingStateMediator.js +36 -1
- package/dist/hooks/useAutoAdminTranslate.js +61 -1
- package/dist/hooks/useHash.js +24 -1
- package/dist/hooks/useLogger.js +20 -1
- package/dist/hooks/useRoutePathPattern.js +20 -1
- package/dist/hooks/useVirtualHash.js +28 -1
- package/dist/index.js +77 -3406
- package/dist/list/DashAutoListActions.js +57 -1
- package/dist/list/DashAutoListDatagridWrapper.js +68 -1
- package/dist/list/DashAutoListDefaultActionsWrapper.js +14 -1
- package/dist/list/DashAutoListFilterFormWithButton.js +80 -1
- package/dist/list/DashAutoListTopToolbar.js +180 -1
- package/dist/mui/AttributeToField.js +576 -1
- package/dist/mui/AttributeToInput.js +630 -1
- package/dist/mui/AutoAdminResizableDrawer.js +63 -1
- package/dist/mui/AutoDataGrid.js +120 -1
- package/dist/mui/AutoReferenceFormTab.js +53 -1
- package/dist/mui/AutoReferenceTab.js +46 -1
- package/dist/mui/AutoTabs.js +19 -1
- package/dist/mui/components/ExtendedPagination.js +34 -1
- package/dist/mui/components/ListStringField.js +25 -1
- package/dist/providers/DashAuthProvider.js +215 -1
- package/dist/providers/DashDataProvider.js +310 -1
- package/dist/providers/index.js +10 -1
- package/dist/react-admin.d.js +0 -0
- package/dist/toolbar/buttons/BottomToolbarButtons.js +65 -1
- package/dist/toolbar/buttons/DashResourceButton.js +181 -1
- package/dist/toolbar/buttons/ListButtons.js +80 -1
- package/dist/toolbar/buttons/ToolbarButtons.js +135 -1
- package/dist/types/ActionCallback.d.js +0 -0
- package/dist/utils/SimpleLogger.js +52 -1
- package/dist/utils/enumToChoices.js +5 -1
- package/dist/utils/evalActionPermission.js +11 -1
- package/dist/utils/groupByTabs.js +21 -1
- package/dist/utils/hashedGroupByTabs.js +12 -1
- package/dist/utils/invertMap.js +12 -1
- package/dist/utils/isClassComponent.js +7 -1
- package/dist/utils/isComponent.js +29 -1
- package/dist/utils/isEnum.js +5 -1
- package/dist/utils/isFC.js +8 -1
- package/dist/utils/replaceParams.js +9 -1
- package/dist/utils/validate.js +19 -1
- package/dist/wrappers/UserAction.js +60 -1
- package/dist/wrappers/index.js +4 -1
- package/package.json +134 -120
- package/src/DashAutoAdminComponentRegistry.tsx +75 -0
- package/src/DashAutoAdminForm.tsx +155 -0
- package/src/DashAutoAdminResizableDrawer.tsx +69 -0
- package/src/DashAutoAdminSaveButton.tsx +116 -0
- package/src/DashAutoCreate.tsx +118 -0
- package/src/DashAutoDrawer.tsx +288 -0
- package/src/DashAutoEdit.tsx +109 -0
- package/src/DashAutoFiltersGenerator.tsx +208 -0
- package/src/DashAutoFormGroups.tsx +146 -0
- package/src/DashAutoFormLayout.tsx.review +113 -0
- package/src/DashAutoFormMuiTabs.tsx +368 -0
- package/src/DashAutoFormTabs.tsx +177 -0
- package/src/DashAutoGroup.tsx +42 -0
- package/src/DashAutoLayout.tsx +57 -0
- package/src/DashAutoList.tsx +237 -0
- package/src/DashAutoPostFilterForm.tsx +35 -0
- package/src/DashAutoReferenceTab.tsx +9 -0
- package/src/DashAutoResource.tsx +85 -0
- package/src/DashAutoResourceLayout.tsx +50 -0
- package/src/DashAutoShow.tsx +200 -0
- package/src/DashAutoTabbedForm.review.tsx +262 -0
- package/src/DashAutoTabbedForm.tsx +324 -0
- package/src/DashAutoTabs.tsx +19 -0
- package/src/DashFilterWrapper.tsx +43 -0
- package/src/DashRedirect.tsx +46 -0
- package/src/TabbedLayout.tsx +29 -0
- package/src/common/DashAutoTitle.tsx +24 -0
- package/src/common/components/FabButton.tsx +40 -0
- package/src/common/components/TranslatedLabel.tsx +81 -0
- package/src/common/settings/Settings.tsx +236 -0
- package/src/common/settings/SettingsBarIcons.tsx +72 -0
- package/src/context/DashAutoAdminFormContext.tsx +31 -0
- package/src/hooks/useAutoAdminLoadingStateMediator.tsx +42 -0
- package/src/hooks/useAutoAdminTranslate.tsx +106 -0
- package/src/hooks/useHash.tsx +27 -0
- package/src/hooks/useLogger.tsx +23 -0
- package/src/hooks/useRoutePathPattern.tsx +24 -0
- package/src/hooks/useVirtualHash.tsx +34 -0
- package/src/index.ts +85 -0
- package/src/interfaces/ICustomResourceSubComponent.ts +11 -0
- package/src/interfaces/IDashApplicationLayoutMainAction.ts +37 -0
- package/src/interfaces/IDashApplicationLayoutMenuItem.ts +24 -0
- package/src/interfaces/IDashAutoAdminAttribute.ts +104 -0
- package/src/interfaces/IDashAutoAdminCustomFieldComponent.ts +18 -0
- package/src/interfaces/IDashAutoAdminFormOptions.ts +22 -0
- package/src/interfaces/IDashAutoAdminListActions.ts +13 -0
- package/src/interfaces/IDashAutoAdminReference.ts +16 -0
- package/src/interfaces/IDashAutoAdminResourceConfig.ts +360 -0
- package/src/interfaces/IDashAutoForm.ts +24 -0
- package/src/interfaces/IDashAutoGridButton.ts +35 -0
- package/src/interfaces/IDashAutoShow.ts +12 -0
- package/src/interfaces/IGroupExtraData.ts +8 -0
- package/src/interfaces/IRecord.ts +7 -0
- package/src/interfaces/IReferenceFilter.ts +55 -0
- package/src/interfaces/IResourceComponent.ts +8 -0
- package/src/interfaces/IToolbarButton.ts +11 -0
- package/src/list/DashAutoListActions.tsx +88 -0
- package/src/list/DashAutoListDatagridWrapper.tsx +74 -0
- package/src/list/DashAutoListDefaultActionsWrapper.tsx +31 -0
- package/src/list/DashAutoListFilterFormWithButton.tsx +93 -0
- package/src/list/DashAutoListTopToolbar.tsx +240 -0
- package/src/mui/AttributeToField.tsx +657 -0
- package/src/mui/AttributeToInput.tsx +728 -0
- package/src/mui/AutoAdminResizableDrawer.tsx +69 -0
- package/src/mui/AutoDataGrid.tsx +127 -0
- package/src/mui/AutoReferenceFormTab.tsx +51 -0
- package/src/mui/AutoReferenceTab.tsx +45 -0
- package/src/mui/AutoTabs.tsx +32 -0
- package/src/mui/components/ExtendedPagination.tsx +23 -0
- package/src/mui/components/ListStringField.tsx +32 -0
- package/src/providers/DashAuthProvider.ts +341 -0
- package/src/providers/DashDataProvider.ts +466 -0
- package/src/providers/index.ts +17 -0
- package/src/toolbar/buttons/BottomToolbarButtons.tsx +59 -0
- package/src/toolbar/buttons/DashResourceButton.tsx +223 -0
- package/src/toolbar/buttons/ListButtons.tsx +137 -0
- package/src/toolbar/buttons/ToolbarButtons.tsx +186 -0
- package/src/utils/SimpleLogger.tsx +46 -0
- package/src/utils/enumToChoices.tsx +3 -0
- package/src/utils/evalActionPermission.tsx +14 -0
- package/src/utils/groupByTabs.tsx +23 -0
- package/src/utils/hashedGroupByTabs.tsx +16 -0
- package/src/utils/invertMap.tsx +10 -0
- package/src/utils/isClassComponent.tsx +9 -0
- package/src/utils/isComponent.tsx +45 -0
- package/src/utils/isEnum.tsx +3 -0
- package/src/utils/isFC.tsx +6 -0
- package/src/utils/replaceParams.tsx +6 -0
- package/src/utils/validate.tsx +24 -0
- package/src/wrappers/UserAction.tsx +67 -0
- package/src/wrappers/index.tsx +1 -0
- /package/{dist → src}/DashAutoAdminSaveButton.tsx.bkup +0 -0
- /package/{dist/DashAutoFormLayout.tsx.review → src/DashAutoFormLayout.tsx} +0 -0
- /package/{dist → src}/DashAutoFormTabs.review +0 -0
- /package/{dist → src}/DashAutoFormTabs.tsx.formcontext.wip +0 -0
- /package/{dist → src}/mui/AttributeToField.tsx.review +0 -0
- /package/{dist → src}/mui/AttributeToInput.tsx.review +0 -0
- /package/{dist → src}/react-admin.d.ts +0 -0
- /package/{dist → src}/types/ActionCallback.d.ts +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { JSX, PropsWithChildren } from 'react';
|
|
3
|
+
import IDashAutoAdminResourceConfig from '../interfaces/IDashAutoAdminResourceConfig';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export interface IDashAutoListActionsWrapper extends PropsWithChildren {
|
|
7
|
+
resourceConfig: IDashAutoAdminResourceConfig,
|
|
8
|
+
autoFilters?: JSX.Element[]
|
|
9
|
+
}
|
|
10
|
+
const DashAutoListDefaultListActionsWrapper: React.FC<IDashAutoListActionsWrapper> = ({
|
|
11
|
+
resourceConfig,
|
|
12
|
+
autoFilters,
|
|
13
|
+
children,
|
|
14
|
+
}) => {
|
|
15
|
+
|
|
16
|
+
const hasToolbarItems: boolean =
|
|
17
|
+
(autoFilters && autoFilters.length) ||
|
|
18
|
+
resourceConfig.create ||
|
|
19
|
+
resourceConfig.exporter ||
|
|
20
|
+
resourceConfig.customToolbarElements
|
|
21
|
+
? true
|
|
22
|
+
: false;
|
|
23
|
+
|
|
24
|
+
if (!hasToolbarItems) return children;
|
|
25
|
+
|
|
26
|
+
return <div className='top-toolbar-default'>{children}</div>;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default DashAutoListDefaultListActionsWrapper;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
4
|
+
import { Box, Button } from '@mui/material';
|
|
5
|
+
import { FilterFormBase, ListContext } from 'react-admin';
|
|
6
|
+
|
|
7
|
+
// Safe hook that doesn't throw when context is missing
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
const useSafeListContext = (): any => {
|
|
10
|
+
const context = React.useContext(ListContext);
|
|
11
|
+
return context ?? null;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
import { IToolbarFilters } from './DashAutoListTopToolbar';
|
|
15
|
+
|
|
16
|
+
export interface IToolbarFiltersHandler {
|
|
17
|
+
submit: () => void;
|
|
18
|
+
reset: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//const DashAutoListFilterFormWithButton:React.ForwardRefRenderFunction<IToolbarFiltersHandler, IToolbarFilters> = (
|
|
22
|
+
// props,
|
|
23
|
+
// forwardedRef,
|
|
24
|
+
//) => {
|
|
25
|
+
//const DashAutoListFilterFormWithButton:React.FC<IToolbarFilters> = React.forwardRef((props ,forwardedRef: React.Ref<IToolbarFiltersHandler>)=> {
|
|
26
|
+
|
|
27
|
+
const DashAutoListFilterFormWithButton = React.forwardRef<IToolbarFiltersHandler, IToolbarFilters>((props, forwardedRef) => {
|
|
28
|
+
|
|
29
|
+
const { filters, resourceConfig } = props;
|
|
30
|
+
|
|
31
|
+
const listContext = useSafeListContext();
|
|
32
|
+
const displayedFilters = listContext?.displayedFilters ?? [];
|
|
33
|
+
const filterValues = listContext?.filterValues ?? {};
|
|
34
|
+
const setFilters = listContext?.setFilters;
|
|
35
|
+
|
|
36
|
+
const form = useForm({
|
|
37
|
+
defaultValues: filterValues,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const onSubmit = (values) => {
|
|
42
|
+
|
|
43
|
+
if (Object.keys(values).length > 0 && setFilters) {
|
|
44
|
+
setFilters(values, displayedFilters);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
const keyDownHandler = event => {
|
|
50
|
+
if (event.key === 'Enter') {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
form.handleSubmit(onSubmit)();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
document.addEventListener('keydown', keyDownHandler);
|
|
56
|
+
return () => {
|
|
57
|
+
document.removeEventListener('keydown', keyDownHandler);
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
const { reset } = form;
|
|
61
|
+
const handleSubmit = form.handleSubmit(onSubmit);
|
|
62
|
+
|
|
63
|
+
React.useImperativeHandle(forwardedRef, () => ({
|
|
64
|
+
submit() {
|
|
65
|
+
handleSubmit();
|
|
66
|
+
},
|
|
67
|
+
reset() {
|
|
68
|
+
reset();
|
|
69
|
+
},
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<FormProvider {...form}>
|
|
75
|
+
<Box mb={1}>
|
|
76
|
+
<FilterFormBase
|
|
77
|
+
onSubmit={onSubmit}
|
|
78
|
+
filters={filters}
|
|
79
|
+
|
|
80
|
+
/>
|
|
81
|
+
{ resourceConfig?.filterButtonPosition === 'filters-container' &&
|
|
82
|
+
<Button className='toolbar-filters-filter-button' onClick={() => form.handleSubmit(onSubmit)()} variant={'contained'} color="primary" type="button">
|
|
83
|
+
Filtrar
|
|
84
|
+
</Button>}
|
|
85
|
+
</Box>
|
|
86
|
+
|
|
87
|
+
</FormProvider>
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
export default DashAutoListFilterFormWithButton;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import FabButton from '../common/components/FabButton';
|
|
2
|
+
import { SavedQueriesList, useRefresh, useUnselectAll, ListContext } from 'react-admin';
|
|
3
|
+
import { TopToolbar, FilterForm } from 'react-admin';
|
|
4
|
+
import IDashAutoAdminResourceConfig from '../interfaces/IDashAutoAdminResourceConfig';
|
|
5
|
+
import { FC, ReactNode, useContext, JSX } from 'react';
|
|
6
|
+
import { Box, Button, Collapse, Fab, Grid, Portal } from '@mui/material';
|
|
7
|
+
import FilterAltOffIcon from '@mui/icons-material/FilterAltOff';
|
|
8
|
+
import DashAutoListFilterFormWithButton, { IToolbarFiltersHandler } from './DashAutoListFilterFormWithButton';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import KeyboardArrowUp from '@mui/icons-material/KeyboardArrowUp';
|
|
11
|
+
import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';
|
|
12
|
+
import Search from '@mui/icons-material/Search';
|
|
13
|
+
import { ToolbarCreateButton, ToolbarExportButton } from '../toolbar/buttons/ToolbarButtons';
|
|
14
|
+
import { Refresh } from '@mui/icons-material';
|
|
15
|
+
|
|
16
|
+
// Safe hook that doesn't throw when context is missing
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
const useSafeListContext = (): any => {
|
|
19
|
+
const context = useContext(ListContext);
|
|
20
|
+
return context ?? null;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export interface IToolbarFilters {
|
|
24
|
+
resourceConfig: IDashAutoAdminResourceConfig;
|
|
25
|
+
filters: any;
|
|
26
|
+
filterButtonText?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const ToolbarFilters = React.forwardRef<IToolbarFiltersHandler, IToolbarFilters>((props, forwardedRef) => {
|
|
30
|
+
const handleSubmit = () => {
|
|
31
|
+
console.error('handleSubmit at ToolbarFilters not implemented');
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const reset = () => {
|
|
35
|
+
console.error('reset at ToolbarFilters not implemented');
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
React.useImperativeHandle(forwardedRef, () => ({
|
|
39
|
+
submit() {
|
|
40
|
+
handleSubmit();
|
|
41
|
+
},
|
|
42
|
+
reset() {
|
|
43
|
+
reset();
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
const { resourceConfig, filters } = props;
|
|
48
|
+
return resourceConfig.hideDefaultFilters !== true ? <FilterForm filters={filters} /> : <></>;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Add display name for debugging
|
|
52
|
+
ToolbarFilters.displayName = 'ToolbarFilters';
|
|
53
|
+
|
|
54
|
+
export interface IDashAutoListTopToolbar {
|
|
55
|
+
resourceConfig: IDashAutoAdminResourceConfig,
|
|
56
|
+
autoFilters: JSX.Element[],
|
|
57
|
+
filters: ReactNode[],
|
|
58
|
+
countFilters: number,
|
|
59
|
+
expanded: boolean,
|
|
60
|
+
setExpanded: (expanded: boolean) => void,
|
|
61
|
+
filterCountToCollapse?: number,
|
|
62
|
+
collapsedSize?: number | string,
|
|
63
|
+
fabButtonSize?: string, // New optional prop for FAB button size
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const DashAutoListTopToolbar: FC<IDashAutoListTopToolbar> = (props) => {
|
|
67
|
+
const {
|
|
68
|
+
resourceConfig,
|
|
69
|
+
autoFilters,
|
|
70
|
+
filters,
|
|
71
|
+
countFilters,
|
|
72
|
+
expanded,
|
|
73
|
+
setExpanded,
|
|
74
|
+
filterCountToCollapse = 5,
|
|
75
|
+
collapsedSize = '60px',
|
|
76
|
+
fabButtonSize = '20px' // Default to 20px as requested
|
|
77
|
+
} = props;
|
|
78
|
+
|
|
79
|
+
// Use safe context hook that doesn't throw when context is missing
|
|
80
|
+
const listContext = useSafeListContext();
|
|
81
|
+
const setFilters = listContext?.setFilters;
|
|
82
|
+
const unselectAll = useUnselectAll(resourceConfig.listProps?.storeKey || resourceConfig.model);
|
|
83
|
+
|
|
84
|
+
const FilterComponent = resourceConfig.FilterFormComponent
|
|
85
|
+
? resourceConfig.FilterFormComponent
|
|
86
|
+
: (resourceConfig.filterWithSubmit === true ? DashAutoListFilterFormWithButton : ToolbarFilters);
|
|
87
|
+
|
|
88
|
+
type FilterComponentHandle = React.ElementRef<React.ForwardRefExoticComponent<IToolbarFilters & React.RefAttributes<IToolbarFiltersHandler>>>;
|
|
89
|
+
|
|
90
|
+
const ref = React.useRef<FilterComponentHandle>(null);
|
|
91
|
+
const refresh = useRefresh();
|
|
92
|
+
const clearFilters = () => {
|
|
93
|
+
unselectAll();
|
|
94
|
+
if (setFilters) {
|
|
95
|
+
setFilters({}, []);
|
|
96
|
+
}
|
|
97
|
+
ref.current?.reset();
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const refreshList = () => {
|
|
101
|
+
refresh();
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return <div>
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<div
|
|
109
|
+
style={{
|
|
110
|
+
display: 'flex',
|
|
111
|
+
justifyContent: 'flex-start',
|
|
112
|
+
flexWrap: 'wrap',
|
|
113
|
+
}}
|
|
114
|
+
className='toolbar-actions'
|
|
115
|
+
>
|
|
116
|
+
<ToolbarCreateButton mode='create' resourceConfig={resourceConfig} />
|
|
117
|
+
<ToolbarExportButton mode='create' resourceConfig={resourceConfig} />
|
|
118
|
+
|
|
119
|
+
{typeof resourceConfig.customToolbarElements === 'function'
|
|
120
|
+
? resourceConfig.customToolbarElements(filters)
|
|
121
|
+
: resourceConfig.customToolbarElements}
|
|
122
|
+
|
|
123
|
+
{typeof resourceConfig.customToolbarActions === 'function'
|
|
124
|
+
? resourceConfig.customToolbarActions(filters)
|
|
125
|
+
: resourceConfig.customToolbarActions}
|
|
126
|
+
|
|
127
|
+
{!!resourceConfig.showSavedQueries && <SavedQueriesList />}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
{countFilters ? (
|
|
136
|
+
<div>
|
|
137
|
+
<Collapse
|
|
138
|
+
className='toolbar-collapse'
|
|
139
|
+
orientation='vertical'
|
|
140
|
+
collapsedSize={collapsedSize}
|
|
141
|
+
in={expanded}
|
|
142
|
+
timeout='auto'
|
|
143
|
+
>
|
|
144
|
+
<div className='toolbar-filters'>
|
|
145
|
+
<FilterComponent ref={ref} resourceConfig={resourceConfig} filters={filters} />
|
|
146
|
+
</div>
|
|
147
|
+
</Collapse>
|
|
148
|
+
</div>
|
|
149
|
+
) : <></>}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
{countFilters && resourceConfig?.filterWithSubmit === true && resourceConfig?.filterButtonPosition !== 'filters-container' ?
|
|
157
|
+
<div
|
|
158
|
+
style={{
|
|
159
|
+
display: 'flex',
|
|
160
|
+
justifyContent: 'flex-end',
|
|
161
|
+
flexWrap: 'wrap',
|
|
162
|
+
}}
|
|
163
|
+
className='toolbar-buttons'
|
|
164
|
+
>
|
|
165
|
+
<Button
|
|
166
|
+
endIcon={<Search />}
|
|
167
|
+
variant='contained'
|
|
168
|
+
onClick={() => {
|
|
169
|
+
ref.current?.submit();
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
Filtrar
|
|
173
|
+
</Button>
|
|
174
|
+
</div>: <></>}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
<Box className='toolbar-right-buttons' sx={{
|
|
179
|
+
|
|
180
|
+
gap: 0.5,
|
|
181
|
+
padding: 0.5
|
|
182
|
+
|
|
183
|
+
}}>
|
|
184
|
+
<FabButton
|
|
185
|
+
onClick={refreshList}
|
|
186
|
+
size='small'
|
|
187
|
+
aria-label='refresh'
|
|
188
|
+
color='primary'
|
|
189
|
+
icon={<Refresh sx={{ fontSize: '1rem' }} />}
|
|
190
|
+
tooltip={'Refrescar'}
|
|
191
|
+
style={{
|
|
192
|
+
width: fabButtonSize,
|
|
193
|
+
height: fabButtonSize,
|
|
194
|
+
minHeight: fabButtonSize
|
|
195
|
+
}}
|
|
196
|
+
/>
|
|
197
|
+
{countFilters && autoFilters ? (
|
|
198
|
+
<FabButton
|
|
199
|
+
onClick={clearFilters}
|
|
200
|
+
size='small'
|
|
201
|
+
aria-label='refresh'
|
|
202
|
+
color='primary'
|
|
203
|
+
icon={<FilterAltOffIcon sx={{ fontSize: '1rem' }} />}
|
|
204
|
+
tooltip={'Borrar filtros'}
|
|
205
|
+
style={{
|
|
206
|
+
width: fabButtonSize,
|
|
207
|
+
height: fabButtonSize,
|
|
208
|
+
minHeight: fabButtonSize
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
211
|
+
) : <></>}
|
|
212
|
+
|
|
213
|
+
{countFilters/*> (Number(filterCountToCollapse) || 3)*/ ? (
|
|
214
|
+
<Fab
|
|
215
|
+
size='small'
|
|
216
|
+
aria-label='collapse'
|
|
217
|
+
color='primary'
|
|
218
|
+
onClick={() => setExpanded(!expanded)}
|
|
219
|
+
style={{
|
|
220
|
+
width: fabButtonSize,
|
|
221
|
+
height: fabButtonSize,
|
|
222
|
+
minHeight: fabButtonSize
|
|
223
|
+
}}
|
|
224
|
+
className='toolbar-collapse-button'
|
|
225
|
+
>
|
|
226
|
+
{expanded ? <KeyboardArrowDown sx={{ fontSize: '1rem' }} /> : <KeyboardArrowUp sx={{ fontSize: '1rem' }} />}
|
|
227
|
+
</Fab>
|
|
228
|
+
) : <></>}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
</Box>
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export default DashAutoListTopToolbar;
|