@coldsmirk/ledger-mantine 0.10.1 → 0.10.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/dist/index.js CHANGED
@@ -428,8 +428,11 @@ function useRowReorder({ onRowReorder, labels, viewportRef, getCenterRows, nameR
428
428
  body.append(rowClone);
429
429
  ghostTable.append(colgroup, body);
430
430
  element.replaceChildren(ghostTable);
431
- const surface = getComputedStyle(source).getPropertyValue("--ledger-body-bg").trim();
432
- if (surface !== "") element.style.setProperty("--ledger-body-bg", surface);
431
+ const sourceStyle = getComputedStyle(source);
432
+ for (const variable of ["--ledger-body-bg", "--ledger-border-color"]) {
433
+ const value = sourceStyle.getPropertyValue(variable).trim();
434
+ if (value !== "") element.style.setProperty(variable, value);
435
+ }
433
436
  const rowRect = source.getBoundingClientRect();
434
437
  ghostOrigin.current = {
435
438
  x: rowRect.left - ghostPosition.current.x,
@@ -2812,7 +2815,10 @@ function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, last,
2812
2815
  colSpan,
2813
2816
  role: "cell",
2814
2817
  ...getStyles("detailPanel"),
2815
- children: renderDetailPanel?.(row)
2818
+ children: /* @__PURE__ */ jsx("div", {
2819
+ "data-detail-content": true,
2820
+ children: renderDetailPanel?.(row)
2821
+ })
2816
2822
  })
2817
2823
  });
2818
2824
  }
@@ -4193,11 +4199,18 @@ function minWidthPx(tableMinWidth, viewport) {
4193
4199
  return Number.parseFloat(getComputedStyle(tableElement).minWidth) || 0;
4194
4200
  }
4195
4201
  function useColumnWidths(table, { columns, viewport, tableMinWidth, injectedWidth, autosizeWidths }) {
4196
- const [availableWidth, setAvailableWidth] = useState(0);
4202
+ const [widths, setWidths] = useState({
4203
+ available: 0,
4204
+ viewport: 0
4205
+ });
4197
4206
  const measure = useCallback(() => {
4198
4207
  if (!viewport) return;
4199
- const next = Math.max(viewport.clientWidth, minWidthPx(tableMinWidth, viewport));
4200
- setAvailableWidth((previous) => previous === next ? previous : next);
4208
+ const inner = Math.max(0, Math.round(viewport.clientWidth));
4209
+ const available = Math.max(inner, minWidthPx(tableMinWidth, viewport));
4210
+ setWidths((previous) => previous.available === available && previous.viewport === inner ? previous : {
4211
+ available,
4212
+ viewport: inner
4213
+ });
4201
4214
  }, [viewport, tableMinWidth]);
4202
4215
  useLayoutEffect(() => {
4203
4216
  measure();
@@ -4225,11 +4238,11 @@ function useColumnWidths(table, { columns, viewport, tableMinWidth, injectedWidt
4225
4238
  minSize: raw ? raw.minSize ?? defaultColumn?.minSize : column.columnDef.minSize,
4226
4239
  maxSize: raw ? raw.maxSize ?? defaultColumn?.maxSize : column.columnDef.maxSize
4227
4240
  };
4228
- }), columnSizing, availableWidth);
4241
+ }), columnSizing, widths.available);
4229
4242
  }, [
4230
4243
  columns,
4231
4244
  columnSizing,
4232
- availableWidth,
4245
+ widths.available,
4233
4246
  defaultColumn,
4234
4247
  injectedWidth,
4235
4248
  autosizeWidths
@@ -4237,9 +4250,15 @@ function useColumnWidths(table, { columns, viewport, tableMinWidth, injectedWidt
4237
4250
  const signature = JSON.stringify([
4238
4251
  resolved.total,
4239
4252
  resolved.filler,
4253
+ widths.viewport,
4240
4254
  Object.entries(resolved.byId)
4241
4255
  ]);
4242
- return useMemo(() => resolved, [signature]);
4256
+ return useMemo(() => {
4257
+ return {
4258
+ ...resolved,
4259
+ viewportWidth: widths.viewport
4260
+ };
4261
+ }, [signature]);
4243
4262
  }
4244
4263
  //#endregion
4245
4264
  //#region src/ledger-features.ts
@@ -7248,6 +7267,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7248
7267
  }
7249
7268
  }
7250
7269
  varsMap["--ledger-pinned-start-width"] = `${leftOffset}px`;
7270
+ if (columnWidths.viewportWidth > 0) varsMap["--ledger-viewport-width"] = `${columnWidths.viewportWidth}px`;
7251
7271
  let rightOffset = 0;
7252
7272
  for (let index = visibleLeafColumns.length - 1; index >= 0; index -= 1) {
7253
7273
  const column = visibleLeafColumns[index];