@archbase/components 3.0.2 → 3.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archbase/components",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
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.2",
42
- "@archbase/data": "3.0.2",
43
- "@archbase/layout": "3.0.2",
41
+ "@archbase/core": "3.0.3",
42
+ "@archbase/data": "3.0.3",
43
+ "@archbase/layout": "3.0.3",
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: '8px 16px',
36
- borderTop: `1px solid ${theme.colors.gray[theme.colorScheme === 'dark' ? 8 : 3]}`,
37
- borderBottomLeftRadius: theme.radius.sm,
38
- borderBottomRightRadius: theme.radius.sm
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: '8px 16px',
92
- borderBottom: `1px solid ${theme.colors.gray[theme.colorScheme === 'dark' ? 8 : 3]}`,
93
- borderTopLeftRadius: theme.radius.sm,
94
- borderTopRightRadius: theme.radius.sm
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
 
@@ -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,
@@ -193,6 +194,11 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
193
194
  activeFilters: externalActiveFilters,
194
195
  onFiltersChange: externalOnFiltersChange,
195
196
  hideMuiFilters = false,
197
+ // Props para controle de bordas internas
198
+ withToolbarBorder = true,
199
+ withPaginationBorder = true,
200
+ toolbarPadding,
201
+ paginationPadding,
196
202
  } = props
197
203
  const theme = useArchbaseTheme()
198
204
  const { colorScheme } = useMantineColorScheme();
@@ -743,6 +749,7 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
743
749
  const getThemedStyles = () => {
744
750
  return {
745
751
  root: {
752
+ height: '100%', // Garante que o DataGrid ocupe toda a altura do container
746
753
  border: withBorder
747
754
  ? `1px solid ${theme.colors.gray[colorScheme === 'dark' ? 8 : 3]}`
748
755
  : '0',
@@ -750,6 +757,46 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
750
757
  overflow: 'hidden', // Garante que o conteúdo respeite o border-radius
751
758
  backgroundColor: colorScheme === 'dark' ? theme.colors.dark[6] : theme.white,
752
759
  color: colorScheme === 'dark' ? theme.colors.gray[0] : theme.colors.dark[9],
760
+
761
+ // Scrollbar customizada do MUI DataGrid - estilo Mantine (mais fina e elegante)
762
+ '& .MuiDataGrid-scrollbar': {
763
+ '&.MuiDataGrid-scrollbar--horizontal': {
764
+ height: '8px !important',
765
+ },
766
+ '&.MuiDataGrid-scrollbar--vertical': {
767
+ width: '8px !important',
768
+ },
769
+ backgroundColor: colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[1],
770
+ borderRadius: '4px',
771
+ '& .MuiDataGrid-scrollbarContent': {
772
+ borderRadius: '4px',
773
+ },
774
+ },
775
+
776
+ // Scrollbar nativa (fallback) - estilo Mantine
777
+ '& .MuiDataGrid-virtualScroller': {
778
+ '&::-webkit-scrollbar': {
779
+ width: '8px',
780
+ height: '8px',
781
+ },
782
+ '&::-webkit-scrollbar-track': {
783
+ backgroundColor: colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[1],
784
+ borderRadius: '4px',
785
+ },
786
+ '&::-webkit-scrollbar-thumb': {
787
+ backgroundColor: colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[4],
788
+ borderRadius: '4px',
789
+ '&:hover': {
790
+ backgroundColor: colorScheme === 'dark' ? theme.colors.dark[2] : theme.colors.gray[5],
791
+ },
792
+ },
793
+ // Firefox
794
+ scrollbarWidth: 'thin',
795
+ scrollbarColor: colorScheme === 'dark'
796
+ ? `${theme.colors.dark[3]} ${theme.colors.dark[6]}`
797
+ : `${theme.colors.gray[4]} ${theme.colors.gray[1]}`,
798
+ },
799
+
753
800
  fontSize:
754
801
  typeof fontSize === 'string' &&
755
802
  ['xs', 'sm', 'md', 'lg', 'xl'].includes(fontSize as string)
@@ -875,7 +922,7 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
875
922
  type: 'string' as const,
876
923
  sortable: false,
877
924
  filterable: false,
878
- width: 60,
925
+ width: actionsColumnWidth,
879
926
  renderCell: (params) => renderRowActions(params.row as T)
880
927
  }
881
928
 
@@ -1375,6 +1422,9 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
1375
1422
  activeFilters={activeFilters}
1376
1423
  onFiltersChange={handleCompositeFiltersChange}
1377
1424
  hideMuiFilters={hideMuiFilters}
1425
+ // Props para controle de bordas
1426
+ withBorder={withToolbarBorder}
1427
+ padding={toolbarPadding}
1378
1428
  />
1379
1429
  )}
1380
1430
 
@@ -1384,7 +1434,7 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
1384
1434
  renderFixedDetailPanel()}
1385
1435
 
1386
1436
  {/* Grid sem toolbar interna */}
1387
- <Box style={{ flex: 1, overflow: 'hidden', position: 'relative' }}>
1437
+ <Box style={{ flex: 1, overflow: 'hidden', position: 'relative', minHeight: 0 }}>
1388
1438
  <DataGrid
1389
1439
  apiRef={apiRef}
1390
1440
  rows={rows}
@@ -1434,6 +1484,9 @@ function ArchbaseDataGrid<T extends object = any, ID = any>(props: ArchbaseDataG
1434
1484
  paginationLabels={paginationLabels}
1435
1485
  bottomToolbarMinHeight={bottomToolbarMinHeight}
1436
1486
  theme={theme}
1487
+ // Props para controle de bordas
1488
+ withBorder={withPaginationBorder}
1489
+ padding={paginationPadding}
1437
1490
  />:null}
1438
1491
 
1439
1492
  {/* Painéis de detalhes nos modos não-inline (modal/drawer) */}