@algorithm-shift/design-system 1.2.956 → 1.2.957
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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -27758,8 +27758,14 @@ function useLazyDropdown(config) {
|
|
|
27758
27758
|
useEffect13(() => {
|
|
27759
27759
|
const cfg = configRef.current;
|
|
27760
27760
|
if (!cfg.enabled || !cfg.value || cfg.dataSource !== "api" || !cfg.apiUrl) return;
|
|
27761
|
-
|
|
27762
|
-
|
|
27761
|
+
if (!!cfg.isMultiSelect) {
|
|
27762
|
+
const values = String(cfg.value).split(",").map((v) => v.trim());
|
|
27763
|
+
const valueExists = values.every((val) => options.some((opt) => opt.value === val));
|
|
27764
|
+
if (valueExists) return;
|
|
27765
|
+
} else {
|
|
27766
|
+
const valueExists = options.some((opt) => opt.value === cfg.value);
|
|
27767
|
+
if (valueExists) return;
|
|
27768
|
+
}
|
|
27763
27769
|
fetchValueItem();
|
|
27764
27770
|
}, [config.value, config.dataKey, config.apiUrl, config.dataSource, transformToOptions]);
|
|
27765
27771
|
const loadMore = useCallback2(() => {
|
|
@@ -28682,7 +28688,8 @@ function LazyMultiSelectDropdown({
|
|
|
28682
28688
|
dataLabel,
|
|
28683
28689
|
initialData: options || [],
|
|
28684
28690
|
value,
|
|
28685
|
-
axiosInstance
|
|
28691
|
+
axiosInstance,
|
|
28692
|
+
isMultiSelect: true
|
|
28686
28693
|
});
|
|
28687
28694
|
const ensureUnique = (arr) => {
|
|
28688
28695
|
return Array.from(new Set(arr));
|
|
@@ -28746,11 +28753,11 @@ function LazyMultiSelectDropdown({
|
|
|
28746
28753
|
} else {
|
|
28747
28754
|
updated = ensureUnique([...normalizedValue, val]);
|
|
28748
28755
|
}
|
|
28749
|
-
onChange(convertOutput(updated), id);
|
|
28756
|
+
onChange?.(convertOutput(updated), id);
|
|
28750
28757
|
};
|
|
28751
28758
|
const removeTag = (val) => {
|
|
28752
28759
|
const updated = normalizedValue.filter((v) => v !== val);
|
|
28753
|
-
onChange(convertOutput(updated), id);
|
|
28760
|
+
onChange?.(convertOutput(updated), id);
|
|
28754
28761
|
};
|
|
28755
28762
|
const handleFocus = () => {
|
|
28756
28763
|
if (!disabled) setIsOpen(true);
|