goobs-frontend 0.9.10 → 0.9.12

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": "goobs-frontend",
3
- "version": "0.9.10",
3
+ "version": "0.9.12",
4
4
  "type": "module",
5
5
  "description": "A comprehensive React-based libary that extends the functionality of Material-UI",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@ interface ColumnHeaderRowProps {
19
19
  // The entire columns array if we need them on mobile
20
20
  allColumns: ColumnDef[]
21
21
 
22
- // The chosen overflow column or mobile column
22
+ // The chosen "overflow" column or mobile column
23
23
  selectedOverflowField: string
24
24
  setSelectedOverflowField: React.Dispatch<React.SetStateAction<string>>
25
25
  }
@@ -77,7 +77,7 @@ const ColumnHeaderRow: React.FC<ColumnHeaderRowProps> = ({
77
77
  boxSizing: 'border-box',
78
78
  overflow: 'visible',
79
79
  position: 'relative',
80
- zIndex: 10,
80
+ zIndex: 100, // Increased z-index for mobile dropdown
81
81
  // If you want no left padding on mobile header as well:
82
82
  paddingLeft: 0,
83
83
  }}
@@ -93,6 +93,10 @@ const ColumnHeaderRow: React.FC<ColumnHeaderRowProps> = ({
93
93
  shrunkfontcolor="black"
94
94
  unshrunkfontcolor="black"
95
95
  shrunklabelposition="aboveNotch"
96
+ style={{
97
+ marginBottom: 0,
98
+ marginTop: 0,
99
+ }}
96
100
  />
97
101
  </TableCell>
98
102
  </TableRow>
@@ -133,12 +137,14 @@ const ColumnHeaderRow: React.FC<ColumnHeaderRowProps> = ({
133
137
  <TableCell
134
138
  key="overflow-header"
135
139
  sx={{
136
- width: 275,
140
+ width: 275, // Increased width for dropdown (was 200)
141
+ minWidth: 275,
137
142
  boxSizing: 'border-box',
138
143
  overflow: 'visible',
139
144
  position: 'relative',
140
- zIndex: 10,
145
+ zIndex: 100, // Increased z-index to ensure dropdown appears above other elements
141
146
  paddingLeft: 0, // <-- remove left padding here
147
+ height: '55px',
142
148
  }}
143
149
  >
144
150
  <SearchableDropdown
@@ -154,7 +160,11 @@ const ColumnHeaderRow: React.FC<ColumnHeaderRowProps> = ({
154
160
  inputfontcolor="black"
155
161
  shrunkfontcolor="black"
156
162
  unshrunkfontcolor="black"
157
- shrunklabelposition="aboveNotch"
163
+ shrunklabelposition="onNotch"
164
+ style={{
165
+ marginBottom: 0,
166
+ marginTop: 0,
167
+ }}
158
168
  />
159
169
  </TableCell>
160
170
  )
@@ -52,7 +52,7 @@ function Table({
52
52
  })
53
53
 
54
54
  // Decide which columns to render in the <TableHead /> for desktop.
55
- // On mobile, we skip the __overflow__ approach and just show the single dropdown.
55
+ // On mobile, we skip the "__overflow__" approach and just show the single dropdown.
56
56
  const finalDesktopColumns = !isMobile
57
57
  ? overflowDesktopColumns.length > 0
58
58
  ? [
@@ -63,16 +63,23 @@ function Table({
63
63
  : []
64
64
 
65
65
  return (
66
- // The main wrapper. Key: allow horizontal scroll if table is too wide.
67
- <Box sx={{ width: '100%', overflowX: 'auto' }}>
66
+ // The main wrapper - Using overflowX: 'hidden' to prevent horizontal scrollbar
67
+ <Box sx={{ width: '100%', overflowX: 'hidden' }}>
68
68
  {/* We set the "ref" here so that useComputeTableResize can measure width. */}
69
- <TableContainer ref={containerRef} sx={{ overflowX: 'auto' }}>
69
+ <TableContainer
70
+ ref={containerRef}
71
+ sx={{
72
+ overflowX: 'visible', // Changed from 'auto' to 'visible'
73
+ }}
74
+ >
70
75
  <MuiTable
71
76
  sx={{
72
- // Let columns expand to their set widths
77
+ // Set width to 100% to fit container
78
+ width: '100%',
79
+ // Keep tableLayout as 'auto' to respect column widths
73
80
  tableLayout: 'auto',
74
81
  // Force the table's minimum width to accommodate large columns
75
- minWidth: 'fit-content',
82
+ minWidth: isMobile ? 'auto' : 'fit-content',
76
83
  }}
77
84
  >
78
85
  {/* Table Header */}
@@ -87,7 +94,7 @@ function Table({
87
94
  finalDesktopColumns={finalDesktopColumns}
88
95
  // Overflow columns (desktop)
89
96
  overflowDesktopColumns={overflowDesktopColumns}
90
- // Current selected column for overflow or mobile
97
+ // Current "selected" column for overflow or mobile
91
98
  selectedOverflowField={selectedOverflowField}
92
99
  setSelectedOverflowField={setSelectedOverflowField}
93
100
  // The entire columns array so we can present them all on mobile
@@ -93,8 +93,8 @@ function DataGrid({
93
93
  flexDirection: 'column',
94
94
  // Increase or remove height if you want more vertical space:
95
95
  height: 'calc(100vh - 60px)',
96
- // The key: allow horizontal scroll so columns with big widths can be scrolled
97
- overflow: 'auto',
96
+ // Add overflow hidden at the DataGrid level to prevent horizontal scrollbars
97
+ overflow: 'hidden',
98
98
  backgroundColor: woad.main,
99
99
  }}
100
100
  >
@@ -132,12 +132,11 @@ function DataGrid({
132
132
  display: 'flex',
133
133
  flexDirection: 'column',
134
134
  alignItems: 'flex-start',
135
+ // Ensure this container doesn't create scrollbars
136
+ overflow: 'hidden',
135
137
  }}
136
138
  >
137
- {/*
138
- This is the actual <Table/> component (not the file).
139
- Just leaving it as-is, but inside it we do a horizontal scroll and tableLayout: 'auto'.
140
- */}
139
+ {/* Table component */}
141
140
  <Table
142
141
  columns={columns}
143
142
  rows={visibleRows}
@@ -86,8 +86,8 @@ export function useComputeTableResize({
86
86
  return 60
87
87
  }
88
88
  const header = col.headerName || col.field
89
- // +40 as a buffer for padding, sorting icons, etc.
90
- return measureTextWidth(header) + 40
89
+ // +60 as a larger buffer for padding, sorting icons, etc. to prevent premature overflow
90
+ return measureTextWidth(header) + 60
91
91
  },
92
92
  [measureTextWidth]
93
93
  )
@@ -102,14 +102,17 @@ export function useComputeTableResize({
102
102
  if (!containerRef.current) return
103
103
  const containerWidth = containerRef.current.offsetWidth
104
104
 
105
+ // Add a buffer zone to make transitions smoother
106
+ const COLUMN_TRANSITION_BUFFER = 50 // pixels of buffer
107
+
105
108
  // Only consider columns that are visible
106
109
  const visibleCols = columns.filter(
107
110
  col => columnVisibility[col.field] !== false
108
111
  )
109
112
 
110
113
  let usedWidth = checkboxSelection ? 50 : 0
111
- // ~180 px for the "overflow" column if needed
112
- const overflowReservedWidth = showOverflowDropdown ? 180 : 0
114
+ // Increase overflow column width for better usability (was 180)
115
+ const overflowReservedWidth = showOverflowDropdown ? 275 : 0
113
116
 
114
117
  const canFit: ColumnDef[] = []
115
118
  let theOverflow: ColumnDef[] = []
@@ -120,28 +123,43 @@ export function useComputeTableResize({
120
123
 
121
124
  if (col.width != null) {
122
125
  // If the developer explicitly set a width, forcibly add to canFit
123
- canFit.push(col)
124
- usedWidth += needed
125
- continue
126
- }
127
-
128
- // Otherwise, do the old "fit" check
129
- if (usedWidth + needed + overflowReservedWidth <= containerWidth) {
130
- canFit.push(col)
131
- usedWidth += needed
126
+ // only if we have enough space with our buffer
127
+ if (
128
+ usedWidth +
129
+ needed +
130
+ overflowReservedWidth +
131
+ COLUMN_TRANSITION_BUFFER <=
132
+ containerWidth
133
+ ) {
134
+ canFit.push(col)
135
+ usedWidth += needed
136
+ } else {
137
+ // Not enough space, all remaining columns go to overflow
138
+ theOverflow = visibleCols.slice(i)
139
+ break
140
+ }
132
141
  } else {
133
- // everything else is overflow
134
- theOverflow = visibleCols.slice(i)
135
-
136
- // If we can't fit i-th column, let's see if we can also move
137
- // the last fitted column to overflow
138
- if (theOverflow.length > 0 && canFit.length > 1) {
139
- const lastFitted = canFit.pop()
140
- if (lastFitted) {
141
- theOverflow = [lastFitted, ...theOverflow]
142
+ // Standard "does it fit?" check with buffer to prevent flickering/jumping
143
+ if (
144
+ usedWidth + needed + overflowReservedWidth <=
145
+ containerWidth - COLUMN_TRANSITION_BUFFER
146
+ ) {
147
+ canFit.push(col)
148
+ usedWidth += needed
149
+ } else {
150
+ // everything else is overflow
151
+ theOverflow = visibleCols.slice(i)
152
+
153
+ // If we can't fit i-th column, let's see if we can also move
154
+ // the last fitted column to overflow to make more room
155
+ if (theOverflow.length > 0 && canFit.length > 1) {
156
+ const lastFitted = canFit.pop()
157
+ if (lastFitted) {
158
+ theOverflow = [lastFitted, ...theOverflow]
159
+ }
142
160
  }
161
+ break
143
162
  }
144
- break
145
163
  }
146
164
  }
147
165