@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.
package/dist/index.js CHANGED
@@ -18042,6 +18042,23 @@ function toCssSize3(value) {
18042
18042
  if (value === void 0) return void 0;
18043
18043
  return typeof value === "number" ? `${value}px` : value;
18044
18044
  }
18045
+ var DEFAULT_WORKBENCH_COLUMN_WIDTH = 160;
18046
+ var DEFAULT_WORKBENCH_ICON_COLUMN_WIDTH = 56;
18047
+ var DEFAULT_WORKBENCH_ACTION_COLUMN_WIDTH = 128;
18048
+ function numericCssSize(value) {
18049
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
18050
+ if (typeof value !== "string") return void 0;
18051
+ const match = value.trim().match(/^(\d+(?:\.\d+)?)px$/i);
18052
+ return match ? Number(match[1]) : void 0;
18053
+ }
18054
+ function defaultWorkbenchColumnWidth(column, action) {
18055
+ if (column.renderType === "icon") return DEFAULT_WORKBENCH_ICON_COLUMN_WIDTH;
18056
+ if (action) return DEFAULT_WORKBENCH_ACTION_COLUMN_WIDTH;
18057
+ return DEFAULT_WORKBENCH_COLUMN_WIDTH;
18058
+ }
18059
+ function resolvedWorkbenchColumnWidth(column, controlledWidth, action) {
18060
+ return controlledWidth ?? numericCssSize(column.width) ?? numericCssSize(column.minWidth) ?? defaultWorkbenchColumnWidth(column, action);
18061
+ }
18045
18062
  function defaultFormatLabel(value) {
18046
18063
  if (value === void 0 || value === null || value === false) return null;
18047
18064
  return value;
@@ -18170,11 +18187,21 @@ function WorkbenchTableView({
18170
18187
  const resolvedActivePrimaryColumn = activePrimaryColumn ?? activeTablePrimaryColumn;
18171
18188
  const orderedColumns = getOrderedColumns(columns, resolvedColumnOrder);
18172
18189
  const hiddenRowCount = Math.max(0, Number(totalRowCount || rows.length) - Number(renderedRowCount || rows.length));
18173
- const resolvedMinWidth = tableMinWidth ?? minWidth ?? Math.max(760, Math.min(orderedColumns.length * 112, 1440));
18174
18190
  const renderValue = renderCell ?? renderFieldValue ?? ((column, row) => row?.[column.key]);
18175
18191
  const isAction = isActionColumn ?? isActionField ?? (() => false);
18176
18192
  const isDisabled = isRowDisabled ?? isWorkbenchPlaceholderRow ?? (() => false);
18177
18193
  const resolveColumnIcon = getColumnIcon ?? getColumnTypeIcon;
18194
+ const resolvedMinWidth = tableMinWidth ?? minWidth ?? Math.max(
18195
+ 760,
18196
+ orderedColumns.reduce(
18197
+ (total, column) => total + resolvedWorkbenchColumnWidth(
18198
+ column,
18199
+ resolvedColumnSizes[column.key],
18200
+ isAction(column)
18201
+ ),
18202
+ 0
18203
+ )
18204
+ );
18178
18205
  const footer = hiddenRowCount > 0 && hiddenRowsMessage ? typeof hiddenRowsMessage === "function" ? hiddenRowsMessage(hiddenRowCount, renderedRowCount || rows.length, totalRowCount || rows.length) : hiddenRowsMessage : null;
18179
18206
  return /* @__PURE__ */ jsxRuntime.jsxs(
18180
18207
  BaseTableContainer,
@@ -18202,6 +18229,7 @@ function WorkbenchTableView({
18202
18229
  style: { minWidth: resolvedMinWidth },
18203
18230
  children: [
18204
18231
  /* @__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) => {
18232
+ const defaultColumnWidth = defaultWorkbenchColumnWidth(column, isAction(column));
18205
18233
  const columnType = column.renderType || column.type || getColumnDataType?.(column.key, rows, column);
18206
18234
  const columnIcon = renderWorkbenchIcon(
18207
18235
  resolveColumnIcon?.(columnType, column),
@@ -18236,7 +18264,7 @@ function WorkbenchTableView({
18236
18264
  dragLabel: column.dragLabel,
18237
18265
  resizable: column.resizable,
18238
18266
  resizeLabel: column.resizeLabel,
18239
- width: column.width,
18267
+ width: column.width ?? defaultColumnWidth,
18240
18268
  minWidth: typeof column.minWidth === "number" ? column.minWidth : void 0,
18241
18269
  maxWidth: typeof column.maxWidth === "number" ? column.maxWidth : void 0,
18242
18270
  className: cn(
@@ -18292,6 +18320,7 @@ function WorkbenchTableView({
18292
18320
  className: cn(
18293
18321
  shouldWrap ? "align-top whitespace-normal" : "whitespace-nowrap",
18294
18322
  "px-4 py-3 text-muted-foreground",
18323
+ !shouldWrap && "overflow-hidden text-ellipsis",
18295
18324
  stickyFirstColumn && columnIndex === 0 && "sticky left-0 z-10 bg-card/95 text-foreground shadow-[1px_0_0_0_hsl(var(--border)/0.3)]",
18296
18325
  column.compactCellClassName,
18297
18326
  column.cellClassName,