drf-react-by-schema 0.2.2 → 0.3.1

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.
Files changed (79) hide show
  1. package/dist/api.d.ts +84 -0
  2. package/dist/api.js +613 -0
  3. package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts +8 -0
  4. package/dist/components/DataGridBySchemaEditable/ConfirmDialog.js +21 -0
  5. package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts +16 -0
  6. package/dist/components/DataGridBySchemaEditable/CustomToolbar.js +77 -0
  7. package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts +16 -0
  8. package/dist/components/DataGridBySchemaEditable/FooterToolbar.js +41 -0
  9. package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts +8 -0
  10. package/dist/components/DataGridBySchemaEditable/GridDecimalInput.js +32 -0
  11. package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts +8 -0
  12. package/dist/components/DataGridBySchemaEditable/GridPatternInput.js +30 -0
  13. package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts +3 -0
  14. package/dist/components/DataGridBySchemaEditable/InputInterval.js +105 -0
  15. package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts +33 -0
  16. package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.js +140 -0
  17. package/dist/components/DataGridBySchemaEditable/utils.d.ts +15 -0
  18. package/{src/components/DataGridBySchemaEditable/utils.ts → dist/components/DataGridBySchemaEditable/utils.js} +32 -50
  19. package/dist/components/DataGridBySchemaEditable.d.ts +34 -0
  20. package/dist/components/DataGridBySchemaEditable.js +549 -0
  21. package/dist/components/DataTotals.d.ts +14 -0
  22. package/dist/components/DataTotals.js +23 -0
  23. package/dist/components/DialogActions.d.ts +10 -0
  24. package/dist/components/DialogActions.js +17 -0
  25. package/dist/components/DialogJSONSchemaForm.d.ts +12 -0
  26. package/dist/components/DialogJSONSchemaForm.js +20 -0
  27. package/dist/components/FormButtons.d.ts +14 -0
  28. package/dist/components/FormButtons.js +39 -0
  29. package/dist/components/GenericModelList.d.ts +19 -0
  30. package/dist/components/GenericModelList.js +113 -0
  31. package/dist/components/GenericRelatedModelList.d.ts +25 -0
  32. package/dist/components/GenericRelatedModelList.js +111 -0
  33. package/dist/components/TextFieldBySchema.js +39 -0
  34. package/dist/context/APIWrapper.d.ts +12 -0
  35. package/dist/context/APIWrapper.js +341 -0
  36. package/dist/context/APIWrapperContext.d.ts +75 -0
  37. package/dist/context/APIWrapperContext.js +15 -0
  38. package/dist/context/DRFReactBySchemaContext.d.ts +20 -0
  39. package/dist/context/DRFReactBySchemaContext.js +19 -0
  40. package/dist/context/DRFReactBySchemaProvider.d.ts +13 -0
  41. package/dist/context/DRFReactBySchemaProvider.js +53 -0
  42. package/dist/context/Form.d.ts +11 -0
  43. package/dist/context/Form.js +82 -0
  44. package/dist/context/Overlays.d.ts +4 -0
  45. package/dist/context/Overlays.js +87 -0
  46. package/dist/index.d.ts +11 -0
  47. package/dist/index.js +14 -27
  48. package/{src/styles/index.ts → dist/styles/index.d.ts} +0 -1
  49. package/dist/styles/index.js +28 -0
  50. package/dist/styles/layout.d.ts +107 -0
  51. package/dist/styles/layout.js +56 -0
  52. package/dist/styles/theme.d.ts +21 -0
  53. package/dist/styles/theme.js +139 -0
  54. package/dist/utils.d.ts +75 -0
  55. package/dist/utils.js +268 -0
  56. package/package.json +15 -2
  57. package/.eslintrc.js +0 -14
  58. package/.gitlab-ci.yml +0 -14
  59. package/src/api.ts +0 -733
  60. package/src/components/DataGridBySchemaEditable/ConfirmDialog.tsx +0 -41
  61. package/src/components/DataGridBySchemaEditable/CustomToolbar.tsx +0 -93
  62. package/src/components/DataGridBySchemaEditable/FooterToolbar.tsx +0 -77
  63. package/src/components/DataGridBySchemaEditable/GridDecimalInput.tsx +0 -41
  64. package/src/components/DataGridBySchemaEditable/GridPatternInput.tsx +0 -37
  65. package/src/components/DataGridBySchemaEditable/InputInterval.tsx +0 -194
  66. package/src/components/DataGridBySchemaEditable/SelectEditInputCell.tsx +0 -153
  67. package/src/components/DataGridBySchemaEditable.md +0 -50
  68. package/src/components/DataGridBySchemaEditable.tsx +0 -747
  69. package/src/components/DataTotals.tsx +0 -56
  70. package/src/components/GenericModelList.tsx +0 -155
  71. package/src/context/DRFReactBySchemaProvider.md +0 -50
  72. package/src/context/DRFReactBySchemaProvider.tsx +0 -78
  73. package/src/index.ts +0 -64
  74. package/src/styles/layout.ts +0 -104
  75. package/src/styles/theme.ts +0 -190
  76. package/src/utils.ts +0 -321
  77. package/styleguide.config.js +0 -13
  78. package/tsconfig.json +0 -104
  79. package/webpack.config.js +0 -24
@@ -1,56 +0,0 @@
1
- import React from 'react';
2
- import Alert, { AlertColor } from '@mui/material/Alert';
3
- import List from '@mui/material/List';
4
- import ListItem from '@mui/material/ListItem';
5
- import { NumericFormat } from 'react-number-format';
6
- import { Item } from '../utils';
7
- import { DRFReactBySchemaContext, DRFReactBySchemaContextType } from '../context/DRFReactBySchemaProvider';
8
-
9
- export interface SumRowsType {
10
- rows: Item[],
11
- severity?: AlertColor;
12
- }
13
-
14
- interface DataTotalsProps {
15
- data?: Item[];
16
- sumRows?: SumRowsType;
17
- visibleRows?: string[];
18
- };
19
-
20
- const DataTotals = ({
21
- data,
22
- sumRows,
23
- visibleRows
24
- }: DataTotalsProps) => {
25
- return (
26
- <>
27
- {data && sumRows && sumRows.rows.length > 0 &&
28
- <Alert severity={sumRows.severity || 'info'}>
29
- <List dense={true}>
30
- {sumRows.rows.map(row => (
31
- <ListItem key={`sumRows_${row.field}`}>
32
- <NumericFormat
33
- value={data.reduce((total, item) => {
34
- if (parseFloat(item[row.field]) && visibleRows && visibleRows.includes(item.id)) {
35
- return total + parseFloat(item[row.field]);
36
- }
37
- return total;
38
- }, 0)}
39
- thousandSeparator='.'
40
- decimalSeparator=','
41
- displayType={'text'}
42
- decimalScale={row.isCount ? 0 : 2}
43
- fixedDecimalScale={true}
44
- prefix={row.prefix}
45
- suffix={row.suffix}
46
- />
47
- </ListItem>
48
- ))}
49
- </List>
50
- </Alert>
51
- }
52
- </>
53
- );
54
- };
55
-
56
- export default DataTotals;
@@ -1,155 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import Box from '@mui/material/Box';
3
-
4
- import DataGridBySchemaEditable from './DataGridBySchemaEditable';
5
- import DataTotals, { SumRowsType } from './DataTotals';
6
- import { Layout } from '../styles';
7
- // import CONSTANTS from '../constants';
8
- import { GridEnrichedBySchemaColDef, Item, SchemaType } from '../utils';
9
- import { DataSchemaColumnsType, getGenericModelList, getGenericModelListProps } from '../api';
10
- import { DRFReactBySchemaContext, DRFReactBySchemaContextType } from '../context/DRFReactBySchemaProvider';
11
-
12
- interface GenericModelListProps {
13
- columnFields: string[];
14
- hiddenFields?: string[];
15
- minWidthFields?: Record<string, number>;
16
- indexFieldBasePath: string;
17
- indexField: string;
18
- customColumnOperations?: (column: GridEnrichedBySchemaColDef) => GridEnrichedBySchemaColDef;
19
- customLinkDestination?: (p: any) => string;
20
- sumRows?: SumRowsType;
21
- isAutoHeight?: boolean;
22
- model: string;
23
- handleLoading: (p: any) => void;
24
- forceReload: boolean;
25
- LinkComponent: React.ReactNode;
26
- }
27
-
28
- const GenericModelList = ({
29
- columnFields,
30
- hiddenFields = [],
31
- minWidthFields,
32
- indexFieldBasePath,
33
- indexField,
34
- customColumnOperations,
35
- customLinkDestination,
36
- sumRows,
37
- isAutoHeight = true,
38
- model,
39
- handleLoading,
40
- forceReload = false,
41
- LinkComponent = null
42
- }: GenericModelListProps) => {
43
- const { serverEndPoint, isInBatches, firstBatchLength }:DRFReactBySchemaContextType = DRFReactBySchemaContext
44
- ? React.useContext(DRFReactBySchemaContext) as DRFReactBySchemaContextType
45
- : { serverEndPoint: null };
46
- if (!serverEndPoint) {
47
- console.error('Error: There is no endpoint defined in DRFReactBySchemaProvider!');
48
- return (<></>);
49
- }
50
- interface dataProps {
51
- data: Item[];
52
- schema: SchemaType;
53
- columns: GridEnrichedBySchemaColDef[]
54
- };
55
- const [data, setData] = useState<DataSchemaColumnsType | boolean>(false);
56
- const [visibleRows, setVisibleRows] = useState<string[]>([]);
57
- const [hideFooterPagination, setHideFooterPagination] = useState(false);
58
-
59
- const finalCustomColumnOperations = (column: GridEnrichedBySchemaColDef) => {
60
- if (minWidthFields) {
61
- if (Object.prototype.hasOwnProperty.call(minWidthFields, column.field)) {
62
- column.minWidth = minWidthFields[column.field];
63
- }
64
- }
65
-
66
- if (customColumnOperations) {
67
- return customColumnOperations(column);
68
- }
69
-
70
- return column;
71
- };
72
-
73
- const loadObjectList = async () => {
74
- const loadParams:getGenericModelListProps = {
75
- model,
76
- serverEndPoint,
77
- columnFields,
78
- hiddenFields,
79
- isInBatches
80
- };
81
- handleLoading(true);
82
- const loadedData = await getGenericModelList(loadParams);
83
- if (loadedData && typeof loadedData !== 'boolean') {
84
- setData(loadedData);
85
- handleLoading(false);
86
- if (isInBatches && loadedData.data.length === firstBatchLength) {
87
- setHideFooterPagination(true);
88
- getGenericModelList({
89
- ...loadParams,
90
- loadedSchema: loadedData.schema
91
- }).then(lastBatchData => {
92
- if (lastBatchData && typeof lastBatchData !== 'boolean') {
93
- setData({
94
- ...loadedData,
95
- data: [
96
- ...loadedData.data,
97
- ...lastBatchData.data
98
- ]
99
- });
100
- }
101
- setHideFooterPagination(false);
102
- });
103
- }
104
- return;
105
- }
106
- console.log('error retrieving data!');
107
- };
108
-
109
- if (forceReload) {
110
- loadObjectList();
111
- }
112
-
113
- useEffect(() => {
114
- loadObjectList();
115
- }, []);
116
-
117
- return (
118
- <>
119
- {data && typeof data !== 'boolean' && data.columns &&
120
- <>
121
- <Box sx={Layout.dataGridWithTabs}>
122
- <DataGridBySchemaEditable
123
- data={data.data}
124
- columns={data.columns}
125
- schema={data.schema || {}}
126
- model={model}
127
- indexField={indexField}
128
- indexFieldBasePath={indexFieldBasePath}
129
- isEditable={false}
130
- isAutoHeight={isAutoHeight}
131
- hideFooterPagination={hideFooterPagination}
132
- customColumnOperations={finalCustomColumnOperations}
133
- customLinkDestination={customLinkDestination}
134
- setVisibleRows={setVisibleRows}
135
- onDataChange={newData => {
136
- setData({
137
- ...data,
138
- data: newData
139
- });
140
- }}
141
- LinkComponent={LinkComponent}
142
- />
143
- </Box>
144
- <DataTotals
145
- data={data.data}
146
- sumRows={sumRows}
147
- visibleRows={visibleRows}
148
- />
149
- </>
150
- }
151
- </>
152
- );
153
- };
154
-
155
- export default GenericModelList;
@@ -1,50 +0,0 @@
1
- DRFReactBySchemaProvider example:
2
-
3
- ```js
4
- import DataGridBySchemaEditable from '../components/DataGridBySchemaEditable';
5
- const data = {
6
- data: [],
7
- columns: [],
8
- schema: {}
9
- };
10
- const model = 'example';
11
- const indexField = null;
12
- const indexFieldBasePath = null;
13
- const isAutoHeight = true;
14
- const hideFooterPagination = false;
15
- const finalCustomColumnOperations = null;
16
- const customLinkDestination = null;
17
- const setVisibleRows = null;
18
- const setData = (newData) => {
19
- return '';
20
- };
21
- const Link = null;
22
- <DRFReactBySchemaProvider
23
- serverEndPoint={{
24
- url: 'https://icv.eita.org.br/api',
25
- apiTokenUrl: 'https://icv.eita.org.br/api-auth/token'
26
- }}
27
- >
28
- <DataGridBySchemaEditable
29
- data={data.data}
30
- columns={data.columns}
31
- schema={data.schema}
32
- model={model}
33
- indexField={indexField}
34
- indexFieldBasePath={indexFieldBasePath}
35
- isEditable={false}
36
- isAutoHeight={isAutoHeight}
37
- hideFooterPagination={hideFooterPagination}
38
- customColumnOperations={finalCustomColumnOperations}
39
- customLinkDestination={customLinkDestination}
40
- setVisibleRows={setVisibleRows}
41
- onDataChange={newData => {
42
- setData({
43
- ...data,
44
- data: newData
45
- });
46
- }}
47
- LinkComponent={Link}
48
- />
49
- </DRFReactBySchemaProvider>
50
- ```
@@ -1,78 +0,0 @@
1
- import { ServerResponse } from 'http';
2
- import React from 'react';
3
-
4
- export interface serverEndPointType {
5
- url: string;
6
- autocomplete?: string;
7
- api?: string;
8
- JSONSchema?: string;
9
- apiTokenUrl: string;
10
- getToken?: string;
11
- refreshToken?: string,
12
- verifyToken?: string
13
- }
14
- export interface DRFReactBySchemaContextType {
15
- serverEndPoint: serverEndPointType | null;
16
- isInBatches?: boolean;
17
- firstBatchLength?: number;
18
- }
19
-
20
- interface DRFReactBySchemaProviderProps extends DRFReactBySchemaContextType {
21
- children: React.ReactNode;
22
- }
23
-
24
- export const DRFReactBySchemaContext = React.createContext<DRFReactBySchemaContextType>({
25
- serverEndPoint: null,
26
- isInBatches: true,
27
- firstBatchLength: 100
28
- });
29
-
30
- /**
31
- *
32
- *
33
- * @param {*} props
34
- * @returns {*}
35
- */
36
- const DRFReactBySchemaProvider: React.FC<DRFReactBySchemaProviderProps> = ({
37
- serverEndPoint,
38
- isInBatches,
39
- firstBatchLength,
40
- children
41
- }) => {
42
- if (serverEndPoint) {
43
- const defaultKeys = [
44
- 'autocomplete',
45
- 'api',
46
- ['JSONSchema', 'jsonschema'],
47
- ['getToken', ''],
48
- ['refreshToken', 'refresh'],
49
- ['verifyToken', 'verify']
50
- ];
51
- for (const key of defaultKeys) {
52
- const hybridKey = (typeof key === 'string')
53
- ? key as keyof serverEndPointType
54
- : key[0] as keyof serverEndPointType;
55
- const hybridUrl = (typeof key === 'string')
56
- ? key
57
- : key[1];
58
- if (serverEndPoint[hybridKey]) {
59
- continue;
60
- }
61
- serverEndPoint[hybridKey] = `${serverEndPoint.url}/${hybridUrl}`;
62
- }
63
- }
64
-
65
- return (
66
- <DRFReactBySchemaContext.Provider
67
- value={{
68
- serverEndPoint,
69
- isInBatches,
70
- firstBatchLength
71
- }}
72
- >
73
- {children}
74
- </DRFReactBySchemaContext.Provider>
75
- );
76
- }
77
-
78
- export default DRFReactBySchemaProvider;
package/src/index.ts DELETED
@@ -1,64 +0,0 @@
1
- import {
2
- updateData,
3
- partialUpdateData,
4
- createData,
5
- deleteData,
6
- createOrUpdateData,
7
- updateDataBySchema,
8
- addExistingRelatedModel,
9
- getAutoComplete,
10
- getJSONSchema,
11
- createOrUpdateJSONSchema,
12
- loginByPayload,
13
- setAuthToken,
14
- isLoggedIn,
15
- getGenericModelList,
16
- getGenericModel
17
- } from './api';
18
- import {
19
- emptyByType,
20
- getChoiceByValue,
21
- populateValues,
22
- buildGenericYupValidationSchema,
23
- errorProps,
24
- getTmpId,
25
- isTmpId,
26
- getPatternFormat
27
- } from './utils';
28
-
29
- // Components:
30
- import DRFReactBySchemaProvider, { DRFReactBySchemaContext } from './context/DRFReactBySchemaProvider';
31
- import DataGridBySchemaEditable from './components/DataGridBySchemaEditable';
32
- import GenericModelList from './components/GenericModelList';
33
- import DataTotals from './components/DataTotals';
34
-
35
- export {
36
- DRFReactBySchemaProvider,
37
- DRFReactBySchemaContext,
38
- DataGridBySchemaEditable,
39
- GenericModelList,
40
- DataTotals,
41
- updateData,
42
- partialUpdateData,
43
- createData,
44
- deleteData,
45
- createOrUpdateData,
46
- updateDataBySchema,
47
- addExistingRelatedModel,
48
- getAutoComplete,
49
- getJSONSchema,
50
- createOrUpdateJSONSchema,
51
- loginByPayload,
52
- setAuthToken,
53
- isLoggedIn,
54
- getGenericModelList,
55
- getGenericModel,
56
- emptyByType,
57
- getChoiceByValue,
58
- populateValues,
59
- buildGenericYupValidationSchema,
60
- errorProps,
61
- getTmpId,
62
- isTmpId,
63
- getPatternFormat
64
- };
@@ -1,104 +0,0 @@
1
- import theme from './theme';
2
-
3
- export const content = {
4
- flexGrow: 1,
5
- pr: 3,
6
- pl: 3,
7
- pt: 2,
8
- pb: 0
9
- };
10
-
11
- export const main = {
12
- ...content,
13
- ml: 4
14
- };
15
-
16
- export const flexRow = {
17
- display: 'flex',
18
- flexDirection: 'row',
19
- justifyContent: 'space-between',
20
- alignItems: 'center'
21
- };
22
-
23
- export const topBar = {
24
- ...flexRow,
25
- width: '100%',
26
- pl: 3,
27
- pr: 6
28
- };
29
-
30
- export const loadingBox = {
31
- ...flexRow,
32
- height: '100%',
33
- backgroundColor: '#ccc',
34
- justifyContent: 'center'
35
- };
36
-
37
- export const actionButtons = {
38
- ...flexRow,
39
- width: '100%',
40
- alignItems: 'flex-start'
41
- };
42
-
43
- export const inLineForm = {
44
- ...flexRow,
45
- width: '100%',
46
- justifyContent: 'flex-start'
47
- };
48
-
49
- export const flexColumn = {
50
- ...flexRow,
51
- flexDirection: 'column'
52
- };
53
-
54
- export const flexRowGrow = {
55
- ...flexRow,
56
- flexGrow: 1
57
- };
58
-
59
- export const topBarOverList = {
60
- ...flexRowGrow,
61
- mb: 2
62
- };
63
-
64
- export const dataGrid = {
65
- height: 'calc(100vh - 180px)',
66
- mt: 2
67
- };
68
-
69
- export const dataGridWithTabs = {
70
- ...dataGrid,
71
- mt: 0
72
- };
73
-
74
- export const dataGridFixedHeight = {
75
- ...dataGrid,
76
- height: 400
77
- };
78
-
79
- export const fullWidthButton = {
80
- mt: 3,
81
- width: '100%'
82
- };
83
-
84
- export const formCard = {
85
- width: '100%',
86
- backgroundColor: theme.palette.formCard.main,
87
- mt: 2,
88
- mb: 2
89
- };
90
-
91
- export const formCardContent = {
92
- maxHeight: 350,
93
- overflow: 'scroll'
94
- };
95
-
96
- export const metabaseAppEmbed = {
97
- height: 1700
98
- };
99
-
100
- export const geoPicker = {
101
- height: 350,
102
- width: '100%',
103
- mt: 0
104
- };
@@ -1,190 +0,0 @@
1
- import type {} from '@mui/x-data-grid/themeAugmentation';
2
- import { createTheme } from '@mui/material/styles';
3
- import { ptBR as corePtBR } from '@mui/material/locale';
4
- import { ptBR } from '@mui/x-data-grid';
5
- import { ptBR as pickersPtBR } from '@mui/x-date-pickers';
6
-
7
- declare module '@mui/material/styles' {
8
- // interface Theme {
9
- // status: {
10
- // danger: React.CSSProperties['color'];
11
- // };
12
- // }
13
- interface Palette {
14
- avatars: string[];
15
- avatarsMore: string[];
16
- topBarButton: Palette['primary'];
17
- producao: Palette['primary'];
18
- empreendimento: Palette['primary'];
19
- comercializacao: Palette['primary'];
20
- credito: Palette['primary'];
21
- certificacao: Palette['primary'];
22
- successButton: Palette['primary'];
23
- selectedItem: Palette['primary'];
24
- tableColumnHeader: Palette['primary'];
25
- formCard: Palette['primary'];
26
- }
27
- // interface PaletteOptions {
28
- // neutral: PaletteOptions['primary'];
29
- // }
30
- //
31
- interface PaletteColor {
32
- semaphoric?: string;
33
- }
34
- // interface SimplePaletteColorOptions {
35
- // darker?: string;
36
- // }
37
- // interface ThemeOptions {
38
- // status: {
39
- // danger: React.CSSProperties['color'];
40
- // };
41
- // }
42
- }
43
-
44
-
45
- ptBR.components.MuiDataGrid.defaultProps.localeText = {
46
- ...ptBR.components.MuiDataGrid.defaultProps.localeText,
47
- toolbarQuickFilterPlaceholder: 'Buscar...',
48
- toolbarQuickFilterLabel: 'Buscar',
49
- toolbarQuickFilterDeleteIconLabel: 'Limpar busca'
50
- };
51
-
52
- const palette = {
53
- avatars: ['#e60049', '#0bb4ff', '#50e991', '#e6d800', '#9b19f5', '#ffa300', '#dc0ab4', '#b3d4ff', '#00bfa0'],
54
- avatarsMore: ['#023fa5', '#8e063b', '#d33f6a', '#11c638', '#ef9708', '#0fcfc0', '#f79cd4', '#7d87b9', '#bb7784', '#4a6fe3', '#8595e1', '#b5bbe3', '#e6afb9', '#e07b91', '#8dd593', '#c6dec7', '#ead3c6', '#f0b98d', '#9cded6', '#d5eae7', '#f3e1eb', '#f6c4e1', '#bec1d4', '#d6bcc0'],
55
- topBarButton: {
56
- main: '#ffffff'
57
- },
58
- producao: {
59
- main: '#e60049',
60
- contrastText: '#fff'
61
- },
62
- empreendimento: {
63
- main: '#0bb4ff',
64
- contrastText: '#fff'
65
- },
66
- comercializacao: {
67
- main: '#ffa300',
68
- contrastText: '#fff'
69
- },
70
- credito: {
71
- main: '#dc0ab4',
72
- contrastText: '#fff'
73
- },
74
- certificacao: {
75
- main: '#9b19f5',
76
- contrastText: '#fff'
77
- },
78
- background: {
79
- default: '#D9D9D9'
80
- },
81
- primary: {
82
- main: '#3949AB'
83
- },
84
- secondary: {
85
- main: '#9ca4d5',
86
- contrastText: '#fff'
87
- },
88
- successButton: {
89
- main: '#CDDC39',
90
- contrastText: '#fff'
91
- },
92
- success: {
93
- main: '#0e0',
94
- contrastText: '#fff',
95
- semaphoric: '#0e0'
96
- },
97
- error: {
98
- main: '#d32f2f',
99
- semaphoric: '#f66'
100
- },
101
- warning: {
102
- main: '#ee0',
103
- semaphoric: '#ee0'
104
- },
105
- selectedItem: {
106
- main: '#2962FF'
107
- },
108
- tableColumnHeader: {
109
- main: '#ECEFF1'
110
- },
111
- formCard: {
112
- main: '#FFF'
113
- }
114
- };
115
-
116
- const theme = createTheme(
117
- {
118
- palette,
119
- components: {
120
- MuiButton: {
121
- styleOverrides: {
122
- contained: {
123
- // borderRadius: 50
124
- }
125
- }
126
- },
127
- MuiTextField: {
128
- styleOverrides: {
129
- root: {
130
- '&.Mui-required .MuiFormLabel-asterisk': {
131
- // color: '#F00'
132
- }
133
- }
134
- }
135
- },
136
- MuiListItemButton: {
137
- styleOverrides: {
138
- root: {
139
- '&.Mui-selected, :hover': {
140
- color: palette.selectedItem.main,
141
- '& .MuiListItemIcon-root': {
142
- color: palette.selectedItem.main
143
- }
144
- },
145
- '&.Mui-selected:hover': {
146
- color: palette.selectedItem.main,
147
- '& .MuiListItemIcon-root': {
148
- color: palette.selectedItem.main
149
- }
150
- },
151
- '&.disabled': {
152
- opacity: 0.5
153
- }
154
- }
155
- }
156
- },
157
- MuiDataGrid: {
158
- styleOverrides: {
159
- root: {
160
- backgroundColor: palette.formCard.main,
161
- '& .MuiDataGrid-columnHeaderTitle': {
162
- overflow: 'visible',
163
- lineHeight: '1.43rem',
164
- whiteSpace: 'normal'
165
- }
166
- },
167
- cell: {
168
- // backgroundColor: 'yellow'
169
- },
170
- columnHeader: {
171
- backgroundColor: palette.tableColumnHeader.main
172
- }
173
- }
174
- },
175
- MuiTabs: {
176
- styleOverrides: {
177
- root: {
178
- backgroundColor: palette.formCard.main,
179
- marginTop: 20
180
- }
181
- }
182
- }
183
- }
184
- },
185
- corePtBR,
186
- ptBR,
187
- pickersPtBR
188
- );
189
-
190
- export default theme;