aq-fe-framework 0.1.596 → 0.1.598

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.
@@ -194,6 +194,7 @@ import { useQueryClient } from "@tanstack/react-query";
194
194
  import { notifications } from "@mantine/notifications";
195
195
  import { useMutation, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
196
196
  function useMyReactMutation({
197
+ isPrototype,
197
198
  axiosFn,
198
199
  options,
199
200
  mutationType = "create",
@@ -204,6 +205,9 @@ function useMyReactMutation({
204
205
  const queryClient = useQueryClient2();
205
206
  return useMutation(__spreadProps(__spreadValues({
206
207
  mutationFn: async (values) => {
208
+ if (isPrototype) {
209
+ return [];
210
+ }
207
211
  const res = await axiosFn(values);
208
212
  if (res.data.isSuccess == 0) throw new Error(res.data.message);
209
213
  return res.data.data;
@@ -14,7 +14,7 @@ import {
14
14
  baseAxios_default,
15
15
  useMyReactMutation,
16
16
  useQ_AQ_GetAQModule
17
- } from "./chunk-5NR2OP5O.mjs";
17
+ } from "./chunk-AR64BQSX.mjs";
18
18
  import {
19
19
  utils_notification_show
20
20
  } from "./chunk-7ZCOFATU.mjs";
@@ -477,7 +477,7 @@ function MyActionIconDelete(_a) {
477
477
  {
478
478
  crudType: "delete",
479
479
  onClick: handleCLick,
480
- loading: loadingState[0]
480
+ loading: mutation.isPending
481
481
  }
482
482
  ),
483
483
  /* @__PURE__ */ jsx10(
@@ -575,7 +575,8 @@ function MyActionIconUpdate(_a) {
575
575
  MyButton,
576
576
  {
577
577
  type: "submit",
578
- crudType: "save"
578
+ crudType: "save",
579
+ loading: mutation.isPending
579
580
  }
580
581
  )
581
582
  ] }) })
@@ -1139,7 +1140,7 @@ function MyButtonCreate(_a) {
1139
1140
  mutation.mutate(values);
1140
1141
  }), children: /* @__PURE__ */ jsxs11(MyFlexColumn, { children: [
1141
1142
  children,
1142
- /* @__PURE__ */ jsx21(MyButton, { type: "submit", crudType: "save" })
1143
+ /* @__PURE__ */ jsx21(MyButton, { type: "submit", crudType: "save", loading: mutation.isPending })
1143
1144
  ] }) })
1144
1145
  })
1145
1146
  );
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MyButton
3
- } from "./chunk-VGZ2UE3K.mjs";
3
+ } from "./chunk-BCTZIPA2.mjs";
4
4
  import {
5
5
  __objRest,
6
6
  __spreadProps,
@@ -3,7 +3,7 @@ import {
3
3
  MyFieldset,
4
4
  MyFlexColumn,
5
5
  MyFlexRow
6
- } from "./chunk-VGZ2UE3K.mjs";
6
+ } from "./chunk-BCTZIPA2.mjs";
7
7
  import {
8
8
  useStore_Permission
9
9
  } from "./chunk-PW6WTEVB.mjs";
@@ -17,7 +17,7 @@ import {
17
17
  baseAxios_default,
18
18
  useMyReactMutation,
19
19
  useMyReactQuery
20
- } from "./chunk-5NR2OP5O.mjs";
20
+ } from "./chunk-AR64BQSX.mjs";
21
21
  import {
22
22
  utils_notification_show
23
23
  } from "./chunk-7ZCOFATU.mjs";
@@ -6,7 +6,7 @@ import { AxiosResponse } from 'axios';
6
6
  import { M as MyApiResponse } from '../createBaseApi-75GHCO22.mjs';
7
7
  import { useDisclosure, useListState } from '@mantine/hooks';
8
8
  import { UseFormReturnType, useForm } from '@mantine/form';
9
- import { M as MyReactMutationProps } from '../useMyReactMutation-DdCNebJI.mjs';
9
+ import { M as MyReactMutationProps } from '../useMyReactMutation-CqcrOOF9.mjs';
10
10
  import { I as I_BasicAppShell_LinkItem, B as BasicAppShellProps } from '../types-DcfN8y1h.mjs';
11
11
  import { I as IUtils_Excel_ColumnConfig } from '../utils_excel-BYB9qbHd.mjs';
12
12
  import { MRT_ColumnDef, MRT_RowData, MRT_TableOptions, MRT_TableInstance } from 'mantine-react-table';
@@ -68,12 +68,12 @@ import {
68
68
  useHeaderMegaMenuStore,
69
69
  useS_ButtonImport,
70
70
  useStore_BasicAppShell
71
- } from "../chunk-VGZ2UE3K.mjs";
71
+ } from "../chunk-BCTZIPA2.mjs";
72
72
  import "../chunk-PW6WTEVB.mjs";
73
73
  import "../chunk-5COIJ2CE.mjs";
74
74
  import "../chunk-EWDS5IOF.mjs";
75
75
  import "../chunk-OMJJAHOC.mjs";
76
- import "../chunk-5NR2OP5O.mjs";
76
+ import "../chunk-AR64BQSX.mjs";
77
77
  import "../chunk-WZ6PXGGC.mjs";
78
78
  import "../chunk-7ZCOFATU.mjs";
79
79
  import "../chunk-FWCSY2DS.mjs";
@@ -6,7 +6,7 @@ import { UseFormReturnType } from '@mantine/form';
6
6
  import { AxiosResponse } from 'axios';
7
7
  import { M as MyApiResponse } from '../createBaseApi-75GHCO22.mjs';
8
8
  import { useDisclosure } from '@mantine/hooks';
9
- import { M as MyReactMutationProps } from '../useMyReactMutation-DdCNebJI.mjs';
9
+ import { M as MyReactMutationProps } from '../useMyReactMutation-CqcrOOF9.mjs';
10
10
  import { UseReactToPrintOptions } from 'react-to-print';
11
11
  import { UseQueryResult, QueryKey, UseQueryOptions } from '@tanstack/react-query';
12
12
  import { MRT_RowData, MRT_ColumnDef } from 'mantine-react-table';
@@ -22,18 +22,18 @@ import {
22
22
  MyStatsCard,
23
23
  MyTextInput,
24
24
  MyWeeklySessionSchedulerPicker
25
- } from "../chunk-TM5KDO5S.mjs";
25
+ } from "../chunk-S4K4K3X3.mjs";
26
26
  import "../chunk-GFEMKKFH.mjs";
27
27
  import {
28
28
  MyModalDelete
29
- } from "../chunk-YXBTBZCE.mjs";
30
- import "../chunk-VGZ2UE3K.mjs";
29
+ } from "../chunk-GFW64WZ2.mjs";
30
+ import "../chunk-BCTZIPA2.mjs";
31
31
  import "../chunk-PW6WTEVB.mjs";
32
32
  import "../chunk-5COIJ2CE.mjs";
33
33
  import "../chunk-EWDS5IOF.mjs";
34
34
  import "../chunk-OMJJAHOC.mjs";
35
35
  import "../chunk-K6S7R6LU.mjs";
36
- import "../chunk-5NR2OP5O.mjs";
36
+ import "../chunk-AR64BQSX.mjs";
37
37
  import "../chunk-WZ6PXGGC.mjs";
38
38
  import "../chunk-7ZCOFATU.mjs";
39
39
  import "../chunk-FWCSY2DS.mjs";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  MyModalDelete
3
- } from "../chunk-YXBTBZCE.mjs";
4
- import "../chunk-VGZ2UE3K.mjs";
3
+ } from "../chunk-GFW64WZ2.mjs";
4
+ import "../chunk-BCTZIPA2.mjs";
5
5
  import "../chunk-PW6WTEVB.mjs";
6
6
  import "../chunk-5COIJ2CE.mjs";
7
7
  import "../chunk-EWDS5IOF.mjs";
8
8
  import "../chunk-OMJJAHOC.mjs";
9
9
  import {
10
10
  useMyReactMutation
11
- } from "../chunk-5NR2OP5O.mjs";
11
+ } from "../chunk-AR64BQSX.mjs";
12
12
  import "../chunk-WZ6PXGGC.mjs";
13
13
  import "../chunk-7ZCOFATU.mjs";
14
14
  import {
@@ -7,7 +7,7 @@ import { M as MyApiResponse } from '../createBaseApi-75GHCO22.mjs';
7
7
  export { I as IPagingParams, c as createBaseApi } from '../createBaseApi-75GHCO22.mjs';
8
8
  import * as next_dist_shared_lib_app_router_context_shared_runtime from 'next/dist/shared/lib/app-router-context.shared-runtime';
9
9
  import * as React from 'react';
10
- export { M as MyReactMutationProps, u as useMyReactMutation } from '../useMyReactMutation-DdCNebJI.mjs';
10
+ export { M as MyReactMutationProps, u as useMyReactMutation } from '../useMyReactMutation-CqcrOOF9.mjs';
11
11
  import { I as IAQModule } from '../IAQModule-4U3n2emx.mjs';
12
12
  import '../IBaseEntity-ChMy9RzQ.mjs';
13
13
  import '../type_mutation-CCtnyeP3.mjs';
@@ -8,7 +8,7 @@ import {
8
8
  useMyReactQuery,
9
9
  useMyRouter,
10
10
  useQ_AQ_GetAQModule
11
- } from "../chunk-5NR2OP5O.mjs";
11
+ } from "../chunk-AR64BQSX.mjs";
12
12
  import "../chunk-WZ6PXGGC.mjs";
13
13
  import "../chunk-7ZCOFATU.mjs";
14
14
  import "../chunk-FWCSY2DS.mjs";
@@ -7,11 +7,11 @@ import {
7
7
  MyRichTextEditor,
8
8
  MySelect as MySelect2,
9
9
  MyTextInput as MyTextInput2
10
- } from "../chunk-TM5KDO5S.mjs";
10
+ } from "../chunk-S4K4K3X3.mjs";
11
11
  import {
12
12
  const_object_documentTypes
13
13
  } from "../chunk-GFEMKKFH.mjs";
14
- import "../chunk-YXBTBZCE.mjs";
14
+ import "../chunk-GFW64WZ2.mjs";
15
15
  import {
16
16
  F_authenticate_Logout,
17
17
  MyActionIconDelete,
@@ -34,7 +34,7 @@ import {
34
34
  MyTab,
35
35
  MyTextInput,
36
36
  useS_authenticate
37
- } from "../chunk-VGZ2UE3K.mjs";
37
+ } from "../chunk-BCTZIPA2.mjs";
38
38
  import {
39
39
  createGenericStore,
40
40
  useStore_Permission
@@ -67,7 +67,7 @@ import {
67
67
  useMyRouter,
68
68
  useQ_AQ_GetAQModule,
69
69
  useQ_SkillCenter_GetAll
70
- } from "../chunk-5NR2OP5O.mjs";
70
+ } from "../chunk-AR64BQSX.mjs";
71
71
  import "../chunk-WZ6PXGGC.mjs";
72
72
  import {
73
73
  utils_notification_show
@@ -187,6 +187,13 @@ var service_role = __spreadProps(__spreadValues({}, createBaseApi(CONTROLLER2, b
187
187
  },
188
188
  addUser: (params, roleIds) => {
189
189
  return baseAxios_default.post(CONTROLLER2 + "/AddUser", { params, body: roleIds });
190
+ },
191
+ addUsers: (params, userIds) => {
192
+ return baseAxios_default.post(
193
+ CONTROLLER2 + "/AddUsers",
194
+ userIds,
195
+ { params }
196
+ );
190
197
  }
191
198
  });
192
199
 
@@ -4388,7 +4395,7 @@ function F_pageContentConfig_Save({ menuValues }) {
4388
4395
  return service_pageContent.updateList([{ id: 1 }]);
4389
4396
  }
4390
4397
  });
4391
- return /* @__PURE__ */ jsx91(MyButton2, { actionType: "save", onClick: () => updatePageConfigMutation.mutate({}) });
4398
+ return /* @__PURE__ */ jsx91(MyButton2, { actionType: "save", onClick: () => updatePageConfigMutation.mutate() });
4392
4399
  }
4393
4400
 
4394
4401
  // src/modules-features/admin/core/pageContentConfig/F_pageContentConfig_ReadMenu.tsx
@@ -4808,6 +4815,7 @@ function Adapter_UserTable(_a) {
4808
4815
  return /* @__PURE__ */ jsx104(
4809
4816
  UseCase_UserTable,
4810
4817
  __spreadValues({
4818
+ getRowId: (row) => row.id,
4811
4819
  data: ((_a2 = adminAccountQuery.data) == null ? void 0 : _a2.map(mapper_user.mapToDomain)) || []
4812
4820
  }, rest)
4813
4821
  );
@@ -4823,15 +4831,8 @@ function Adapter_UserAddToRole({
4823
4831
  const disc = useDisclosure2();
4824
4832
  const userSelectedId = useState7({});
4825
4833
  const mutation = useMyReactMutation({
4826
- axiosFn: async ({ userId: roleId2 }) => {
4827
- return {
4828
- data: {
4829
- isSuccess: 1,
4830
- message: "Gi\u1EA3 l\u1EADp",
4831
- data: []
4832
- // <-- `void` hợp lệ
4833
- }
4834
- };
4834
+ axiosFn: async ({ userIds, roleId: roleId2 }) => {
4835
+ return service_role.addUsers({ roleId: roleId2 }, userIds);
4835
4836
  },
4836
4837
  successNotification: "Th\xEAm ng\u01B0\u1EDDi d\xF9ng v\xE0o nh\xF3m quy\u1EC1n th\xE0nh c\xF4ng! (Gi\u1EA3 l\u1EADp)",
4837
4838
  options: {
@@ -4860,7 +4861,7 @@ function Adapter_UserAddToRole({
4860
4861
  actionType: "select",
4861
4862
  onClick: () => mutation.mutate({
4862
4863
  roleId,
4863
- userId: Object.keys(userSelectedId[0]).map(Number)
4864
+ userIds: Object.keys(userSelectedId[0]).map(Number)
4864
4865
  })
4865
4866
  }
4866
4867
  )
@@ -4882,6 +4883,7 @@ import { Tabs as Tabs3 } from "@mantine/core";
4882
4883
  import { useDisclosure as useDisclosure3 } from "@mantine/hooks";
4883
4884
  import { jsx as jsx107, jsxs as jsxs59 } from "react/jsx-runtime";
4884
4885
  function Feat_CreateUpdateRole({ values }) {
4886
+ const isUpdate = values != void 0;
4885
4887
  const disc = useDisclosure3();
4886
4888
  return /* @__PURE__ */ jsx107(
4887
4889
  MyButtonModal2,
@@ -4890,18 +4892,23 @@ function Feat_CreateUpdateRole({ values }) {
4890
4892
  buttonProps: { actionType: "create" },
4891
4893
  actionIconProps: { actionType: "update" },
4892
4894
  modalProps: { size: "80%", title: "Chi ti\u1EBFt nh\xF3m t\xE0i kho\u1EA3n" },
4893
- isActionIcon: !!values,
4895
+ isActionIcon: isUpdate,
4894
4896
  children: /* @__PURE__ */ jsxs59(Tabs3, { defaultValue: "gallery", children: [
4895
4897
  /* @__PURE__ */ jsxs59(Tabs3.List, { children: [
4896
4898
  /* @__PURE__ */ jsx107(Tabs3.Tab, { value: "gallery", children: "Th\xF4ng tin chung" }),
4897
- /* @__PURE__ */ jsx107(Tabs3.Tab, { value: "messages", children: "Danh s\xE1ch th\xE0nh vi\xEAn" })
4899
+ /* @__PURE__ */ jsx107(Tabs3.Tab, { value: "messages", hidden: !isUpdate, children: "Danh s\xE1ch th\xE0nh vi\xEAn" })
4898
4900
  ] }),
4899
4901
  /* @__PURE__ */ jsx107(Tabs3.Panel, { value: "gallery", pt: "md", children: /* @__PURE__ */ jsx107(Adapter_RoleForm, { onSuccess: disc[1].close, values }) }),
4900
4902
  /* @__PURE__ */ jsx107(Tabs3.Panel, { value: "messages", pt: "md", children: /* @__PURE__ */ jsx107(MyFieldset, { title: "Danh s\xE1ch t\xE0i kho\u1EA3n ng\u01B0\u1EDDi d\xF9ng thu\u1ED9c nh\xF3m", children: /* @__PURE__ */ jsx107(
4901
4903
  Adapter_UserTable,
4902
4904
  {
4903
4905
  visibleFields: ["code", "userFullName", "unit"],
4904
- renderTopToolbarCustomActions: () => /* @__PURE__ */ jsx107(Adapter_UserAddToRole, { roleId: 2 }),
4906
+ renderTopToolbarCustomActions: () => /* @__PURE__ */ jsx107(
4907
+ Adapter_UserAddToRole,
4908
+ {
4909
+ roleId: Number(values == null ? void 0 : values.id)
4910
+ }
4911
+ ),
4905
4912
  renderRowActions: () => /* @__PURE__ */ jsx107(MyCenterFull, { children: /* @__PURE__ */ jsx107(Adapter_UserDelete, {}) })
4906
4913
  }
4907
4914
  ) }) })
@@ -4,7 +4,8 @@ import { t as type_mutation } from './type_mutation-CCtnyeP3.mjs';
4
4
  import { AxiosResponse } from 'axios';
5
5
  import { M as MyApiResponse } from './createBaseApi-75GHCO22.mjs';
6
6
 
7
- interface MyReactMutationProps<IReq, IRes> {
7
+ interface MyReactMutationProps<IReq = void, IRes = void> {
8
+ isPrototype?: boolean;
8
9
  axiosFn: (values: IReq) => Promise<AxiosResponse<MyApiResponse<IRes>>>;
9
10
  options?: UseMutationOptions<IRes, Error, IReq>;
10
11
  mutationType?: type_mutation;
@@ -12,6 +13,6 @@ interface MyReactMutationProps<IReq, IRes> {
12
13
  enableDefaultError?: boolean;
13
14
  successNotification?: string;
14
15
  }
15
- declare function useMyReactMutation<IReq, IRes>({ axiosFn, options, mutationType, enableDefaultSuccess, enableDefaultError, successNotification }: MyReactMutationProps<IReq, IRes>): _tanstack_react_query.UseMutationResult<IRes, Error, IReq, unknown>;
16
+ declare function useMyReactMutation<IReq = void, IRes = void>({ isPrototype, axiosFn, options, mutationType, enableDefaultSuccess, enableDefaultError, successNotification }: MyReactMutationProps<IReq, IRes>): _tanstack_react_query.UseMutationResult<IRes, Error, IReq, unknown>;
16
17
 
17
18
  export { type MyReactMutationProps as M, useMyReactMutation as u };
package/package.json CHANGED
@@ -50,7 +50,7 @@
50
50
  "types": "./dist/types/index.d.mts"
51
51
  }
52
52
  },
53
- "version": "0.1.596",
53
+ "version": "0.1.598",
54
54
  "private": false,
55
55
  "files": [
56
56
  "dist"