@inf-monkeys-tech/monkeys-design 1.0.1 → 1.0.2

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.
@@ -6468,6 +6468,23 @@ function toCssSize2(value) {
6468
6468
  if (value === void 0) return void 0;
6469
6469
  return typeof value === "number" ? `${value}px` : value;
6470
6470
  }
6471
+ var DEFAULT_WORKBENCH_COLUMN_WIDTH = 160;
6472
+ var DEFAULT_WORKBENCH_ICON_COLUMN_WIDTH = 56;
6473
+ var DEFAULT_WORKBENCH_ACTION_COLUMN_WIDTH = 128;
6474
+ function numericCssSize(value) {
6475
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
6476
+ if (typeof value !== "string") return void 0;
6477
+ const match = value.trim().match(/^(\d+(?:\.\d+)?)px$/i);
6478
+ return match ? Number(match[1]) : void 0;
6479
+ }
6480
+ function defaultWorkbenchColumnWidth(column, action) {
6481
+ if (column.renderType === "icon") return DEFAULT_WORKBENCH_ICON_COLUMN_WIDTH;
6482
+ if (action) return DEFAULT_WORKBENCH_ACTION_COLUMN_WIDTH;
6483
+ return DEFAULT_WORKBENCH_COLUMN_WIDTH;
6484
+ }
6485
+ function resolvedWorkbenchColumnWidth(column, controlledWidth, action) {
6486
+ return controlledWidth ?? numericCssSize(column.width) ?? numericCssSize(column.minWidth) ?? defaultWorkbenchColumnWidth(column, action);
6487
+ }
6471
6488
  function defaultFormatLabel(value) {
6472
6489
  if (value === void 0 || value === null || value === false) return null;
6473
6490
  return value;
@@ -6596,11 +6613,21 @@ function WorkbenchTableView({
6596
6613
  const resolvedActivePrimaryColumn = activePrimaryColumn ?? activeTablePrimaryColumn;
6597
6614
  const orderedColumns = getOrderedColumns(columns, resolvedColumnOrder);
6598
6615
  const hiddenRowCount = Math.max(0, Number(totalRowCount || rows.length) - Number(renderedRowCount || rows.length));
6599
- const resolvedMinWidth = tableMinWidth ?? minWidth ?? Math.max(760, Math.min(orderedColumns.length * 112, 1440));
6600
6616
  const renderValue = renderCell ?? renderFieldValue ?? ((column, row) => row?.[column.key]);
6601
6617
  const isAction = isActionColumn ?? isActionField ?? (() => false);
6602
6618
  const isDisabled = isRowDisabled ?? isWorkbenchPlaceholderRow ?? (() => false);
6603
6619
  const resolveColumnIcon = getColumnIcon ?? getColumnTypeIcon;
6620
+ const resolvedMinWidth = tableMinWidth ?? minWidth ?? Math.max(
6621
+ 760,
6622
+ orderedColumns.reduce(
6623
+ (total, column) => total + resolvedWorkbenchColumnWidth(
6624
+ column,
6625
+ resolvedColumnSizes[column.key],
6626
+ isAction(column)
6627
+ ),
6628
+ 0
6629
+ )
6630
+ );
6604
6631
  const footer = hiddenRowCount > 0 && hiddenRowsMessage ? typeof hiddenRowsMessage === "function" ? hiddenRowsMessage(hiddenRowCount, renderedRowCount || rows.length, totalRowCount || rows.length) : hiddenRowsMessage : null;
6605
6632
  return /* @__PURE__ */ jsxRuntime.jsxs(
6606
6633
  BaseTableContainer,
@@ -6628,6 +6655,7 @@ function WorkbenchTableView({
6628
6655
  style: { minWidth: resolvedMinWidth },
6629
6656
  children: [
6630
6657
  /* @__PURE__ */ jsxRuntime.jsx(BaseTableHeader, { appearance, className: cn("text-[10px] font-mono uppercase tracking-wide text-muted-foreground", classNames?.header), children: /* @__PURE__ */ jsxRuntime.jsx(BaseTableRow, { className: cn("hover:bg-transparent", classNames?.headerRow), children: orderedColumns.map((column, columnIndex) => {
6658
+ const defaultColumnWidth = defaultWorkbenchColumnWidth(column, isAction(column));
6631
6659
  const columnType = column.renderType || column.type || getColumnDataType?.(column.key, rows, column);
6632
6660
  const columnIcon = renderWorkbenchIcon(
6633
6661
  resolveColumnIcon?.(columnType, column),
@@ -6662,7 +6690,7 @@ function WorkbenchTableView({
6662
6690
  dragLabel: column.dragLabel,
6663
6691
  resizable: column.resizable,
6664
6692
  resizeLabel: column.resizeLabel,
6665
- width: column.width,
6693
+ width: column.width ?? defaultColumnWidth,
6666
6694
  minWidth: typeof column.minWidth === "number" ? column.minWidth : void 0,
6667
6695
  maxWidth: typeof column.maxWidth === "number" ? column.maxWidth : void 0,
6668
6696
  className: cn(
@@ -6718,6 +6746,7 @@ function WorkbenchTableView({
6718
6746
  className: cn(
6719
6747
  shouldWrap ? "align-top whitespace-normal" : "whitespace-nowrap",
6720
6748
  "px-4 py-3 text-muted-foreground",
6749
+ !shouldWrap && "overflow-hidden text-ellipsis",
6721
6750
  stickyFirstColumn && columnIndex === 0 && "sticky left-0 z-10 bg-card/95 text-foreground shadow-[1px_0_0_0_hsl(var(--border)/0.3)]",
6722
6751
  column.compactCellClassName,
6723
6752
  column.cellClassName,