aq-fe-framework 0.1.420 → 0.1.422
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.
@@ -3,12 +3,12 @@ import {
|
|
3
3
|
MyFlexColumn,
|
4
4
|
MyFlexRow
|
5
5
|
} from "./chunk-GEYCGM75.mjs";
|
6
|
-
import {
|
7
|
-
enum_daysOfWeek
|
8
|
-
} from "./chunk-K6S7R6LU.mjs";
|
9
6
|
import {
|
10
7
|
const_object_colors
|
11
8
|
} from "./chunk-OMJJAHOC.mjs";
|
9
|
+
import {
|
10
|
+
enum_daysOfWeek
|
11
|
+
} from "./chunk-K6S7R6LU.mjs";
|
12
12
|
import {
|
13
13
|
useMyReactMutation,
|
14
14
|
useMyReactQuery
|
@@ -625,7 +625,7 @@ function MySelect(_a) {
|
|
625
625
|
}
|
626
626
|
|
627
627
|
// src/core/input/MySelectFromAPI.tsx
|
628
|
-
import { useMemo as useMemo2 } from "react";
|
628
|
+
import { useEffect as useEffect3, useMemo as useMemo2 } from "react";
|
629
629
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
630
630
|
function MySelectFromAPI(_a) {
|
631
631
|
var _b = _a, {
|
@@ -633,13 +633,15 @@ function MySelectFromAPI(_a) {
|
|
633
633
|
axiosFn,
|
634
634
|
labelWithCode,
|
635
635
|
onChange,
|
636
|
-
setObjectData
|
636
|
+
setObjectData,
|
637
|
+
autoSelectFirstItem
|
637
638
|
} = _b, rest = __objRest(_b, [
|
638
639
|
"queryKey",
|
639
640
|
"axiosFn",
|
640
641
|
"labelWithCode",
|
641
642
|
"onChange",
|
642
|
-
"setObjectData"
|
643
|
+
"setObjectData",
|
644
|
+
"autoSelectFirstItem"
|
643
645
|
]);
|
644
646
|
const query = useMyReactQuery({
|
645
647
|
queryKey,
|
@@ -667,6 +669,16 @@ function MySelectFromAPI(_a) {
|
|
667
669
|
setObjectData(selected);
|
668
670
|
}
|
669
671
|
};
|
672
|
+
useEffect3(() => {
|
673
|
+
var _a2, _b2, _c;
|
674
|
+
if (autoSelectFirstItem && query.data && query.data.length > 0) {
|
675
|
+
const firstItem = query.data[0];
|
676
|
+
const value = (_b2 = (_a2 = firstItem.id) == null ? void 0 : _a2.toString()) != null ? _b2 : "";
|
677
|
+
const label = labelWithCode ? `${firstItem.code} - ${firstItem.name}` : (_c = firstItem.name) != null ? _c : "";
|
678
|
+
onChange == null ? void 0 : onChange(value, { value, label });
|
679
|
+
setObjectData == null ? void 0 : setObjectData(firstItem);
|
680
|
+
}
|
681
|
+
}, [query.data, autoSelectFirstItem]);
|
670
682
|
return /* @__PURE__ */ jsx12(
|
671
683
|
MySelect,
|
672
684
|
__spreadValues({
|
package/dist/core/index.d.mts
CHANGED
@@ -110,8 +110,9 @@ interface MySelectFromAPIProps<IRes extends IBaseEntity, IBody = any> extends Om
|
|
110
110
|
axiosFn: () => Promise<AxiosResponse<MyApiResponse<IRes[]>, IBody>>;
|
111
111
|
labelWithCode?: boolean;
|
112
112
|
setObjectData?: (item: IRes | undefined) => void;
|
113
|
+
autoSelectFirstItem?: boolean;
|
113
114
|
}
|
114
|
-
declare function MySelectFromAPI<IRes extends IBaseEntity, IBody = any>({ queryKey, axiosFn, labelWithCode, onChange, setObjectData, ...rest }: MySelectFromAPIProps<IRes, IBody>): react_jsx_runtime.JSX.Element;
|
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
116
|
|
116
117
|
interface CoreTextInputProps extends TextInputProps {
|
117
118
|
label?: string;
|
package/dist/core/index.mjs
CHANGED
@@ -13,11 +13,11 @@ import {
|
|
13
13
|
MyStatsCard,
|
14
14
|
MyTextInput,
|
15
15
|
MyWeeklySessionSchedulerPicker
|
16
|
-
} from "../chunk-
|
17
|
-
import "../chunk-GEYCGM75.mjs";
|
18
|
-
import "../chunk-K6S7R6LU.mjs";
|
16
|
+
} from "../chunk-AQDTIRC5.mjs";
|
19
17
|
import "../chunk-GFEMKKFH.mjs";
|
18
|
+
import "../chunk-GEYCGM75.mjs";
|
20
19
|
import "../chunk-OMJJAHOC.mjs";
|
20
|
+
import "../chunk-K6S7R6LU.mjs";
|
21
21
|
import "../chunk-PRN7KYPD.mjs";
|
22
22
|
import "../chunk-7ZCOFATU.mjs";
|
23
23
|
import "../chunk-FWCSY2DS.mjs";
|
@@ -38,26 +38,26 @@ import {
|
|
38
38
|
createGenericStore
|
39
39
|
} from "../chunk-Y3YGC5IH.mjs";
|
40
40
|
import "../chunk-5U2JSHSJ.mjs";
|
41
|
-
import {
|
42
|
-
enum_emailConfigModule
|
43
|
-
} from "../chunk-VH4ZAD6M.mjs";
|
44
41
|
import {
|
45
42
|
MyButton as MyButton2,
|
46
43
|
MyDataTableSelectOne,
|
47
44
|
MyTextInput as MyTextInput2
|
48
|
-
} from "../chunk-
|
45
|
+
} from "../chunk-AQDTIRC5.mjs";
|
46
|
+
import {
|
47
|
+
const_object_documentTypes
|
48
|
+
} from "../chunk-GFEMKKFH.mjs";
|
49
49
|
import {
|
50
50
|
MyDataTable,
|
51
51
|
MyFlexColumn,
|
52
52
|
MyFlexRow
|
53
53
|
} from "../chunk-GEYCGM75.mjs";
|
54
|
-
import "../chunk-K6S7R6LU.mjs";
|
55
|
-
import {
|
56
|
-
const_object_documentTypes
|
57
|
-
} from "../chunk-GFEMKKFH.mjs";
|
58
54
|
import {
|
59
55
|
const_object_colors
|
60
56
|
} from "../chunk-OMJJAHOC.mjs";
|
57
|
+
import {
|
58
|
+
enum_emailConfigModule
|
59
|
+
} from "../chunk-VH4ZAD6M.mjs";
|
60
|
+
import "../chunk-K6S7R6LU.mjs";
|
61
61
|
import {
|
62
62
|
baseAxios_default,
|
63
63
|
createBaseApi,
|