@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.
@@ -6446,6 +6446,23 @@ function toCssSize2(value) {
6446
6446
  if (value === void 0) return void 0;
6447
6447
  return typeof value === "number" ? `${value}px` : value;
6448
6448
  }
6449
+ var DEFAULT_WORKBENCH_COLUMN_WIDTH = 160;
6450
+ var DEFAULT_WORKBENCH_ICON_COLUMN_WIDTH = 56;
6451
+ var DEFAULT_WORKBENCH_ACTION_COLUMN_WIDTH = 128;
6452
+ function numericCssSize(value) {
6453
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
6454
+ if (typeof value !== "string") return void 0;
6455
+ const match = value.trim().match(/^(\d+(?:\.\d+)?)px$/i);
6456
+ return match ? Number(match[1]) : void 0;
6457
+ }
6458
+ function defaultWorkbenchColumnWidth(column, action) {
6459
+ if (column.renderType === "icon") return DEFAULT_WORKBENCH_ICON_COLUMN_WIDTH;
6460
+ if (action) return DEFAULT_WORKBENCH_ACTION_COLUMN_WIDTH;
6461
+ return DEFAULT_WORKBENCH_COLUMN_WIDTH;
6462
+ }
6463
+ function resolvedWorkbenchColumnWidth(column, controlledWidth, action) {
6464
+ return controlledWidth ?? numericCssSize(column.width) ?? numericCssSize(column.minWidth) ?? defaultWorkbenchColumnWidth(column, action);
6465
+ }
6449
6466
  function defaultFormatLabel(value) {
6450
6467
  if (value === void 0 || value === null || value === false) return null;
6451
6468
  return value;
@@ -6574,11 +6591,21 @@ function WorkbenchTableView({
6574
6591
  const resolvedActivePrimaryColumn = activePrimaryColumn ?? activeTablePrimaryColumn;
6575
6592
  const orderedColumns = getOrderedColumns(columns, resolvedColumnOrder);
6576
6593
  const hiddenRowCount = Math.max(0, Number(totalRowCount || rows.length) - Number(renderedRowCount || rows.length));
6577
- const resolvedMinWidth = tableMinWidth ?? minWidth ?? Math.max(760, Math.min(orderedColumns.length * 112, 1440));
6578
6594
  const renderValue = renderCell ?? renderFieldValue ?? ((column, row) => row?.[column.key]);
6579
6595
  const isAction = isActionColumn ?? isActionField ?? (() => false);
6580
6596
  const isDisabled = isRowDisabled ?? isWorkbenchPlaceholderRow ?? (() => false);
6581
6597
  const resolveColumnIcon = getColumnIcon ?? getColumnTypeIcon;
6598
+ const resolvedMinWidth = tableMinWidth ?? minWidth ?? Math.max(
6599
+ 760,
6600
+ orderedColumns.reduce(
6601
+ (total, column) => total + resolvedWorkbenchColumnWidth(
6602
+ column,
6603
+ resolvedColumnSizes[column.key],
6604
+ isAction(column)
6605
+ ),
6606
+ 0
6607
+ )
6608
+ );
6582
6609
  const footer = hiddenRowCount > 0 && hiddenRowsMessage ? typeof hiddenRowsMessage === "function" ? hiddenRowsMessage(hiddenRowCount, renderedRowCount || rows.length, totalRowCount || rows.length) : hiddenRowsMessage : null;
6583
6610
  return /* @__PURE__ */ jsxs(
6584
6611
  BaseTableContainer,
@@ -6606,6 +6633,7 @@ function WorkbenchTableView({
6606
6633
  style: { minWidth: resolvedMinWidth },
6607
6634
  children: [
6608
6635
  /* @__PURE__ */ jsx(BaseTableHeader, { appearance, className: cn("text-[10px] font-mono uppercase tracking-wide text-muted-foreground", classNames?.header), children: /* @__PURE__ */ jsx(BaseTableRow, { className: cn("hover:bg-transparent", classNames?.headerRow), children: orderedColumns.map((column, columnIndex) => {
6636
+ const defaultColumnWidth = defaultWorkbenchColumnWidth(column, isAction(column));
6609
6637
  const columnType = column.renderType || column.type || getColumnDataType?.(column.key, rows, column);
6610
6638
  const columnIcon = renderWorkbenchIcon(
6611
6639
  resolveColumnIcon?.(columnType, column),
@@ -6640,7 +6668,7 @@ function WorkbenchTableView({
6640
6668
  dragLabel: column.dragLabel,
6641
6669
  resizable: column.resizable,
6642
6670
  resizeLabel: column.resizeLabel,
6643
- width: column.width,
6671
+ width: column.width ?? defaultColumnWidth,
6644
6672
  minWidth: typeof column.minWidth === "number" ? column.minWidth : void 0,
6645
6673
  maxWidth: typeof column.maxWidth === "number" ? column.maxWidth : void 0,
6646
6674
  className: cn(
@@ -6696,6 +6724,7 @@ function WorkbenchTableView({
6696
6724
  className: cn(
6697
6725
  shouldWrap ? "align-top whitespace-normal" : "whitespace-nowrap",
6698
6726
  "px-4 py-3 text-muted-foreground",
6727
+ !shouldWrap && "overflow-hidden text-ellipsis",
6699
6728
  stickyFirstColumn && columnIndex === 0 && "sticky left-0 z-10 bg-card/95 text-foreground shadow-[1px_0_0_0_hsl(var(--border)/0.3)]",
6700
6729
  column.compactCellClassName,
6701
6730
  column.cellClassName,