aq-fe-framework 0.1.429 → 0.1.431
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-RZBHPPQT.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
|
@@ -619,19 +619,28 @@ function MySelect(_a) {
|
|
619
619
|
data: data != null ? data : [],
|
620
620
|
error: isError ? true : void 0,
|
621
621
|
rightSection: isLoading ? /* @__PURE__ */ jsx11(Loader, { size: "xs" }) : void 0,
|
622
|
-
disabled: isLoading || isError
|
622
|
+
disabled: isLoading || isError,
|
623
|
+
styles: (theme) => ({
|
624
|
+
input: rest.readOnly ? {
|
625
|
+
backgroundColor: const_object_colors.mantineBackgroundTertiary,
|
626
|
+
fontWeight: 500,
|
627
|
+
cursor: "default",
|
628
|
+
borderColor: theme.colors.gray[4]
|
629
|
+
} : {}
|
630
|
+
})
|
623
631
|
}, rest)
|
624
632
|
);
|
625
633
|
}
|
626
634
|
|
627
635
|
// src/core/input/MySelectFromAPI.tsx
|
628
|
-
import { useEffect as useEffect3, useMemo as useMemo2, useRef } from "react";
|
636
|
+
import { useCallback, useEffect as useEffect3, useMemo as useMemo2, useRef } from "react";
|
629
637
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
630
638
|
function MySelectFromAPI(_a) {
|
631
639
|
var _b = _a, {
|
632
640
|
queryKey,
|
633
641
|
axiosFn,
|
634
642
|
labelWithCode,
|
643
|
+
getOptionLabel,
|
635
644
|
onChange,
|
636
645
|
value,
|
637
646
|
setObjectData,
|
@@ -640,27 +649,31 @@ function MySelectFromAPI(_a) {
|
|
640
649
|
"queryKey",
|
641
650
|
"axiosFn",
|
642
651
|
"labelWithCode",
|
652
|
+
"getOptionLabel",
|
643
653
|
"onChange",
|
644
654
|
"value",
|
645
655
|
"setObjectData",
|
646
656
|
"autoSelectFirstItem"
|
647
657
|
]);
|
648
|
-
const query = useMyReactQuery({
|
649
|
-
|
650
|
-
|
651
|
-
|
658
|
+
const query = useMyReactQuery({ queryKey, axiosFn });
|
659
|
+
const hasAutoSelected = useRef(false);
|
660
|
+
const getLabel = useCallback(
|
661
|
+
(item) => {
|
662
|
+
var _a2, _b2;
|
663
|
+
return (_b2 = getOptionLabel == null ? void 0 : getOptionLabel(item)) != null ? _b2 : labelWithCode ? `${item.code} - ${item.name}` : (_a2 = item.name) != null ? _a2 : "";
|
664
|
+
},
|
665
|
+
[getOptionLabel, labelWithCode]
|
666
|
+
);
|
652
667
|
const options = useMemo2(() => {
|
653
|
-
var _a2;
|
654
|
-
|
655
|
-
|
656
|
-
var _a3, _b2, _c;
|
668
|
+
var _a2, _b2;
|
669
|
+
return (_b2 = (_a2 = query.data) == null ? void 0 : _a2.map((item) => {
|
670
|
+
var _a3, _b3;
|
657
671
|
return {
|
658
|
-
value: (
|
659
|
-
label:
|
672
|
+
value: (_b3 = (_a3 = item.id) == null ? void 0 : _a3.toString()) != null ? _b3 : "",
|
673
|
+
label: getLabel(item)
|
660
674
|
};
|
661
|
-
})) != null ?
|
662
|
-
}, [query.data]);
|
663
|
-
const hasAutoSelected = useRef(false);
|
675
|
+
})) != null ? _b2 : [];
|
676
|
+
}, [query.data, getLabel]);
|
664
677
|
const handleChange = (value2, option) => {
|
665
678
|
var _a2;
|
666
679
|
onChange == null ? void 0 : onChange(value2, option);
|
@@ -674,22 +687,22 @@ function MySelectFromAPI(_a) {
|
|
674
687
|
};
|
675
688
|
useEffect3(() => {
|
676
689
|
var _a2, _b2, _c;
|
677
|
-
if (autoSelectFirstItem && !hasAutoSelected.current &&
|
690
|
+
if (autoSelectFirstItem && !hasAutoSelected.current && ((_a2 = query.data) == null ? void 0 : _a2.length) && (value === void 0 || value === null || value === "")) {
|
678
691
|
const firstItem = query.data[0];
|
679
|
-
const
|
680
|
-
const
|
681
|
-
onChange == null ? void 0 : onChange(
|
692
|
+
const firstValue = (_c = (_b2 = firstItem.id) == null ? void 0 : _b2.toString()) != null ? _c : "";
|
693
|
+
const firstLabel = getLabel(firstItem);
|
694
|
+
onChange == null ? void 0 : onChange(firstValue, { value: firstValue, label: firstLabel });
|
682
695
|
setObjectData == null ? void 0 : setObjectData(firstItem);
|
683
696
|
hasAutoSelected.current = true;
|
684
697
|
}
|
685
|
-
}, [autoSelectFirstItem, query.data,
|
698
|
+
}, [autoSelectFirstItem, query.data, value, getLabel, onChange, setObjectData]);
|
686
699
|
return /* @__PURE__ */ jsx12(
|
687
700
|
MySelect,
|
688
701
|
__spreadValues({
|
689
702
|
isLoading: query.isLoading,
|
690
703
|
isError: query.isError,
|
691
704
|
data: options,
|
692
|
-
onChange:
|
705
|
+
onChange: handleChange,
|
693
706
|
value
|
694
707
|
}, rest)
|
695
708
|
);
|
@@ -727,7 +740,6 @@ function MyTextInput(_a) {
|
|
727
740
|
styles: (theme) => ({
|
728
741
|
input: rest.readOnly ? {
|
729
742
|
backgroundColor: const_object_colors.mantineBackgroundTertiary,
|
730
|
-
color: theme.colors.dark[7],
|
731
743
|
fontWeight: 500,
|
732
744
|
cursor: "default",
|
733
745
|
borderColor: theme.colors.gray[4]
|
package/dist/core/index.d.mts
CHANGED
@@ -109,10 +109,11 @@ interface MySelectFromAPIProps<IRes extends IBaseEntity, IBody = any> extends Om
|
|
109
109
|
queryKey: QueryKey;
|
110
110
|
axiosFn: () => Promise<AxiosResponse<MyApiResponse<IRes[]>, IBody>>;
|
111
111
|
labelWithCode?: boolean;
|
112
|
+
getOptionLabel?: (item: IRes) => string;
|
112
113
|
setObjectData?: (item: IRes | undefined) => void;
|
113
114
|
autoSelectFirstItem?: boolean;
|
114
115
|
}
|
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
|
+
declare function MySelectFromAPI<IRes extends IBaseEntity, IBody = any>({ queryKey, axiosFn, labelWithCode, getOptionLabel, onChange, value, setObjectData, autoSelectFirstItem, ...rest }: MySelectFromAPIProps<IRes, IBody>): react_jsx_runtime.JSX.Element;
|
116
117
|
|
117
118
|
interface CoreTextInputProps extends TextInputProps {
|
118
119
|
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-
|
16
|
+
} from "../chunk-7AGWTSJE.mjs";
|
17
17
|
import "../chunk-RZBHPPQT.mjs";
|
18
|
-
import "../chunk-K6S7R6LU.mjs";
|
19
18
|
import "../chunk-GFEMKKFH.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";
|
@@ -5,6 +5,12 @@ import {
|
|
5
5
|
utils_converter_enumToSelectOptions,
|
6
6
|
utils_file_fileToAQDocumentType
|
7
7
|
} from "../chunk-NRTOFI27.mjs";
|
8
|
+
import {
|
9
|
+
baseColumns
|
10
|
+
} from "../chunk-2SBUKAGS.mjs";
|
11
|
+
import {
|
12
|
+
U0DateToDDMMYYYString
|
13
|
+
} from "../chunk-I2XIN2R3.mjs";
|
8
14
|
import {
|
9
15
|
F_authenticate_Logout,
|
10
16
|
MyActionIconDelete,
|
@@ -32,32 +38,26 @@ import {
|
|
32
38
|
createGenericStore
|
33
39
|
} from "../chunk-Y3YGC5IH.mjs";
|
34
40
|
import "../chunk-5U2JSHSJ.mjs";
|
35
|
-
import {
|
36
|
-
baseColumns
|
37
|
-
} from "../chunk-2SBUKAGS.mjs";
|
38
|
-
import {
|
39
|
-
U0DateToDDMMYYYString
|
40
|
-
} from "../chunk-I2XIN2R3.mjs";
|
41
41
|
import {
|
42
42
|
MyButton as MyButton2,
|
43
43
|
MyDataTableSelectOne,
|
44
44
|
MyTextInput as MyTextInput2
|
45
|
-
} from "../chunk-
|
45
|
+
} from "../chunk-7AGWTSJE.mjs";
|
46
46
|
import {
|
47
47
|
MyDataTable,
|
48
48
|
MyFlexColumn,
|
49
49
|
MyFlexRow
|
50
50
|
} from "../chunk-RZBHPPQT.mjs";
|
51
|
-
import {
|
52
|
-
enum_emailConfigModule
|
53
|
-
} from "../chunk-VH4ZAD6M.mjs";
|
54
|
-
import "../chunk-K6S7R6LU.mjs";
|
55
51
|
import {
|
56
52
|
const_object_documentTypes
|
57
53
|
} 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,
|
package/dist/utils/index.mjs
CHANGED
@@ -21,15 +21,15 @@ import {
|
|
21
21
|
utils_time_getCurrentTimeString,
|
22
22
|
utils_validator_validateCode
|
23
23
|
} from "../chunk-NRTOFI27.mjs";
|
24
|
-
import {
|
25
|
-
utils_pdf_download
|
26
|
-
} from "../chunk-5U2JSHSJ.mjs";
|
27
24
|
import {
|
28
25
|
U0DateToDDMMYYYString,
|
29
26
|
utils_date_dateToDDMMYYYString,
|
30
27
|
utils_date_formatToDateTimeStartEnd,
|
31
28
|
utils_date_getHHmm
|
32
29
|
} from "../chunk-I2XIN2R3.mjs";
|
30
|
+
import {
|
31
|
+
utils_pdf_download
|
32
|
+
} from "../chunk-5U2JSHSJ.mjs";
|
33
33
|
import {
|
34
34
|
utils_notification_show
|
35
35
|
} from "../chunk-7ZCOFATU.mjs";
|