qbs-react-grid 1.1.17 → 1.1.19

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/es/Table.js CHANGED
@@ -8,7 +8,7 @@ import debounce from 'lodash/debounce';
8
8
  import flatten from 'lodash/flatten';
9
9
  import isFunction from 'lodash/isFunction';
10
10
  import PropTypes from 'prop-types';
11
- import React, { useCallback, useImperativeHandle, useReducer, useRef, useState } from 'react';
11
+ import React, { useCallback, useImperativeHandle, useReducer, useRef, useState, useEffect } from 'react';
12
12
  import CellGroup from './CellGroup';
13
13
  import { CELL_PADDING_HEIGHT, EXPANDED_KEY, ROW_HEADER_HEIGHT, ROW_HEIGHT, SCROLLBAR_WIDTH, SORT_TYPE, TREE_DEPTH } from './constants';
14
14
  import EmptyMessage from './EmptyMessage';
@@ -617,6 +617,9 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
617
617
  var _useState2 = useState(Array(data === null || data === void 0 ? void 0 : data.length).fill(1)),
618
618
  rowZIndices = _useState2[0],
619
619
  setRowZIndices = _useState2[1];
620
+ useEffect(function () {
621
+ if ((data === null || data === void 0 ? void 0 : data.length) > 0) setRowZIndices(Array(data === null || data === void 0 ? void 0 : data.length).fill(1));
622
+ }, [data]);
620
623
  var handleParentCallBack = function handleParentCallBack(index) {
621
624
  setRowZIndices(function (currentZIndices) {
622
625
  return currentZIndices.map(function (_, idx) {
@@ -728,7 +731,10 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
728
731
  width: rowWidth,
729
732
  height: _nextRowHeight,
730
733
  cellHeight: _nextRowHeight,
731
- index: _index
734
+ index: _index,
735
+ dataLength: data === null || data === void 0 ? void 0 : data.length,
736
+ handleParentCallBack: handleParentCallBack,
737
+ zIndexValue: rowZIndices[_index]
732
738
  };
733
739
  visibleRows.current.push(renderRowData(bodyCells, _rowData2, _rowProps, false));
734
740
  }
File without changes
File without changes
package/lib/Table.js CHANGED
@@ -624,6 +624,9 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
624
624
  var _useState2 = (0, _react.useState)(Array(data === null || data === void 0 ? void 0 : data.length).fill(1)),
625
625
  rowZIndices = _useState2[0],
626
626
  setRowZIndices = _useState2[1];
627
+ (0, _react.useEffect)(function () {
628
+ if ((data === null || data === void 0 ? void 0 : data.length) > 0) setRowZIndices(Array(data === null || data === void 0 ? void 0 : data.length).fill(1));
629
+ }, [data]);
627
630
  var handleParentCallBack = function handleParentCallBack(index) {
628
631
  setRowZIndices(function (currentZIndices) {
629
632
  return currentZIndices.map(function (_, idx) {
@@ -735,7 +738,10 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
735
738
  width: rowWidth,
736
739
  height: _nextRowHeight,
737
740
  cellHeight: _nextRowHeight,
738
- index: _index
741
+ index: _index,
742
+ dataLength: data === null || data === void 0 ? void 0 : data.length,
743
+ handleParentCallBack: handleParentCallBack,
744
+ zIndexValue: rowZIndices[_index]
739
745
  };
740
746
  visibleRows.current.push(renderRowData(bodyCells, _rowData2, _rowProps, false));
741
747
  }
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qbs-react-grid",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "description": "A React table component",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
package/src/Row.tsx CHANGED
@@ -49,7 +49,6 @@ const Row = React.forwardRef((props: RowProps, ref: React.Ref<HTMLDivElement>) =
49
49
  };
50
50
  const INDEX = index as number;
51
51
  translateDOMPositionXY?.(styles as CSSStyleDeclaration, 0, top);
52
-
53
52
  return (
54
53
  <div
55
54
  role="row"
package/src/Table.tsx CHANGED
@@ -3,7 +3,14 @@ import debounce from 'lodash/debounce';
3
3
  import flatten from 'lodash/flatten';
4
4
  import isFunction from 'lodash/isFunction';
5
5
  import PropTypes from 'prop-types';
6
- import React, { useCallback, useImperativeHandle, useReducer, useRef, useState } from 'react';
6
+ import React, {
7
+ useCallback,
8
+ useImperativeHandle,
9
+ useReducer,
10
+ useRef,
11
+ useState,
12
+ useEffect
13
+ } from 'react';
7
14
 
8
15
  import CellGroup from './CellGroup';
9
16
  import {
@@ -945,7 +952,9 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
945
952
  return scrollbars;
946
953
  };
947
954
  const [rowZIndices, setRowZIndices] = useState(Array(data?.length).fill(1));
948
-
955
+ useEffect(() => {
956
+ if (data?.length > 0) setRowZIndices(Array(data?.length).fill(1));
957
+ }, [data]);
949
958
  const handleParentCallBack = (index: number) => {
950
959
  setRowZIndices(currentZIndices => currentZIndices.map((_, idx) => (idx === index ? 10 : 1)));
951
960
  };
@@ -1072,7 +1081,10 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
1072
1081
  width: rowWidth,
1073
1082
  height: nextRowHeight,
1074
1083
  cellHeight: nextRowHeight,
1075
- index: index
1084
+ index: index,
1085
+ dataLength: data?.length,
1086
+ handleParentCallBack: handleParentCallBack,
1087
+ zIndexValue: rowZIndices[index]
1076
1088
  };
1077
1089
  visibleRows.current.push(renderRowData(bodyCells, rowData, rowProps, false));
1078
1090
  }
File without changes