@zvndev/yable-react 0.5.1 → 0.6.0

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
@@ -2269,8 +2269,42 @@ function TableCell({
2269
2269
  } else {
2270
2270
  content = overrideValue !== void 0 ? overrideValue : cell.renderValue();
2271
2271
  }
2272
+ const isGroupRow = cell.row.getIsGrouped();
2273
+ if (isGroupRow) {
2274
+ if (column.id === cell.row.groupingColumnId) {
2275
+ const expanded = cell.row.getIsExpanded();
2276
+ content = /* @__PURE__ */ jsxs("span", { className: "yable-group-cell", style: { paddingLeft: cell.row.depth * 16 }, children: [
2277
+ /* @__PURE__ */ jsx(
2278
+ "button",
2279
+ {
2280
+ type: "button",
2281
+ className: "yable-group-toggle",
2282
+ "aria-label": expanded ? "Collapse group" : "Expand group",
2283
+ "aria-expanded": expanded,
2284
+ onClick: cell.row.getToggleExpandedHandler(),
2285
+ children: expanded ? "\u25BE" : "\u25B8"
2286
+ }
2287
+ ),
2288
+ /* @__PURE__ */ jsx("span", { className: "yable-group-value", children: String(cell.row.groupingValue ?? "") }),
2289
+ /* @__PURE__ */ jsxs("span", { className: "yable-group-count", children: [
2290
+ "(",
2291
+ cell.row.getLeafRows().length,
2292
+ ")"
2293
+ ] })
2294
+ ] });
2295
+ } else {
2296
+ const aggDef = column.columnDef.aggregatedCell;
2297
+ if (typeof aggDef === "function") {
2298
+ content = aggDef(cell.getContext());
2299
+ } else {
2300
+ const aggVal = cell.getValue();
2301
+ content = aggVal == null ? null : aggVal;
2302
+ }
2303
+ }
2304
+ }
2272
2305
  const handleClick = useCallback(
2273
2306
  (e) => {
2307
+ if (cell.row.getIsGrouped()) return;
2274
2308
  table.events.emit("cell:click", {
2275
2309
  cell,
2276
2310
  row: cell.row,
@@ -2336,7 +2370,7 @@ function TableCell({
2336
2370
  const cellStyleDef = column.columnDef.cellStyle;
2337
2371
  const userStyle = typeof cellStyleDef === "function" ? cellStyleDef(cell.getContext()) : cellStyleDef;
2338
2372
  const mergedStyle = userStyle ? { ...style, ...userStyle } : style;
2339
- const showFillHandle = isFocused && Boolean(table.options.enableFillHandle) && onFillHandleMouseDown != null;
2373
+ const showFillHandle = isFocused && Boolean(table.options.enableFillHandle) && onFillHandleMouseDown != null && !isGroupRow;
2340
2374
  const classNames = [
2341
2375
  "yable-td",
2342
2376
  isFocused && "yable-cell--focused",
@@ -2357,6 +2391,7 @@ function TableCell({
2357
2391
  "data-pinned": pinned || void 0,
2358
2392
  "data-cell-status": cellStatus !== "idle" ? cellStatus : void 0,
2359
2393
  "data-column-id": column.id,
2394
+ "data-grouped": isGroupRow || void 0,
2360
2395
  "data-row-index": rowIndex,
2361
2396
  "data-column-index": columnIndex,
2362
2397
  "data-cell-selected": isCellSelected || void 0,