@topconsultnpm/sdkui-react-beta 6.6.7 → 6.6.8

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.
@@ -3,7 +3,6 @@ export { default as TMButton, TMButtonNew } from './base/TMButton';
3
3
  export { default as TMClosableList } from './base/TMClosableList';
4
4
  export * from './base/TMContextMenu';
5
5
  export { default as TMDropDownMenu } from './base/TMDropDownMenu';
6
- export { default as TMListViewOLD } from './base/TMListViewOLD';
7
6
  export { default as TMListView } from './base/TMListView';
8
7
  export { default as TMList } from './base/TMList';
9
8
  export { default as TMModal } from './base/TMModal';
@@ -5,7 +5,6 @@ export { default as TMButton, TMButtonNew } from './base/TMButton';
5
5
  export { default as TMClosableList } from './base/TMClosableList';
6
6
  export * from './base/TMContextMenu';
7
7
  export { default as TMDropDownMenu } from './base/TMDropDownMenu';
8
- export { default as TMListViewOLD } from './base/TMListViewOLD';
9
8
  export { default as TMListView } from './base/TMListView';
10
9
  export { default as TMList } from './base/TMList';
11
10
  export { default as TMModal } from './base/TMModal';
@@ -181,8 +181,10 @@ declare function IconLayerGroup(props: Readonly<React.SVGProps<SVGSVGElement>>):
181
181
  declare function IconTree(props: Readonly<React.SVGProps<SVGSVGElement>>): import("react/jsx-runtime").JSX.Element;
182
182
  declare function IconGrid(props: Readonly<React.SVGProps<SVGSVGElement>>): import("react/jsx-runtime").JSX.Element;
183
183
  declare function IconList(props: Readonly<React.SVGProps<SVGSVGElement>>): import("react/jsx-runtime").JSX.Element;
184
- declare function IconLock(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
184
+ declare function IconLock(props: Readonly<React.SVGProps<SVGSVGElement>>): import("react/jsx-runtime").JSX.Element;
185
185
  declare function IconLockClosed(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
186
186
  declare function IconBxLock(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
187
- export { Icon123, IconABC, IconAccessPoint, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBoard, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFolderSearch, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMaximize, IconMinimize, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMonitor, IconOpenInNew, IconNotification, IconNotificationFill, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconSortAscLetters, IconSortDescLetters, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup };
187
+ declare function IconFolder(props: Readonly<React.SVGProps<SVGSVGElement>>): import("react/jsx-runtime").JSX.Element;
188
+ declare function IconFolderOpen(props: Readonly<React.SVGProps<SVGSVGElement>>): import("react/jsx-runtime").JSX.Element;
189
+ export { Icon123, IconABC, IconAccessPoint, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBoard, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFolderSearch, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMaximize, IconMinimize, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMonitor, IconOpenInNew, IconNotification, IconNotificationFill, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFolder, IconFolderOpen, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconSortAscLetters, IconSortDescLetters, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup };
188
190
  /** https://reactsvgicons.com */
@@ -513,4 +513,10 @@ function IconList(props) { return (_jsxs("svg", { fontSize: props.fontSize ? pro
513
513
  function IconLock(props) { return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 448 512", fill: "currentColor", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M144 144v48h160v-48c0-44.2-35.8-80-80-80s-80 35.8-80 80zm-64 48v-48C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64v192c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64h16z" }), " "] })); }
514
514
  function IconLockClosed(props) { return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 24 24", fill: "currentColor", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M7 10V7a5 5 0 1110 0v3h2a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2v-8c0-1.1.9-2 2-2h2zm2 0h6V7a3 3 0 00-6 0v3zm-4 2v8h14v-8H5zm7 2a1 1 0 011 1v2a1 1 0 01-2 0v-2a1 1 0 011-1z" }), " "] })); }
515
515
  function IconBxLock(props) { return (_jsxs("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 24 24", fill: "currentColor", height: "1em", width: "1em", ...props, children: [" ", _jsx("path", { d: "M12 2C9.243 2 7 4.243 7 7v2H6c-1.103 0-2 .897-2 2v9c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2v-9c0-1.103-.897-2-2-2h-1V7c0-2.757-2.243-5-5-5zM9 7c0-1.654 1.346-3 3-3s3 1.346 3 3v2H9V7zm9.002 13H13v-2.278c.595-.347 1-.985 1-1.722 0-1.103-.897-2-2-2s-2 .897-2 2c0 .736.405 1.375 1 1.722V20H6v-9h12l.002 9z" }), " "] })); }
516
- export { Icon123, IconABC, IconAccessPoint, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBoard, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFolderSearch, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMaximize, IconMinimize, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMonitor, IconOpenInNew, IconNotification, IconNotificationFill, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconSortAscLetters, IconSortDescLetters, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup };
516
+ function IconFolder(props) {
517
+ return (_jsx("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 1024 1024", fill: "currentColor", height: "1em", width: "1em", ...props, children: _jsx("path", { d: "M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32z" }) }));
518
+ }
519
+ function IconFolderOpen(props) {
520
+ return (_jsx("svg", { fontSize: props.fontSize ? props.fontSize : FONTSIZE, viewBox: "0 0 1024 1024", fill: "currentColor", height: "1em", width: "1em", ...props, children: _jsx("path", { d: "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zm-180 0H238c-13 0-24.8 7.9-29.7 20L136 643.2V256h188.5l119.6 114.4H748V444z" }) }));
521
+ }
522
+ export { Icon123, IconABC, IconAccessPoint, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBoard, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFolderSearch, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMaximize, IconMinimize, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMonitor, IconOpenInNew, IconNotification, IconNotificationFill, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFolder, IconFolderOpen, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconSortAscLetters, IconSortDescLetters, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.6.7",
3
+ "version": "6.6.8",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import { ITMEditorBase, Colors as C } from './TMEditorBase';
3
- type SelectedValueType = {
4
- fieldName: string;
5
- fieldValues: any[];
6
- };
7
- interface ITMListView extends ITMEditorBase {
8
- dataSource?: any[];
9
- multipleSelect?: boolean;
10
- searchable?: boolean;
11
- header?: boolean;
12
- footer?: boolean;
13
- selectedListItems?: (e: any[]) => void;
14
- displayField?: string;
15
- customListViewItem?: JSX.Element;
16
- customItemDetails?: JSX.Element;
17
- hasItemDetails?: boolean;
18
- detailsFields?: string[];
19
- color?: C;
20
- selectedValues?: any[] | SelectedValueType;
21
- maxHeight?: string;
22
- }
23
- declare const TMListViewOLD: React.FC<ITMListView>;
24
- export default TMListViewOLD;
@@ -1,321 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useEffect, useState } from 'react';
3
- import styled from 'styled-components';
4
- import { Colors, FontSize } from '../../utils/theme';
5
- import { getColor } from '../../helper/helpers';
6
- import { IconCloseCircle, IconDown, IconInsertAbove, IconInsertBelow, IconSearch, IconUp } from '../../helper';
7
- const StyledContainer = styled.div `
8
- z-index: -1;
9
- border: 1px solid;
10
- border-color: ${props => getColor(props.$color)} ;
11
- overflow: auto;
12
- max-height: ${props => props.$maxHight};
13
- `;
14
- const StyledListViewWrapper = styled.div `
15
- display: flex;
16
- flex-direction: column;
17
- justify-content: flex-start;
18
- align-items: flex-start;
19
- font-size: ${props => props.$fontSize} ;
20
- `;
21
- const StyledListItemContainer = styled.div `
22
- display: flex;
23
- width: 100%;
24
- flex-direction: row;
25
- justify-content: space-between;
26
- align-items: center;
27
- padding: 5px;
28
- background-color: ${props => !props.$isSelected ? props.$index % 2 === 0 ? 'white' : Colors.colore_sul_primary : Colors.secondary};
29
- font-size: ${props => props.$fontSize};
30
- color: ${props => !props.$isSelected ? Colors.primary : 'white'};
31
- z-index: 1;
32
- `;
33
- const StyledLsitItemCheck = styled.input `
34
- margin-right: 5px;
35
- cursor: pointer;
36
- `;
37
- const StyledListItem = styled.li `
38
- padding: 3px;
39
- list-style: none;
40
- text-decoration: none;
41
- color: ${props => props.$color};
42
- `;
43
- const StyledListViewItemDetails = styled.div `
44
- display: flex;
45
- flex-direction: column;
46
- align-items: flex-start;
47
- justify-content: flex-start;
48
- padding: 5px;
49
- background-color: ${Colors.contenitore_su_colore_primary};
50
- color: white;
51
- width: 100%;
52
- `;
53
- const StyledDetailsToggleButton = styled.button `
54
- border: none;
55
- background-color: transparent;
56
- cursor: pointer;
57
- color: ${props => props.$isSelected ? 'white' : Colors.primary};
58
- `;
59
- const StyledListViewSearchContainer = styled.div `
60
- position: sticky;
61
- padding: 5px;
62
- top: 0px;
63
- display: flex;
64
- flex-direction: row;
65
- align-items: center;
66
- justify-content: flex-start;
67
- padding-bottom: 5px;
68
- border-bottom: 1px solid ${props => getColor(props.$color)};
69
- background-color: ${props => getColor(props.$color)};
70
- z-index: 100;
71
- `;
72
- const StyledSelectOptionCheckBox = styled.input `
73
- margin-right: 5px;
74
- margin-left: 2px;
75
- cursor: pointer;
76
- width: 20px;
77
- height: 20px;
78
- `;
79
- const StyledListViewSearchInput = styled.input `
80
- width: 100%;
81
- padding: 3px 10px;
82
- border-radius: 5px;
83
- border-width: 1px ;
84
- border-color: ${props => getColor(props.$color)};
85
- border-style: solid;
86
- color: ${props => getColor(props.$color)};
87
- &::placeholder{
88
- color: ${props => getColor(props.$color)};
89
- }
90
- &:focus{
91
- outline: none;
92
- background-color: #fbf5ca;
93
- }
94
- `;
95
- const StyledListViewSearchIcon = styled.button `
96
- background-color: transparent;
97
- border: none;
98
- cursor: ${props => props.$isSearch ? 'pointer' : 'default'};
99
- color: ${props => getColor(props.$color)};
100
- position: absolute;
101
- right: 10px;
102
- top: 10px;
103
- &:focus{
104
- outline: ${props => !props.$isSearch && 'none'};
105
- }
106
- `;
107
- const StyledListViewFooter = styled.div `
108
- z-index: 100;
109
- position: sticky;
110
- bottom: 0px;
111
- width: 100%;
112
- padding: 5px;
113
- background-color: ${props => getColor(props.$color)};
114
- color: white;
115
- font-size: 1rem;
116
- `;
117
- const StyledShowHideDetailsButton = styled.button `
118
- background-color: transparent;
119
- border: none;
120
- margin-right: 10px;
121
- /* color: ${props => getColor(props.$color)}; */
122
- color: white;
123
- cursor: pointer;
124
- transform: translateY(1.5px);
125
- `;
126
- const TMListViewOLD = ({ maxHeight = '100%', selectedValues = [], color = 'primary', footer = false, header = false, customItemDetails, customListViewItem, hasItemDetails = false, detailsFields, dataSource, displayField, searchable, elementStyle, selectedListItems, multipleSelect = false, fontSize = FontSize.defaultFontSize }) => {
127
- const [focusedItem, setFocusedItem] = useState(undefined);
128
- const [selectedItems, setSelectedItems] = useState([]);
129
- const [detailRequestItems, setDetailRequestItems] = useState([]);
130
- const [currentDetailsFields, setCurrentDetailsField] = useState(detailsFields);
131
- const [searchValue, setSearchValue] = useState('');
132
- const [currentDataSource, setCurrentDataSource] = useState([]);
133
- const [usedFields, setUsedFields] = useState([]);
134
- useEffect(() => {
135
- if (!selectedValues.fieldName) {
136
- setSelectedItems(selectedValues);
137
- }
138
- else {
139
- let data = [];
140
- for (let value of selectedValues.fieldValues) {
141
- for (let d of currentDataSource) {
142
- if (value === d[selectedValues.fieldName]) {
143
- data.push(d);
144
- }
145
- }
146
- }
147
- setSelectedItems(data);
148
- }
149
- }, [currentDataSource]);
150
- useEffect(() => { selectedListItems && selectedListItems(selectedItems); }, [selectedItems]);
151
- useEffect(() => {
152
- const selectByKey = (e) => { if (e.code === 'Space' && focusedItem) {
153
- onListItemClick();
154
- } };
155
- window.addEventListener('keyup', selectByKey);
156
- return () => window.removeEventListener('keyup', selectByKey);
157
- }, [focusedItem, selectedItems]);
158
- useEffect(() => {
159
- let arr = [];
160
- if (customListViewItem) {
161
- for (let key of Object.keys(customListViewItem.props)) {
162
- arr.push(customListViewItem.props[key]);
163
- }
164
- }
165
- else {
166
- arr.push(displayField);
167
- }
168
- if (customItemDetails) {
169
- for (let key of Object.keys(customItemDetails.props)) {
170
- arr.push(customItemDetails.props[key]);
171
- }
172
- }
173
- else if (currentDetailsFields) {
174
- for (let field of currentDetailsFields) {
175
- arr.push(field);
176
- }
177
- }
178
- setUsedFields(arr);
179
- }, [customItemDetails, customListViewItem, displayField, detailsFields]);
180
- useEffect(() => {
181
- if (hasItemDetails) {
182
- let keys = Object.keys(dataSource[0]);
183
- if (!displayField) {
184
- let detailsKeys = keys.filter(key => key !== displayField);
185
- if (!detailsFields) {
186
- setCurrentDetailsField(detailsKeys);
187
- }
188
- else {
189
- setCurrentDetailsField(detailsFields);
190
- }
191
- }
192
- else {
193
- if (!detailsFields) {
194
- setCurrentDetailsField(keys);
195
- }
196
- else {
197
- setCurrentDetailsField(detailsFields);
198
- }
199
- }
200
- }
201
- }, [hasItemDetails, detailsFields, displayField]);
202
- useEffect(() => {
203
- if (searchable) {
204
- if (searchValue.length > 0) {
205
- filter(dataSource, searchValue);
206
- }
207
- else {
208
- setCurrentDataSource(dataSource);
209
- }
210
- }
211
- else {
212
- setCurrentDataSource(dataSource);
213
- }
214
- }, [dataSource, searchValue, searchable]);
215
- const showHideDetails = () => {
216
- if (detailRequestItems.length > 0) {
217
- setDetailRequestItems([]);
218
- }
219
- else {
220
- setDetailRequestItems(currentDataSource);
221
- }
222
- };
223
- const filter = (dataSource, value) => {
224
- let arr = [];
225
- for (let data of dataSource) {
226
- if (typeof data === 'string') {
227
- setCurrentDataSource(dataSource.filter(item => item.toString().toLowerCase().includes(value.toLowerCase())));
228
- }
229
- else {
230
- for (let key of usedFields) {
231
- if (data[key].toString().toLowerCase().includes(value.toLowerCase())) {
232
- if (!arr.includes(data)) {
233
- arr.push(data);
234
- }
235
- }
236
- }
237
- ;
238
- setCurrentDataSource(arr);
239
- }
240
- }
241
- };
242
- const onListItemClick = () => {
243
- if (multipleSelect) {
244
- if (!hasItem(selectedItems, focusedItem)) {
245
- setSelectedItems(prev => [...prev, focusedItem]);
246
- }
247
- else {
248
- (setSelectedItems(selectedItems.filter(item => JSON.stringify(item) !== JSON.stringify(focusedItem))));
249
- }
250
- }
251
- else {
252
- setSelectedItems([]);
253
- setSelectedItems(prev => [...prev, focusedItem]);
254
- }
255
- };
256
- const onCheckClick = () => { if (hasItem(selectedItems, focusedItem)) {
257
- setSelectedItems(selectedItems.filter(item => JSON.stringify(item) !== JSON.stringify(focusedItem)));
258
- } };
259
- const detailsToggle = (e) => {
260
- if (detailRequestItems.includes(focusedItem)) {
261
- setDetailRequestItems(detailRequestItems.filter(item => item !== focusedItem));
262
- }
263
- else {
264
- setDetailRequestItems(prev => [...prev, focusedItem]);
265
- }
266
- };
267
- const obj = (data, type) => {
268
- let object = {};
269
- switch (type) {
270
- case 'item':
271
- for (let key of Object.keys(customListViewItem?.props)) {
272
- object[key] = data[customListViewItem?.props[key]];
273
- }
274
- break;
275
- case 'details':
276
- for (let key of Object.keys(customItemDetails?.props)) {
277
- object[key] = data[customItemDetails?.props[key]];
278
- }
279
- break;
280
- }
281
- return object;
282
- };
283
- const hasItem = (arr, el) => {
284
- let bool = false;
285
- for (let item of arr) {
286
- if (typeof item === 'string') {
287
- if (item === el) {
288
- bool = true;
289
- break;
290
- }
291
- else {
292
- bool = false;
293
- }
294
- }
295
- else {
296
- if (JSON.stringify(item) == JSON.stringify(el)) {
297
- bool = true;
298
- break;
299
- }
300
- else {
301
- bool = false;
302
- }
303
- }
304
- }
305
- return bool;
306
- };
307
- const selectDeselectAll = () => { if (selectedItems.length > 0) {
308
- setSelectedItems([]);
309
- }
310
- else {
311
- setSelectedItems(currentDataSource);
312
- } };
313
- const renderedList = () => {
314
- return (currentDataSource?.map((d, index) => (_jsxs(StyledListViewWrapper, { "$fontSize": fontSize, children: [_jsxs(StyledListItemContainer, { "$isFocused": focusedItem === d, "$isSelected": hasItem(selectedItems, d), "$fontSize": fontSize, tabIndex: 0, "$index": index, onFocus: () => setFocusedItem(d), children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', width: '100%' }, onClick: onListItemClick, children: [multipleSelect && _jsx(StyledLsitItemCheck, { checked: hasItem(selectedItems, d), onChange: onCheckClick, tabIndex: -1, type: "checkbox" }), !customListViewItem ? _jsx(StyledListItem, { "$color": color, children: displayField ? d[displayField] : d }) : React.cloneElement(customListViewItem, obj(d, 'item'))] }), hasItemDetails && _jsx(StyledDetailsToggleButton, { "$isSelected": hasItem(selectedItems, d), onClick: (e) => detailsToggle(e), children: detailRequestItems.includes(d) ? _jsx(IconUp, {}) : _jsx(IconDown, {}) })] }), detailRequestItems.includes(d) && _jsxs(StyledListViewItemDetails, { children: [" ", !customItemDetails ? currentDetailsFields.map((detail, index) => (_jsxs("div", { children: [detail, ": ", d[detail]] }, index))) : React.cloneElement(customItemDetails, obj(d, 'details')), " "] })] }, index))));
315
- };
316
- const renderedHeader = () => {
317
- return (_jsxs(StyledListViewSearchContainer, { "$color": color, children: [multipleSelect && _jsx(StyledSelectOptionCheckBox, { "$color": color, "$fontsize": fontSize, type: 'checkbox', checked: selectedItems.length > 0, onChange: selectDeselectAll }), hasItemDetails && _jsx(StyledShowHideDetailsButton, { "$color": color, onClick: showHideDetails, children: detailRequestItems.length > 0 ? _jsx(IconInsertBelow, {}) : _jsx(IconInsertAbove, {}) }), searchable && _jsx(StyledListViewSearchInput, { "$color": color, value: searchValue, onChange: (e) => setSearchValue(e.target.value), placeholder: 'search' }), searchable && _jsx(StyledListViewSearchIcon, { onClick: () => searchValue.length > 0 && setSearchValue(''), "$isSearch": searchValue.length > 0, "$color": color, children: searchValue.length > 0 ? _jsx(IconCloseCircle, {}) : _jsx(IconSearch, {}) })] }));
318
- };
319
- return (_jsx("div", { style: elementStyle, children: _jsxs(StyledContainer, { "$maxHight": maxHeight, "$color": color, children: [" ", (searchable || multipleSelect) && renderedHeader(), " ", _jsx("ul", { children: renderedList() }), " ", multipleSelect && footer && _jsxs(StyledListViewFooter, { "$color": color, children: ["Selected items: ", selectedItems.length, " | Visible items: ", currentDataSource.length] })] }) }));
320
- };
321
- export default TMListViewOLD;