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

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.56785bf",
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,11 @@ export const WandelbotsDataGrid = externalizeComponent(
278
298
  height: "100%",
279
299
  display: "flex",
280
300
  flexDirection: "column",
281
- background:
282
- theme.palette.backgroundPaperElevation?.[5] || "#202233",
301
+ ...sx,
283
302
  }}
284
303
  >
285
304
  <DataGrid
305
+ apiRef={apiRef}
286
306
  rows={rows}
287
307
  columns={columns}
288
308
  onRowClick={handleRowClick}
@@ -309,33 +329,42 @@ export const WandelbotsDataGrid = externalizeComponent(
309
329
  ...dataGridProps?.initialState,
310
330
  }}
311
331
  {...dataGridProps}
312
- // Ensure autosize properties are not overridden by dataGridProps
313
- autosizeOnMount={dataGridProps?.autosizeOnMount ?? true}
332
+ // Ensure autosize properties are always enabled and not overridden by dataGridProps
333
+ autosizeOnMount={true}
314
334
  autosizeOptions={{
335
+ // Merge any custom autosize options first
336
+ ...(dataGridProps?.autosizeOptions || {}),
337
+ // Force these key properties to always be true to maintain autosize behavior
315
338
  includeOutliers: true,
316
339
  includeHeaders: true,
317
340
  expand: true,
318
- ...dataGridProps?.autosizeOptions,
341
+ // Auto-size all columns by default (can be overridden by dataGridProps)
342
+ columns:
343
+ dataGridProps?.autosizeOptions?.columns ||
344
+ columns.map((col) => col.field),
319
345
  }}
320
346
  sx={{
321
347
  border: "none",
322
- backgroundColor: "transparent",
348
+
323
349
  width: "100%",
350
+ // Remove any MUI overlays and elevation effects
351
+ "& .MuiPaper-root": {
352
+ boxShadow: "none !important",
353
+ },
354
+ "& .MuiDataGrid-overlay": {},
324
355
  "& .MuiDataGrid-main": {
325
356
  border: "none",
326
- backgroundColor: "transparent",
327
- },
328
- "& .MuiDataGrid-container--top [role=row]": {
329
- backgroundColor: "transparent !important",
357
+
358
+ // Remove any surface or paper overlays
359
+ "& .MuiPaper-root": {},
330
360
  },
361
+ "& .MuiDataGrid-container--top [role=row]": {},
331
362
  "& .MuiDataGrid-topContainer": {
332
363
  borderBottom: "none !important",
333
364
  },
334
365
  "& .MuiDataGrid-columnHeaders": {
335
366
  border: "none",
336
367
  borderBottom: "none !important",
337
- backgroundColor:
338
- theme.palette.backgroundPaperElevation?.[5] || "#202233",
339
368
  },
340
369
  "& .MuiDataGrid-row": {
341
370
  cursor: onRowClick ? "pointer" : "default",
@@ -343,7 +372,6 @@ export const WandelbotsDataGrid = externalizeComponent(
343
372
  margin: "1px 0",
344
373
  position: "relative",
345
374
  "&:hover": {
346
- backgroundColor: "transparent !important",
347
375
  "&::before": {
348
376
  content: '""',
349
377
  position: "absolute",
@@ -358,10 +386,7 @@ export const WandelbotsDataGrid = externalizeComponent(
358
386
  },
359
387
  // Disable MUI's built-in selection styling completely
360
388
  "&.Mui-selected": {
361
- backgroundColor: "transparent !important",
362
- "&:hover": {
363
- backgroundColor: "transparent !important",
364
- },
389
+ "&:hover": {},
365
390
  },
366
391
  // Highlight selected row with a distinct color using data attribute
367
392
  ...(selectedRowId !== null && {
@@ -401,7 +426,7 @@ export const WandelbotsDataGrid = externalizeComponent(
401
426
  border: "none",
402
427
  paddingLeft: "40px",
403
428
  paddingRight: "40px",
404
- backgroundColor: "transparent !important",
429
+
405
430
  "& .MuiDataGrid-columnHeaderTitle": {
406
431
  color: "rgba(255, 255, 255, 0.6)",
407
432
  },
@@ -410,14 +435,12 @@ export const WandelbotsDataGrid = externalizeComponent(
410
435
  padding: "8px",
411
436
  border: "none !important",
412
437
  borderBottom: "none !important",
413
- "& .MuiBox-root": {
414
- backgroundColor: "transparent !important",
415
- },
416
- "& .MuiFormControl-root": {
417
- backgroundColor: "transparent !important",
418
- },
419
- "& .MuiInputBase-root": {
420
- backgroundColor: "transparent !important",
438
+
439
+ "& .MuiBox-root": {},
440
+ "& .MuiFormControl-root": {},
441
+ "& .MuiInputBase-root": {},
442
+ "& .MuiPaper-root": {
443
+ boxShadow: "none !important",
421
444
  },
422
445
  "& *": {
423
446
  borderBottom: "none !important",
@@ -444,8 +467,12 @@ export const WandelbotsDataGrid = externalizeComponent(
444
467
  borderBottom: "none !important",
445
468
  borderLeft: "none !important",
446
469
  borderRight: "none !important",
470
+
447
471
  "--rowBorderColor": "none !important",
448
472
  },
473
+ // Remove any remaining MUI background overlays
474
+ "& .MuiBackdrop-root": {},
475
+ "& .MuiModal-backdrop": {},
449
476
  ...dataGridProps?.sx,
450
477
  }}
451
478
  />