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
  }
@@ -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 = IBaseEntity[], IBody = any> extends Omit<MySelectProps, 'isLoading' | 'isError'> {
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 = IBaseEntity[], IBody = any>({ queryKey, axiosFn, labelWithCode, ...rest }: MySelectFromAPIProps<IRes, IBody>): react_jsx_runtime.JSX.Element;
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;
@@ -13,7 +13,7 @@ import {
13
13
  MyStatsCard,
14
14
  MyTextInput,
15
15
  MyWeeklySessionSchedulerPicker
16
- } from "../chunk-IICRBEHX.mjs";
16
+ } from "../chunk-DO3NAJIP.mjs";
17
17
  import "../chunk-GFEMKKFH.mjs";
18
18
  import "../chunk-GEYCGM75.mjs";
19
19
  import "../chunk-OMJJAHOC.mjs";
@@ -15,7 +15,7 @@ import {
15
15
  MyButton,
16
16
  MyDataTableSelectOne,
17
17
  MyTextInput
18
- } from "../chunk-IICRBEHX.mjs";
18
+ } from "../chunk-DO3NAJIP.mjs";
19
19
  import {
20
20
  const_object_documentTypes
21
21
  } from "../chunk-GFEMKKFH.mjs";
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "types": "./dist/columns/index.d.mts"
43
43
  }
44
44
  },
45
- "version": "0.1.418",
45
+ "version": "0.1.419",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"