aq-fe-framework 0.1.424 → 0.1.426
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.
@@ -625,7 +625,7 @@ function MySelect(_a) {
|
|
625
625
|
}
|
626
626
|
|
627
627
|
// src/core/input/MySelectFromAPI.tsx
|
628
|
-
import { useEffect as useEffect3, useMemo as useMemo2 } from "react";
|
628
|
+
import { useEffect as useEffect3, useMemo as useMemo2, useRef } from "react";
|
629
629
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
630
630
|
function MySelectFromAPI(_a) {
|
631
631
|
var _b = _a, {
|
@@ -660,9 +660,10 @@ function MySelectFromAPI(_a) {
|
|
660
660
|
};
|
661
661
|
})) != null ? _a2 : [];
|
662
662
|
}, [query.data]);
|
663
|
-
const
|
663
|
+
const hasAutoSelected = useRef(false);
|
664
|
+
const handleChange = (value2, option) => {
|
664
665
|
var _a2;
|
665
|
-
onChange == null ? void 0 : onChange(value2,
|
666
|
+
onChange == null ? void 0 : onChange(value2, option);
|
666
667
|
if (setObjectData) {
|
667
668
|
const selected = (_a2 = query.data) == null ? void 0 : _a2.find((item) => {
|
668
669
|
var _a3;
|
@@ -673,22 +674,22 @@ function MySelectFromAPI(_a) {
|
|
673
674
|
};
|
674
675
|
useEffect3(() => {
|
675
676
|
var _a2, _b2, _c;
|
676
|
-
if (value)
|
677
|
-
if (autoSelectFirstItem && query.data && query.data.length > 0) {
|
677
|
+
if (autoSelectFirstItem && !hasAutoSelected.current && query.data && query.data.length > 0 && (value === void 0 || value === null || value === "")) {
|
678
678
|
const firstItem = query.data[0];
|
679
|
-
const
|
679
|
+
const val = (_b2 = (_a2 = firstItem.id) == null ? void 0 : _a2.toString()) != null ? _b2 : "";
|
680
680
|
const label = labelWithCode ? `${firstItem.code} - ${firstItem.name}` : (_c = firstItem.name) != null ? _c : "";
|
681
|
-
onChange == null ? void 0 : onChange(
|
681
|
+
onChange == null ? void 0 : onChange(val, { value: val, label });
|
682
682
|
setObjectData == null ? void 0 : setObjectData(firstItem);
|
683
|
+
hasAutoSelected.current = true;
|
683
684
|
}
|
684
|
-
}, [query.data,
|
685
|
+
}, [autoSelectFirstItem, query.data, labelWithCode, onChange, setObjectData, value]);
|
685
686
|
return /* @__PURE__ */ jsx12(
|
686
687
|
MySelect,
|
687
688
|
__spreadValues({
|
688
689
|
isLoading: query.isLoading,
|
689
690
|
isError: query.isError,
|
690
691
|
data: options,
|
691
|
-
onChange: (value2,
|
692
|
+
onChange: (value2, option) => handleChange(value2, option),
|
692
693
|
value
|
693
694
|
}, rest)
|
694
695
|
);
|
@@ -62,7 +62,8 @@ import {
|
|
62
62
|
useS_BasicAppShell,
|
63
63
|
useS_ButtonImport,
|
64
64
|
utils_layout_getItemsWithoutLinks
|
65
|
-
} from "../chunk-
|
65
|
+
} from "../chunk-DZXMICDD.mjs";
|
66
|
+
import "../chunk-Y3YGC5IH.mjs";
|
66
67
|
import "../chunk-5U2JSHSJ.mjs";
|
67
68
|
import {
|
68
69
|
MyDataTable,
|
@@ -72,7 +73,6 @@ import {
|
|
72
73
|
import "../chunk-OMJJAHOC.mjs";
|
73
74
|
import "../chunk-PRN7KYPD.mjs";
|
74
75
|
import "../chunk-7ZCOFATU.mjs";
|
75
|
-
import "../chunk-Y3YGC5IH.mjs";
|
76
76
|
import "../chunk-FWCSY2DS.mjs";
|
77
77
|
export {
|
78
78
|
AQButtonCreateByImportFile,
|
package/dist/core/index.mjs
CHANGED
@@ -33,13 +33,16 @@ import {
|
|
33
33
|
groupToTwoLevels,
|
34
34
|
useS_authenticate,
|
35
35
|
utils_layout_getItemsWithoutLinks
|
36
|
-
} from "../chunk-
|
36
|
+
} from "../chunk-DZXMICDD.mjs";
|
37
|
+
import {
|
38
|
+
createGenericStore
|
39
|
+
} from "../chunk-Y3YGC5IH.mjs";
|
37
40
|
import "../chunk-5U2JSHSJ.mjs";
|
38
41
|
import {
|
39
42
|
MyButton as MyButton2,
|
40
43
|
MyDataTableSelectOne,
|
41
44
|
MyTextInput as MyTextInput2
|
42
|
-
} from "../chunk-
|
45
|
+
} from "../chunk-KYVHHB4Q.mjs";
|
43
46
|
import {
|
44
47
|
MyDataTable,
|
45
48
|
MyFlexColumn,
|
@@ -68,9 +71,6 @@ import {
|
|
68
71
|
import {
|
69
72
|
utils_notification_show
|
70
73
|
} from "../chunk-7ZCOFATU.mjs";
|
71
|
-
import {
|
72
|
-
createGenericStore
|
73
|
-
} from "../chunk-Y3YGC5IH.mjs";
|
74
74
|
import {
|
75
75
|
__objRest,
|
76
76
|
__spreadProps,
|
package/package.json
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
import {
|
2
|
+
createGenericStore
|
3
|
+
} from "./chunk-Y3YGC5IH.mjs";
|
1
4
|
import {
|
2
5
|
utils_pdf_download
|
3
6
|
} from "./chunk-5U2JSHSJ.mjs";
|
@@ -17,9 +20,6 @@ import {
|
|
17
20
|
import {
|
18
21
|
utils_notification_show
|
19
22
|
} from "./chunk-7ZCOFATU.mjs";
|
20
|
-
import {
|
21
|
-
createGenericStore
|
22
|
-
} from "./chunk-Y3YGC5IH.mjs";
|
23
23
|
import {
|
24
24
|
__objRest,
|
25
25
|
__spreadProps,
|