@clickhouse/click-ui 0.0.195 → 0.0.196

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.
@@ -18143,12 +18143,9 @@ const StyledCell = styled.div.withConfig({
18143
18143
  $selectionType,
18144
18144
  $height,
18145
18145
  $type = "body",
18146
- $showBorder,
18147
- $rowAutoHeight
18146
+ $showBorder
18148
18147
  }) => `
18149
- height: ${$rowAutoHeight ? "100%" : `${$height}px`};
18150
- min-height: ${$rowAutoHeight ? "auto" : ""};
18151
- overflow-y: ${$rowAutoHeight ? "auto" : ""};
18148
+ height: ${$height}px;
18152
18149
  background: ${theme2.click.grid[$type].cell.color.background[$selectionType]};
18153
18150
  color: ${$type === "header" ? theme2.click.grid.header.cell.color.title[$selectionType] : theme2.click.grid.body.cell.color.text[$selectionType]};
18154
18151
  font: ${theme2.click.grid.cell.text.default};
@@ -18169,7 +18166,6 @@ const StyledCell = styled.div.withConfig({
18169
18166
  ${$isLastColumn ? `
18170
18167
  border-right-color: ${theme2.click.grid[$type].cell.color.stroke[$isFocused ? "selectDirect" : $selectionType]};
18171
18168
  ` : "border-right: none;"}
18172
- ${$rowAutoHeight && "border: none;"}
18173
18169
  `, ({
18174
18170
  theme: theme2,
18175
18171
  $isLastRow,
@@ -18177,9 +18173,8 @@ const StyledCell = styled.div.withConfig({
18177
18173
  $selectionType,
18178
18174
  $type = "body",
18179
18175
  $isSelectedTop,
18180
- $isSelectedLeft,
18181
- $rowAutoHeight
18182
- }) => $isSelectedTop || $isSelectedLeft || $selectionType === "selectDirect" && ($isLastRow || $isLastColumn) || $rowAutoHeight ? `
18176
+ $isSelectedLeft
18177
+ }) => $isSelectedTop || $isSelectedLeft || $selectionType === "selectDirect" && ($isLastRow || $isLastColumn) ? `
18183
18178
  &::before {
18184
18179
  content: "";
18185
18180
  position: absolute;
@@ -18191,7 +18186,6 @@ const StyledCell = styled.div.withConfig({
18191
18186
  ${$isSelectedLeft ? `border-left: 1px solid ${theme2.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
18192
18187
  ${$selectionType === "selectDirect" && $isLastRow ? `border-bottom: 1px solid ${theme2.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
18193
18188
  ${$selectionType === "selectDirect" && $isLastColumn ? `border-right: 1px solid ${theme2.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
18194
- ${$rowAutoHeight && "border: none;"}
18195
18189
  }
18196
18190
  ` : "");
18197
18191
  const RowNumberColumnContainer = styled.div.withConfig({
@@ -18202,7 +18196,7 @@ const RowNumberColumnContainer = styled.div.withConfig({
18202
18196
  }) => `
18203
18197
  top: ${$height}px;
18204
18198
  width: ${$width}px;
18205
- height: 100%
18199
+ height: 100%;
18206
18200
  `, ({
18207
18201
  $scrolledHorizontal,
18208
18202
  theme: theme2
@@ -18211,11 +18205,10 @@ const RowNumberCell = styled.div.withConfig({
18211
18205
  componentId: "sc-7gbi4d-1"
18212
18206
  })(["position:absolute;left:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%;", ""], ({
18213
18207
  $height,
18214
- $rowNumber,
18215
- $rowAutoHeight
18208
+ $rowNumber
18216
18209
  }) => `
18217
18210
  top: ${$height * $rowNumber}px;
18218
- height: ${$rowAutoHeight ? "100%" : `${$height}px`};
18211
+ height: ${$height}px;
18219
18212
  `);
18220
18213
  const RowNumber = ({
18221
18214
  rowIndex,
@@ -18224,8 +18217,7 @@ const RowNumber = ({
18224
18217
  isLastRow,
18225
18218
  isFirstRow,
18226
18219
  showBorder,
18227
- rowStart,
18228
- rowAutoHeight
18220
+ rowStart
18229
18221
  }) => {
18230
18222
  const currentRowIndex = rowIndex + rowStart;
18231
18223
  const selectionType = getSelectionType({
@@ -18238,7 +18230,7 @@ const RowNumber = ({
18238
18230
  type: "row"
18239
18231
  });
18240
18232
  const isSelectedTop = (topSelectionType === "selectDirect" || isSelected) && topSelectionType !== selectionType;
18241
- return /* @__PURE__ */ jsx(RowNumberCell, { $rowNumber: rowIndex, $height: rowHeight, $rowAutoHeight: rowAutoHeight, children: /* @__PURE__ */ jsx(StyledCell, { $height: rowHeight, $isLastColumn: false, $selectionType: selectionType, $isFirstColumn: true, $type: "header", $isFirstRow: isFirstRow, $isFocused: false, $isLastRow: isLastRow, $isSelectedLeft: isSelected, $isSelectedTop: isSelectedTop, $rowAutoHeight: rowAutoHeight, "data-selected": isSelected, "data-grid-row": currentRowIndex, "data-grid-column": -1, "data-testid": `header-cell-${currentRowIndex}-x`, $showBorder: showBorder, "data-align": "right", children: currentRowIndex }) });
18233
+ return /* @__PURE__ */ jsx(RowNumberCell, { $rowNumber: rowIndex, $height: rowHeight, children: /* @__PURE__ */ jsx(StyledCell, { $height: rowHeight, $isLastColumn: false, $selectionType: selectionType, $isFirstColumn: true, $type: "header", $isFirstRow: isFirstRow, $isFocused: false, $isLastRow: isLastRow, $isSelectedLeft: isSelected, $isSelectedTop: isSelectedTop, "data-selected": isSelected, "data-grid-row": currentRowIndex, "data-grid-column": -1, "data-testid": `header-cell-${currentRowIndex}-x`, $showBorder: showBorder, "data-align": "right", children: currentRowIndex }) });
18242
18234
  };
18243
18235
  const RowNumberColumn = ({
18244
18236
  minRow,
@@ -18251,12 +18243,11 @@ const RowNumberColumn = ({
18251
18243
  showHeader,
18252
18244
  scrolledHorizontal,
18253
18245
  rowStart = 0,
18254
- showBorder,
18255
- rowAutoHeight
18246
+ showBorder
18256
18247
  }) => {
18257
- return /* @__PURE__ */ jsx(RowNumberColumnContainer, { $height: headerHeight, $width: rowWidth, $scrolledHorizontal: scrolledHorizontal, $rowAutoHeight: rowAutoHeight, children: Array.from({
18248
+ return /* @__PURE__ */ jsx(RowNumberColumnContainer, { $height: headerHeight, $width: rowWidth, $scrolledHorizontal: scrolledHorizontal, children: Array.from({
18258
18249
  length: maxRow - minRow + 1
18259
- }, (_, index2) => minRow + index2).map((rowIndex) => /* @__PURE__ */ jsx(RowNumber, { getSelectionType, rowHeight, rowIndex, isLastRow: rowIndex === rowCount, isFirstRow: !showHeader && rowIndex === 0, showBorder, rowStart, rowAutoHeight }, `row-number-${rowIndex}`)) });
18250
+ }, (_, index2) => minRow + index2).map((rowIndex) => /* @__PURE__ */ jsx(RowNumber, { getSelectionType, rowHeight, rowIndex, isLastRow: rowIndex === rowCount, isFirstRow: !showHeader && rowIndex === 0, showBorder, rowStart }, `row-number-${rowIndex}`)) });
18260
18251
  };
18261
18252
  function isObject$a(value) {
18262
18253
  var type = typeof value;
@@ -18638,7 +18629,7 @@ const RowColumnContainer = styled(HeaderCellContainer).withConfig({
18638
18629
  }) => $scrolledHorizontal ? `box-shadow: 0px 0 0px 1px ${theme2.click.grid.header.cell.color.stroke.default};` : "");
18639
18630
  const RowColumn = styled(StyledCell).withConfig({
18640
18631
  componentId: "sc-1oadqc8-4"
18641
- })(["width:100%;text-align:right;overflow:hidden;"]);
18632
+ })(["width:100%;text-align:right;"]);
18642
18633
  const Column = ({
18643
18634
  columnIndex,
18644
18635
  cell,
@@ -19067,9 +19058,7 @@ const Cell = memo(({
19067
19058
  showRowNumber,
19068
19059
  showHeader,
19069
19060
  rowHeight,
19070
- rowStart,
19071
- rowAutoHeight,
19072
- updateRowHeight
19061
+ rowStart
19073
19062
  } = data;
19074
19063
  const currentRowIndex = rowIndex + rowStart;
19075
19064
  const {
@@ -19098,21 +19087,7 @@ const Cell = memo(({
19098
19087
  const belowSelectionBorder = (selectionType === "selectDirect" || belowSelection === "selectDirect") && selectionType !== belowSelection;
19099
19088
  const selectionBorderLeft = rightOfSelectionBorder || rightOfFocus || isFocused;
19100
19089
  const selectionBorderTop = belowSelectionBorder || belowFocus || isFocused;
19101
- const cellRef = useRef(null);
19102
- useEffect(() => {
19103
- if (!rowAutoHeight) {
19104
- return;
19105
- }
19106
- if (cellRef.current) {
19107
- const height = cellRef.current.getBoundingClientRect().height;
19108
- updateRowHeight(rowIndex, height);
19109
- }
19110
- }, [updateRowHeight, rowIndex, rowAutoHeight]);
19111
- const styleWithHeight = {
19112
- ...style,
19113
- height: "auto"
19114
- };
19115
- return /* @__PURE__ */ jsx("div", { style: styleWithHeight, "data-row": currentRowIndex, "data-column": columnIndex, ref: cellRef, children: /* @__PURE__ */ jsx(StyledCell, { as: CellData, rowIndex: currentRowIndex, columnIndex, type: "row-cell", "data-selected": isFocused || selectionType === "selectDirect", "data-focused": isFocused, $isSelectedTop: selectionBorderTop, $isSelectedLeft: selectionBorderLeft, $isFocused: isFocused, $isLastRow: rowCount - 1 === rowIndex, $isLastColumn: columnCount - 1 === columnIndex, $isFirstColumn: columnIndex === 0 && !showRowNumber, $isFirstRow: rowIndex === 0 && !showHeader, $selectionType: selectionType, $height: rowHeight, "data-grid-row": currentRowIndex, "data-grid-column": columnIndex, $showBorder: true, $rowAutoHeight: rowAutoHeight, ...props }) });
19090
+ return /* @__PURE__ */ jsx("div", { style, "data-row": currentRowIndex, "data-column": columnIndex, children: /* @__PURE__ */ jsx(StyledCell, { as: CellData, rowIndex: currentRowIndex, columnIndex, type: "row-cell", "data-selected": isFocused || selectionType === "selectDirect", "data-focused": isFocused, $isSelectedTop: selectionBorderTop, $isSelectedLeft: selectionBorderLeft, $isFocused: isFocused, $isLastRow: rowCount - 1 === rowIndex, $isLastColumn: columnCount - 1 === columnIndex, $isFirstColumn: columnIndex === 0 && !showRowNumber, $isFirstRow: rowIndex === 0 && !showHeader, $selectionType: selectionType, $height: rowHeight, "data-grid-row": currentRowIndex, "data-grid-column": columnIndex, $showBorder: true, ...props }) });
19116
19091
  }, areEqual);
19117
19092
  var reactDomServerLegacy_browser_production_min = {};
19118
19093
  /**
@@ -33322,7 +33297,6 @@ const Grid = forwardRef(({
33322
33297
  onContextMenu: onContextMenuProp,
33323
33298
  forwardedGridRef,
33324
33299
  onItemsRendered: onItemsRenderedProp,
33325
- rowAutoHeight,
33326
33300
  ...props
33327
33301
  }, forwardedRef) => {
33328
33302
  const [focus, setFocus] = useState(focusProp ?? {
@@ -33366,25 +33340,6 @@ const Grid = forwardRef(({
33366
33340
  }
33367
33341
  }
33368
33342
  }, [cell, columnCount, focus, focusProp, rowCount, selection, showToast, onCopyCallback]);
33369
- const rowHeightsRef = useRef(/* @__PURE__ */ new Map());
33370
- const getRowHeight2 = useCallback((index2) => {
33371
- if (rowAutoHeight && rowHeightsRef.current.get(index2)) {
33372
- return rowHeightsRef.current.get(index2) + rowHeight;
33373
- }
33374
- return rowHeight;
33375
- }, [rowHeight, rowAutoHeight]);
33376
- const updateRowHeight = useCallback((rowIndex, height) => {
33377
- if (!rowAutoHeight) {
33378
- return;
33379
- }
33380
- const prevHeight = rowHeightsRef.current.get(rowIndex) ?? 0;
33381
- if (height > prevHeight) {
33382
- rowHeightsRef.current.set(rowIndex, height);
33383
- if (gridRef.current) {
33384
- gridRef.current.resetAfterRowIndex(rowIndex);
33385
- }
33386
- }
33387
- }, [rowAutoHeight]);
33388
33343
  const customOnCopy = useMemo(() => {
33389
33344
  const result = async () => {
33390
33345
  if (onCopyProp) {
@@ -33548,10 +33503,7 @@ const Grid = forwardRef(({
33548
33503
  rowHeight,
33549
33504
  headerHeight,
33550
33505
  rowNumberWidth,
33551
- rowStart,
33552
- rowAutoHeight,
33553
- updateRowHeight,
33554
- getRowHeight: getRowHeight2
33506
+ rowStart
33555
33507
  };
33556
33508
  const InnerElementType = forwardRef(({
33557
33509
  children,
@@ -33560,7 +33512,7 @@ const Grid = forwardRef(({
33560
33512
  const [minRow, maxRow, minColumn, maxColumn] = getRenderedCursor(children);
33561
33513
  return /* @__PURE__ */ jsxs(GridContainer, { ...containerProps, className: `sticky-grid__container grid-outer ${props.className ?? ""}`, children: [
33562
33514
  /* @__PURE__ */ jsx(GridDataContainer, { $top: showHeader ? headerHeight : 0, $left: showRowNumber ? rowNumberWidth : 0, ref, children }),
33563
- showRowNumber && /* @__PURE__ */ jsx(RowNumberColumn, { scrolledHorizontal, minRow, maxRow, rowHeight, headerHeight, rowWidth: rowNumberWidth, rowCount, getSelectionType, showHeader, rowStart, showBorder, rowAutoHeight }),
33515
+ showRowNumber && /* @__PURE__ */ jsx(RowNumberColumn, { scrolledHorizontal, minRow, maxRow, rowHeight, headerHeight, rowWidth: rowNumberWidth, rowCount, getSelectionType, showHeader, rowStart, showBorder }),
33564
33516
  showHeader && /* @__PURE__ */ jsx(Header, { scrolledVertical, scrolledHorizontal, showRowNumber, minColumn, maxColumn, height: headerHeight, getColumnWidth: columnWidth, cell, rowNumberWidth, getSelectionType, columnCount, onColumnResize, getColumnHorizontalPosition, getResizerPosition, showBorder, resizingState })
33565
33517
  ] });
33566
33518
  });
@@ -33813,16 +33765,11 @@ const Grid = forwardRef(({
33813
33765
  const width = columnWidth(args.columnIndex);
33814
33766
  return /* @__PURE__ */ jsx(Cell, { ...args, width });
33815
33767
  };
33816
- useEffect(() => {
33817
- if (gridRef.current) {
33818
- gridRef.current.resetAfterRowIndex(0);
33819
- }
33820
- }, [rowCount, columnCount]);
33821
33768
  return /* @__PURE__ */ jsxs(ContextMenu, { modal: false, onOpenChange: setContextMenuOpen, children: [
33822
33769
  /* @__PURE__ */ jsx(ContextMenuTrigger, { as: ContextMenu.Trigger, ref: mergeRefs([forwardedRef, containerRef]), tabIndex: 0, onMouseDown, onMouseMove, onKeyDown, onPointerDown, onPointerUp, onPointerLeave: setPointerCapture, onPointerEnter: setPointerCapture, onContextMenu, $rounded: rounded, $height: autoHeight ? rowCount * rowHeight + (showHeader ? headerHeight : 0) + elementBorderRef.current.scrollBarHeight : void 0, $showBorder: showBorder, children: /* @__PURE__ */ jsx(AutoSizer, { onResize, children: ({
33823
33770
  height,
33824
33771
  width
33825
- }) => /* @__PURE__ */ jsx(VariableSizeGrid, { ref: forwardedGridRef ? mergeRefs([forwardedGridRef, gridRef]) : gridRef, height, width, columnCount, rowHeight: getRowHeight2, useIsScrolling, innerElementType: InnerElementType, itemData: data, initialScrollTop: focus.row < rowStart ? focus.row * rowHeight : (focus.row - rowStart) * rowHeight, initialScrollLeft: getColumnHorizontalPosition(focus.column), columnWidth, rowCount, onScroll, outerRef, outerElementType: OuterElementType, onItemsRendered, ...props, children: CellWithWidth }) }) }),
33772
+ }) => /* @__PURE__ */ jsx(VariableSizeGrid, { ref: forwardedGridRef ? mergeRefs([forwardedGridRef, gridRef]) : gridRef, height, width, columnCount, rowHeight: () => rowHeight, useIsScrolling, innerElementType: InnerElementType, itemData: data, initialScrollTop: focus.row < rowStart ? focus.row * rowHeight : (focus.row - rowStart) * rowHeight, initialScrollLeft: getColumnHorizontalPosition(focus.column), columnWidth, rowCount, onScroll, outerRef, outerElementType: OuterElementType, onItemsRendered, ...props, children: CellWithWidth }) }) }),
33826
33773
  /* @__PURE__ */ jsx(ContextMenu.Content, { children: menuOptions.map((option2, index2) => /* @__PURE__ */ jsx(ContextMenu.Item, { onSelect: option2.onSelect, children: option2.label }, `grid-${index2}`)) })
33827
33774
  ] });
33828
33775
  });
@@ -18158,12 +18158,9 @@ var __publicField = (obj, key, value) => {
18158
18158
  $selectionType,
18159
18159
  $height,
18160
18160
  $type = "body",
18161
- $showBorder,
18162
- $rowAutoHeight
18161
+ $showBorder
18163
18162
  }) => `
18164
- height: ${$rowAutoHeight ? "100%" : `${$height}px`};
18165
- min-height: ${$rowAutoHeight ? "auto" : ""};
18166
- overflow-y: ${$rowAutoHeight ? "auto" : ""};
18163
+ height: ${$height}px;
18167
18164
  background: ${theme2.click.grid[$type].cell.color.background[$selectionType]};
18168
18165
  color: ${$type === "header" ? theme2.click.grid.header.cell.color.title[$selectionType] : theme2.click.grid.body.cell.color.text[$selectionType]};
18169
18166
  font: ${theme2.click.grid.cell.text.default};
@@ -18184,7 +18181,6 @@ var __publicField = (obj, key, value) => {
18184
18181
  ${$isLastColumn ? `
18185
18182
  border-right-color: ${theme2.click.grid[$type].cell.color.stroke[$isFocused ? "selectDirect" : $selectionType]};
18186
18183
  ` : "border-right: none;"}
18187
- ${$rowAutoHeight && "border: none;"}
18188
18184
  `, ({
18189
18185
  theme: theme2,
18190
18186
  $isLastRow,
@@ -18192,9 +18188,8 @@ var __publicField = (obj, key, value) => {
18192
18188
  $selectionType,
18193
18189
  $type = "body",
18194
18190
  $isSelectedTop,
18195
- $isSelectedLeft,
18196
- $rowAutoHeight
18197
- }) => $isSelectedTop || $isSelectedLeft || $selectionType === "selectDirect" && ($isLastRow || $isLastColumn) || $rowAutoHeight ? `
18191
+ $isSelectedLeft
18192
+ }) => $isSelectedTop || $isSelectedLeft || $selectionType === "selectDirect" && ($isLastRow || $isLastColumn) ? `
18198
18193
  &::before {
18199
18194
  content: "";
18200
18195
  position: absolute;
@@ -18206,7 +18201,6 @@ var __publicField = (obj, key, value) => {
18206
18201
  ${$isSelectedLeft ? `border-left: 1px solid ${theme2.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
18207
18202
  ${$selectionType === "selectDirect" && $isLastRow ? `border-bottom: 1px solid ${theme2.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
18208
18203
  ${$selectionType === "selectDirect" && $isLastColumn ? `border-right: 1px solid ${theme2.click.grid[$type].cell.color.stroke.selectDirect};` : ""}
18209
- ${$rowAutoHeight && "border: none;"}
18210
18204
  }
18211
18205
  ` : "");
18212
18206
  const RowNumberColumnContainer = styledComponents.styled.div.withConfig({
@@ -18217,7 +18211,7 @@ var __publicField = (obj, key, value) => {
18217
18211
  }) => `
18218
18212
  top: ${$height}px;
18219
18213
  width: ${$width}px;
18220
- height: 100%
18214
+ height: 100%;
18221
18215
  `, ({
18222
18216
  $scrolledHorizontal,
18223
18217
  theme: theme2
@@ -18226,11 +18220,10 @@ var __publicField = (obj, key, value) => {
18226
18220
  componentId: "sc-7gbi4d-1"
18227
18221
  })(["position:absolute;left:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%;", ""], ({
18228
18222
  $height,
18229
- $rowNumber,
18230
- $rowAutoHeight
18223
+ $rowNumber
18231
18224
  }) => `
18232
18225
  top: ${$height * $rowNumber}px;
18233
- height: ${$rowAutoHeight ? "100%" : `${$height}px`};
18226
+ height: ${$height}px;
18234
18227
  `);
18235
18228
  const RowNumber = ({
18236
18229
  rowIndex,
@@ -18239,8 +18232,7 @@ var __publicField = (obj, key, value) => {
18239
18232
  isLastRow,
18240
18233
  isFirstRow,
18241
18234
  showBorder,
18242
- rowStart,
18243
- rowAutoHeight
18235
+ rowStart
18244
18236
  }) => {
18245
18237
  const currentRowIndex = rowIndex + rowStart;
18246
18238
  const selectionType = getSelectionType({
@@ -18253,7 +18245,7 @@ var __publicField = (obj, key, value) => {
18253
18245
  type: "row"
18254
18246
  });
18255
18247
  const isSelectedTop = (topSelectionType === "selectDirect" || isSelected) && topSelectionType !== selectionType;
18256
- return /* @__PURE__ */ jsxRuntime.jsx(RowNumberCell, { $rowNumber: rowIndex, $height: rowHeight, $rowAutoHeight: rowAutoHeight, children: /* @__PURE__ */ jsxRuntime.jsx(StyledCell, { $height: rowHeight, $isLastColumn: false, $selectionType: selectionType, $isFirstColumn: true, $type: "header", $isFirstRow: isFirstRow, $isFocused: false, $isLastRow: isLastRow, $isSelectedLeft: isSelected, $isSelectedTop: isSelectedTop, $rowAutoHeight: rowAutoHeight, "data-selected": isSelected, "data-grid-row": currentRowIndex, "data-grid-column": -1, "data-testid": `header-cell-${currentRowIndex}-x`, $showBorder: showBorder, "data-align": "right", children: currentRowIndex }) });
18248
+ return /* @__PURE__ */ jsxRuntime.jsx(RowNumberCell, { $rowNumber: rowIndex, $height: rowHeight, children: /* @__PURE__ */ jsxRuntime.jsx(StyledCell, { $height: rowHeight, $isLastColumn: false, $selectionType: selectionType, $isFirstColumn: true, $type: "header", $isFirstRow: isFirstRow, $isFocused: false, $isLastRow: isLastRow, $isSelectedLeft: isSelected, $isSelectedTop: isSelectedTop, "data-selected": isSelected, "data-grid-row": currentRowIndex, "data-grid-column": -1, "data-testid": `header-cell-${currentRowIndex}-x`, $showBorder: showBorder, "data-align": "right", children: currentRowIndex }) });
18257
18249
  };
18258
18250
  const RowNumberColumn = ({
18259
18251
  minRow,
@@ -18266,12 +18258,11 @@ var __publicField = (obj, key, value) => {
18266
18258
  showHeader,
18267
18259
  scrolledHorizontal,
18268
18260
  rowStart = 0,
18269
- showBorder,
18270
- rowAutoHeight
18261
+ showBorder
18271
18262
  }) => {
18272
- return /* @__PURE__ */ jsxRuntime.jsx(RowNumberColumnContainer, { $height: headerHeight, $width: rowWidth, $scrolledHorizontal: scrolledHorizontal, $rowAutoHeight: rowAutoHeight, children: Array.from({
18263
+ return /* @__PURE__ */ jsxRuntime.jsx(RowNumberColumnContainer, { $height: headerHeight, $width: rowWidth, $scrolledHorizontal: scrolledHorizontal, children: Array.from({
18273
18264
  length: maxRow - minRow + 1
18274
- }, (_, index2) => minRow + index2).map((rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(RowNumber, { getSelectionType, rowHeight, rowIndex, isLastRow: rowIndex === rowCount, isFirstRow: !showHeader && rowIndex === 0, showBorder, rowStart, rowAutoHeight }, `row-number-${rowIndex}`)) });
18265
+ }, (_, index2) => minRow + index2).map((rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(RowNumber, { getSelectionType, rowHeight, rowIndex, isLastRow: rowIndex === rowCount, isFirstRow: !showHeader && rowIndex === 0, showBorder, rowStart }, `row-number-${rowIndex}`)) });
18275
18266
  };
18276
18267
  function isObject$a(value) {
18277
18268
  var type = typeof value;
@@ -18653,7 +18644,7 @@ var __publicField = (obj, key, value) => {
18653
18644
  }) => $scrolledHorizontal ? `box-shadow: 0px 0 0px 1px ${theme2.click.grid.header.cell.color.stroke.default};` : "");
18654
18645
  const RowColumn = styledComponents.styled(StyledCell).withConfig({
18655
18646
  componentId: "sc-1oadqc8-4"
18656
- })(["width:100%;text-align:right;overflow:hidden;"]);
18647
+ })(["width:100%;text-align:right;"]);
18657
18648
  const Column = ({
18658
18649
  columnIndex,
18659
18650
  cell,
@@ -19082,9 +19073,7 @@ var __publicField = (obj, key, value) => {
19082
19073
  showRowNumber,
19083
19074
  showHeader,
19084
19075
  rowHeight,
19085
- rowStart,
19086
- rowAutoHeight,
19087
- updateRowHeight
19076
+ rowStart
19088
19077
  } = data;
19089
19078
  const currentRowIndex = rowIndex + rowStart;
19090
19079
  const {
@@ -19113,21 +19102,7 @@ var __publicField = (obj, key, value) => {
19113
19102
  const belowSelectionBorder = (selectionType === "selectDirect" || belowSelection === "selectDirect") && selectionType !== belowSelection;
19114
19103
  const selectionBorderLeft = rightOfSelectionBorder || rightOfFocus || isFocused;
19115
19104
  const selectionBorderTop = belowSelectionBorder || belowFocus || isFocused;
19116
- const cellRef = React.useRef(null);
19117
- React.useEffect(() => {
19118
- if (!rowAutoHeight) {
19119
- return;
19120
- }
19121
- if (cellRef.current) {
19122
- const height = cellRef.current.getBoundingClientRect().height;
19123
- updateRowHeight(rowIndex, height);
19124
- }
19125
- }, [updateRowHeight, rowIndex, rowAutoHeight]);
19126
- const styleWithHeight = {
19127
- ...style,
19128
- height: "auto"
19129
- };
19130
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: styleWithHeight, "data-row": currentRowIndex, "data-column": columnIndex, ref: cellRef, children: /* @__PURE__ */ jsxRuntime.jsx(StyledCell, { as: CellData, rowIndex: currentRowIndex, columnIndex, type: "row-cell", "data-selected": isFocused || selectionType === "selectDirect", "data-focused": isFocused, $isSelectedTop: selectionBorderTop, $isSelectedLeft: selectionBorderLeft, $isFocused: isFocused, $isLastRow: rowCount - 1 === rowIndex, $isLastColumn: columnCount - 1 === columnIndex, $isFirstColumn: columnIndex === 0 && !showRowNumber, $isFirstRow: rowIndex === 0 && !showHeader, $selectionType: selectionType, $height: rowHeight, "data-grid-row": currentRowIndex, "data-grid-column": columnIndex, $showBorder: true, $rowAutoHeight: rowAutoHeight, ...props }) });
19105
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style, "data-row": currentRowIndex, "data-column": columnIndex, children: /* @__PURE__ */ jsxRuntime.jsx(StyledCell, { as: CellData, rowIndex: currentRowIndex, columnIndex, type: "row-cell", "data-selected": isFocused || selectionType === "selectDirect", "data-focused": isFocused, $isSelectedTop: selectionBorderTop, $isSelectedLeft: selectionBorderLeft, $isFocused: isFocused, $isLastRow: rowCount - 1 === rowIndex, $isLastColumn: columnCount - 1 === columnIndex, $isFirstColumn: columnIndex === 0 && !showRowNumber, $isFirstRow: rowIndex === 0 && !showHeader, $selectionType: selectionType, $height: rowHeight, "data-grid-row": currentRowIndex, "data-grid-column": columnIndex, $showBorder: true, ...props }) });
19131
19106
  }, areEqual);
19132
19107
  var reactDomServerLegacy_browser_production_min = {};
19133
19108
  /**
@@ -33337,7 +33312,6 @@ var __publicField = (obj, key, value) => {
33337
33312
  onContextMenu: onContextMenuProp,
33338
33313
  forwardedGridRef,
33339
33314
  onItemsRendered: onItemsRenderedProp,
33340
- rowAutoHeight,
33341
33315
  ...props
33342
33316
  }, forwardedRef) => {
33343
33317
  const [focus, setFocus] = React.useState(focusProp ?? {
@@ -33381,25 +33355,6 @@ var __publicField = (obj, key, value) => {
33381
33355
  }
33382
33356
  }
33383
33357
  }, [cell, columnCount, focus, focusProp, rowCount, selection, showToast, onCopyCallback]);
33384
- const rowHeightsRef = React.useRef(/* @__PURE__ */ new Map());
33385
- const getRowHeight = React.useCallback((index2) => {
33386
- if (rowAutoHeight && rowHeightsRef.current.get(index2)) {
33387
- return rowHeightsRef.current.get(index2) + rowHeight;
33388
- }
33389
- return rowHeight;
33390
- }, [rowHeight, rowAutoHeight]);
33391
- const updateRowHeight = React.useCallback((rowIndex, height) => {
33392
- if (!rowAutoHeight) {
33393
- return;
33394
- }
33395
- const prevHeight = rowHeightsRef.current.get(rowIndex) ?? 0;
33396
- if (height > prevHeight) {
33397
- rowHeightsRef.current.set(rowIndex, height);
33398
- if (gridRef.current) {
33399
- gridRef.current.resetAfterRowIndex(rowIndex);
33400
- }
33401
- }
33402
- }, [rowAutoHeight]);
33403
33358
  const customOnCopy = React.useMemo(() => {
33404
33359
  const result = async () => {
33405
33360
  if (onCopyProp) {
@@ -33563,10 +33518,7 @@ var __publicField = (obj, key, value) => {
33563
33518
  rowHeight,
33564
33519
  headerHeight,
33565
33520
  rowNumberWidth,
33566
- rowStart,
33567
- rowAutoHeight,
33568
- updateRowHeight,
33569
- getRowHeight
33521
+ rowStart
33570
33522
  };
33571
33523
  const InnerElementType = React.forwardRef(({
33572
33524
  children,
@@ -33575,7 +33527,7 @@ var __publicField = (obj, key, value) => {
33575
33527
  const [minRow, maxRow, minColumn, maxColumn] = getRenderedCursor(children);
33576
33528
  return /* @__PURE__ */ jsxRuntime.jsxs(GridContainer, { ...containerProps, className: `sticky-grid__container grid-outer ${props.className ?? ""}`, children: [
33577
33529
  /* @__PURE__ */ jsxRuntime.jsx(GridDataContainer, { $top: showHeader ? headerHeight : 0, $left: showRowNumber ? rowNumberWidth : 0, ref, children }),
33578
- showRowNumber && /* @__PURE__ */ jsxRuntime.jsx(RowNumberColumn, { scrolledHorizontal, minRow, maxRow, rowHeight, headerHeight, rowWidth: rowNumberWidth, rowCount, getSelectionType, showHeader, rowStart, showBorder, rowAutoHeight }),
33530
+ showRowNumber && /* @__PURE__ */ jsxRuntime.jsx(RowNumberColumn, { scrolledHorizontal, minRow, maxRow, rowHeight, headerHeight, rowWidth: rowNumberWidth, rowCount, getSelectionType, showHeader, rowStart, showBorder }),
33579
33531
  showHeader && /* @__PURE__ */ jsxRuntime.jsx(Header, { scrolledVertical, scrolledHorizontal, showRowNumber, minColumn, maxColumn, height: headerHeight, getColumnWidth: columnWidth, cell, rowNumberWidth, getSelectionType, columnCount, onColumnResize, getColumnHorizontalPosition, getResizerPosition, showBorder, resizingState })
33580
33532
  ] });
33581
33533
  });
@@ -33828,16 +33780,11 @@ var __publicField = (obj, key, value) => {
33828
33780
  const width = columnWidth(args.columnIndex);
33829
33781
  return /* @__PURE__ */ jsxRuntime.jsx(Cell, { ...args, width });
33830
33782
  };
33831
- React.useEffect(() => {
33832
- if (gridRef.current) {
33833
- gridRef.current.resetAfterRowIndex(0);
33834
- }
33835
- }, [rowCount, columnCount]);
33836
33783
  return /* @__PURE__ */ jsxRuntime.jsxs(ContextMenu, { modal: false, onOpenChange: setContextMenuOpen, children: [
33837
33784
  /* @__PURE__ */ jsxRuntime.jsx(ContextMenuTrigger, { as: ContextMenu.Trigger, ref: mergeRefs([forwardedRef, containerRef]), tabIndex: 0, onMouseDown, onMouseMove, onKeyDown, onPointerDown, onPointerUp, onPointerLeave: setPointerCapture, onPointerEnter: setPointerCapture, onContextMenu, $rounded: rounded, $height: autoHeight ? rowCount * rowHeight + (showHeader ? headerHeight : 0) + elementBorderRef.current.scrollBarHeight : void 0, $showBorder: showBorder, children: /* @__PURE__ */ jsxRuntime.jsx(AutoSizer, { onResize, children: ({
33838
33785
  height,
33839
33786
  width
33840
- }) => /* @__PURE__ */ jsxRuntime.jsx(VariableSizeGrid, { ref: forwardedGridRef ? mergeRefs([forwardedGridRef, gridRef]) : gridRef, height, width, columnCount, rowHeight: getRowHeight, useIsScrolling, innerElementType: InnerElementType, itemData: data, initialScrollTop: focus.row < rowStart ? focus.row * rowHeight : (focus.row - rowStart) * rowHeight, initialScrollLeft: getColumnHorizontalPosition(focus.column), columnWidth, rowCount, onScroll, outerRef, outerElementType: OuterElementType, onItemsRendered, ...props, children: CellWithWidth }) }) }),
33787
+ }) => /* @__PURE__ */ jsxRuntime.jsx(VariableSizeGrid, { ref: forwardedGridRef ? mergeRefs([forwardedGridRef, gridRef]) : gridRef, height, width, columnCount, rowHeight: () => rowHeight, useIsScrolling, innerElementType: InnerElementType, itemData: data, initialScrollTop: focus.row < rowStart ? focus.row * rowHeight : (focus.row - rowStart) * rowHeight, initialScrollLeft: getColumnHorizontalPosition(focus.column), columnWidth, rowCount, onScroll, outerRef, outerElementType: OuterElementType, onItemsRendered, ...props, children: CellWithWidth }) }) }),
33841
33788
  /* @__PURE__ */ jsxRuntime.jsx(ContextMenu.Content, { children: menuOptions.map((option, index2) => /* @__PURE__ */ jsxRuntime.jsx(ContextMenu.Item, { onSelect: option.onSelect, children: option.label }, `grid-${index2}`)) })
33842
33789
  ] });
33843
33790
  });
@@ -19,5 +19,5 @@ interface HeaderProps {
19
19
  scrolledHorizontal: boolean;
20
20
  resizingState: ResizingState;
21
21
  }
22
- declare const Header: ({ scrolledVertical, scrolledHorizontal, showRowNumber, rowNumberWidth, minColumn, maxColumn, height, getColumnWidth, cell, columnCount, getSelectionType, onColumnResize, getColumnHorizontalPosition, getResizerPosition, showBorder, resizingState, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
22
+ declare const Header: ({ scrolledVertical, scrolledHorizontal, showRowNumber, rowNumberWidth, minColumn, maxColumn, height, getColumnWidth, cell, columnCount, getSelectionType, onColumnResize, getColumnHorizontalPosition, getResizerPosition, showBorder, resizingState }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
23
23
  export default Header;
@@ -12,7 +12,6 @@ interface RowNumberColumnProps {
12
12
  scrolledHorizontal: boolean;
13
13
  rowStart: number;
14
14
  showBorder: boolean;
15
- rowAutoHeight?: boolean;
16
15
  }
17
- declare const RowNumberColumn: ({ minRow, maxRow, rowHeight, headerHeight, rowWidth, getSelectionType, rowCount, showHeader, scrolledHorizontal, rowStart, showBorder, rowAutoHeight, }: RowNumberColumnProps) => import("react/jsx-runtime").JSX.Element;
16
+ declare const RowNumberColumn: ({ minRow, maxRow, rowHeight, headerHeight, rowWidth, getSelectionType, rowCount, showHeader, scrolledHorizontal, rowStart, showBorder, }: RowNumberColumnProps) => import("react/jsx-runtime").JSX.Element;
18
17
  export default RowNumberColumn;
@@ -12,5 +12,4 @@ export declare const StyledCell: import('styled-components/dist/types').IStyledC
12
12
  $height: number;
13
13
  $type?: "body" | "header";
14
14
  $showBorder: boolean;
15
- $rowAutoHeight?: boolean;
16
15
  }>> & string;
@@ -107,9 +107,6 @@ export interface ItemDataType {
107
107
  headerHeight: number;
108
108
  rowNumberWidth: number;
109
109
  rowStart: number;
110
- rowAutoHeight?: boolean;
111
- updateRowHeight: (rowIndex: number, height: number) => void;
112
- getRowHeight: (index: number) => number;
113
110
  }
114
111
  export interface GridContextMenuItemProps extends Omit<ContextMenuItemProps, "children"> {
115
112
  label: ReactNode;
@@ -140,7 +137,6 @@ export interface GridProps extends Omit<VariableSizeGridProps, "height" | "width
140
137
  onCopyCallback?: (copied: boolean) => void;
141
138
  onContextMenu?: MouseEventHandler<HTMLDivElement>;
142
139
  forwardedGridRef?: MutableRefObject<VariableSizeGrid>;
143
- rowAutoHeight?: boolean;
144
140
  }
145
141
  export type ResizerPosition = {
146
142
  left: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.195",
3
+ "version": "0.0.196",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",