ar-design 0.1.89 → 0.1.90

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.
@@ -8,7 +8,6 @@ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef,
8
8
  import Actions from "./Actions";
9
9
  const TableWithRef = forwardRef(({ children, title, description, data, columns, actions, selections, searchedParams, pagination, config = { isSearchable: false }, }, ref) => {
10
10
  // refs
11
- let _dataLength = useRef(0);
12
11
  const _tableWrapper = useRef(null);
13
12
  const _table = useRef(null);
14
13
  const _tableContent = useRef(null);
@@ -22,6 +21,7 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
22
21
  const [selectionItems, setSelectionItems] = useState([]);
23
22
  const [searchedText, setSearchedText] = useState(undefined);
24
23
  const [_searchedParams, setSearchedParams] = useState(undefined);
24
+ // const [totalRecords, setTotalRecords] = useState<number>(0);
25
25
  const [currentPage, setCurrentPage] = useState(1);
26
26
  if (config && Object.keys(config.scroll || {}).length > 0) {
27
27
  if (_tableContent.current && config.scroll) {
@@ -132,14 +132,13 @@ const TableWithRef = forwardRef(({ children, title, description, data, columns,
132
132
  };
133
133
  const getData = useCallback(() => {
134
134
  let _data = [...data];
135
- _dataLength.current = data.length;
135
+ if (searchedText)
136
+ _data = _data.filter((item) => deepSearch(item, searchedText));
136
137
  if (pagination && !config.isServerSide) {
137
138
  const indexOfLastRow = currentPage * pagination.perPage;
138
139
  const indexOfFirstRow = indexOfLastRow - pagination.perPage;
139
- _data = data.slice(indexOfFirstRow, indexOfLastRow);
140
+ _data = _data.slice(indexOfFirstRow, indexOfLastRow);
140
141
  }
141
- if (searchedText)
142
- _data = _data.filter((item) => deepSearch(item, searchedText));
143
142
  return _data;
144
143
  }, [data, searchedText, currentPage]);
145
144
  // useEffects
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.1.89",
3
+ "version": "0.1.90",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",