react-core-ts 1.2.30 → 1.2.32
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/AutoCompleteWithSelectedList.js +24 -38
- package/dist/AutoCompleteWithSelectedList.js.map +1 -1
- package/dist/AutoCompleteWithTreeStructure.js +1 -1
- package/dist/AutoCompleteWithTreeStructure.js.map +1 -1
- package/dist/ExpandableAutoComplete.js +1 -1
- package/dist/ExpandableAutoComplete.js.map +1 -1
- package/dist/dummyAutoCompleteWithSelectedList.d.ts +4 -0
- package/dist/dummyAutoCompleteWithSelectedList.js +456 -0
- package/dist/dummyAutoCompleteWithSelectedList.js.map +1 -0
- package/dist/index.d.ts +15 -15
- package/dist/styles/components/autocomplete.css +1 -1
- package/package.json +1 -1
- package/src/AutoCompleteWithSelectedList.tsx +43 -63
- package/src/AutoCompleteWithTreeStructure.tsx +1 -1
- package/src/ExpandableAutoComplete.tsx +1 -1
- package/src/dummyAutoCompleteWithSelectedList.tsx +778 -0
- package/src/index.tsx +15 -15
- package/src/styles/components/autocomplete.css +1 -1
- package/dist/styles/styles/components/autocomplete.css +0 -616
- package/dist/styles/styles/components/selectedautocomplete.css +0 -128
- package/dist/styles/styles/components/tooltip.css +0 -496
- package/dist/styles/styles/components/treedropdown.css +0 -63
- package/dist/styles/styles/global.css +0 -8
|
@@ -81,7 +81,6 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
81
81
|
const [nextPage, setNextPage] = useState<number | undefined>(1);
|
|
82
82
|
const [dropOpen, setDropOpen] = useState<boolean>(false);
|
|
83
83
|
const [selectedItems, setSelectedItems] = useState<ValueProps[]>([]);
|
|
84
|
-
|
|
85
84
|
const [showAllSelected, setShowAllSelected] = useState<boolean>(false);
|
|
86
85
|
const [expandArrowClick, setExpandArrowClick] = useState<
|
|
87
86
|
number | undefined
|
|
@@ -92,8 +91,8 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
92
91
|
const dropRef = useRef(null);
|
|
93
92
|
const inputSearchRef = useRef(null);
|
|
94
93
|
useImperativeHandle(ref, () => inputRef.current);
|
|
95
|
-
const [dropdownStyle, setDropdownStyle] = useState
|
|
96
|
-
top:
|
|
94
|
+
const [dropdownStyle, setDropdownStyle] = useState({
|
|
95
|
+
top: 0,
|
|
97
96
|
left: 0,
|
|
98
97
|
width: 200,
|
|
99
98
|
});
|
|
@@ -109,27 +108,24 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
109
108
|
// Check if there's enough space below the input for the dropdown
|
|
110
109
|
const spaceBelow = window.innerHeight - inputRect.bottom;
|
|
111
110
|
const spaceAbove = inputRect.top + window.scrollY;
|
|
112
|
-
let dropdownHeight = viewMode ? 160 : 380; // Assume a fixed height or calculate based on content
|
|
113
111
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
dropdownHeight += type === 'auto_suggestion' ? 220 : 192;
|
|
112
|
+
let dropdownHeight = viewMode ? 160 : 300; // Assume a fixed height or calculate based on content
|
|
113
|
+
if (countOnly) {
|
|
114
|
+
if (dropdownSelectedRef?.current)
|
|
115
|
+
dropdownHeight += dropdownSelectedRef?.current?.clientHeight;
|
|
119
116
|
}
|
|
120
117
|
|
|
121
118
|
if (tab.length > 0) {
|
|
122
119
|
if (tabRef?.current) dropdownHeight += tabRef?.current?.clientHeight;
|
|
123
120
|
}
|
|
124
|
-
console.log(dropdownHeight);
|
|
125
121
|
if (spaceBelow >= dropdownHeight) {
|
|
126
122
|
dropdownPosition.top =
|
|
127
123
|
inputRect.top + window.scrollY + inputRect.height;
|
|
128
124
|
} else {
|
|
129
|
-
dropdownPosition.top =
|
|
130
|
-
|
|
131
|
-
: inputRect.top + window.scrollY - dropdownHeight + 73 + topMargin;
|
|
125
|
+
dropdownPosition.top =
|
|
126
|
+
inputRect.top + window.scrollY - dropdownHeight + 73 + topMargin;
|
|
132
127
|
}
|
|
128
|
+
|
|
133
129
|
setDropdownStyle({
|
|
134
130
|
...dropdownPosition,
|
|
135
131
|
});
|
|
@@ -143,7 +139,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
143
139
|
return () => {
|
|
144
140
|
window.removeEventListener('resize', adjustDropdownPosition);
|
|
145
141
|
};
|
|
146
|
-
}, [selectedItems, expandArrowClick
|
|
142
|
+
}, [dropOpen, selectedItems, expandArrowClick]);
|
|
147
143
|
|
|
148
144
|
const { suggestions, isLoading, handlePickSuggestions } = useSuggestions(
|
|
149
145
|
getData,
|
|
@@ -230,7 +226,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
230
226
|
|
|
231
227
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
232
228
|
const { value } = e.target;
|
|
233
|
-
|
|
229
|
+
setDropOpen(true);
|
|
234
230
|
setSearchValue(value);
|
|
235
231
|
handleChangeWithDebounce(value);
|
|
236
232
|
if (!value) {
|
|
@@ -287,8 +283,9 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
287
283
|
if (
|
|
288
284
|
dropRef.current &&
|
|
289
285
|
event.target instanceof Node &&
|
|
290
|
-
!dropRef.current.contains(event.target)
|
|
291
|
-
|
|
286
|
+
!dropRef.current.contains(event.target)
|
|
287
|
+
// &&
|
|
288
|
+
// event.target.nodeName !== "svg"
|
|
292
289
|
) {
|
|
293
290
|
setTimeout(() => {
|
|
294
291
|
setDropOpen(false);
|
|
@@ -300,7 +297,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
300
297
|
window.addEventListener('scroll', handleClickOutside as any);
|
|
301
298
|
|
|
302
299
|
const scrollableDivs = document.querySelectorAll(
|
|
303
|
-
'div[style*="overflow"], .overflow-auto '
|
|
300
|
+
'div[style*="overflow"], .overflow-auto ,overflow-y-auto overflow-x-auto'
|
|
304
301
|
);
|
|
305
302
|
scrollableDivs.forEach((div) =>
|
|
306
303
|
div.addEventListener('scroll', handleClickOutside as any)
|
|
@@ -365,7 +362,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
365
362
|
if (countOnly) {
|
|
366
363
|
setTimeout(() => {
|
|
367
364
|
if (inputSearchRef.current) inputSearchRef.current.focus();
|
|
368
|
-
},
|
|
365
|
+
}, 10);
|
|
369
366
|
} else {
|
|
370
367
|
if (inputRef.current) inputRef.current.focus();
|
|
371
368
|
}
|
|
@@ -395,13 +392,11 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
395
392
|
.join(', ')
|
|
396
393
|
: '';
|
|
397
394
|
|
|
398
|
-
const handleDropOpen =
|
|
399
|
-
e.stopPropagation();
|
|
395
|
+
const handleDropOpen = (e: any) => {
|
|
400
396
|
if (!dropOpen) setDropOpen(true);
|
|
401
397
|
};
|
|
402
398
|
|
|
403
399
|
const handleDropClose = (e: any) => {
|
|
404
|
-
e.stopPropagation();
|
|
405
400
|
if (dropOpen) setDropOpen(false);
|
|
406
401
|
};
|
|
407
402
|
|
|
@@ -613,14 +608,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
613
608
|
ReactDOM.createPortal(
|
|
614
609
|
<div
|
|
615
610
|
ref={dropRef}
|
|
616
|
-
style={{
|
|
617
|
-
...dropdownStyle,
|
|
618
|
-
minHeight: viewMode
|
|
619
|
-
? 160
|
|
620
|
-
: type === 'auto_suggestion'
|
|
621
|
-
? 164
|
|
622
|
-
: 192,
|
|
623
|
-
}}
|
|
611
|
+
style={{ ...dropdownStyle, minHeight: viewMode ? 100 : 192 }}
|
|
624
612
|
className={`qbs-autocomplete-suggestions qbs-autocomplete-selected-suggestions ${
|
|
625
613
|
viewMode ? 'qbs-dropdown-selected-preview' : ''
|
|
626
614
|
} ${viewMode && selectedItems?.length === 0 ? 'hidden' : ''}`}
|
|
@@ -701,17 +689,12 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
701
689
|
)}
|
|
702
690
|
</div>
|
|
703
691
|
<>
|
|
704
|
-
{
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
}}
|
|
711
|
-
className={`qbs-expandable-container qbs-dropdown-selected-container`}
|
|
712
|
-
ref={dropdownSelectedRef}
|
|
713
|
-
>
|
|
714
|
-
{selectedItems?.length > 0 ? (
|
|
692
|
+
{countOnly && selectedItems?.length > 0 && (
|
|
693
|
+
<>
|
|
694
|
+
<div
|
|
695
|
+
className={`qbs-expandable-container qbs-dropdown-selected-container`}
|
|
696
|
+
ref={dropdownSelectedRef}
|
|
697
|
+
>
|
|
715
698
|
<div className={`qbs-flex qbs-w-full qbs-text-xs`}>
|
|
716
699
|
<div className="qbs-selected-lbs qbs-flex-grow">
|
|
717
700
|
Selected Items
|
|
@@ -725,30 +708,27 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
725
708
|
Clear all
|
|
726
709
|
</div>
|
|
727
710
|
</div>
|
|
728
|
-
) : (
|
|
729
|
-
<div> No Items Selected</div>
|
|
730
|
-
)}
|
|
731
711
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
712
|
+
{getSelectedItems(true)}
|
|
713
|
+
|
|
714
|
+
<>
|
|
715
|
+
{selectedItems?.length > itemCount &&
|
|
716
|
+
showAllSelected && (
|
|
717
|
+
<div className="qbs-readmore-collapse">
|
|
718
|
+
<div
|
|
719
|
+
className="qbs-more-collapse"
|
|
720
|
+
onClick={() => {
|
|
721
|
+
handleCollapseArrowClick();
|
|
722
|
+
}}
|
|
723
|
+
>
|
|
724
|
+
<DropArrow className={`icon-button-rotate`} />
|
|
725
|
+
</div>
|
|
745
726
|
</div>
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
{/* )} */}
|
|
727
|
+
)}
|
|
728
|
+
</>
|
|
729
|
+
</div>
|
|
730
|
+
</>
|
|
731
|
+
)}
|
|
752
732
|
</>
|
|
753
733
|
</div>,
|
|
754
734
|
document.body
|
|
@@ -245,7 +245,7 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
245
245
|
window.addEventListener("scroll", handleClickOutside as any);
|
|
246
246
|
|
|
247
247
|
const scrollableDivs = document.querySelectorAll(
|
|
248
|
-
'div[style*="overflow"], .overflow-auto'
|
|
248
|
+
'div[style*="overflow"], .overflow-auto ,overflow-y-auto overflow-x-auto'
|
|
249
249
|
);
|
|
250
250
|
scrollableDivs.forEach((div) =>
|
|
251
251
|
div.addEventListener("scroll", handleClickOutside as any)
|
|
@@ -262,7 +262,7 @@ const ExpandableAutoComplete = forwardRef<
|
|
|
262
262
|
window.addEventListener("scroll", handleClickOutside as any);
|
|
263
263
|
|
|
264
264
|
const scrollableDivs = document.querySelectorAll(
|
|
265
|
-
'div[style*="overflow"], .overflow-auto'
|
|
265
|
+
'div[style*="overflow"], .overflow-auto ,overflow-y-auto overflow-x-auto'
|
|
266
266
|
);
|
|
267
267
|
scrollableDivs.forEach((div) =>
|
|
268
268
|
div.addEventListener("scroll", handleClickOutside as any)
|