@archbase/components 3.0.2 → 3.0.4
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/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/datagrid/main/archbase-data-grid-types.d.ts +23 -0
- package/dist/index.js +5069 -4999
- package/package.json +4 -4
- package/src/datagrid/main/archbase-data-grid-pagination.tsx +16 -5
- package/src/datagrid/main/archbase-data-grid-toolbar.tsx +15 -4
- package/src/datagrid/main/archbase-data-grid-types.tsx +29 -0
- package/src/datagrid/main/archbase-data-grid.tsx +70 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archbase/components",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "UI Components for Archbase React v3 - Form editors, data visualization, and business components",
|
|
5
5
|
"author": "Edson Martins <edsonmartins2005@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"react-dom": "^18.3.0 || ^19.2.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@archbase/core": "3.0.
|
|
42
|
-
"@archbase/data": "3.0.
|
|
43
|
-
"@archbase/layout": "3.0.
|
|
41
|
+
"@archbase/core": "3.0.4",
|
|
42
|
+
"@archbase/data": "3.0.4",
|
|
43
|
+
"@archbase/layout": "3.0.4",
|
|
44
44
|
"@datou/react-vis-timeline": "^1.4.0",
|
|
45
45
|
"@gfazioli/mantine-list-view-table": "^1.1.9",
|
|
46
46
|
"@gfazioli/mantine-onboarding-tour": "^2.6.5",
|
|
@@ -13,7 +13,11 @@ export const ArchbaseDataGridPagination = React.memo<ArchbaseDataGridPaginationP
|
|
|
13
13
|
onPaginationModelChange,
|
|
14
14
|
paginationLabels,
|
|
15
15
|
bottomToolbarMinHeight,
|
|
16
|
-
theme
|
|
16
|
+
theme,
|
|
17
|
+
// Props para controle de bordas e espaçamento
|
|
18
|
+
withBorder = true,
|
|
19
|
+
padding = '8px 12px',
|
|
20
|
+
borderRadius,
|
|
17
21
|
}) => {
|
|
18
22
|
// Garantir que totalRecords seja um número válido e finito
|
|
19
23
|
const safeTotalRecords = Number.isFinite(totalRecords) && !isNaN(totalRecords) && totalRecords >= 0
|
|
@@ -28,14 +32,21 @@ export const ArchbaseDataGridPagination = React.memo<ArchbaseDataGridPaginationP
|
|
|
28
32
|
Math.max(1, paginationModel.pageSize) : 10
|
|
29
33
|
};
|
|
30
34
|
|
|
35
|
+
// Calcular o padding final
|
|
36
|
+
const finalPadding = typeof padding === 'number' ? `${padding}px` : padding;
|
|
37
|
+
// Calcular o border radius final
|
|
38
|
+
const finalBorderRadius = borderRadius !== undefined
|
|
39
|
+
? (typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius)
|
|
40
|
+
: theme.radius.sm;
|
|
41
|
+
|
|
31
42
|
return (
|
|
32
43
|
<Paper
|
|
33
44
|
style={{
|
|
34
45
|
minHeight: bottomToolbarMinHeight || 'auto',
|
|
35
|
-
padding:
|
|
36
|
-
borderTop: `1px solid ${theme.colors.gray[theme.colorScheme === 'dark' ? 8 : 3]}
|
|
37
|
-
borderBottomLeftRadius:
|
|
38
|
-
borderBottomRightRadius:
|
|
46
|
+
padding: finalPadding,
|
|
47
|
+
borderTop: withBorder ? `1px solid ${theme.colors.gray[theme.colorScheme === 'dark' ? 8 : 3]}` : 'none',
|
|
48
|
+
borderBottomLeftRadius: finalBorderRadius,
|
|
49
|
+
borderBottomRightRadius: finalBorderRadius
|
|
39
50
|
}}
|
|
40
51
|
>
|
|
41
52
|
<GridPagination
|
|
@@ -35,6 +35,10 @@ export const ArchbaseDataGridToolbar = React.memo<ArchbaseDataGridToolbarProps>(
|
|
|
35
35
|
activeFilters,
|
|
36
36
|
onFiltersChange,
|
|
37
37
|
hideMuiFilters = false,
|
|
38
|
+
// Props para controle de bordas e espaçamento
|
|
39
|
+
withBorder = true,
|
|
40
|
+
padding = '8px 12px',
|
|
41
|
+
borderRadius,
|
|
38
42
|
}) => {
|
|
39
43
|
// Estado local para o filtro global para manter o valor entre re-renderizações
|
|
40
44
|
const [globalFilterValue, setGlobalFilterValue] = useState(filterModel.quickFilterValues?.[0] || '');
|
|
@@ -83,15 +87,22 @@ export const ArchbaseDataGridToolbar = React.memo<ArchbaseDataGridToolbarProps>(
|
|
|
83
87
|
if (!toolbarLeftContent && !enableGlobalFilter && !enableTopToolbarActions) {
|
|
84
88
|
return null;
|
|
85
89
|
}
|
|
90
|
+
// Calcular o padding final
|
|
91
|
+
const finalPadding = typeof padding === 'number' ? `${padding}px` : padding;
|
|
92
|
+
// Calcular o border radius final
|
|
93
|
+
const finalBorderRadius = borderRadius !== undefined
|
|
94
|
+
? (typeof borderRadius === 'number' ? `${borderRadius}px` : borderRadius)
|
|
95
|
+
: theme.radius.sm;
|
|
96
|
+
|
|
86
97
|
return (
|
|
87
98
|
<Paper
|
|
88
99
|
style={{
|
|
89
100
|
display: 'flex',
|
|
90
101
|
justifyContent: 'space-between',
|
|
91
|
-
padding:
|
|
92
|
-
borderBottom: `1px solid ${theme.colors.gray[theme.colorScheme === 'dark' ? 8 : 3]}
|
|
93
|
-
borderTopLeftRadius:
|
|
94
|
-
borderTopRightRadius:
|
|
102
|
+
padding: finalPadding,
|
|
103
|
+
borderBottom: withBorder ? `1px solid ${theme.colors.gray[theme.colorScheme === 'dark' ? 8 : 3]}` : 'none',
|
|
104
|
+
borderTopLeftRadius: finalBorderRadius,
|
|
105
|
+
borderTopRightRadius: finalBorderRadius
|
|
95
106
|
}}
|
|
96
107
|
>
|
|
97
108
|
{/* Lado esquerdo da toolbar */}
|
|
@@ -84,6 +84,14 @@ export interface ArchbaseDataGridToolbarProps {
|
|
|
84
84
|
activeFilters?: ArchbaseActiveFilter[];
|
|
85
85
|
onFiltersChange?: (filters: ArchbaseActiveFilter[], rsql?: string) => void;
|
|
86
86
|
hideMuiFilters?: boolean;
|
|
87
|
+
|
|
88
|
+
// Props para controle de bordas e espaçamento
|
|
89
|
+
/** Exibir borda inferior da toolbar. Default: true */
|
|
90
|
+
withBorder?: boolean;
|
|
91
|
+
/** Padding da toolbar. Default: '8px 12px' */
|
|
92
|
+
padding?: string | number;
|
|
93
|
+
/** Border radius da toolbar. Default: theme.radius.sm */
|
|
94
|
+
borderRadius?: string | number;
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
// Props para o componente ArchbaseDataGridPagination
|
|
@@ -99,6 +107,14 @@ export interface ArchbaseDataGridPaginationProps {
|
|
|
99
107
|
};
|
|
100
108
|
bottomToolbarMinHeight?: string | number;
|
|
101
109
|
theme: any;
|
|
110
|
+
|
|
111
|
+
// Props para controle de bordas e espaçamento
|
|
112
|
+
/** Exibir borda superior da paginação. Default: true */
|
|
113
|
+
withBorder?: boolean;
|
|
114
|
+
/** Padding da paginação. Default: '8px 12px' */
|
|
115
|
+
padding?: string | number;
|
|
116
|
+
/** Border radius da paginação. Default: theme.radius.sm */
|
|
117
|
+
borderRadius?: string | number;
|
|
102
118
|
}
|
|
103
119
|
|
|
104
120
|
/**
|
|
@@ -244,6 +260,16 @@ export interface ArchbaseDataGridProps<T extends object = any, ID = any> {
|
|
|
244
260
|
columnAutoWidth?: boolean;
|
|
245
261
|
rowHeight?: number;
|
|
246
262
|
|
|
263
|
+
// Propriedades de controle de bordas internas
|
|
264
|
+
/** Exibir borda inferior da toolbar. Default: true */
|
|
265
|
+
withToolbarBorder?: boolean;
|
|
266
|
+
/** Exibir borda superior da paginação. Default: true */
|
|
267
|
+
withPaginationBorder?: boolean;
|
|
268
|
+
/** Padding da toolbar. Default: '8px 12px' */
|
|
269
|
+
toolbarPadding?: string | number;
|
|
270
|
+
/** Padding da paginação. Default: '8px 12px' */
|
|
271
|
+
paginationPadding?: string | number;
|
|
272
|
+
|
|
247
273
|
// Propriedades de exportação e impressão
|
|
248
274
|
printTitle?: string;
|
|
249
275
|
logoPrint?: string;
|
|
@@ -253,6 +279,7 @@ export interface ArchbaseDataGridProps<T extends object = any, ID = any> {
|
|
|
253
279
|
// Propriedades de layout
|
|
254
280
|
toolbarAlignment?: 'left' | 'right' | 'center';
|
|
255
281
|
positionActionsColumn?: 'first' | 'last';
|
|
282
|
+
actionsColumnWidth?: number;
|
|
256
283
|
toolbarLeftContent?: ReactNode;
|
|
257
284
|
bottomToolbarMinHeight?: string | number;
|
|
258
285
|
|
|
@@ -261,6 +288,8 @@ export interface ArchbaseDataGridProps<T extends object = any, ID = any> {
|
|
|
261
288
|
|
|
262
289
|
// Flags de exibição
|
|
263
290
|
showProgressBars?: boolean;
|
|
291
|
+
/** Oculta o footer interno do MUI DataGrid. Default: true (footer é gerenciado externamente) */
|
|
292
|
+
hideFooter?: boolean;
|
|
264
293
|
|
|
265
294
|
// Callbacks
|
|
266
295
|
onSelectedRowsChanged?: (rows: T[]) => void;
|
|
@@ -156,6 +156,7 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
156
156
|
csvOptions,
|
|
157
157
|
toolbarAlignment = 'right',
|
|
158
158
|
positionActionsColumn = 'first',
|
|
159
|
+
actionsColumnWidth = 60,
|
|
159
160
|
toolbarLeftContent,
|
|
160
161
|
columnAutoWidth = false,
|
|
161
162
|
rowHeight = 52,
|
|
@@ -164,6 +165,7 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
164
165
|
onPrint,
|
|
165
166
|
onFilterModelChange,
|
|
166
167
|
showProgressBars = true,
|
|
168
|
+
hideFooter = true,
|
|
167
169
|
variant = 'filled',
|
|
168
170
|
fontSize,
|
|
169
171
|
cellPadding,
|
|
@@ -193,6 +195,11 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
193
195
|
activeFilters: externalActiveFilters,
|
|
194
196
|
onFiltersChange: externalOnFiltersChange,
|
|
195
197
|
hideMuiFilters = false,
|
|
198
|
+
// Props para controle de bordas internas
|
|
199
|
+
withToolbarBorder = true,
|
|
200
|
+
withPaginationBorder = true,
|
|
201
|
+
toolbarPadding,
|
|
202
|
+
paginationPadding,
|
|
196
203
|
} = props
|
|
197
204
|
const theme = useArchbaseTheme()
|
|
198
205
|
const { colorScheme } = useMantineColorScheme();
|
|
@@ -743,6 +750,7 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
743
750
|
const getThemedStyles = () => {
|
|
744
751
|
return {
|
|
745
752
|
root: {
|
|
753
|
+
height: '100%', // Garante que o DataGrid ocupe toda a altura do container
|
|
746
754
|
border: withBorder
|
|
747
755
|
? `1px solid ${theme.colors.gray[colorScheme === 'dark' ? 8 : 3]}`
|
|
748
756
|
: '0',
|
|
@@ -750,6 +758,46 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
750
758
|
overflow: 'hidden', // Garante que o conteúdo respeite o border-radius
|
|
751
759
|
backgroundColor: colorScheme === 'dark' ? theme.colors.dark[6] : theme.white,
|
|
752
760
|
color: colorScheme === 'dark' ? theme.colors.gray[0] : theme.colors.dark[9],
|
|
761
|
+
|
|
762
|
+
// Scrollbar customizada do MUI DataGrid - estilo Mantine (mais fina e elegante)
|
|
763
|
+
'& .MuiDataGrid-scrollbar': {
|
|
764
|
+
'&.MuiDataGrid-scrollbar--horizontal': {
|
|
765
|
+
height: '8px !important',
|
|
766
|
+
},
|
|
767
|
+
'&.MuiDataGrid-scrollbar--vertical': {
|
|
768
|
+
width: '8px !important',
|
|
769
|
+
},
|
|
770
|
+
backgroundColor: colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[1],
|
|
771
|
+
borderRadius: '4px',
|
|
772
|
+
'& .MuiDataGrid-scrollbarContent': {
|
|
773
|
+
borderRadius: '4px',
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
|
|
777
|
+
// Scrollbar nativa (fallback) - estilo Mantine
|
|
778
|
+
'& .MuiDataGrid-virtualScroller': {
|
|
779
|
+
'&::-webkit-scrollbar': {
|
|
780
|
+
width: '8px',
|
|
781
|
+
height: '8px',
|
|
782
|
+
},
|
|
783
|
+
'&::-webkit-scrollbar-track': {
|
|
784
|
+
backgroundColor: colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[1],
|
|
785
|
+
borderRadius: '4px',
|
|
786
|
+
},
|
|
787
|
+
'&::-webkit-scrollbar-thumb': {
|
|
788
|
+
backgroundColor: colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[4],
|
|
789
|
+
borderRadius: '4px',
|
|
790
|
+
'&:hover': {
|
|
791
|
+
backgroundColor: colorScheme === 'dark' ? theme.colors.dark[2] : theme.colors.gray[5],
|
|
792
|
+
},
|
|
793
|
+
},
|
|
794
|
+
// Firefox
|
|
795
|
+
scrollbarWidth: 'thin',
|
|
796
|
+
scrollbarColor: colorScheme === 'dark'
|
|
797
|
+
? `${theme.colors.dark[3]} ${theme.colors.dark[6]}`
|
|
798
|
+
: `${theme.colors.gray[4]} ${theme.colors.gray[1]}`,
|
|
799
|
+
},
|
|
800
|
+
|
|
753
801
|
fontSize:
|
|
754
802
|
typeof fontSize === 'string' &&
|
|
755
803
|
['xs', 'sm', 'md', 'lg', 'xl'].includes(fontSize as string)
|
|
@@ -838,7 +886,19 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
838
886
|
},
|
|
839
887
|
|
|
840
888
|
'& .MuiDataGrid-virtualScroller': {
|
|
841
|
-
paddingBottom: '
|
|
889
|
+
paddingBottom: '0px !important',
|
|
890
|
+
display: 'flex',
|
|
891
|
+
flexDirection: 'column',
|
|
892
|
+
},
|
|
893
|
+
|
|
894
|
+
'& .MuiDataGrid-virtualScrollerContent': {
|
|
895
|
+
flexBasis: 'auto !important',
|
|
896
|
+
flexGrow: '1 !important',
|
|
897
|
+
flexShrink: '0 !important',
|
|
898
|
+
},
|
|
899
|
+
|
|
900
|
+
'& .MuiDataGrid-filler': {
|
|
901
|
+
display: 'none !important',
|
|
842
902
|
}
|
|
843
903
|
}
|
|
844
904
|
}
|
|
@@ -875,7 +935,7 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
875
935
|
type: 'string' as const,
|
|
876
936
|
sortable: false,
|
|
877
937
|
filterable: false,
|
|
878
|
-
width:
|
|
938
|
+
width: actionsColumnWidth,
|
|
879
939
|
renderCell: (params) => renderRowActions(params.row as T)
|
|
880
940
|
}
|
|
881
941
|
|
|
@@ -1375,6 +1435,9 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
1375
1435
|
activeFilters={activeFilters}
|
|
1376
1436
|
onFiltersChange={handleCompositeFiltersChange}
|
|
1377
1437
|
hideMuiFilters={hideMuiFilters}
|
|
1438
|
+
// Props para controle de bordas
|
|
1439
|
+
withBorder={withToolbarBorder}
|
|
1440
|
+
padding={toolbarPadding}
|
|
1378
1441
|
/>
|
|
1379
1442
|
)}
|
|
1380
1443
|
|
|
@@ -1384,7 +1447,7 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
1384
1447
|
renderFixedDetailPanel()}
|
|
1385
1448
|
|
|
1386
1449
|
{/* Grid sem toolbar interna */}
|
|
1387
|
-
<Box style={{ flex: 1, overflow: 'hidden', position: 'relative' }}>
|
|
1450
|
+
<Box style={{ flex: 1, overflow: 'hidden', position: 'relative', minHeight: 0 }}>
|
|
1388
1451
|
<DataGrid
|
|
1389
1452
|
apiRef={apiRef}
|
|
1390
1453
|
rows={rows}
|
|
@@ -1413,6 +1476,7 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
1413
1476
|
sx={getThemedStyles().root}
|
|
1414
1477
|
disableColumnFilter={!allowColumnFilters}
|
|
1415
1478
|
disableColumnMenu={true}
|
|
1479
|
+
hideFooter={hideFooter}
|
|
1416
1480
|
slots={{
|
|
1417
1481
|
// Removemos os slots de toolbar e paginação pois eles agora estão fora da grid
|
|
1418
1482
|
toolbar: null,
|
|
@@ -1434,6 +1498,9 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
|
|
|
1434
1498
|
paginationLabels={paginationLabels}
|
|
1435
1499
|
bottomToolbarMinHeight={bottomToolbarMinHeight}
|
|
1436
1500
|
theme={theme}
|
|
1501
|
+
// Props para controle de bordas
|
|
1502
|
+
withBorder={withPaginationBorder}
|
|
1503
|
+
padding={paginationPadding}
|
|
1437
1504
|
/>:null}
|
|
1438
1505
|
|
|
1439
1506
|
{/* Painéis de detalhes nos modos não-inline (modal/drawer) */}
|