aq-fe-framework 0.1.418 → 0.1.419
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.
@@ -631,11 +631,15 @@ function MySelectFromAPI(_a) {
|
|
631
631
|
var _b = _a, {
|
632
632
|
queryKey,
|
633
633
|
axiosFn,
|
634
|
-
labelWithCode
|
634
|
+
labelWithCode,
|
635
|
+
onChange,
|
636
|
+
setObjectData
|
635
637
|
} = _b, rest = __objRest(_b, [
|
636
638
|
"queryKey",
|
637
639
|
"axiosFn",
|
638
|
-
"labelWithCode"
|
640
|
+
"labelWithCode",
|
641
|
+
"onChange",
|
642
|
+
"setObjectData"
|
639
643
|
]);
|
640
644
|
const query = useMyReactQuery({
|
641
645
|
queryKey,
|
@@ -652,12 +656,24 @@ function MySelectFromAPI(_a) {
|
|
652
656
|
};
|
653
657
|
})) != null ? _a2 : [];
|
654
658
|
}, [query.data]);
|
659
|
+
const handleChange = (value, options2) => {
|
660
|
+
var _a2;
|
661
|
+
onChange == null ? void 0 : onChange(value, options2);
|
662
|
+
if (setObjectData) {
|
663
|
+
const selected = (_a2 = query.data) == null ? void 0 : _a2.find((item) => {
|
664
|
+
var _a3;
|
665
|
+
return ((_a3 = item.id) == null ? void 0 : _a3.toString()) === value;
|
666
|
+
});
|
667
|
+
setObjectData(selected);
|
668
|
+
}
|
669
|
+
};
|
655
670
|
return /* @__PURE__ */ jsx12(
|
656
671
|
MySelect,
|
657
672
|
__spreadValues({
|
658
673
|
isLoading: query.isLoading,
|
659
674
|
isError: query.isError,
|
660
|
-
data: options
|
675
|
+
data: options,
|
676
|
+
onChange: (value, options2) => handleChange == null ? void 0 : handleChange(value, options2)
|
661
677
|
}, rest)
|
662
678
|
);
|
663
679
|
}
|
package/dist/core/index.d.mts
CHANGED
@@ -105,12 +105,13 @@ interface MySelectProps extends SelectProps {
|
|
105
105
|
}
|
106
106
|
declare function MySelect({ label, data, isLoading, isError, ...rest }: MySelectProps): react_jsx_runtime.JSX.Element;
|
107
107
|
|
108
|
-
interface MySelectFromAPIProps<IRes
|
108
|
+
interface MySelectFromAPIProps<IRes extends IBaseEntity[], IBody = any> extends Omit<MySelectProps, 'isLoading' | 'isError'> {
|
109
109
|
queryKey: QueryKey;
|
110
110
|
axiosFn: () => Promise<AxiosResponse<MyApiResponse<IRes>, IBody>>;
|
111
111
|
labelWithCode?: boolean;
|
112
|
+
setObjectData?: (item: IRes | undefined) => void;
|
112
113
|
}
|
113
|
-
declare function MySelectFromAPI<IRes
|
114
|
+
declare function MySelectFromAPI<IRes extends IBaseEntity[], IBody = any>({ queryKey, axiosFn, labelWithCode, onChange, setObjectData, ...rest }: MySelectFromAPIProps<IRes, IBody>): react_jsx_runtime.JSX.Element;
|
114
115
|
|
115
116
|
interface CoreTextInputProps extends TextInputProps {
|
116
117
|
label?: string;
|
package/dist/core/index.mjs
CHANGED