@topconsultnpm/sdkui-react-beta 6.6.75 → 6.6.76

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.
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  interface ListProps<T> {
2
3
  dataSource?: T[];
3
4
  selectedItem?: T;
@@ -13,7 +14,9 @@ interface ListProps<T> {
13
14
  orderBy?: string;
14
15
  grouping?: string;
15
16
  showId?: boolean;
17
+ setShowId?: React.Dispatch<React.SetStateAction<boolean>>;
16
18
  showSearch?: boolean;
19
+ setShowSearch?: React.Dispatch<React.SetStateAction<boolean>>;
17
20
  onScrollChange?: (e: {
18
21
  x: number;
19
22
  y: number;
@@ -23,5 +26,5 @@ interface ListProps<T> {
23
26
  onItemDblClick?: (item: T) => void;
24
27
  itemTemplate?: (item: T) => JSX.Element;
25
28
  }
26
- declare const TMListView: <T>({ showId, showSearch, grouping, orderBy, id, onScrollChange, scroll, searchKeys, searchable, itemTemplate, customColor, dataSource, exprKey, onSelectionChanged, onItemClick, onItemDblClick, selectedItem }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
29
+ declare const TMListView: <T>({ showId, setShowId, showSearch, setShowSearch, grouping, orderBy, id, onScrollChange, scroll, searchKeys, searchable, itemTemplate, customColor, dataSource, exprKey, onSelectionChanged, onItemClick, onItemDblClick, selectedItem }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
27
30
  export default TMListView;
@@ -11,7 +11,7 @@ const StyledListItem = styled.div ` width: 100%; height: max-content; border-bot
11
11
  const StyledListViewContainer = styled.div ` position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; width: 100%; height: 100%; `;
12
12
  const StyledSearchContainer = styled.div ` width: 100%; height: max-content; padding: 5px; border-bottom: 1px solid #e5e5e5; display: flex; align-items: center; gap: 10px; `;
13
13
  const StyledListViewFooter = styled.div ` background-color: ${props => props.$bgColor}; width: 100%; height: 25px; padding: 5px 15px; border-top: 1px solid #e5e5e5; display: flex; align-items: center; gap: 10px; `;
14
- const TMListView = ({ showId, showSearch, grouping = '', orderBy, id, onScrollChange, scroll, searchKeys = [], searchable = false, itemTemplate, customColor, dataSource = [], exprKey = 'id', onSelectionChanged, onItemClick, onItemDblClick, selectedItem }) => {
14
+ const TMListView = ({ showId, setShowId, showSearch, setShowSearch, grouping = '', orderBy, id, onScrollChange, scroll, searchKeys = [], searchable = false, itemTemplate, customColor, dataSource = [], exprKey = 'id', onSelectionChanged, onItemClick, onItemDblClick, selectedItem }) => {
15
15
  const listRef = useRef(null);
16
16
  const contRef = useRef(null);
17
17
  const orderRef = useRef(null);
@@ -264,15 +264,25 @@ const TMListView = ({ showId, showSearch, grouping = '', orderBy, id, onScrollCh
264
264
  return '100%';
265
265
  };
266
266
  useEffect(() => {
267
- if (showId === undefined)
267
+ if (showId === undefined || showId === localShowId)
268
268
  return;
269
269
  setLocalShowId(showId);
270
270
  }, [showId]);
271
271
  useEffect(() => {
272
- if (showSearch === undefined)
272
+ if (showSearch === undefined || showSearch === localShowSearch)
273
273
  return;
274
274
  setLocalShowSearch(showSearch);
275
275
  }, [showSearch]);
276
+ useEffect(() => {
277
+ if (showId === undefined || setShowId === undefined || showId === localShowId)
278
+ return;
279
+ setShowId(localShowId);
280
+ }, [localShowId]);
281
+ useEffect(() => {
282
+ if (showSearch === undefined || setShowSearch === undefined || showSearch === localShowSearch)
283
+ return;
284
+ setShowSearch(localShowSearch);
285
+ }, [localShowSearch]);
276
286
  const generateContextMenuItems = (localShowSearch, localShowId, showOrderMenu, grouping, searchKeys) => {
277
287
  const items = [];
278
288
  // Add search menu item only if showSearch prop is undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.6.75",
3
+ "version": "6.6.76",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",