@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.mjs CHANGED
@@ -18013,6 +18013,23 @@ function toCssSize3(value) {
18013
18013
  if (value === void 0) return void 0;
18014
18014
  return typeof value === "number" ? `${value}px` : value;
18015
18015
  }
18016
+ var DEFAULT_WORKBENCH_COLUMN_WIDTH = 160;
18017
+ var DEFAULT_WORKBENCH_ICON_COLUMN_WIDTH = 56;
18018
+ var DEFAULT_WORKBENCH_ACTION_COLUMN_WIDTH = 128;
18019
+ function numericCssSize(value) {
18020
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
18021
+ if (typeof value !== "string") return void 0;
18022
+ const match = value.trim().match(/^(\d+(?:\.\d+)?)px$/i);
18023
+ return match ? Number(match[1]) : void 0;
18024
+ }
18025
+ function defaultWorkbenchColumnWidth(column, action) {
18026
+ if (column.renderType === "icon") return DEFAULT_WORKBENCH_ICON_COLUMN_WIDTH;
18027
+ if (action) return DEFAULT_WORKBENCH_ACTION_COLUMN_WIDTH;
18028
+ return DEFAULT_WORKBENCH_COLUMN_WIDTH;
18029
+ }
18030
+ function resolvedWorkbenchColumnWidth(column, controlledWidth, action) {
18031
+ return controlledWidth ?? numericCssSize(column.width) ?? numericCssSize(column.minWidth) ?? defaultWorkbenchColumnWidth(column, action);
18032
+ }
18016
18033
  function defaultFormatLabel(value) {
18017
18034
  if (value === void 0 || value === null || value === false) return null;
18018
18035
  return value;
@@ -18141,11 +18158,21 @@ function WorkbenchTableView({
18141
18158
  const resolvedActivePrimaryColumn = activePrimaryColumn ?? activeTablePrimaryColumn;
18142
18159
  const orderedColumns = getOrderedColumns(columns, resolvedColumnOrder);
18143
18160
  const hiddenRowCount = Math.max(0, Number(totalRowCount || rows.length) - Number(renderedRowCount || rows.length));
18144
- const resolvedMinWidth = tableMinWidth ?? minWidth ?? Math.max(760, Math.min(orderedColumns.length * 112, 1440));
18145
18161
  const renderValue = renderCell ?? renderFieldValue ?? ((column, row) => row?.[column.key]);
18146
18162
  const isAction = isActionColumn ?? isActionField ?? (() => false);
18147
18163
  const isDisabled = isRowDisabled ?? isWorkbenchPlaceholderRow ?? (() => false);
18148
18164
  const resolveColumnIcon = getColumnIcon ?? getColumnTypeIcon;
18165
+ const resolvedMinWidth = tableMinWidth ?? minWidth ?? Math.max(
18166
+ 760,
18167
+ orderedColumns.reduce(
18168
+ (total, column) => total + resolvedWorkbenchColumnWidth(
18169
+ column,
18170
+ resolvedColumnSizes[column.key],
18171
+ isAction(column)
18172
+ ),
18173
+ 0
18174
+ )
18175
+ );
18149
18176
  const footer = hiddenRowCount > 0 && hiddenRowsMessage ? typeof hiddenRowsMessage === "function" ? hiddenRowsMessage(hiddenRowCount, renderedRowCount || rows.length, totalRowCount || rows.length) : hiddenRowsMessage : null;
18150
18177
  return /* @__PURE__ */ jsxs(
18151
18178
  BaseTableContainer,
@@ -18173,6 +18200,7 @@ function WorkbenchTableView({
18173
18200
  style: { minWidth: resolvedMinWidth },
18174
18201
  children: [
18175
18202
  /* @__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) => {
18203
+ const defaultColumnWidth = defaultWorkbenchColumnWidth(column, isAction(column));
18176
18204
  const columnType = column.renderType || column.type || getColumnDataType?.(column.key, rows, column);
18177
18205
  const columnIcon = renderWorkbenchIcon(
18178
18206
  resolveColumnIcon?.(columnType, column),
@@ -18207,7 +18235,7 @@ function WorkbenchTableView({
18207
18235
  dragLabel: column.dragLabel,
18208
18236
  resizable: column.resizable,
18209
18237
  resizeLabel: column.resizeLabel,
18210
- width: column.width,
18238
+ width: column.width ?? defaultColumnWidth,
18211
18239
  minWidth: typeof column.minWidth === "number" ? column.minWidth : void 0,
18212
18240
  maxWidth: typeof column.maxWidth === "number" ? column.maxWidth : void 0,
18213
18241
  className: cn(
@@ -18263,6 +18291,7 @@ function WorkbenchTableView({
18263
18291
  className: cn(
18264
18292
  shouldWrap ? "align-top whitespace-normal" : "whitespace-nowrap",
18265
18293
  "px-4 py-3 text-muted-foreground",
18294
+ !shouldWrap && "overflow-hidden text-ellipsis",
18266
18295
  stickyFirstColumn && columnIndex === 0 && "sticky left-0 z-10 bg-card/95 text-foreground shadow-[1px_0_0_0_hsl(var(--border)/0.3)]",
18267
18296
  column.compactCellClassName,
18268
18297
  column.cellClassName,