aq-fe-framework 0.1.262 → 0.1.263
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.
- package/dist/{chunk-33OCBXSX.mjs → chunk-QAIXZSQA.mjs} +14 -0
- package/dist/{chunk-CC2N6SZ6.mjs → chunk-TOSMACJI.mjs} +46 -55
- package/dist/components/index.d.mts +10 -10
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/index.mjs +1 -1
- package/dist/modules-features/index.mjs +2 -2
- package/package.json +1 -1
@@ -83,6 +83,7 @@ var useLoadAxiosConfig = ({ axiosInstance = baseAxios_default }) => {
|
|
83
83
|
import { useQueryClient } from "@tanstack/react-query";
|
84
84
|
|
85
85
|
// src/hooks/custom-hooks/useMyReactMutation.ts
|
86
|
+
import { notifications } from "@mantine/notifications";
|
86
87
|
import { useMutation } from "@tanstack/react-query";
|
87
88
|
function useMyReactMutation({
|
88
89
|
axiosFn,
|
@@ -93,6 +94,19 @@ function useMyReactMutation({
|
|
93
94
|
const res = await axiosFn(values);
|
94
95
|
if (res.data.isSuccess == 0) throw new Error(res.data.message);
|
95
96
|
return res.data.data;
|
97
|
+
},
|
98
|
+
onError: (e) => {
|
99
|
+
if (e.message == null) {
|
100
|
+
notifications.show({
|
101
|
+
message: "Kh\xF4ng th\u1EC3 thao t\xE1c, l\u1ED7i ch\u01B0a x\xE1c \u0111\u1ECBnh!",
|
102
|
+
color: "red"
|
103
|
+
});
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
notifications.show({
|
107
|
+
message: e.message,
|
108
|
+
color: "red"
|
109
|
+
});
|
96
110
|
}
|
97
111
|
}, options));
|
98
112
|
}
|
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
baseAxios_default,
|
9
9
|
useMyReactMutation,
|
10
10
|
useQ_AQ_GetAQModule
|
11
|
-
} from "./chunk-
|
11
|
+
} from "./chunk-QAIXZSQA.mjs";
|
12
12
|
import {
|
13
13
|
createGenericStore
|
14
14
|
} from "./chunk-Y3YGC5IH.mjs";
|
@@ -274,7 +274,7 @@ function MyButton(_a) {
|
|
274
274
|
// src/components/ActionIcons/ActionIconCRUD/MyActionIconDelete.tsx
|
275
275
|
import { Group, Highlight } from "@mantine/core";
|
276
276
|
import { useDisclosure as useDisclosure2 } from "@mantine/hooks";
|
277
|
-
import {
|
277
|
+
import { useQueryClient } from "@tanstack/react-query";
|
278
278
|
import { useState as useState2 } from "react";
|
279
279
|
|
280
280
|
// src/components/ActionIcons/ActionIconModal/MyActionIconModal.tsx
|
@@ -398,28 +398,27 @@ function MyActionIconDelete(_a) {
|
|
398
398
|
const queryClient = useQueryClient();
|
399
399
|
const disc = useDisclosure2();
|
400
400
|
const loadingState = useState2();
|
401
|
-
const mutation =
|
402
|
-
|
403
|
-
|
404
|
-
|
401
|
+
const mutation = useMyReactMutation({
|
402
|
+
axiosFn: () => onSubmit(),
|
403
|
+
options: __spreadValues(__spreadValues({
|
404
|
+
onSuccess: () => {
|
405
|
+
queryClient.invalidateQueries();
|
406
|
+
utils_notification_show({ crudType: "delete" });
|
407
|
+
disc[1].close();
|
408
|
+
}
|
409
|
+
}, onSuccess && {
|
410
|
+
onSuccess: () => {
|
405
411
|
onSuccess();
|
406
|
-
return;
|
407
412
|
}
|
408
|
-
|
409
|
-
|
410
|
-
utils_notification_show({ crudType: "delete" });
|
411
|
-
disc[1].close();
|
412
|
-
},
|
413
|
-
onError: () => {
|
414
|
-
if (onError) {
|
413
|
+
}), onError && {
|
414
|
+
onError: () => {
|
415
415
|
onError();
|
416
|
-
return;
|
417
416
|
}
|
418
|
-
}
|
417
|
+
})
|
419
418
|
});
|
420
419
|
function handleCLick() {
|
421
420
|
loadingState[1](true);
|
422
|
-
mutation.mutate();
|
421
|
+
mutation.mutate(void 0);
|
423
422
|
}
|
424
423
|
return /* @__PURE__ */ jsxs4(
|
425
424
|
MyActionIconModal,
|
@@ -465,7 +464,7 @@ function MyActionIconDelete(_a) {
|
|
465
464
|
|
466
465
|
// src/components/ActionIcons/ActionIconCRUD/MyActionIconUpdate.tsx
|
467
466
|
import { useDisclosure as useDisclosure3 } from "@mantine/hooks";
|
468
|
-
import {
|
467
|
+
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
469
468
|
import { useEffect as useEffect2 } from "react";
|
470
469
|
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
471
470
|
function MyActionIconUpdate(_a) {
|
@@ -486,21 +485,23 @@ function MyActionIconUpdate(_a) {
|
|
486
485
|
]);
|
487
486
|
const disc = useDisclosure3();
|
488
487
|
const queryClient = useQueryClient2();
|
489
|
-
const mutation =
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
488
|
+
const mutation = useMyReactMutation({
|
489
|
+
axiosFn: (values) => onSubmit(values),
|
490
|
+
options: __spreadValues(__spreadValues({
|
491
|
+
onSuccess: () => {
|
492
|
+
queryClient.invalidateQueries();
|
493
|
+
utils_notification_show({ crudType: "update" });
|
494
|
+
disc[1].close();
|
495
|
+
}
|
496
|
+
}, onSuccess && {
|
497
|
+
onSuccess: () => {
|
495
498
|
onSuccess();
|
496
499
|
}
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
if (onError) onError();
|
503
|
-
}
|
500
|
+
}), onError && {
|
501
|
+
onError: () => {
|
502
|
+
onError();
|
503
|
+
}
|
504
|
+
})
|
504
505
|
});
|
505
506
|
useEffect2(() => {
|
506
507
|
if (!resetFormWhenclose) return;
|
@@ -777,7 +778,7 @@ function MyAnchorViewPDF({ label, pdfLink }) {
|
|
777
778
|
import { FileInput } from "@mantine/core";
|
778
779
|
import { useDisclosure as useDisclosure6 } from "@mantine/hooks";
|
779
780
|
import { IconFileTypeXls } from "@tabler/icons-react";
|
780
|
-
import { useMutation
|
781
|
+
import { useMutation, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
781
782
|
import * as XLSX from "xlsx";
|
782
783
|
|
783
784
|
// src/components/Buttons/ButtonModal/MyButtonModal.tsx
|
@@ -906,7 +907,7 @@ function AQButtonCreateByImportFile(_a) {
|
|
906
907
|
]);
|
907
908
|
const disc = useDisclosure6();
|
908
909
|
const queryClient = useQueryClient3();
|
909
|
-
const mutation =
|
910
|
+
const mutation = useMutation({
|
910
911
|
mutationFn: async () => {
|
911
912
|
return await onSubmit();
|
912
913
|
},
|
@@ -1003,7 +1004,6 @@ function AQButtonExportData({
|
|
1003
1004
|
|
1004
1005
|
// src/components/Buttons/ButtonCRUD/MyButtonCreate.tsx
|
1005
1006
|
import { useDisclosure as useDisclosure7 } from "@mantine/hooks";
|
1006
|
-
import { notifications } from "@mantine/notifications";
|
1007
1007
|
import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
1008
1008
|
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
1009
1009
|
function MyButtonCreate(_a) {
|
@@ -1031,11 +1031,8 @@ function MyButtonCreate(_a) {
|
|
1031
1031
|
const queryClient = useQueryClient4();
|
1032
1032
|
const mutation = useMyReactMutation({
|
1033
1033
|
axiosFn: (values) => onSubmit(values),
|
1034
|
-
options: {
|
1034
|
+
options: __spreadValues(__spreadValues({
|
1035
1035
|
onSuccess: () => {
|
1036
|
-
if (onSuccess) {
|
1037
|
-
onSuccess();
|
1038
|
-
}
|
1039
1036
|
queryClient.invalidateQueries();
|
1040
1037
|
utils_notification_show({ crudType: "create" });
|
1041
1038
|
disclosure[1].close();
|
@@ -1045,22 +1042,16 @@ function MyButtonCreate(_a) {
|
|
1045
1042
|
if (notResetFormWhenSubmit == false) {
|
1046
1043
|
form.reset();
|
1047
1044
|
}
|
1048
|
-
},
|
1049
|
-
onError: (e4) => {
|
1050
|
-
if (onError) onError();
|
1051
|
-
if (e4.message == null) {
|
1052
|
-
notifications.show({
|
1053
|
-
message: "Kh\xF4ng th\u1EC3 thao t\xE1c, l\u1ED7i ch\u01B0a x\xE1c \u0111\u1ECBnh!",
|
1054
|
-
color: "red"
|
1055
|
-
});
|
1056
|
-
return;
|
1057
|
-
}
|
1058
|
-
notifications.show({
|
1059
|
-
message: e4.message,
|
1060
|
-
color: "red"
|
1061
|
-
});
|
1062
1045
|
}
|
1063
|
-
}
|
1046
|
+
}, onSuccess && {
|
1047
|
+
onSuccess: () => {
|
1048
|
+
onSuccess();
|
1049
|
+
}
|
1050
|
+
}), onError && {
|
1051
|
+
onError: () => {
|
1052
|
+
onError();
|
1053
|
+
}
|
1054
|
+
})
|
1064
1055
|
});
|
1065
1056
|
return /* @__PURE__ */ jsx21(MyButtonModal, __spreadProps(__spreadValues({ disclosure, crudType: "create" }, rest), { children: /* @__PURE__ */ jsx21("form", { onSubmit: form.onSubmit((values) => {
|
1066
1057
|
mutation.mutate(values);
|
@@ -1073,7 +1064,7 @@ function MyButtonCreate(_a) {
|
|
1073
1064
|
// src/components/Buttons/ButtonCRUD/MyButtonDeleteList.tsx
|
1074
1065
|
import { Group as Group5, Highlight as Highlight2 } from "@mantine/core";
|
1075
1066
|
import { useDisclosure as useDisclosure8 } from "@mantine/hooks";
|
1076
|
-
import { useMutation as
|
1067
|
+
import { useMutation as useMutation2, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
1077
1068
|
import { useState as useState7 } from "react";
|
1078
1069
|
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
1079
1070
|
function MyButtonDeleteList(_a) {
|
@@ -1091,7 +1082,7 @@ function MyButtonDeleteList(_a) {
|
|
1091
1082
|
const queryClient = useQueryClient5();
|
1092
1083
|
const disc = useDisclosure8();
|
1093
1084
|
const loadingState = useState7();
|
1094
|
-
const mutation =
|
1085
|
+
const mutation = useMutation2({
|
1095
1086
|
mutationFn: async () => await onSubmit(),
|
1096
1087
|
onSuccess: () => {
|
1097
1088
|
if (onSuccess) {
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
2
|
import React$1, { ReactNode, ComponentProps } from 'react';
|
3
3
|
import { MantineSize, ActionIconProps, ButtonProps, useModalsStack, CheckboxProps, SelectProps, NumberFormatterProps, FieldsetProps, FileInputProps, NumberInputProps, TextareaProps, TextInputProps, ContainerProps, FlexProps, GroupProps, TypographyStylesProviderProps, TabsProps, SkeletonProps } from '@mantine/core';
|
4
|
+
import { M as MyApiResponse } from '../createBaseApi-BJ2TH3XA.mjs';
|
5
|
+
import { AxiosResponse } from 'axios';
|
4
6
|
import { useDisclosure, useListState } from '@mantine/hooks';
|
5
7
|
import { UseFormReturnType, useForm } from '@mantine/form';
|
6
8
|
import { I as I_BasicAppShell_LinkItem } from '../BasicAppShell-CGKvZ5wV.mjs';
|
7
9
|
export { a as BasicAppShell, B as BasicAppShell_transformMenuToEnum, g as groupToTwoLevels, u as utils_layout_getItemsWithoutLinks } from '../BasicAppShell-CGKvZ5wV.mjs';
|
8
|
-
import { M as MyApiResponse } from '../createBaseApi-BJ2TH3XA.mjs';
|
9
|
-
import { AxiosResponse } from 'axios';
|
10
10
|
import { I as IUtils_Excel_ColumnConfig, a as IAQFileDetail } from '../utils_file-G8NTHCO-.mjs';
|
11
11
|
import { MRT_ColumnDef, MRT_RowData, MRT_TableOptions, MRT_TableInstance } from 'mantine-react-table';
|
12
12
|
import { ConfigOptions } from 'export-to-csv';
|
@@ -55,24 +55,24 @@ interface IMyActionIconModal extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
|
|
55
55
|
}
|
56
56
|
declare function MyActionIconModal({ fullScreen, crudType, disclosure, modalSize, title, children, icon, ...rest }: IMyActionIconModal): react_jsx_runtime.JSX.Element | undefined;
|
57
57
|
|
58
|
-
interface IActionIconDelete extends Omit<ComponentProps<typeof MyActionIconModal>, "disclosure"> {
|
59
|
-
onSubmit: () =>
|
58
|
+
interface IActionIconDelete<IReq, IRes> extends Omit<ComponentProps<typeof MyActionIconModal>, "disclosure" | "onSubmit"> {
|
59
|
+
onSubmit: () => Promise<AxiosResponse<MyApiResponse<IRes>>>;
|
60
60
|
onSuccess?: () => void;
|
61
61
|
onError?: () => void;
|
62
62
|
contextData?: string;
|
63
63
|
loading?: boolean;
|
64
64
|
}
|
65
|
-
declare function MyActionIconDelete({ onSubmit, onSuccess, onError, contextData, ...rest }: IActionIconDelete): react_jsx_runtime.JSX.Element;
|
65
|
+
declare function MyActionIconDelete<IReq, IRes>({ onSubmit, onSuccess, onError, contextData, ...rest }: IActionIconDelete<IReq, IRes>): react_jsx_runtime.JSX.Element;
|
66
66
|
|
67
|
-
interface IActionIconUpdate<
|
67
|
+
interface IActionIconUpdate<IReq, IRes> extends Omit<ComponentProps<typeof MyActionIconModal>, "form" | "disclosure" | "onSubmit"> {
|
68
68
|
resetFormWhenclose?: boolean;
|
69
|
-
onSubmit: (values:
|
69
|
+
onSubmit: (values: IReq) => Promise<AxiosResponse<MyApiResponse<IRes>>>;
|
70
70
|
onSuccess?: () => void;
|
71
71
|
onError?: () => void;
|
72
|
-
form: UseFormReturnType<
|
72
|
+
form: UseFormReturnType<IReq>;
|
73
73
|
disclosure?: ReturnType<typeof useDisclosure>;
|
74
74
|
}
|
75
|
-
declare function MyActionIconUpdate<
|
75
|
+
declare function MyActionIconUpdate<IReq, IRes>({ resetFormWhenclose, form, onSubmit, onSuccess, onError, children, ...rest }: IActionIconUpdate<IReq, IRes>): react_jsx_runtime.JSX.Element;
|
76
76
|
|
77
77
|
declare function MyActionIconDownloadPDF({ pdfLink }: {
|
78
78
|
pdfLink: string;
|
@@ -141,7 +141,7 @@ interface AQButtonExportDataProps {
|
|
141
141
|
declare function AQButtonExportData({ isAllData, objectName, data, exportConfig }: AQButtonExportDataProps): react_jsx_runtime.JSX.Element;
|
142
142
|
|
143
143
|
interface IMyButtonCreate<IReq, IRes> extends Omit<ComponentProps<typeof MyButtonModal>, "disclosure" | "form" | "onSubmit"> {
|
144
|
-
onSubmit: (
|
144
|
+
onSubmit: (values: IReq) => Promise<AxiosResponse<MyApiResponse<IRes>>>;
|
145
145
|
onSuccess?: () => void;
|
146
146
|
onError?: () => void;
|
147
147
|
form: UseFormReturnType<IReq>;
|
@@ -68,10 +68,10 @@ import {
|
|
68
68
|
useS_BasicAppShell,
|
69
69
|
useS_ButtonImport,
|
70
70
|
utils_layout_getItemsWithoutLinks
|
71
|
-
} from "../chunk-
|
71
|
+
} from "../chunk-TOSMACJI.mjs";
|
72
72
|
import "../chunk-NWBLJ3W3.mjs";
|
73
73
|
import "../chunk-K6S7R6LU.mjs";
|
74
|
-
import "../chunk-
|
74
|
+
import "../chunk-QAIXZSQA.mjs";
|
75
75
|
import "../chunk-Y3YGC5IH.mjs";
|
76
76
|
import "../chunk-5U2JSHSJ.mjs";
|
77
77
|
import "../chunk-7ZCOFATU.mjs";
|
package/dist/hooks/index.mjs
CHANGED
@@ -24,7 +24,7 @@ import {
|
|
24
24
|
useS_BasicAppShell,
|
25
25
|
useS_authenticate,
|
26
26
|
utils_layout_getItemsWithoutLinks
|
27
|
-
} from "../chunk-
|
27
|
+
} from "../chunk-TOSMACJI.mjs";
|
28
28
|
import {
|
29
29
|
const_object_documentTypes
|
30
30
|
} from "../chunk-GFEMKKFH.mjs";
|
@@ -39,7 +39,7 @@ import {
|
|
39
39
|
baseAxios_default,
|
40
40
|
useQ_AQ_GetAQModule,
|
41
41
|
useQ_SkillCenter_GetAll
|
42
|
-
} from "../chunk-
|
42
|
+
} from "../chunk-QAIXZSQA.mjs";
|
43
43
|
import {
|
44
44
|
createGenericStore
|
45
45
|
} from "../chunk-Y3YGC5IH.mjs";
|