@wandelbots/wandelbots-js-react-components 2.33.0-pr.feature-robot-precondition-list.372.cb3db34 → 2.33.0-pr.feature-robot-precondition-list.372.b6e19a9

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": "@wandelbots/wandelbots-js-react-components",
3
- "version": "2.33.0-pr.feature-robot-precondition-list.372.cb3db34",
3
+ "version": "2.33.0-pr.feature-robot-precondition-list.372.b6e19a9",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -14,9 +14,10 @@ import {
14
14
  QuickFilterTrigger,
15
15
  Toolbar,
16
16
  ToolbarButton,
17
+ useGridApiRef,
17
18
  } from "@mui/x-data-grid"
18
19
  import { observer } from "mobx-react-lite"
19
- import { useMemo, useState } from "react"
20
+ import { useEffect, useMemo, useState } from "react"
20
21
  import { externalizeComponent } from "../externalizeComponent"
21
22
 
22
23
  export interface WandelbotsDataGridProps<T = Record<string, unknown>> {
@@ -83,6 +84,11 @@ export interface WandelbotsDataGridProps<T = Record<string, unknown>> {
83
84
  * @default false
84
85
  */
85
86
  selectFirstByDefault?: boolean
87
+
88
+ /**
89
+ * Custom sx styles for the root container
90
+ */
91
+ sx?: React.ComponentProps<typeof Box>["sx"]
86
92
  }
87
93
 
88
94
  export const WandelbotsDataGrid = externalizeComponent(
@@ -100,8 +106,10 @@ export const WandelbotsDataGrid = externalizeComponent(
100
106
  dataGridProps,
101
107
  CustomToolbar,
102
108
  selectFirstByDefault = false,
109
+ sx,
103
110
  }: WandelbotsDataGridProps<T>) => {
104
111
  const theme = useTheme()
112
+ const apiRef = useGridApiRef()
105
113
 
106
114
  // Internal state for selection when not controlled
107
115
  const [internalSelectedItem, setInternalSelectedItem] =
@@ -110,6 +118,18 @@ export const WandelbotsDataGrid = externalizeComponent(
110
118
  // Prepare rows for the DataGrid
111
119
  const rows = useMemo(() => data.map(getRowData), [data, getRowData])
112
120
 
121
+ // Auto-resize columns when data changes
122
+ useEffect(() => {
123
+ if (apiRef.current && rows.length > 0) {
124
+ apiRef.current.autosizeColumns({
125
+ includeOutliers: true,
126
+ includeHeaders: true,
127
+ expand: true,
128
+ columns: columns.map((col) => col.field),
129
+ })
130
+ }
131
+ }, [rows, columns, apiRef])
132
+
113
133
  // Handle default selection - only use if no selectedItem is explicitly provided
114
134
  const effectiveSelectedItem = useMemo(() => {
115
135
  // If selectedItem is explicitly provided, use it (including null)
@@ -278,11 +298,13 @@ export const WandelbotsDataGrid = externalizeComponent(
278
298
  height: "100%",
279
299
  display: "flex",
280
300
  flexDirection: "column",
281
- background:
301
+ backgroundColor:
282
302
  theme.palette.backgroundPaperElevation?.[5] || "#202233",
303
+ ...sx, // Your custom styles will override the theme default
283
304
  }}
284
305
  >
285
306
  <DataGrid
307
+ apiRef={apiRef}
286
308
  rows={rows}
287
309
  columns={columns}
288
310
  onRowClick={handleRowClick}
@@ -309,21 +331,39 @@ export const WandelbotsDataGrid = externalizeComponent(
309
331
  ...dataGridProps?.initialState,
310
332
  }}
311
333
  {...dataGridProps}
312
- // Ensure autosize properties are not overridden by dataGridProps
313
- autosizeOnMount={dataGridProps?.autosizeOnMount ?? true}
334
+ // Ensure autosize properties are always enabled and not overridden by dataGridProps
335
+ autosizeOnMount={true}
314
336
  autosizeOptions={{
337
+ // Merge any custom autosize options first
338
+ ...(dataGridProps?.autosizeOptions || {}),
339
+ // Force these key properties to always be true to maintain autosize behavior
315
340
  includeOutliers: true,
316
341
  includeHeaders: true,
317
342
  expand: true,
318
- ...dataGridProps?.autosizeOptions,
343
+ // Auto-size all columns by default (can be overridden by dataGridProps)
344
+ columns:
345
+ dataGridProps?.autosizeOptions?.columns ||
346
+ columns.map((col) => col.field),
319
347
  }}
320
348
  sx={{
321
349
  border: "none",
322
350
  backgroundColor: "transparent",
323
351
  width: "100%",
352
+ // Remove any MUI overlays and elevation effects
353
+ "& .MuiPaper-root": {
354
+ backgroundColor: "transparent !important",
355
+ boxShadow: "none !important",
356
+ },
357
+ "& .MuiDataGrid-overlay": {
358
+ backgroundColor: "transparent !important",
359
+ },
324
360
  "& .MuiDataGrid-main": {
325
361
  border: "none",
326
362
  backgroundColor: "transparent",
363
+ // Remove any surface or paper overlays
364
+ "& .MuiPaper-root": {
365
+ backgroundColor: "transparent !important",
366
+ },
327
367
  },
328
368
  "& .MuiDataGrid-container--top [role=row]": {
329
369
  backgroundColor: "transparent !important",
@@ -410,6 +450,7 @@ export const WandelbotsDataGrid = externalizeComponent(
410
450
  padding: "8px",
411
451
  border: "none !important",
412
452
  borderBottom: "none !important",
453
+ backgroundColor: "transparent !important",
413
454
  "& .MuiBox-root": {
414
455
  backgroundColor: "transparent !important",
415
456
  },
@@ -419,6 +460,10 @@ export const WandelbotsDataGrid = externalizeComponent(
419
460
  "& .MuiInputBase-root": {
420
461
  backgroundColor: "transparent !important",
421
462
  },
463
+ "& .MuiPaper-root": {
464
+ backgroundColor: "transparent !important",
465
+ boxShadow: "none !important",
466
+ },
422
467
  "& *": {
423
468
  borderBottom: "none !important",
424
469
  },
@@ -444,8 +489,16 @@ export const WandelbotsDataGrid = externalizeComponent(
444
489
  borderBottom: "none !important",
445
490
  borderLeft: "none !important",
446
491
  borderRight: "none !important",
492
+ backgroundColor: "transparent !important",
447
493
  "--rowBorderColor": "none !important",
448
494
  },
495
+ // Remove any remaining MUI background overlays
496
+ "& .MuiBackdrop-root": {
497
+ backgroundColor: "transparent !important",
498
+ },
499
+ "& .MuiModal-backdrop": {
500
+ backgroundColor: "transparent !important",
501
+ },
449
502
  ...dataGridProps?.sx,
450
503
  }}
451
504
  />