react-core-ts 1.3.71 → 1.3.73
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/AutoCompleteWithTreeStructure.js +7 -7
- package/dist/AutoCompleteWithTreeStructure.js.map +1 -1
- package/dist/ReactAutoComplete.js +1 -1
- package/dist/ReactAutoComplete.js.map +1 -1
- package/dist/commontypes.d.ts +3 -0
- package/dist/components/TreeNode.js +4 -2
- package/dist/components/TreeNode.js.map +1 -1
- package/dist/styles/components/treedropdown.css +12 -1
- package/dist/styles/styles/components/autocomplete.css +631 -0
- package/dist/styles/styles/components/selectedautocomplete.css +130 -0
- package/dist/styles/styles/components/tooltip.css +497 -0
- package/dist/styles/styles/components/treedropdown.css +90 -0
- package/dist/styles/styles/global.css +8 -0
- package/docs/App.tsx +3 -2
- package/package.json +1 -1
- package/src/AutoCompleteWithTreeStructure.tsx +7 -0
- package/src/ReactAutoComplete.tsx +1 -1
- package/src/commontypes.ts +3 -0
- package/src/components/TreeNode.tsx +34 -17
- package/src/styles/components/treedropdown.css +12 -1
package/docs/App.tsx
CHANGED
|
@@ -146,14 +146,15 @@ export default function App() {
|
|
|
146
146
|
type="custom_select"
|
|
147
147
|
// async
|
|
148
148
|
desc="name"
|
|
149
|
-
isMultiple={
|
|
149
|
+
isMultiple={false}
|
|
150
150
|
flatArray={true}
|
|
151
|
-
singleSelect={
|
|
151
|
+
singleSelect={true}
|
|
152
152
|
expandable={true}
|
|
153
153
|
isTreeDropdown={true}
|
|
154
154
|
descId="id"
|
|
155
155
|
data={treeDropData}
|
|
156
156
|
paginationEnabled={false}
|
|
157
|
+
showIcon={true}
|
|
157
158
|
initialLoad={false}
|
|
158
159
|
itemCount={5}
|
|
159
160
|
// nextBlock={nexBlock}
|
package/package.json
CHANGED
|
@@ -67,6 +67,9 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
67
67
|
handleUpdateParent,
|
|
68
68
|
isSeachable = true,
|
|
69
69
|
customDropOffset = 300,
|
|
70
|
+
showIcon,
|
|
71
|
+
handleShowIcon,
|
|
72
|
+
hasDisableSelection,
|
|
70
73
|
},
|
|
71
74
|
ref
|
|
72
75
|
) => {
|
|
@@ -440,6 +443,8 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
440
443
|
isMultiple={isMultiple}
|
|
441
444
|
singleSelect={singleSelect}
|
|
442
445
|
handleSelect={handleSelect}
|
|
446
|
+
showIcon={handleShowIcon?.(node) ?? showIcon}
|
|
447
|
+
hasDisableSelection={hasDisableSelection?.(node)}
|
|
443
448
|
idx={node[descId]}
|
|
444
449
|
updateNode={updateNode}
|
|
445
450
|
desc={desc}
|
|
@@ -703,6 +708,8 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
703
708
|
singleSelect={singleSelect}
|
|
704
709
|
idx={suggestion[descId]}
|
|
705
710
|
handleSelect={handleSelect}
|
|
711
|
+
showIcon={handleShowIcon?.(suggestion) ?? showIcon}
|
|
712
|
+
hasDisableSelection={hasDisableSelection?.(suggestion)}
|
|
706
713
|
updateNode={updateNode}
|
|
707
714
|
desc={desc}
|
|
708
715
|
descId={descId}
|
|
@@ -461,7 +461,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
|
|
|
461
461
|
// return 'bottom'
|
|
462
462
|
// }
|
|
463
463
|
const filteredData =
|
|
464
|
-
inputValue !== '*' && type !== 'custom_select' && !noLocalFilter
|
|
464
|
+
inputValue !== '*' && inputValue !== '' && type !== 'custom_select' && !noLocalFilter
|
|
465
465
|
? suggestions?.filter((item: valueProps) =>
|
|
466
466
|
checkIncludes(
|
|
467
467
|
item.name,
|
package/src/commontypes.ts
CHANGED
|
@@ -66,6 +66,9 @@ export interface AutoSuggestionInputProps {
|
|
|
66
66
|
handleUpdateParent?: (val: boolean, level?: string) => void;
|
|
67
67
|
isSeachable?: boolean; // show search input
|
|
68
68
|
customDropOffset?: number; // adjust dropdown postion manually if any overlap issue
|
|
69
|
+
showIcon?: boolean;
|
|
70
|
+
handleShowIcon?: (node: any) => boolean;
|
|
71
|
+
hasDisableSelection?: (node: any) => boolean;
|
|
69
72
|
}
|
|
70
73
|
export interface IconsProps {
|
|
71
74
|
name: any;
|
|
@@ -17,6 +17,8 @@ const TreeNode: React.FC<any> = ({
|
|
|
17
17
|
selected,
|
|
18
18
|
handleSelect,
|
|
19
19
|
singleSelectIcon,
|
|
20
|
+
showIcon,
|
|
21
|
+
hasDisableSelection,
|
|
20
22
|
}) => {
|
|
21
23
|
// Toggle the expanded state when clicking on the node
|
|
22
24
|
const handleToggle = (node?: any) => {
|
|
@@ -27,6 +29,7 @@ const TreeNode: React.FC<any> = ({
|
|
|
27
29
|
const { checked } = e.target;
|
|
28
30
|
updateNode(dataItem[descId], checked, dataItem);
|
|
29
31
|
};
|
|
32
|
+
|
|
30
33
|
return (
|
|
31
34
|
<div>
|
|
32
35
|
<li className="qbs-tree-list-container">
|
|
@@ -48,13 +51,15 @@ const TreeNode: React.FC<any> = ({
|
|
|
48
51
|
</span>
|
|
49
52
|
)}
|
|
50
53
|
<div
|
|
51
|
-
className={
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
54
|
+
className={`${
|
|
55
|
+
isMultiple || (singleSelect && !showIcon)
|
|
56
|
+
? 'qbs-tree-list-container-sub-container'
|
|
57
|
+
: 'qbs-tree-list-container-sub-container-hideicon'
|
|
58
|
+
} ${isSelected(node, selected) ? 'checked' : ''} ${
|
|
59
|
+
node.expanded ? 'qbs-expanded-child' : ''
|
|
60
|
+
} ${node?.children?.length > 0 ? '' : 'lightmarginLeft'}`}
|
|
56
61
|
>
|
|
57
|
-
{(isMultiple || singleSelect) && (
|
|
62
|
+
{(isMultiple || (singleSelect && showIcon)) && (
|
|
58
63
|
<div
|
|
59
64
|
style={{ alignItems: singleSelect ? 'flex-start' : 'center' }}
|
|
60
65
|
className={`${'qbs-autocomplete-checkbox'}`}
|
|
@@ -83,21 +88,33 @@ const TreeNode: React.FC<any> = ({
|
|
|
83
88
|
</label>
|
|
84
89
|
</>
|
|
85
90
|
) : (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
showIcon && (
|
|
92
|
+
<span className="qbs-tree-single-select-icon">
|
|
93
|
+
{singleSelectIcon ?? <QuestionIcon />}
|
|
94
|
+
</span>
|
|
95
|
+
)
|
|
89
96
|
)}
|
|
90
97
|
</div>
|
|
91
98
|
)}
|
|
92
99
|
{singleSelect ? (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
hasDisableSelection ? (
|
|
101
|
+
<span
|
|
102
|
+
className={`${
|
|
103
|
+
node.expanded ? 'qbs-expanded-child' : ''
|
|
104
|
+
} qbs-tree-list-container-sub-text `}
|
|
105
|
+
>
|
|
106
|
+
{node[desc]}
|
|
107
|
+
</span>
|
|
108
|
+
) : (
|
|
109
|
+
<span
|
|
110
|
+
onClick={() => handleSelect(node)}
|
|
111
|
+
className={`${
|
|
112
|
+
node.expanded ? 'qbs-expanded-child' : ''
|
|
113
|
+
} qbs-tree-list-container-sub-text cursor-pointer`}
|
|
114
|
+
>
|
|
115
|
+
{node[desc]}
|
|
116
|
+
</span>
|
|
117
|
+
)
|
|
101
118
|
) : (
|
|
102
119
|
<span
|
|
103
120
|
className={`${
|
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
width: 100%; /* Corresponds to w-full in Tailwind */
|
|
33
33
|
color: #3d414a;
|
|
34
34
|
}
|
|
35
|
+
.qbs-tree-list-container-sub-container-hideicon {
|
|
36
|
+
display: flex;
|
|
37
|
+
gap: 6px; /* Corresponds to gap-2 in Tailwind */
|
|
38
|
+
padding: 0.5rem; /* Corresponds to p-2 in Tailwind */
|
|
39
|
+
flex-direction: row; /* Corresponds to flex-row in Tailwind */
|
|
40
|
+
width: 100%; /* Corresponds to w-full in Tailwind */
|
|
41
|
+
color: #3d414a;
|
|
42
|
+
}
|
|
35
43
|
.qbs-tree-list-container-sub-container:hover {
|
|
36
44
|
color: #003c71;
|
|
37
45
|
background-color: rgba(141, 194, 240, 0.15) !important;
|
|
@@ -55,9 +63,12 @@
|
|
|
55
63
|
0.15
|
|
56
64
|
) !important; /* Corresponds to bg-green-200 in Tailwind */
|
|
57
65
|
}
|
|
58
|
-
.
|
|
66
|
+
.marginLeft {
|
|
59
67
|
margin-left: 28px; /* Corresponds to ml-2 in Tailwind */
|
|
60
68
|
}
|
|
69
|
+
.lightmarginLeft {
|
|
70
|
+
margin-left: 19px; /* Corresponds to ml-2 in Tailwind */
|
|
71
|
+
}
|
|
61
72
|
.qbs-tree-list-container-sub- {
|
|
62
73
|
line-height: 18px; /* Corresponds to leading-[18px] in Tailwind */
|
|
63
74
|
font-size: 0.875rem; /* Corresponds to text-sm in Tailwind (14px) */
|