@uxf/data-grid 11.112.0 → 11.113.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/data-grid.js CHANGED
@@ -32,7 +32,7 @@ function DataGrid(props) {
32
32
  react_1.default.createElement(toolbar_customs_1.DataGridToolbarCustoms, { buttons: props.customActions })),
33
33
  react_1.default.createElement(linear_progress_1.DataGridLinearProgress, { isLoading: props.isLoading }),
34
34
  react_1.default.createElement(filter_list_1.DataGridFilterList, { actions: props.actions, filterHandlers: (_c = props.filterHandlers) !== null && _c !== void 0 ? _c : filter_handler_1.defaultFilterHandlers, schema: props.schema, state: props.state }),
35
- react_1.default.createElement(table_v2_1.DataGridTableV2, { NoRowsFallback: props.NoRowsFallback, actionCell: props.actionCell, actions: props.actions, bodyCells: (_d = props.bodyCells) !== null && _d !== void 0 ? _d : body_cell_1.BodyCells, data: (_f = (_e = props.data) === null || _e === void 0 ? void 0 : _e.result) !== null && _f !== void 0 ? _f : empty_array_1.EMPTY_ARRAY, error: props.error, hasStickyHeader: props.hasStickyHeader, headerRowHeight: props.headerRowHeight, isLoading: props.isLoading, isRowSelectDisabled: props.isRowSelectDisabled, isRowsSelectable: props.isRowsSelectable, keyExtractor: props.keyExtractor, reload: props.reload, rowAccent: props.rowAccent, rowClassName: props.rowClassName, rowHeight: props.rowHeight, schema: props.schema, state: props.state }),
35
+ react_1.default.createElement(table_v2_1.DataGridTableV2, { NoRowsFallback: props.NoRowsFallback, actionCell: props.actionCell, actions: props.actions, bodyCells: (_d = props.bodyCells) !== null && _d !== void 0 ? _d : body_cell_1.BodyCells, data: (_f = (_e = props.data) === null || _e === void 0 ? void 0 : _e.result) !== null && _f !== void 0 ? _f : empty_array_1.EMPTY_ARRAY, error: props.error, hasStickyHeader: props.hasStickyHeader, isLoading: props.isLoading, isRowSelectDisabled: props.isRowSelectDisabled, isRowsSelectable: props.isRowsSelectable, keyExtractor: props.keyExtractor, reload: props.reload, rowAccent: props.rowAccent, rowClassName: props.rowClassName, rowHeight: props.rowHeight, schema: props.schema, state: props.state }),
36
36
  react_1.default.createElement(footer_1.DataGridFooter, null,
37
37
  react_1.default.createElement(rows_per_page_select_1.DataGridRowsPerPageSelect, { actions: props.actions, state: props.state }),
38
38
  react_1.default.createElement(row_counts_1.DataGridRowCounts, { count: (_h = (_g = props.data) === null || _g === void 0 ? void 0 : _g.count) !== null && _h !== void 0 ? _h : 0, state: props.state, totalCount: (_k = (_j = props.data) === null || _j === void 0 ? void 0 : _j.totalCount) !== null && _k !== void 0 ? _k : 0 }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/data-grid",
3
- "version": "11.112.0",
3
+ "version": "11.113.0",
4
4
  "description": "UXF DataGrid",
5
5
  "homepage": "https://gitlab.com/uxf-npm/data-grid#readme",
6
6
  "main": "index.js",
@@ -45,7 +45,7 @@
45
45
  "@uxf/core-react": "11.111.2",
46
46
  "@uxf/localize": "11.111.2",
47
47
  "@uxf/styles": "11.111.2",
48
- "@uxf/ui": "11.112.0",
48
+ "@uxf/ui": "11.113.0",
49
49
  "dayjs": "^1.11.19",
50
50
  "react": ">=18.2.0",
51
51
  "react-dom": ">=18.2.0"
@@ -60,7 +60,7 @@
60
60
  "@uxf/core-react": "11.111.2",
61
61
  "@uxf/localize": "11.111.2",
62
62
  "@uxf/styles": "11.111.2",
63
- "@uxf/ui": "11.112.0",
63
+ "@uxf/ui": "11.113.0",
64
64
  "dayjs": "^1.11.19",
65
65
  "react": "18.3.1",
66
66
  "react-dom": "18.3.1"
@@ -2,7 +2,7 @@ import { Nullish } from "@uxf/core/types";
2
2
  import { BaseGridType, Column } from "../../types";
3
3
  import { DataGridControl } from "../../use-data-grid-control";
4
4
  import { DataGridTableProps } from "../types";
5
- export declare function useResizableColumns<GridType extends BaseGridType>(columns: Column[], actionCell: DataGridTableProps<GridType>["actionCell"], actions: DataGridControl["actions"], selectRowsCellWidth: number | Nullish): {
5
+ export declare function useResizableColumns<GridType extends BaseGridType>(columns: Column[], actionCell: DataGridTableProps<GridType>["actionCell"], actions: DataGridControl["actions"], selectRowsCellWidth: number | Nullish, hasStickyHeader: boolean): {
6
6
  tableRef: import("react").RefObject<HTMLDivElement>;
7
7
  headerRef: import("react").RefObject<HTMLDivElement>;
8
8
  bodyRef: import("react").RefObject<HTMLDivElement>;
@@ -7,7 +7,7 @@ const react_1 = require("react");
7
7
  const get_grid_template_columns_1 = require("../utils/get-grid-template-columns");
8
8
  const COLUMN_ABSOLUTE_MIN_WIDTH = 50;
9
9
  const COLUMN_PADDING = 24;
10
- function useResizableColumns(columns, actionCell, actions, selectRowsCellWidth) {
10
+ function useResizableColumns(columns, actionCell, actions, selectRowsCellWidth, hasStickyHeader) {
11
11
  const [activeIndex, setActiveIndex] = (0, react_1.useState)(null);
12
12
  const tableRef = (0, react_1.useRef)(null);
13
13
  const headerRef = (0, react_1.useRef)(null);
@@ -23,7 +23,7 @@ function useResizableColumns(columns, actionCell, actions, selectRowsCellWidth)
23
23
  const columnMinWidth = (_b = (_a = column.config) === null || _a === void 0 ? void 0 : _a.minWidth) !== null && _b !== void 0 ? _b : COLUMN_ABSOLUTE_MIN_WIDTH;
24
24
  if (i === activeIndex) {
25
25
  const tableScrollLeft = (_d = (_c = headerRef.current) === null || _c === void 0 ? void 0 : _c.scrollLeft) !== null && _d !== void 0 ? _d : 0;
26
- const columnOffsetLeft = ((_e = columnRef === null || columnRef === void 0 ? void 0 : columnRef.offsetLeft) !== null && _e !== void 0 ? _e : 0) + ((_g = (_f = tableRef.current) === null || _f === void 0 ? void 0 : _f.offsetLeft) !== null && _g !== void 0 ? _g : 0);
26
+ const columnOffsetLeft = ((_e = columnRef === null || columnRef === void 0 ? void 0 : columnRef.offsetLeft) !== null && _e !== void 0 ? _e : 0) + (hasStickyHeader ? ((_g = (_f = tableRef.current) === null || _f === void 0 ? void 0 : _f.offsetLeft) !== null && _g !== void 0 ? _g : 0) : 0);
27
27
  const clickPositionX = e.clientX + tableScrollLeft;
28
28
  const width = clickPositionX - columnOffsetLeft;
29
29
  return width >= columnMinWidth ? width : columnMinWidth;
@@ -71,7 +71,7 @@ function useResizableColumns(columns, actionCell, actions, selectRowsCellWidth)
71
71
  window.removeEventListener("mousemove", onMouseMove);
72
72
  window.removeEventListener("mouseup", onMouseUp);
73
73
  };
74
- }, [columns, actions, actionCellWidth, activeIndex, selectRowsCellWidth]);
74
+ }, [columns, actions, actionCellWidth, activeIndex, selectRowsCellWidth, hasStickyHeader]);
75
75
  const onAutoSize = (index) => {
76
76
  var _a, _b;
77
77
  const table = tableRef.current;
@@ -35,8 +35,8 @@ function DataGridTableV2(props) {
35
35
  props.state.userConfig.columnsOrder.indexOf(b.name)
36
36
  : 0);
37
37
  const selectedRowColumnWidth = props.isRowsSelectable ? SELECT_ROWS_CELL_WIDTH : null;
38
- const { tableRef, headerRef, bodyRef, columnRefs, onResizeStart, onAutoSize } = (0, use_resizable_columns_1.useResizableColumns)(visibleColumns, props.actionCell, props.actions, selectedRowColumnWidth);
39
- const gridTemplateRows = (0, get_grid_template_rows_1.getGridTemplateRows)(props.data, (_b = props.headerRowHeight) !== null && _b !== void 0 ? _b : 36, (_c = props.rowHeight) !== null && _c !== void 0 ? _c : 44);
38
+ const { tableRef, headerRef, bodyRef, columnRefs, onResizeStart, onAutoSize } = (0, use_resizable_columns_1.useResizableColumns)(visibleColumns, props.actionCell, props.actions, selectedRowColumnWidth, (_b = props.hasStickyHeader) !== null && _b !== void 0 ? _b : false);
39
+ const gridTemplateRows = (0, get_grid_template_rows_1.getGridTemplateRows)(props.data, (_c = props.rowHeight) !== null && _c !== void 0 ? _c : 44);
40
40
  const gridTemplateBasicColumns = visibleColumns
41
41
  .map((column) => {
42
42
  var _a;
@@ -9,7 +9,6 @@ export interface DataGridTableProps<GridType extends BaseGridType> extends DataG
9
9
  error?: unknown | Nullish;
10
10
  reload: () => Promise<any>;
11
11
  rowHeight?: number | ((row: InferDataGridRow<Schema<GridType>>) => number) | "auto";
12
- headerRowHeight?: number;
13
12
  rowAccent?: (row: InferDataGridRow<Schema<GridType>>) => RowAccent;
14
13
  rowClassName?: (row: InferDataGridRow<Schema<GridType>>) => string | Nullish;
15
14
  keyExtractor?: KeyExtractor;
@@ -1,3 +1,3 @@
1
1
  import { BaseGridType } from "../../types";
2
2
  import { DataGridTableProps } from "../types";
3
- export declare function getGridTemplateRows<GridType extends BaseGridType>(rows: any[], headerRowHeight: number, rowHeight: DataGridTableProps<GridType>["rowHeight"]): string | undefined;
3
+ export declare function getGridTemplateRows<GridType extends BaseGridType>(rows: any[], rowHeight: DataGridTableProps<GridType>["rowHeight"]): string | undefined;
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getGridTemplateRows = getGridTemplateRows;
4
4
  const is_nil_1 = require("@uxf/core/utils/is-nil");
5
5
  const rem_1 = require("@uxf/styles/units/rem");
6
- function getGridTemplateRows(rows, headerRowHeight, rowHeight) {
6
+ function getGridTemplateRows(rows, rowHeight) {
7
7
  if (rowHeight === "auto" || (0, is_nil_1.isNil)(rowHeight)) {
8
8
  return undefined;
9
9
  }
10
10
  if (typeof rowHeight === "number") {
11
- return `${(0, rem_1.rem)(headerRowHeight)} repeat(${rows.length}, ${(0, rem_1.rem)(rowHeight)})`;
11
+ return `repeat(${rows.length}, ${(0, rem_1.rem)(rowHeight)})`;
12
12
  }
13
- return `${headerRowHeight} ${rows.map(rowHeight).join(" ")}`;
13
+ return `${rows.map(rowHeight).join(" ")}`;
14
14
  }
@@ -30,7 +30,6 @@ export type DataGridBaseProps<GridType extends BaseGridType> = {
30
30
  getCsvDownloadUrl?: CsvDownloadGetUrl;
31
31
  gridName?: string;
32
32
  hasStickyHeader?: boolean;
33
- headerRowHeight?: number;
34
33
  isDebug?: boolean;
35
34
  isHiddenColumnsSortable?: boolean;
36
35
  isRowSelectDisabled?: (row: InferDataGridRow<Schema<GridType>>) => boolean;