react-core-ts 1.3.79 → 1.4.0
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 +27 -12
- package/dist/AutoCompleteWithTreeStructure.js.map +1 -1
- package/dist/commontypes.d.ts +4 -0
- package/dist/styles/styles/components/autocomplete.css +630 -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 +97 -0
- package/dist/styles/styles/global.css +8 -0
- package/docs/App.tsx +1 -0
- package/docs/store.ts +1 -1
- package/package.json +1 -1
- package/src/AutoCompleteWithTreeStructure.tsx +26 -8
- package/src/commontypes.ts +4 -0
package/docs/App.tsx
CHANGED
package/docs/store.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const treeDropData = [
|
|
2
2
|
{
|
|
3
|
-
name: 'Port
|
|
3
|
+
name: 'Port 22 - This is the main port in the northern region with significant traffic and operations',
|
|
4
4
|
id: 22,
|
|
5
5
|
parentId: null,
|
|
6
6
|
},
|
package/package.json
CHANGED
|
@@ -72,6 +72,7 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
72
72
|
hasDisableSelection,
|
|
73
73
|
inputType = 'text',
|
|
74
74
|
onFocusTreeDropdown,
|
|
75
|
+
filterCondition,
|
|
75
76
|
},
|
|
76
77
|
ref
|
|
77
78
|
) => {
|
|
@@ -470,18 +471,35 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
470
471
|
|
|
471
472
|
const searchRecursive = (port: any) => {
|
|
472
473
|
if (port[desc].toLowerCase().includes(lowerQuery)) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
474
|
+
if (
|
|
475
|
+
filterCondition &&
|
|
476
|
+
filterCondition.filterKey &&
|
|
477
|
+
filterCondition.filterValue
|
|
478
|
+
) {
|
|
479
|
+
result.push({
|
|
480
|
+
[descId]: port[descId],
|
|
481
|
+
[desc]: port[desc],
|
|
482
|
+
parentId: port.parentId,
|
|
483
|
+
[filterCondition?.filterKey]: port[filterCondition.filterKey],
|
|
484
|
+
});
|
|
485
|
+
} else {
|
|
486
|
+
result.push({
|
|
487
|
+
[descId]: port[descId],
|
|
488
|
+
[desc]: port[desc],
|
|
489
|
+
parentId: port.parentId,
|
|
490
|
+
});
|
|
491
|
+
}
|
|
478
492
|
}
|
|
479
493
|
port.children?.forEach(searchRecursive);
|
|
480
494
|
};
|
|
481
495
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
496
|
+
// Default behavior (filter entire array)
|
|
497
|
+
dropDownData?.forEach(searchRecursive);
|
|
498
|
+
|
|
499
|
+
const final = result.filter((item) => {
|
|
500
|
+
return item[filterCondition?.filterKey] === filterCondition.filterValue;
|
|
501
|
+
});
|
|
502
|
+
setFilteredData(final);
|
|
485
503
|
};
|
|
486
504
|
|
|
487
505
|
const handleSuggestionClick = useCallback((suggestion: ValueProps) => {
|
package/src/commontypes.ts
CHANGED
|
@@ -73,6 +73,10 @@ export interface AutoSuggestionInputProps {
|
|
|
73
73
|
e: React.FocusEvent<HTMLTextAreaElement, Element>
|
|
74
74
|
) => void;
|
|
75
75
|
inputType?: 'text' | 'textarea';
|
|
76
|
+
filterCondition?: {
|
|
77
|
+
filterKey?: any;
|
|
78
|
+
filterValue?: any;
|
|
79
|
+
};
|
|
76
80
|
}
|
|
77
81
|
export interface IconsProps {
|
|
78
82
|
name: any;
|