aq-fe-framework 0.1.423 → 0.1.425

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.
@@ -633,6 +633,7 @@ function MySelectFromAPI(_a) {
633
633
  axiosFn,
634
634
  labelWithCode,
635
635
  onChange,
636
+ value,
636
637
  setObjectData,
637
638
  autoSelectFirstItem
638
639
  } = _b, rest = __objRest(_b, [
@@ -640,6 +641,7 @@ function MySelectFromAPI(_a) {
640
641
  "axiosFn",
641
642
  "labelWithCode",
642
643
  "onChange",
644
+ "value",
643
645
  "setObjectData",
644
646
  "autoSelectFirstItem"
645
647
  ]);
@@ -658,13 +660,13 @@ function MySelectFromAPI(_a) {
658
660
  };
659
661
  })) != null ? _a2 : [];
660
662
  }, [query.data]);
661
- const handleChange = (value, options2) => {
663
+ const handleChange = (value2, options2) => {
662
664
  var _a2;
663
- onChange == null ? void 0 : onChange(value, options2);
665
+ onChange == null ? void 0 : onChange(value2, options2);
664
666
  if (setObjectData) {
665
667
  const selected = (_a2 = query.data) == null ? void 0 : _a2.find((item) => {
666
668
  var _a3;
667
- return ((_a3 = item.id) == null ? void 0 : _a3.toString()) === value;
669
+ return ((_a3 = item.id) == null ? void 0 : _a3.toString()) === value2;
668
670
  });
669
671
  setObjectData(selected);
670
672
  }
@@ -673,19 +675,29 @@ function MySelectFromAPI(_a) {
673
675
  var _a2, _b2, _c;
674
676
  if (autoSelectFirstItem && query.data && query.data.length > 0) {
675
677
  const firstItem = query.data[0];
676
- const value = (_b2 = (_a2 = firstItem.id) == null ? void 0 : _a2.toString()) != null ? _b2 : "";
678
+ const value2 = (_b2 = (_a2 = firstItem.id) == null ? void 0 : _a2.toString()) != null ? _b2 : "";
677
679
  const label = labelWithCode ? `${firstItem.code} - ${firstItem.name}` : (_c = firstItem.name) != null ? _c : "";
678
- onChange == null ? void 0 : onChange(value, { value, label });
680
+ onChange == null ? void 0 : onChange(value2, { value: value2, label });
679
681
  setObjectData == null ? void 0 : setObjectData(firstItem);
680
682
  }
681
683
  }, [query.data, autoSelectFirstItem]);
684
+ useEffect3(() => {
685
+ if (value && setObjectData && query.data) {
686
+ const selected = query.data.find((item) => {
687
+ var _a2;
688
+ return ((_a2 = item.id) == null ? void 0 : _a2.toString()) === value;
689
+ });
690
+ setObjectData(selected);
691
+ }
692
+ }, [value, query.data]);
682
693
  return /* @__PURE__ */ jsx12(
683
694
  MySelect,
684
695
  __spreadValues({
685
696
  isLoading: query.isLoading,
686
697
  isError: query.isError,
687
698
  data: options,
688
- onChange: (value, options2) => handleChange == null ? void 0 : handleChange(value, options2)
699
+ onChange: (value2, options2) => handleChange == null ? void 0 : handleChange(value2, options2),
700
+ value
689
701
  }, rest)
690
702
  );
691
703
  }
@@ -112,7 +112,7 @@ interface MySelectFromAPIProps<IRes extends IBaseEntity, IBody = any> extends Om
112
112
  setObjectData?: (item: IRes | undefined) => void;
113
113
  autoSelectFirstItem?: boolean;
114
114
  }
115
- declare function MySelectFromAPI<IRes extends IBaseEntity, IBody = any>({ queryKey, axiosFn, labelWithCode, onChange, setObjectData, autoSelectFirstItem, ...rest }: MySelectFromAPIProps<IRes, IBody>): react_jsx_runtime.JSX.Element;
115
+ declare function MySelectFromAPI<IRes extends IBaseEntity, IBody = any>({ queryKey, axiosFn, labelWithCode, onChange, value, setObjectData, autoSelectFirstItem, ...rest }: MySelectFromAPIProps<IRes, IBody>): react_jsx_runtime.JSX.Element;
116
116
 
117
117
  interface CoreTextInputProps extends TextInputProps {
118
118
  label?: string;
@@ -13,9 +13,9 @@ import {
13
13
  MyStatsCard,
14
14
  MyTextInput,
15
15
  MyWeeklySessionSchedulerPicker
16
- } from "../chunk-AQDTIRC5.mjs";
17
- import "../chunk-GFEMKKFH.mjs";
16
+ } from "../chunk-MAFELZRY.mjs";
18
17
  import "../chunk-GEYCGM75.mjs";
18
+ import "../chunk-GFEMKKFH.mjs";
19
19
  import "../chunk-OMJJAHOC.mjs";
20
20
  import "../chunk-K6S7R6LU.mjs";
21
21
  import "../chunk-PRN7KYPD.mjs";
@@ -42,15 +42,15 @@ import {
42
42
  MyButton as MyButton2,
43
43
  MyDataTableSelectOne,
44
44
  MyTextInput as MyTextInput2
45
- } from "../chunk-AQDTIRC5.mjs";
46
- import {
47
- const_object_documentTypes
48
- } from "../chunk-GFEMKKFH.mjs";
45
+ } from "../chunk-MAFELZRY.mjs";
49
46
  import {
50
47
  MyDataTable,
51
48
  MyFlexColumn,
52
49
  MyFlexRow
53
50
  } from "../chunk-GEYCGM75.mjs";
51
+ import {
52
+ const_object_documentTypes
53
+ } from "../chunk-GFEMKKFH.mjs";
54
54
  import {
55
55
  const_object_colors
56
56
  } from "../chunk-OMJJAHOC.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.423",
45
+ "version": "0.1.425",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"