@dmsi/wedgekit-react 0.0.208 → 0.0.209

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.
@@ -12,7 +12,7 @@ import {
12
12
  DataGridCell,
13
13
  DragAlongCell,
14
14
  DraggableCellHeader
15
- } from "../chunk-EFX3RPW4.js";
15
+ } from "../chunk-Q3TNALWH.js";
16
16
  import {
17
17
  Menu
18
18
  } from "../chunk-JITZWSPR.js";
@@ -172,7 +172,7 @@ function TableBodyRow({
172
172
  /* @__PURE__ */ jsx2("td", { style: { display: "flex", width: virtualPaddingLeft } })
173
173
  ) : null,
174
174
  columns.map((column) => {
175
- var _a2, _b, _c;
175
+ var _a2;
176
176
  const cell = locked ? column : visibleCells[column.index];
177
177
  if (!cell) {
178
178
  return;
@@ -187,7 +187,6 @@ function TableBodyRow({
187
187
  className: clsx2({
188
188
  "justify-end": typeof cellValue === "number"
189
189
  }),
190
- width: (_c = (_b = cell.column.columnDef.meta) == null ? void 0 : _b.headerWidth) != null ? _c : `${cell.column.getSize()}px`,
191
190
  children: /* @__PURE__ */ jsx2(
192
191
  Tooltip,
193
192
  {
@@ -373,7 +372,15 @@ function TableBody({
373
372
  transform: `translateY(${virtualRows[virtualRows.length - 1].start + 40}px)`
374
373
  },
375
374
  className: "odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal",
376
- children: table.getAllLeafColumns().map((column) => /* @__PURE__ */ jsx4(LoadingCell, { id, testid, column: column.columnDef }, column.id))
375
+ children: table.getAllLeafColumns().map((column) => /* @__PURE__ */ jsx4(
376
+ LoadingCell,
377
+ {
378
+ id,
379
+ testid,
380
+ column: column.columnDef
381
+ },
382
+ column.id
383
+ ))
377
384
  }
378
385
  )
379
386
  ]
@@ -903,23 +910,21 @@ function DataGrid({
903
910
  )
904
911
  ) : null,
905
912
  virtualColumns.map((virtualColumn) => {
906
- var _a2, _b2, _c2, _d2;
913
+ var _a2, _b2, _c2;
907
914
  const header = headerGroup.headers[virtualColumn.index];
908
915
  if (!header) {
909
916
  return;
910
917
  }
911
918
  if (typeof header.column.columnDef.header === "string") {
912
- const customHeaderWidth = (_a2 = header.column.columnDef.meta) == null ? void 0 : _a2.headerWidth;
913
- const cellValue = (_b2 = table.getRowModel().rows[0]) == null ? void 0 : _b2.getValue(header.column.id);
919
+ const cellValue = (_a2 = table.getRowModel().rows[0]) == null ? void 0 : _a2.getValue(header.column.id);
914
920
  return /* @__PURE__ */ jsxs5(
915
921
  DraggableCellHeader,
916
922
  {
917
923
  id: id ? `${id}-header-${header.id}` : void 0,
918
924
  testid: testid ? `${testid}-header-${header.id}` : void 0,
919
925
  header,
920
- locked: (_c2 = header.column.columnDef.meta) == null ? void 0 : _c2.locked,
926
+ locked: (_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.locked,
921
927
  center: centerHeader,
922
- width: customHeaderWidth,
923
928
  className: clsx5(
924
929
  header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
925
930
  "group",
@@ -960,7 +965,7 @@ function DataGrid({
960
965
  header.id
961
966
  );
962
967
  }
963
- return /* @__PURE__ */ jsx8(React3.Fragment, { children: ((_d2 = header.column.columnDef.meta) == null ? void 0 : _d2.checkbox) ? /* @__PURE__ */ jsx8(
968
+ return /* @__PURE__ */ jsx8(React3.Fragment, { children: ((_c2 = header.column.columnDef.meta) == null ? void 0 : _c2.checkbox) ? /* @__PURE__ */ jsx8(
964
969
  DataGridCell,
965
970
  {
966
971
  id: id ? `${id}-header-${header.id}` : void 0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmsi/wedgekit-react",
3
3
  "private": false,
4
- "version": "0.0.208",
4
+ "version": "0.0.209",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsup",
@@ -107,10 +107,6 @@ export function TableBodyRow<T>({
107
107
  className={clsx({
108
108
  "justify-end": typeof cellValue === "number",
109
109
  })}
110
- width={
111
- (cell.column.columnDef.meta?.headerWidth as string | undefined) ??
112
- `${cell.column.getSize()}px`
113
- }
114
110
  >
115
111
  <Tooltip
116
112
  id={id ? `${id}-tooltip-${cell.id}` : undefined}
@@ -89,7 +89,9 @@ export function TableBody<T>({
89
89
  x.headers.map((header) => (
90
90
  <CellElement
91
91
  id={id ? `${id}-filter-cell-${header.id}` : undefined}
92
- testid={testid ? `${testid}-filter-cell-${header.id}` : undefined}
92
+ testid={
93
+ testid ? `${testid}-filter-cell-${header.id}` : undefined
94
+ }
93
95
  noPadding
94
96
  key={header.id}
95
97
  cell={header}
@@ -105,7 +107,11 @@ export function TableBody<T>({
105
107
  }) ?? (
106
108
  <Search
107
109
  id={id ? `${id}-filter-search-${header.id}` : undefined}
108
- testid={testid ? `${testid}-filter-search-${header.id}` : undefined}
110
+ testid={
111
+ testid
112
+ ? `${testid}-filter-search-${header.id}`
113
+ : undefined
114
+ }
109
115
  removeRoundness
110
116
  onChange={(e) =>
111
117
  header.column.setFilterValue(e.target.value)
@@ -156,7 +162,12 @@ export function TableBody<T>({
156
162
  className="odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal"
157
163
  >
158
164
  {table.getAllLeafColumns().map((column) => (
159
- <LoadingCell id={id} testid={testid} key={column.id} column={column.columnDef} />
165
+ <LoadingCell
166
+ id={id}
167
+ testid={testid}
168
+ key={column.id}
169
+ column={column.columnDef}
170
+ />
160
171
  ))}
161
172
  </tr>
162
173
  )}
@@ -401,9 +401,6 @@ export function DataGrid<T extends Record<string, unknown>>({
401
401
  }
402
402
 
403
403
  if (typeof header.column.columnDef.header === "string") {
404
- const customHeaderWidth =
405
- header.column.columnDef.meta?.headerWidth;
406
-
407
404
  const cellValue = table
408
405
  .getRowModel()
409
406
  .rows[0]?.getValue(header.column.id);
@@ -420,7 +417,7 @@ export function DataGrid<T extends Record<string, unknown>>({
420
417
  header={header}
421
418
  locked={header.column.columnDef.meta?.locked}
422
419
  center={centerHeader}
423
- width={customHeaderWidth}
420
+ // width={`${header.column.getSize()}px`}
424
421
  className={clsx(
425
422
  header.column.getCanSort()
426
423
  ? "cursor-pointer"
@@ -14,20 +14,20 @@ import clsx from "clsx";
14
14
  import {
15
15
  ComponentProps,
16
16
  CSSProperties,
17
- memo,
18
17
  PropsWithChildren,
19
18
  RefObject,
20
19
  useEffect,
21
20
  useRef,
22
21
  useState,
22
+ memo,
23
23
  } from "react";
24
24
  import { componentPadding, paddingUsingComponentGap } from "../classNames";
25
- import { AsProps } from "../types";
25
+ import { MenuOption } from "./MenuOption";
26
+ import { Menu } from "./Menu";
26
27
  import { Icon } from "./Icon";
27
28
  import { Search } from "./Search";
28
- import { Menu } from "./Menu";
29
- import { MenuOption } from "./MenuOption";
30
29
  import { useSubMenuSystem } from "./useMenuSystem";
30
+ import type { AsProps } from "../types";
31
31
 
32
32
  type Tags = "td" | "th";
33
33
 
@@ -44,6 +44,7 @@ type DataGridCellProps = PropsWithChildren<{
44
44
  warning?: boolean;
45
45
  center?: boolean;
46
46
  width?: string;
47
+ minWidth?: string;
47
48
  }>;
48
49
 
49
50
  export const DataGridCell = memo(
@@ -63,6 +64,7 @@ export const DataGridCell = memo(
63
64
  warning,
64
65
  center,
65
66
  width,
67
+ minWidth,
66
68
  testid,
67
69
  ...props
68
70
  }: AsProps<Tags> & DataGridCellProps) => {
@@ -171,7 +173,7 @@ export const DataGridCell = memo(
171
173
  id={id}
172
174
  data-testid={testid}
173
175
  className={clsx("flex h-10", !width && "flex-1")}
174
- style={{ width }}
176
+ style={{ width, minWidth }}
175
177
  {...props}
176
178
  data-theme={type === "header" && !locked ? "brand" : undefined}
177
179
  >
@@ -260,7 +262,7 @@ export function DataCellHeader<T>({
260
262
  const style: CSSProperties = {
261
263
  position: "relative",
262
264
  whiteSpace: "nowrap",
263
- width: header.column.columnDef.meta?.headerWidth ?? header.column.getSize(),
265
+ minWidth: header.column.getSize(),
264
266
  "--color-text-primary-normal": "var(--color-text-brand-primary-normal)",
265
267
  "--color-icon-on-action-primary-normal":
266
268
  "var(--color-text-brand-primary-normal)",
@@ -277,6 +279,7 @@ export function DataCellHeader<T>({
277
279
  type="header"
278
280
  component="header"
279
281
  style={style}
282
+ minWidth={`${header.column.getSize()}px`}
280
283
  onClick={header.column.getToggleSortingHandler()}
281
284
  onRightClick={() => setShowMenu(!showMenu)}
282
285
  {...props}
@@ -470,7 +473,6 @@ export function DraggableCellHeader<T extends Record<string, any>>({
470
473
  transition: "width transform 0.2s ease-in-out",
471
474
  whiteSpace: "nowrap",
472
475
  zIndex: isDragging ? 1 : 0,
473
- width: header.column.columnDef.meta?.headerWidth ?? header.column.getSize(),
474
476
  "--color-text-primary-normal": "var(--color-action-000)",
475
477
  "--color-icon-on-action-primary-normal": "var(--color-action-000)",
476
478
  userSelect: "none",
@@ -510,20 +512,12 @@ export function DragAlongCell<T extends RowData, TValue>({
510
512
  position: "relative",
511
513
  transform: CSS.Translate.toString(transform),
512
514
  transition: "width transform 0.2s ease-in-out",
513
- width: cell.column.columnDef.meta?.headerWidth ?? cell.column.getSize(),
515
+ minWidth: cell.column.getSize(),
514
516
  zIndex: isDragging ? 1 : 0,
515
517
  };
516
518
 
517
519
  return (
518
- <DataGridCell
519
- style={style}
520
- ref={setNodeRef}
521
- width={
522
- (cell.column.columnDef.meta?.headerWidth as string | undefined) ??
523
- `${cell.column.getSize()}px`
524
- }
525
- {...props}
526
- >
520
+ <DataGridCell style={style} ref={setNodeRef} {...props}>
527
521
  {children}
528
522
  </DataGridCell>
529
523
  );