aq-fe-framework 0.1.260 → 0.1.262

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.
@@ -1,4 +1,4 @@
1
- import { I as IBaseEntity } from './IAQModule-CIu1JdT0.mjs';
1
+ import { I as IBaseEntity } from './base-BprRafT5.mjs';
2
2
 
3
3
  interface IEmailConfig extends IBaseEntity {
4
4
  emailModule?: number;
@@ -1,12 +1,4 @@
1
- interface IBaseEntity {
2
- id?: number;
3
- code?: string;
4
- name?: string;
5
- concurrencyStamp?: string;
6
- isEnabled?: boolean;
7
- modifiedWhen?: string;
8
- modifiedFullName?: string;
9
- }
1
+ import { I as IBaseEntity } from './base-BprRafT5.mjs';
10
2
 
11
3
  interface IAQModule extends IBaseEntity {
12
4
  officelName?: string;
@@ -28,4 +20,4 @@ interface IAQModule extends IBaseEntity {
28
20
  };
29
21
  }
30
22
 
31
- export type { IBaseEntity as I, IAQModule as a };
23
+ export type { IAQModule as I };
@@ -0,0 +1,11 @@
1
+ interface IBaseEntity {
2
+ id?: number;
3
+ code?: string;
4
+ name?: string;
5
+ concurrencyStamp?: string;
6
+ isEnabled?: boolean;
7
+ modifiedWhen?: string;
8
+ modifiedFullName?: string;
9
+ }
10
+
11
+ export type { IBaseEntity as I };
@@ -89,8 +89,8 @@ function useMyReactMutation({
89
89
  options
90
90
  }) {
91
91
  return useMutation(__spreadValues({
92
- mutationFn: async (variables) => {
93
- const res = await axiosFn(variables);
92
+ mutationFn: async (values) => {
93
+ const res = await axiosFn(values);
94
94
  if (res.data.isSuccess == 0) throw new Error(res.data.message);
95
95
  return res.data.data;
96
96
  }
@@ -142,11 +142,11 @@ function useQ_SkillCenter_GetAll() {
142
142
  }
143
143
 
144
144
  export {
145
- baseAxios_default,
146
- useQ_AQ_GetAQModule,
147
145
  createBaseApi,
146
+ baseAxios_default,
148
147
  useLoadAxiosConfig,
149
148
  useMyReactMutation,
150
149
  useMyReactQuery,
150
+ useQ_AQ_GetAQModule,
151
151
  useQ_SkillCenter_GetAll
152
152
  };
@@ -6,8 +6,9 @@ import {
6
6
  } from "./chunk-K6S7R6LU.mjs";
7
7
  import {
8
8
  baseAxios_default,
9
+ useMyReactMutation,
9
10
  useQ_AQ_GetAQModule
10
- } from "./chunk-HMRYQTJT.mjs";
11
+ } from "./chunk-33OCBXSX.mjs";
11
12
  import {
12
13
  createGenericStore
13
14
  } from "./chunk-Y3YGC5IH.mjs";
@@ -1002,7 +1003,8 @@ function AQButtonExportData({
1002
1003
 
1003
1004
  // src/components/Buttons/ButtonCRUD/MyButtonCreate.tsx
1004
1005
  import { useDisclosure as useDisclosure7 } from "@mantine/hooks";
1005
- import { useMutation as useMutation4, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
1006
+ import { notifications } from "@mantine/notifications";
1007
+ import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
1006
1008
  import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
1007
1009
  function MyButtonCreate(_a) {
1008
1010
  var _b = _a, {
@@ -1027,24 +1029,37 @@ function MyButtonCreate(_a) {
1027
1029
  const defaultDisclosure = useDisclosure7();
1028
1030
  const disclosure = externalDisclosure != null ? externalDisclosure : defaultDisclosure;
1029
1031
  const queryClient = useQueryClient4();
1030
- const mutation = useMutation4({
1031
- mutationFn: async (values) => await onSubmit(values),
1032
- onSuccess: () => {
1033
- if (onSuccess) {
1034
- onSuccess();
1035
- }
1036
- queryClient.invalidateQueries();
1037
- utils_notification_show({ crudType: "create" });
1038
- disclosure[1].close();
1039
- if (notCloseModalWhenSubmit == false) {
1032
+ const mutation = useMyReactMutation({
1033
+ axiosFn: (values) => onSubmit(values),
1034
+ options: {
1035
+ onSuccess: () => {
1036
+ if (onSuccess) {
1037
+ onSuccess();
1038
+ }
1039
+ queryClient.invalidateQueries();
1040
+ utils_notification_show({ crudType: "create" });
1040
1041
  disclosure[1].close();
1042
+ if (notCloseModalWhenSubmit == false) {
1043
+ disclosure[1].close();
1044
+ }
1045
+ if (notResetFormWhenSubmit == false) {
1046
+ form.reset();
1047
+ }
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
+ });
1041
1062
  }
1042
- if (notResetFormWhenSubmit == false) {
1043
- form.reset();
1044
- }
1045
- },
1046
- onError: () => {
1047
- if (onError) onError();
1048
1063
  }
1049
1064
  });
1050
1065
  return /* @__PURE__ */ jsx21(MyButtonModal, __spreadProps(__spreadValues({ disclosure, crudType: "create" }, rest), { children: /* @__PURE__ */ jsx21("form", { onSubmit: form.onSubmit((values) => {
@@ -1058,7 +1073,7 @@ function MyButtonCreate(_a) {
1058
1073
  // src/components/Buttons/ButtonCRUD/MyButtonDeleteList.tsx
1059
1074
  import { Group as Group5, Highlight as Highlight2 } from "@mantine/core";
1060
1075
  import { useDisclosure as useDisclosure8 } from "@mantine/hooks";
1061
- import { useMutation as useMutation5, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
1076
+ import { useMutation as useMutation4, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
1062
1077
  import { useState as useState7 } from "react";
1063
1078
  import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
1064
1079
  function MyButtonDeleteList(_a) {
@@ -1076,7 +1091,7 @@ function MyButtonDeleteList(_a) {
1076
1091
  const queryClient = useQueryClient5();
1077
1092
  const disc = useDisclosure8();
1078
1093
  const loadingState = useState7();
1079
- const mutation = useMutation5({
1094
+ const mutation = useMutation4({
1080
1095
  mutationFn: async () => await onSubmit(),
1081
1096
  onSuccess: () => {
1082
1097
  if (onSuccess) {
@@ -5,6 +5,8 @@ import { useDisclosure, useListState } from '@mantine/hooks';
5
5
  import { UseFormReturnType, useForm } from '@mantine/form';
6
6
  import { I as I_BasicAppShell_LinkItem } from '../BasicAppShell-CGKvZ5wV.mjs';
7
7
  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';
8
10
  import { I as IUtils_Excel_ColumnConfig, a as IAQFileDetail } from '../utils_file-G8NTHCO-.mjs';
9
11
  import { MRT_ColumnDef, MRT_RowData, MRT_TableOptions, MRT_TableInstance } from 'mantine-react-table';
10
12
  import { ConfigOptions } from 'export-to-csv';
@@ -12,6 +14,7 @@ import { DateInputProps } from '@mantine/dates';
12
14
  import { EditorOptions } from '@tiptap/react';
13
15
  import { IconProps, Icon } from '@tabler/icons-react';
14
16
  import { CalendarEventExternal } from '@schedule-x/calendar';
17
+ import '../base-BprRafT5.mjs';
15
18
  import 'exceljs';
16
19
 
17
20
  declare const MyBoxesCore: ({ className, ...rest }: {
@@ -137,16 +140,16 @@ interface AQButtonExportDataProps {
137
140
  }
138
141
  declare function AQButtonExportData({ isAllData, objectName, data, exportConfig }: AQButtonExportDataProps): react_jsx_runtime.JSX.Element;
139
142
 
140
- interface IMyButtonCreate<T> extends Omit<ComponentProps<typeof MyButtonModal>, "disclosure" | "form" | "onSubmit"> {
141
- onSubmit: (values: T) => void;
143
+ interface IMyButtonCreate<IReq, IRes> extends Omit<ComponentProps<typeof MyButtonModal>, "disclosure" | "form" | "onSubmit"> {
144
+ onSubmit: (variables: IReq) => Promise<AxiosResponse<MyApiResponse<IRes>>>;
142
145
  onSuccess?: () => void;
143
146
  onError?: () => void;
144
- form: UseFormReturnType<T>;
147
+ form: UseFormReturnType<IReq>;
145
148
  notCloseModalWhenSubmit?: boolean;
146
149
  notResetFormWhenSubmit?: boolean;
147
150
  disclosure?: ReturnType<typeof useDisclosure>;
148
151
  }
149
- declare function MyButtonCreate<T>({ form, onSubmit, onSuccess, onError, notCloseModalWhenSubmit, notResetFormWhenSubmit, children, disclosure: externalDisclosure, ...rest }: IMyButtonCreate<T>): react_jsx_runtime.JSX.Element;
152
+ declare function MyButtonCreate<IReq, IRes>({ form, onSubmit, onSuccess, onError, notCloseModalWhenSubmit, notResetFormWhenSubmit, children, disclosure: externalDisclosure, ...rest }: IMyButtonCreate<IReq, IRes>): react_jsx_runtime.JSX.Element;
150
153
 
151
154
  interface IMyButtonDeleteList extends Omit<ComponentProps<typeof MyButtonModal>, "disclosure"> {
152
155
  onSubmit: () => void;
@@ -68,10 +68,10 @@ import {
68
68
  useS_BasicAppShell,
69
69
  useS_ButtonImport,
70
70
  utils_layout_getItemsWithoutLinks
71
- } from "../chunk-IE2L2KGO.mjs";
71
+ } from "../chunk-CC2N6SZ6.mjs";
72
72
  import "../chunk-NWBLJ3W3.mjs";
73
73
  import "../chunk-K6S7R6LU.mjs";
74
- import "../chunk-HMRYQTJT.mjs";
74
+ import "../chunk-33OCBXSX.mjs";
75
75
  import "../chunk-Y3YGC5IH.mjs";
76
76
  import "../chunk-5U2JSHSJ.mjs";
77
77
  import "../chunk-7ZCOFATU.mjs";
@@ -0,0 +1,21 @@
1
+ import * as axios from 'axios';
2
+ import { AxiosInstance } from 'axios';
3
+ import { I as IBaseEntity } from './base-BprRafT5.mjs';
4
+
5
+ interface MyApiResponse<IRes> {
6
+ isSuccess: 1 | 0;
7
+ message: string;
8
+ data: IRes;
9
+ }
10
+ declare function createBaseApi<T>(baseUrl: string, axiosInstance: AxiosInstance): {
11
+ getAll: ({ params }?: {
12
+ params?: string;
13
+ }) => Promise<axios.AxiosResponse<MyApiResponse<T[]>, any>>;
14
+ create: (data: Partial<T>) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
15
+ update: (data: Partial<T>) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
16
+ createOrUpdate: (data: Partial<T[]>) => Promise<axios.AxiosResponse<MyApiResponse<T[]>, any>>;
17
+ delete: (id: number) => Promise<axios.AxiosResponse<any, any>>;
18
+ deleteList: (values: IBaseEntity[]) => Promise<axios.AxiosResponse<any, any>>;
19
+ };
20
+
21
+ export { type MyApiResponse as M, createBaseApi as c };
@@ -1,31 +1,17 @@
1
- import * as axios from 'axios';
1
+ import { M as MyApiResponse } from '../createBaseApi-BJ2TH3XA.mjs';
2
+ export { c as createBaseApi } from '../createBaseApi-BJ2TH3XA.mjs';
2
3
  import { AxiosInstance, AxiosResponse } from 'axios';
3
- import { I as IBaseEntity, a as IAQModule } from '../IAQModule-CIu1JdT0.mjs';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { UseMutationOptions, QueryKey, UseQueryOptions } from '@tanstack/react-query';
6
-
7
- interface MyApiResponse<IRes> {
8
- isSuccess: 1 | 0;
9
- message: string;
10
- data: IRes;
11
- }
12
- declare function createBaseApi<T>(baseUrl: string, axiosInstance: AxiosInstance): {
13
- getAll: ({ params }?: {
14
- params?: string;
15
- }) => Promise<axios.AxiosResponse<MyApiResponse<T[]>, any>>;
16
- create: (data: Partial<T>) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
17
- update: (data: Partial<T>) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
18
- createOrUpdate: (data: Partial<T[]>) => Promise<axios.AxiosResponse<MyApiResponse<T[]>, any>>;
19
- delete: (id: number) => Promise<axios.AxiosResponse<any, any>>;
20
- deleteList: (values: IBaseEntity[]) => Promise<axios.AxiosResponse<any, any>>;
21
- };
6
+ import { I as IAQModule } from '../IAQModule-CCtwv-e0.mjs';
7
+ import '../base-BprRafT5.mjs';
22
8
 
23
9
  declare const useLoadAxiosConfig: ({ axiosInstance }: {
24
10
  axiosInstance: AxiosInstance;
25
11
  }) => void;
26
12
 
27
13
  interface MyReactMutationProps<IReq, IRes> {
28
- axiosFn: (variables: IReq) => Promise<AxiosResponse<MyApiResponse<IRes>>>;
14
+ axiosFn: (values: IReq) => Promise<AxiosResponse<MyApiResponse<IRes>>>;
29
15
  options?: UseMutationOptions<IRes, Error, IReq>;
30
16
  }
31
17
  declare function useMyReactMutation<IReq, IRes>({ axiosFn, options, }: MyReactMutationProps<IReq, IRes>): _tanstack_react_query.UseMutationResult<IRes, Error, IReq, unknown>;
@@ -39,4 +25,4 @@ declare function useMyReactQuery<IRes, IBody>({ queryKey, axiosFn, options }: My
39
25
 
40
26
  declare function useQ_AQ_GetAQModule(): _tanstack_react_query.UseQueryResult<IAQModule, Error>;
41
27
 
42
- export { type MyApiResponse, createBaseApi, useLoadAxiosConfig, useMyReactMutation, useMyReactQuery, useQ_AQ_GetAQModule };
28
+ export { MyApiResponse, useLoadAxiosConfig, useMyReactMutation, useMyReactQuery, useQ_AQ_GetAQModule };
@@ -4,7 +4,7 @@ import {
4
4
  useMyReactMutation,
5
5
  useMyReactQuery,
6
6
  useQ_AQ_GetAQModule
7
- } from "../chunk-HMRYQTJT.mjs";
7
+ } from "../chunk-33OCBXSX.mjs";
8
8
  import "../chunk-7ZCOFATU.mjs";
9
9
  import "../chunk-FWCSY2DS.mjs";
10
10
  export {
@@ -1,5 +1,6 @@
1
- export { a as IAQModule, I as IBaseEntity } from '../IAQModule-CIu1JdT0.mjs';
2
- export { I as IEmailConfig } from '../EmailConfig-JHRl7zGL.mjs';
1
+ export { I as IBaseEntity } from '../base-BprRafT5.mjs';
2
+ export { I as IEmailConfig } from '../EmailConfig-DvTXTBt3.mjs';
3
+ export { I as IAQModule } from '../IAQModule-CCtwv-e0.mjs';
3
4
 
4
5
  interface IAcademicYear {
5
6
  id?: number;
@@ -1,8 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { SelectProps } from '@mantine/core';
3
3
  import { I as I_BasicAppShell_LinkItem } from '../BasicAppShell-CGKvZ5wV.mjs';
4
- import { I as IBaseEntity, a as IAQModule } from '../IAQModule-CIu1JdT0.mjs';
5
- import { I as IEmailConfig } from '../EmailConfig-JHRl7zGL.mjs';
4
+ import { I as IBaseEntity } from '../base-BprRafT5.mjs';
5
+ import { I as IAQModule } from '../IAQModule-CCtwv-e0.mjs';
6
+ import { I as IEmailConfig } from '../EmailConfig-DvTXTBt3.mjs';
6
7
  import { ReactNode } from 'react';
7
8
 
8
9
  declare function F_core12196({ FormTypeId }: {
@@ -24,7 +24,7 @@ import {
24
24
  useS_BasicAppShell,
25
25
  useS_authenticate,
26
26
  utils_layout_getItemsWithoutLinks
27
- } from "../chunk-IE2L2KGO.mjs";
27
+ } from "../chunk-CC2N6SZ6.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-HMRYQTJT.mjs";
42
+ } from "../chunk-33OCBXSX.mjs";
43
43
  import {
44
44
  createGenericStore
45
45
  } from "../chunk-Y3YGC5IH.mjs";
package/package.json CHANGED
@@ -34,7 +34,7 @@
34
34
  "types": "./dist/enum/index.d.mts"
35
35
  }
36
36
  },
37
- "version": "0.1.260",
37
+ "version": "0.1.262",
38
38
  "private": false,
39
39
  "files": [
40
40
  "dist"