@oliasoft-open-source/react-ui-library 3.3.8 → 3.3.9
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 +12 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import * as PropTypes from "prop-types";
|
|
|
10
10
|
import PropTypes__default from "prop-types";
|
|
11
11
|
import { FaChevronRight, FaCheck, FaRegCircle, FaSync, FaFileImport, FaRegCopy, FaSortAmountUp, FaClone, FaStar, FaEyeSlash, FaEye, FaUndo, FaChevronDown, FaChevronUp, FaEdit, FaPencilAlt, FaPlus, FaMinus, FaTrash, FaTable, FaSortAmountDown, FaQuestion, FaTimes, FaChartLine, FaArrowUp, FaArrowRight, FaArrowLeft, FaArrowDown, FaAngleDown, FaAngleRight, FaEllipsisV, FaQuestionCircle, FaBook, FaGripLinesVertical, FaChevronLeft, FaInfoCircle, FaExclamationTriangle, FaExclamationCircle, FaCheckCircle, FaAngleDoubleLeft, FaAngleLeft, FaAngleDoubleRight, FaFastBackward, FaFastForward } from "react-icons/fa";
|
|
12
12
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import _$1, { isBoolean as isBoolean$1, isFunction as isFunction$1, isEmpty, isString, isNumber, isArray,
|
|
13
|
+
import _$1, { isBoolean as isBoolean$1, isFunction as isFunction$1, isEmpty, isString, isNumber, isArray, debounce, uniqWith, isEqual as isEqual$3, get as get$1 } from "lodash";
|
|
14
14
|
import ReactDOM, { createPortal, unstable_batchedUpdates, findDOMNode as findDOMNode$2, render } from "react-dom";
|
|
15
15
|
import { HiLockClosed, HiLockOpen } from "react-icons/hi";
|
|
16
16
|
import { GrDrag } from "react-icons/gr";
|
|
@@ -18768,30 +18768,27 @@ const List = ({
|
|
|
18768
18768
|
const listRowRefs = useRef([]);
|
|
18769
18769
|
const listContainerRef = useRef();
|
|
18770
18770
|
const MIN_ITEM_HEIGHT = 44;
|
|
18771
|
-
const
|
|
18772
|
-
const [
|
|
18773
|
-
const [
|
|
18774
|
-
const [hasMore, setHasMore] = useState(index2 < (list2 == null ? void 0 : list2.items.length));
|
|
18771
|
+
const pageSize = infiniteScroll ? Math.ceil(window.innerHeight / MIN_ITEM_HEIGHT) : list2.items.length;
|
|
18772
|
+
const [numVisibleRows, setNumVisibleRows] = useState(pageSize);
|
|
18773
|
+
const [hasMore, setHasMore] = useState(numVisibleRows < (list2 == null ? void 0 : list2.items.length));
|
|
18775
18774
|
useEffect(() => {
|
|
18776
18775
|
listRowRefs.current = listRowRefs.current.slice(0, list2.items.length);
|
|
18777
18776
|
}, [list2.items.length]);
|
|
18778
18777
|
const loadMoreItems = () => {
|
|
18779
|
-
if (
|
|
18778
|
+
if (numVisibleRows >= list2.items.length) {
|
|
18780
18779
|
setHasMore(false);
|
|
18781
18780
|
return;
|
|
18782
18781
|
}
|
|
18783
|
-
const
|
|
18784
|
-
|
|
18785
|
-
setIndex(newIndex);
|
|
18786
|
-
setItems(newItems);
|
|
18782
|
+
const newVisibleRows = pageSize + numVisibleRows;
|
|
18783
|
+
setNumVisibleRows(newVisibleRows);
|
|
18787
18784
|
};
|
|
18788
|
-
const findFirstActiveItemIndex = (
|
|
18785
|
+
const findFirstActiveItemIndex = (items) => items.findIndex((item2) => item2.active === true);
|
|
18789
18786
|
const setScrollToActiveItem = (activeItemIndex) => {
|
|
18790
18787
|
var _a, _b;
|
|
18791
18788
|
const itemBorderLength = 1;
|
|
18792
18789
|
if (triggerScrollToActiveItem && activeItemIndex >= 0) {
|
|
18793
|
-
const itemOffsets = listRowRefs.current.reduce((acc, val,
|
|
18794
|
-
if (
|
|
18790
|
+
const itemOffsets = listRowRefs.current.reduce((acc, val, index2) => {
|
|
18791
|
+
if (index2 < activeItemIndex) {
|
|
18795
18792
|
return acc + val.clientHeight + itemBorderLength;
|
|
18796
18793
|
}
|
|
18797
18794
|
return acc;
|
|
@@ -18850,13 +18847,13 @@ const List = ({
|
|
|
18850
18847
|
}), /* @__PURE__ */ jsx("div", {
|
|
18851
18848
|
className: cx(listStyles.list, bordered2 ? listStyles.bordered : ""),
|
|
18852
18849
|
children: infiniteScroll ? /* @__PURE__ */ jsx(InfiniteScroll, {
|
|
18853
|
-
dataLength:
|
|
18850
|
+
dataLength: numVisibleRows,
|
|
18854
18851
|
next: loadMoreItems,
|
|
18855
18852
|
hasMore,
|
|
18856
18853
|
scrollableTarget: infiniteScrollTarget || "scrollableDiv",
|
|
18857
18854
|
children: /* @__PURE__ */ jsx(ListRow, {
|
|
18858
18855
|
draggable: draggable2,
|
|
18859
|
-
items,
|
|
18856
|
+
items: list2.items.slice(0, numVisibleRows),
|
|
18860
18857
|
expanding,
|
|
18861
18858
|
invokeEditOnRowClick,
|
|
18862
18859
|
onListReorder,
|
package/package.json
CHANGED