@aloudata/aloudata-design 2.10.4 → 2.10.5

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.
@@ -94,7 +94,8 @@ var DataPreviewTable = /*#__PURE__*/forwardRef(function (props, ref) {
94
94
  }, /*#__PURE__*/React.createElement("div", {
95
95
  style: {
96
96
  height: dataStatus === 'pending' ? skeletonRows * CELL_HEIGHT + realHeaderHeight : contentHeight,
97
- position: 'relative'
97
+ position: 'relative',
98
+ width: 'fit-content'
98
99
  }
99
100
  }, /*#__PURE__*/React.createElement("div", {
100
101
  className: "ald-data-preview-sticky"
@@ -11,5 +11,7 @@ interface IMemberSelectionProps {
11
11
  width: number;
12
12
  lockedIds: Array<TUserValue | TUserGroupValue>;
13
13
  }
14
+ export declare const OPTION_HEIGHT = 36;
15
+ export declare const WRAPPER_HEIGHT = 300;
14
16
  export default function MemberSelection(props: IMemberSelectionProps): React.JSX.Element;
15
17
  export {};
@@ -4,18 +4,20 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { useVirtualizer } from '@tanstack/react-virtual';
7
8
  import classNames from 'classnames';
8
9
  import _ from 'lodash';
9
10
  import React, { useDeferredValue, useEffect, useState } from 'react';
10
11
  import Empty from "../../Empty";
11
12
  import { SearchLine } from "../../Icon";
12
13
  import Input from "../../Input";
13
- import ScrollArea from "../../ScrollArea";
14
14
  import Spin from "../../Spin";
15
15
  import { isUser } from "../utils/getUsersWithUserId";
16
16
  import MultipleOption from "./MultipleOption";
17
17
  import { userDisplayNameIsRepeated } from "./Panel";
18
18
  import SingleOption from "./SingleOption";
19
+ export var OPTION_HEIGHT = 36;
20
+ export var WRAPPER_HEIGHT = 300;
19
21
  export default function MemberSelection(props) {
20
22
  var className = props.className,
21
23
  userList = props.userList,
@@ -26,6 +28,18 @@ export default function MemberSelection(props) {
26
28
  loading = props.loading,
27
29
  width = props.width,
28
30
  lockedIds = props.lockedIds;
31
+ var parentRef = React.useRef(null);
32
+
33
+ // The virtualizer
34
+ var rowVirtualizer = useVirtualizer({
35
+ count: userList.length,
36
+ getScrollElement: function getScrollElement() {
37
+ return parentRef.current;
38
+ },
39
+ estimateSize: function estimateSize() {
40
+ return OPTION_HEIGHT;
41
+ }
42
+ });
29
43
  var _useState = useState(''),
30
44
  _useState2 = _slicedToArray(_useState, 2),
31
45
  searchValue = _useState2[0],
@@ -59,18 +73,27 @@ export default function MemberSelection(props) {
59
73
  spinning: loading,
60
74
  size: "small",
61
75
  className: "ald-member-picker-user-list"
62
- }, /*#__PURE__*/React.createElement(ScrollArea, {
76
+ }, /*#__PURE__*/React.createElement("div", {
77
+ ref: parentRef,
78
+ style: {
79
+ height: WRAPPER_HEIGHT,
80
+ overflowY: 'auto',
81
+ overflowX: 'hidden'
82
+ },
63
83
  className: classNames('ald-member-picker-member-list', {
64
84
  'ald-member-picker-member-list-null': userList.length === 0 && !loading
65
- }),
66
- innerClassName: "ald-member-picker-member-scroll"
85
+ })
86
+ // innerClassName="ald-member-picker-member-scroll"
67
87
  }, /*#__PURE__*/React.createElement("div", {
68
88
  className: "ald-member-picker-member-list-inner",
69
89
  style: {
70
90
  width: multiple ? width : undefined,
71
- overflow: 'hidden'
91
+ overflow: 'hidden',
92
+ position: 'relative',
93
+ height: "".concat(rowVirtualizer.getTotalSize(), "px")
72
94
  }
73
- }, userList.map(function (user) {
95
+ }, rowVirtualizer.getVirtualItems().map(function (virtualItem) {
96
+ var user = userList[virtualItem.index];
74
97
  var isSelected = selectedUsers.some(function (selectedUser) {
75
98
  return selectedUser.userId === user.userId;
76
99
  });
@@ -79,7 +102,17 @@ export default function MemberSelection(props) {
79
102
  type: user.type
80
103
  });
81
104
  var disabled = index !== -1;
82
- return multiple ? /*#__PURE__*/React.createElement(MultipleOption, {
105
+ return /*#__PURE__*/React.createElement("div", {
106
+ key: virtualItem.key,
107
+ style: {
108
+ position: 'absolute',
109
+ top: 0,
110
+ left: 0,
111
+ width: '100%',
112
+ height: "".concat(virtualItem.size, "px"),
113
+ transform: "translateY(".concat(virtualItem.start, "px)")
114
+ }
115
+ }, multiple ? /*#__PURE__*/React.createElement(MultipleOption, {
83
116
  key: user.userId,
84
117
  user: user,
85
118
  disabled: disabled,
@@ -96,6 +129,6 @@ export default function MemberSelection(props) {
96
129
  onChange: function onChange(selected, user) {
97
130
  if (isUser(user)) _onChange(selected, user);
98
131
  }
99
- });
132
+ }));
100
133
  })))));
101
134
  }
@@ -51,7 +51,7 @@
51
51
  display: flex;
52
52
  align-items: center;
53
53
  flex-direction: row-reverse;
54
- justify-content: start;
54
+ justify-content: flex-start;
55
55
  }
56
56
  }
57
57
  }
@@ -20,7 +20,7 @@
20
20
  display: inline-flex;
21
21
  gap: 4px;
22
22
  align-items: center;
23
- justify-content: start;
23
+ justify-content: flex-start;
24
24
  height: 20px;
25
25
  padding: 0;
26
26
  cursor: pointer;
@@ -21,7 +21,7 @@ export declare function getTableColumns<TDataItem extends object>({ columns, tot
21
21
  render?: ((text: any, record: TDataItem, rowIndex: number) => import("react").ReactNode) | undefined;
22
22
  ellipsis?: boolean | undefined;
23
23
  noPadding?: boolean | undefined;
24
- align?: "left" | "center" | "right" | undefined;
24
+ align?: "center" | "left" | "right" | undefined;
25
25
  fixed?: "left" | "right" | undefined;
26
26
  sortOrder?: "ascend" | "descend" | null | undefined;
27
27
  };