aq-fe-framework 0.1.506 → 0.1.507

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.
@@ -2,7 +2,7 @@ import {
2
2
  MyDataTable,
3
3
  MyFlexColumn,
4
4
  MyFlexRow
5
- } from "./chunk-KCYPNG4W.mjs";
5
+ } from "./chunk-3DR5DBS6.mjs";
6
6
  import {
7
7
  const_object_colors
8
8
  } from "./chunk-OMJJAHOC.mjs";
@@ -67,12 +67,12 @@ import {
67
67
  useS_BasicAppShell,
68
68
  useS_ButtonImport,
69
69
  utils_layout_getItemsWithoutLinks
70
- } from "../chunk-KCYPNG4W.mjs";
71
- import "../chunk-U62R2QKJ.mjs";
70
+ } from "../chunk-3DR5DBS6.mjs";
72
71
  import "../chunk-5U2JSHSJ.mjs";
73
72
  import "../chunk-OMJJAHOC.mjs";
74
73
  import "../chunk-5IELATPH.mjs";
75
74
  import "../chunk-7ZCOFATU.mjs";
75
+ import "../chunk-U62R2QKJ.mjs";
76
76
  import "../chunk-FWCSY2DS.mjs";
77
77
  export {
78
78
  AQButtonCreateByImportFile,
@@ -18,15 +18,15 @@ import {
18
18
  MyStatsCard,
19
19
  MyTextInput,
20
20
  MyWeeklySessionSchedulerPicker
21
- } from "../chunk-RVLIJK3A.mjs";
21
+ } from "../chunk-3EFZRJKN.mjs";
22
22
  import "../chunk-GFEMKKFH.mjs";
23
- import "../chunk-KCYPNG4W.mjs";
24
- import "../chunk-U62R2QKJ.mjs";
23
+ import "../chunk-3DR5DBS6.mjs";
25
24
  import "../chunk-5U2JSHSJ.mjs";
26
25
  import "../chunk-OMJJAHOC.mjs";
27
26
  import "../chunk-K6S7R6LU.mjs";
28
27
  import "../chunk-5IELATPH.mjs";
29
28
  import "../chunk-7ZCOFATU.mjs";
29
+ import "../chunk-U62R2QKJ.mjs";
30
30
  import "../chunk-FWCSY2DS.mjs";
31
31
  export {
32
32
  MyActionIcon,
@@ -6,6 +6,10 @@ import { I as IEmailConfig } from '../IEmailConfig-CioPObC1.mjs';
6
6
  import { I as IAQModule } from '../IAQModule-4U3n2emx.mjs';
7
7
  import { ReactNode } from 'react';
8
8
 
9
+ declare function Feat_accessControl({ menuData }: {
10
+ menuData: I_BasicAppShell_LinkItem[];
11
+ }): react_jsx_runtime.JSX.Element;
12
+
9
13
  declare function F_accessControl({ menuData }: {
10
14
  menuData: I_BasicAppShell_LinkItem[];
11
15
  }): react_jsx_runtime.JSX.Element;
@@ -43,6 +47,10 @@ declare function useS_accessControl(): {
43
47
  };
44
48
  declare function utils_accessControl_mergePage(arr1: I_accessControl_RolePermission[], arr2: I_accessControl_RolePermission[]): I_accessControl_RolePermission[];
45
49
 
50
+ declare function Feat_accessControlLevel({ menuData }: {
51
+ menuData: I_BasicAppShell_LinkItem[];
52
+ }): react_jsx_runtime.JSX.Element;
53
+
46
54
  declare function F_accessControlLevel({ menuData }: {
47
55
  menuData: I_BasicAppShell_LinkItem[];
48
56
  }): react_jsx_runtime.JSX.Element;
@@ -945,4 +953,4 @@ interface F_authenticate_Login_Props {
945
953
  }
946
954
  declare function F_authenticate_Login({ header, redirectUrlAfterLogin, additionalActions, backgroundImage, onSuccess, showLoginButton, showSaveLogin, showForgotPassword, customSubmit, loginButtonProps }: F_authenticate_Login_Props): react_jsx_runtime.JSX.Element;
947
955
 
948
- export { F_accessControl, F_accessControlLevel, F_accessControlLevel_ReadUser, F_accessControlLevel_Save, F_accessControlLevel_ViewMenuPermissions, F_accessControl_ReadUser, F_accessControl_Save, F_accessControl_ViewMenuPermissions, F_accountManagement, F_accountManagement_ChangePermission, F_accountManagement_Create, F_accountManagement_Delete, F_accountManagement_Read, F_accountManagement_Update, F_authenticate_Login, F_authenticate_Logout, F_authenticate_SplashPage, F_core12196, F_core12196_Create, F_core12196_Delete, F_core12196_Read, F_core12196_Update, F_core16209, F_core16209_Create, F_core16209_Delete, F_core16209_Update, F_core18256, F_core18256_Create, F_core18256_Delete, F_core18256_Read, F_core18256_Select, F_core18256_Update, F_core26965, F_core26965_Create, F_core26965_Delete, F_core26965_Update, F_core27311, F_core27311_Create, F_core27311_Delete, F_core27311_Read, F_core27311_Update, F_core35923, F_core40207, F_core40207_Create, F_core40207_Delete, F_core40207_Read, F_core40207_Update, F_core47643, F_core47643_Delete, F_core47643_Form, F_core47643_Read, F_core64229, F_core64229_Delete, F_core64229_Form, F_core64229_Read, F_core76318, F_core76318_Create, F_core76318_Delete, F_core76318_Update, F_documentCategories, F_documentCategories_Create, F_documentCategories_Delete, F_documentCategories_Read, F_documentCategories_Select, F_documentCategories_Update, F_formTemplateDocs, F_formTemplateDocs_Create, F_formTemplateDocs_Delete, F_formTemplateDocs_Read, F_formTemplateDocs_Update, F_mailConfig, F_mailConfig_CreateUpdate, F_mailConfig_Delete, F_mailConfig_Read, F_moduleConfig, F_organizationPolicyDocs, F_organizationPolicyDocs_Create, F_organizationPolicyDocs_Delete, F_organizationPolicyDocs_Update, F_pageContentConfig, F_roleCatalog, F_roleCatalog_Delete, F_roleCatalog_Form, F_roleCatalog_Read, F_securityPolicyDocs, F_securityPolicyDocs_Create, F_securityPolicyDocs_Delete, F_securityPolicyDocs_Update, F_systemUpdateDocs, F_systemUpdateDocs_Create, F_systemUpdateDocs_Delete, F_systemUpdateDocs_Update, F_userGuideDocs, F_userGuideDocs_Create, F_userGuideDocs_Delete, F_userGuideDocs_Read, F_userGuideDocs_Update, F_workflowProcessDocs, F_workflowProcessDocs_Create, F_workflowProcessDocs_Delete, F_workflowProcessDocs_Read, F_workflowProcessDocs_Update, type I_accessControl_RolePermission, type I_accountManagement_Read, type I_moduleConfig_AQModule, useS_accessControl, useS_authenticate, useS_moduleConfig, utils_accessControl_mergePage };
956
+ export { F_accessControl, F_accessControlLevel, F_accessControlLevel_ReadUser, F_accessControlLevel_Save, F_accessControlLevel_ViewMenuPermissions, F_accessControl_ReadUser, F_accessControl_Save, F_accessControl_ViewMenuPermissions, F_accountManagement, F_accountManagement_ChangePermission, F_accountManagement_Create, F_accountManagement_Delete, F_accountManagement_Read, F_accountManagement_Update, F_authenticate_Login, F_authenticate_Logout, F_authenticate_SplashPage, F_core12196, F_core12196_Create, F_core12196_Delete, F_core12196_Read, F_core12196_Update, F_core16209, F_core16209_Create, F_core16209_Delete, F_core16209_Update, F_core18256, F_core18256_Create, F_core18256_Delete, F_core18256_Read, F_core18256_Select, F_core18256_Update, F_core26965, F_core26965_Create, F_core26965_Delete, F_core26965_Update, F_core27311, F_core27311_Create, F_core27311_Delete, F_core27311_Read, F_core27311_Update, F_core35923, F_core40207, F_core40207_Create, F_core40207_Delete, F_core40207_Read, F_core40207_Update, F_core47643, F_core47643_Delete, F_core47643_Form, F_core47643_Read, F_core64229, F_core64229_Delete, F_core64229_Form, F_core64229_Read, F_core76318, F_core76318_Create, F_core76318_Delete, F_core76318_Update, F_documentCategories, F_documentCategories_Create, F_documentCategories_Delete, F_documentCategories_Read, F_documentCategories_Select, F_documentCategories_Update, F_formTemplateDocs, F_formTemplateDocs_Create, F_formTemplateDocs_Delete, F_formTemplateDocs_Read, F_formTemplateDocs_Update, F_mailConfig, F_mailConfig_CreateUpdate, F_mailConfig_Delete, F_mailConfig_Read, F_moduleConfig, F_organizationPolicyDocs, F_organizationPolicyDocs_Create, F_organizationPolicyDocs_Delete, F_organizationPolicyDocs_Update, F_pageContentConfig, F_roleCatalog, F_roleCatalog_Delete, F_roleCatalog_Form, F_roleCatalog_Read, F_securityPolicyDocs, F_securityPolicyDocs_Create, F_securityPolicyDocs_Delete, F_securityPolicyDocs_Update, F_systemUpdateDocs, F_systemUpdateDocs_Create, F_systemUpdateDocs_Delete, F_systemUpdateDocs_Update, F_userGuideDocs, F_userGuideDocs_Create, F_userGuideDocs_Delete, F_userGuideDocs_Read, F_userGuideDocs_Update, F_workflowProcessDocs, F_workflowProcessDocs_Create, F_workflowProcessDocs_Delete, F_workflowProcessDocs_Read, F_workflowProcessDocs_Update, Feat_accessControl, Feat_accessControlLevel, type I_accessControl_RolePermission, type I_accountManagement_Read, type I_moduleConfig_AQModule, useS_accessControl, useS_authenticate, useS_moduleConfig, utils_accessControl_mergePage };
@@ -3,7 +3,8 @@ import {
3
3
  updateEnableList,
4
4
  utils_config_getBaseUrl,
5
5
  utils_converter_enumToSelectOptions,
6
- utils_file_fileToAQDocumentType
6
+ utils_file_fileToAQDocumentType,
7
+ utils_mantineDataTable_filterColumns
7
8
  } from "../chunk-NIDKTA35.mjs";
8
9
  import {
9
10
  baseColumns
@@ -15,7 +16,7 @@ import {
15
16
  MyButton,
16
17
  MyDataTableSelectOne,
17
18
  MyTextInput as MyTextInput2
18
- } from "../chunk-RVLIJK3A.mjs";
19
+ } from "../chunk-3EFZRJKN.mjs";
19
20
  import {
20
21
  const_object_documentTypes
21
22
  } from "../chunk-GFEMKKFH.mjs";
@@ -44,10 +45,7 @@ import {
44
45
  groupToTwoLevels,
45
46
  useS_authenticate,
46
47
  utils_layout_getItemsWithoutLinks
47
- } from "../chunk-KCYPNG4W.mjs";
48
- import {
49
- createGenericStore
50
- } from "../chunk-U62R2QKJ.mjs";
48
+ } from "../chunk-3DR5DBS6.mjs";
51
49
  import "../chunk-5U2JSHSJ.mjs";
52
50
  import {
53
51
  const_object_colors
@@ -69,6 +67,9 @@ import {
69
67
  import {
70
68
  utils_notification_show
71
69
  } from "../chunk-7ZCOFATU.mjs";
70
+ import {
71
+ createGenericStore
72
+ } from "../chunk-U62R2QKJ.mjs";
72
73
  import {
73
74
  __objRest,
74
75
  __spreadProps,
@@ -91,9 +92,70 @@ import { useEffect } from "react";
91
92
  // src/module/Account/usecase/UseCase_AccountTable.tsx
92
93
  import { useMemo } from "react";
93
94
  import { jsx } from "react/jsx-runtime";
95
+ function UseCase_AccountTable(_a) {
96
+ var _b = _a, {
97
+ data,
98
+ visibleFields
99
+ } = _b, rest = __objRest(_b, [
100
+ "data",
101
+ "visibleFields"
102
+ ]);
103
+ const allColumns = useMemo(() => [
104
+ {
105
+ header: "H\u1ECD v\xE0 t\xEAn",
106
+ accessorKey: "userFullName",
107
+ size: 40
108
+ },
109
+ {
110
+ header: "Email",
111
+ accessorKey: "email"
112
+ },
113
+ ...baseColumns
114
+ ], []);
115
+ const columns = useMemo(() => {
116
+ return utils_mantineDataTable_filterColumns(allColumns, visibleFields);
117
+ }, [allColumns, visibleFields]);
118
+ return /* @__PURE__ */ jsx(
119
+ MyDataTable,
120
+ __spreadValues({
121
+ columns,
122
+ data
123
+ }, rest)
124
+ );
125
+ }
94
126
 
95
127
  // src/module/Account/adapter/Account_Table.tsx
96
128
  import { jsx as jsx2 } from "react/jsx-runtime";
129
+ function Account_Table(_a) {
130
+ var rest = __objRest(_a, []);
131
+ var _a2;
132
+ const query = useMyReactQuery({
133
+ queryKey: ["accounts"],
134
+ axiosFn: () => serivce_account.getAdminAccount()
135
+ });
136
+ useEffect(() => {
137
+ var _a3, _b;
138
+ if (!query.data) return;
139
+ (_b = rest.setIdSelectionOne) == null ? void 0 : _b.call(rest, (_a3 = query.data[0].id) == null ? void 0 : _a3.toString());
140
+ }, [query.data]);
141
+ return /* @__PURE__ */ jsx2(
142
+ UseCase_AccountTable,
143
+ __spreadValues({
144
+ data: ((_a2 = query.data) == null ? void 0 : _a2.map((item) => ({
145
+ id: item.id,
146
+ code: item.code,
147
+ name: item.name,
148
+ userFullName: item.fullName,
149
+ email: item.email,
150
+ concurrencyStamp: item.concurrencyStamp,
151
+ modifiedFullName: item.modifiedFullName,
152
+ modifiedWhen: item.modifiedWhen
153
+ }))) || [],
154
+ isLoading: query.isLoading,
155
+ isError: query.isError
156
+ }, rest)
157
+ );
158
+ }
97
159
 
98
160
  // src/api/services/service_role.ts
99
161
  var CONTROLLER2 = "/role";
@@ -124,6 +186,48 @@ var service_role = __spreadProps(__spreadValues({}, createBaseApi(CONTROLLER2, b
124
186
  // src/module/Permission/adapter/Permission_SaveMenuPermission.tsx
125
187
  import { notifications } from "@mantine/notifications";
126
188
  import { jsx as jsx3 } from "react/jsx-runtime";
189
+ function Permission_SaveMenuPermission({
190
+ roleOrUserId,
191
+ isUserPermission,
192
+ values
193
+ }) {
194
+ const mutation = useMyReactMutation({
195
+ axiosFn: (values2) => {
196
+ if (isUserPermission) return service_role.updateUserPermission({
197
+ pagePermissions: values2,
198
+ userId: roleOrUserId
199
+ });
200
+ return service_role.updatePermission({
201
+ pagePermissions: values2,
202
+ roleId: roleOrUserId
203
+ });
204
+ },
205
+ options: {
206
+ onSuccess: () => {
207
+ notifications.show({
208
+ message: "L\u01B0u th\xE0nh c\xF4ng!"
209
+ });
210
+ }
211
+ }
212
+ });
213
+ return /* @__PURE__ */ jsx3(
214
+ MyButton,
215
+ {
216
+ onClick: () => {
217
+ mutation.mutate((values == null ? void 0 : values.filter((item) => item.id != "0").map((item) => ({
218
+ pageId: parseInt(item.id),
219
+ isCreate: item.isCreate,
220
+ isUpdate: item.isUpdate,
221
+ isDelete: item.isDelete,
222
+ isPrint: item.isPrint,
223
+ isExport: item.isExport || false,
224
+ isRead: item.isRead
225
+ }))) || []);
226
+ },
227
+ actionType: "save"
228
+ }
229
+ );
230
+ }
127
231
 
128
232
  // src/data/menuData.ts
129
233
  var menuData = [
@@ -165,14 +269,219 @@ import { Center, Checkbox, Flex, Paper, ScrollArea, Skeleton, Stack, Table, Text
165
269
  import { IconEye, IconFileExport, IconPencil, IconPlus, IconPrinter, IconTrash } from "@tabler/icons-react";
166
270
  import React from "react";
167
271
  import { jsx as jsx4, jsxs } from "react/jsx-runtime";
272
+ var actionType = [
273
+ { text: "Xem", icon: /* @__PURE__ */ jsx4(IconEye, {}), iconColor: "gray" },
274
+ { text: "Th\xEAm", icon: /* @__PURE__ */ jsx4(IconPlus, {}), iconColor: "blue" },
275
+ { text: "S\u1EEDa", icon: /* @__PURE__ */ jsx4(IconPencil, {}), iconColor: "yellow" },
276
+ { text: "X\xF3a", icon: /* @__PURE__ */ jsx4(IconTrash, {}), iconColor: "red" },
277
+ { text: "In", icon: /* @__PURE__ */ jsx4(IconPrinter, {}), iconColor: "cyan" },
278
+ { text: "Xu\u1EA5t", icon: /* @__PURE__ */ jsx4(IconFileExport, {}), iconColor: "green" }
279
+ ];
280
+ var permissionKeys = [
281
+ "isRead",
282
+ "isCreate",
283
+ "isUpdate",
284
+ "isDelete",
285
+ "isPrint",
286
+ "isExport"
287
+ ];
288
+ function UseCase_PermissionViewCheckTable({ value = [], onChange, isLoading }) {
289
+ const handleCheckboxChange = (menuIndex, key) => {
290
+ const updated = [...value];
291
+ const current = updated[menuIndex][key];
292
+ updated[menuIndex][key] = !current;
293
+ onChange == null ? void 0 : onChange(updated);
294
+ };
295
+ const handleCheckAllAction = (key, checked) => {
296
+ const updated = structuredClone(value);
297
+ updated.forEach((menu) => {
298
+ menu[key] = checked;
299
+ });
300
+ onChange == null ? void 0 : onChange(updated);
301
+ };
302
+ const getDuplicateMenuIds = (data = []) => {
303
+ const allIds = data.map((menu) => menu.id).filter(Boolean);
304
+ const countMap = /* @__PURE__ */ new Map();
305
+ for (const id of allIds) {
306
+ countMap.set(id, (countMap.get(id) || 0) + 1);
307
+ }
308
+ return new Set([...countMap.entries()].filter(([_, count]) => count > 1).map(([id]) => id));
309
+ };
310
+ const groupMenusByTitle = (menus) => {
311
+ const map = /* @__PURE__ */ new Map();
312
+ menus.forEach((menu) => {
313
+ const key = menu.groupTitle || "Ch\u01B0a ph\xE2n nh\xF3m";
314
+ if (!map.has(key)) map.set(key, []);
315
+ map.get(key).push(menu);
316
+ });
317
+ return Array.from(map.entries());
318
+ };
319
+ const duplicateIds = getDuplicateMenuIds(value);
320
+ const groupedMenus = groupMenusByTitle(value);
321
+ return /* @__PURE__ */ jsx4(Paper, { children: /* @__PURE__ */ jsx4(ScrollArea, { children: isLoading ? /* @__PURE__ */ jsxs(Table, { children: [
322
+ /* @__PURE__ */ jsx4(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
323
+ /* @__PURE__ */ jsx4(Table.Th, { children: /* @__PURE__ */ jsx4(Skeleton, { height: 12, width: "80%" }) }),
324
+ Array.from({ length: permissionKeys.length }).map((_, idx) => /* @__PURE__ */ jsx4(Table.Th, { children: /* @__PURE__ */ jsx4(Skeleton, { height: 12, width: 40 }) }, idx))
325
+ ] }) }),
326
+ /* @__PURE__ */ jsx4(Table.Tbody, { children: Array.from({ length: 5 }).map((_, rowIdx) => /* @__PURE__ */ jsxs(Table.Tr, { children: [
327
+ /* @__PURE__ */ jsx4(Table.Td, { children: /* @__PURE__ */ jsx4(Skeleton, { height: 14, width: "60%" }) }),
328
+ Array.from({ length: permissionKeys.length }).map((_2, colIdx) => /* @__PURE__ */ jsx4(Table.Td, { children: /* @__PURE__ */ jsx4(Skeleton, { height: 16, circle: true }) }, colIdx))
329
+ ] }, rowIdx)) })
330
+ ] }) : /* @__PURE__ */ jsxs(Table, { children: [
331
+ /* @__PURE__ */ jsx4(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
332
+ /* @__PURE__ */ jsx4(Table.Th, { children: "Danh s\xE1ch ch\u1EE9c n\u0103ng" }),
333
+ actionType.map((item, idx) => {
334
+ const key = permissionKeys[idx];
335
+ const allChecked = value.every((menu) => menu[key]);
336
+ return /* @__PURE__ */ jsx4(Table.Th, { children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: 4, children: [
337
+ /* @__PURE__ */ jsx4(
338
+ Checkbox,
339
+ {
340
+ checked: allChecked,
341
+ onChange: (e) => handleCheckAllAction(key, e.currentTarget.checked)
342
+ }
343
+ ),
344
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", align: "center", gap: "sm", children: [
345
+ /* @__PURE__ */ jsx4(Text, { size: "xs", children: item.text }),
346
+ item.icon
347
+ ] })
348
+ ] }) }, idx);
349
+ })
350
+ ] }) }),
351
+ /* @__PURE__ */ jsx4(Table.Tbody, { children: groupedMenus.map(([groupTitle, menus], gIdx) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
352
+ /* @__PURE__ */ jsx4(Table.Tr, { bg: const_object_colors.mantineBackgroundBlueLight, children: /* @__PURE__ */ jsx4(Table.Td, { fw: "bold", fs: "italic", colSpan: 7, children: groupTitle }) }),
353
+ menus.map((menu, mIdx) => {
354
+ const menuIndex = value.indexOf(menu);
355
+ const isDuplicate = menu.id && duplicateIds.has(menu.id);
356
+ return /* @__PURE__ */ jsxs(Table.Tr, { bg: isDuplicate ? "red.1" : void 0, children: [
357
+ /* @__PURE__ */ jsx4(Table.Td, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
358
+ menu.name,
359
+ isDuplicate && /* @__PURE__ */ jsxs(Text, { size: "xs", color: "red", children: [
360
+ "ID tr\xF9ng: ",
361
+ menu.id
362
+ ] })
363
+ ] }) }),
364
+ permissionKeys.map((key, pIdx) => {
365
+ var _a;
366
+ return /* @__PURE__ */ jsx4(Table.Td, { children: /* @__PURE__ */ jsx4(Center, { children: /* @__PURE__ */ jsx4(
367
+ Checkbox,
368
+ {
369
+ checked: (_a = menu[key]) != null ? _a : false,
370
+ onChange: () => handleCheckboxChange(menuIndex, key)
371
+ }
372
+ ) }) }, pIdx);
373
+ })
374
+ ] }, mIdx);
375
+ })
376
+ ] }, gIdx)) })
377
+ ] }) }) });
378
+ }
168
379
 
169
380
  // src/module/Permission/adapter/Permission_ViewCheckMenuPermission.tsx
170
381
  import { jsx as jsx5 } from "react/jsx-runtime";
382
+ function Permission_ViewCheckMenuPermission({
383
+ value,
384
+ onChange,
385
+ roleOrUserId,
386
+ isUserPermission
387
+ }) {
388
+ const rolePermissionQuery = useMyReactQuery({
389
+ queryKey: ["rolePermissions", roleOrUserId],
390
+ axiosFn: () => {
391
+ if (isUserPermission) return service_role.getUserPermission({ userId: roleOrUserId });
392
+ return service_role.getRolePermission({ roleId: roleOrUserId });
393
+ }
394
+ });
395
+ const isLoadingState = useState(true);
396
+ function mergePermissionsType(menus, permissions) {
397
+ return menus.map((menu) => {
398
+ const matchedPermission = permissions.find((p) => {
399
+ var _a;
400
+ return ((_a = p.pageId) == null ? void 0 : _a.toString()) === menu.id;
401
+ });
402
+ return __spreadProps(__spreadValues({}, menu), {
403
+ isRead: (matchedPermission == null ? void 0 : matchedPermission.isRead) || false,
404
+ isUpdate: (matchedPermission == null ? void 0 : matchedPermission.isUpdate) || false,
405
+ isDelete: (matchedPermission == null ? void 0 : matchedPermission.isDelete) || false,
406
+ isCreate: (matchedPermission == null ? void 0 : matchedPermission.isCreate) || false,
407
+ isPrint: (matchedPermission == null ? void 0 : matchedPermission.isPrint) || false,
408
+ isExport: (matchedPermission == null ? void 0 : matchedPermission.isExport) || false
409
+ });
410
+ });
411
+ }
412
+ function extractMenusWithRootGroupTitle(data, rootGroupTitle) {
413
+ const result = [];
414
+ for (const item of data) {
415
+ const currentRoot = rootGroupTitle || item.label;
416
+ if (item.links && item.links.length > 0) {
417
+ const children = extractMenusWithRootGroupTitle(item.links, currentRoot);
418
+ result.push(...children);
419
+ }
420
+ if (item.link && item.pageId !== void 0) {
421
+ result.push({
422
+ id: item.pageId.toString(),
423
+ name: item.label,
424
+ groupTitle: rootGroupTitle
425
+ // group theo menu gốc lớn nhất
426
+ });
427
+ }
428
+ }
429
+ return result;
430
+ }
431
+ useEffect2(() => {
432
+ if (!rolePermissionQuery.data) return;
433
+ const flattenMenu = extractMenusWithRootGroupTitle(menuData);
434
+ const menuMerged = mergePermissionsType(flattenMenu, rolePermissionQuery.data);
435
+ onChange == null ? void 0 : onChange(menuMerged);
436
+ isLoadingState[1](false);
437
+ }, [rolePermissionQuery.data]);
438
+ return /* @__PURE__ */ jsx5(
439
+ UseCase_PermissionViewCheckTable,
440
+ {
441
+ isLoading: isLoadingState[0],
442
+ value,
443
+ onChange
444
+ }
445
+ );
446
+ }
171
447
 
172
448
  // src/modules-features/admin/core/accessControl/Feat_accessControl.tsx
173
449
  import { Grid, Stack as Stack2 } from "@mantine/core";
174
450
  import { useState as useState2 } from "react";
175
451
  import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
452
+ function Feat_accessControl({ menuData: menuData2 }) {
453
+ const accountIdState = useState2();
454
+ const memuPermissionState = useState2();
455
+ return /* @__PURE__ */ jsxs2(Grid, { children: [
456
+ /* @__PURE__ */ jsx6(Grid.Col, { span: { base: 12, md: 5 }, children: /* @__PURE__ */ jsx6(
457
+ Account_Table,
458
+ {
459
+ idSelectionOne: accountIdState[0],
460
+ setIdSelectionOne: accountIdState[1]
461
+ }
462
+ ) }),
463
+ /* @__PURE__ */ jsx6(Grid.Col, { span: { base: 12, md: 7 }, children: /* @__PURE__ */ jsxs2(Stack2, { children: [
464
+ /* @__PURE__ */ jsx6(
465
+ Permission_ViewCheckMenuPermission,
466
+ {
467
+ isUserPermission: true,
468
+ roleOrUserId: parseInt(accountIdState[0]),
469
+ value: memuPermissionState[0],
470
+ onChange: memuPermissionState[1],
471
+ menuDataRoot: menuData2
472
+ }
473
+ ),
474
+ /* @__PURE__ */ jsx6(
475
+ Permission_SaveMenuPermission,
476
+ {
477
+ isUserPermission: true,
478
+ roleOrUserId: parseInt(accountIdState[0]),
479
+ values: memuPermissionState[0]
480
+ }
481
+ )
482
+ ] }) })
483
+ ] });
484
+ }
176
485
 
177
486
  // src/modules-features/admin/core/accessControl/old/F_accessControl.tsx
178
487
  import { Grid as Grid2, Paper as Paper2, ScrollArea as ScrollArea3 } from "@mantine/core";
@@ -575,14 +884,101 @@ import { useEffect as useEffect5 } from "react";
575
884
  // src/module/Role/usecase/UseCase_RoleTable.tsx
576
885
  import { useMemo as useMemo3 } from "react";
577
886
  import { jsx as jsx11 } from "react/jsx-runtime";
887
+ function UseCase_RoleTable(_a) {
888
+ var _b = _a, {
889
+ data,
890
+ visibleFields
891
+ } = _b, rest = __objRest(_b, [
892
+ "data",
893
+ "visibleFields"
894
+ ]);
895
+ const allColumns = useMemo3(() => [
896
+ {
897
+ header: "M\xE3 quy\u1EC1n",
898
+ accessorKey: "code",
899
+ size: 40
900
+ },
901
+ {
902
+ header: "T\xEAn quy\u1EC1n",
903
+ accessorKey: "name"
904
+ },
905
+ ...baseColumns
906
+ ], []);
907
+ const columns = useMemo3(() => {
908
+ return utils_mantineDataTable_filterColumns(allColumns, visibleFields);
909
+ }, [allColumns, visibleFields]);
910
+ return /* @__PURE__ */ jsx11(
911
+ MyDataTable,
912
+ __spreadValues({
913
+ columns,
914
+ data
915
+ }, rest)
916
+ );
917
+ }
578
918
 
579
919
  // src/module/Role/adapter/Role_Table.tsx
580
920
  import { jsx as jsx12 } from "react/jsx-runtime";
921
+ function Role_Table(_a) {
922
+ var rest = __objRest(_a, []);
923
+ var _a2;
924
+ const adminRoleQuery = useMyReactQuery({
925
+ queryKey: ["roles"],
926
+ axiosFn: () => service_role.getAdminRole()
927
+ });
928
+ useEffect5(() => {
929
+ var _a3, _b;
930
+ if (!adminRoleQuery.data) return;
931
+ (_b = rest.setIdSelectionOne) == null ? void 0 : _b.call(rest, (_a3 = adminRoleQuery.data[0].id) == null ? void 0 : _a3.toString());
932
+ }, [adminRoleQuery.data]);
933
+ return /* @__PURE__ */ jsx12(
934
+ UseCase_RoleTable,
935
+ __spreadValues({
936
+ data: ((_a2 = adminRoleQuery.data) == null ? void 0 : _a2.map((item) => ({
937
+ id: item.id,
938
+ code: item.code,
939
+ name: item.name
940
+ }))) || [],
941
+ isError: adminRoleQuery.isError,
942
+ isLoading: adminRoleQuery.isLoading
943
+ }, rest)
944
+ );
945
+ }
581
946
 
582
947
  // src/modules-features/admin/core/accessControlLevel/Feat_accessControlLevel.tsx
583
948
  import { Grid as Grid3, Stack as Stack3 } from "@mantine/core";
584
949
  import { useState as useState5 } from "react";
585
950
  import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
951
+ function Feat_accessControlLevel({ menuData: menuData2 }) {
952
+ const accountIdState = useState5();
953
+ const memuPermissionState = useState5();
954
+ return /* @__PURE__ */ jsxs5(Grid3, { children: [
955
+ /* @__PURE__ */ jsx13(Grid3.Col, { span: { base: 12, md: 5 }, children: /* @__PURE__ */ jsx13(
956
+ Role_Table,
957
+ {
958
+ idSelectionOne: accountIdState[0],
959
+ setIdSelectionOne: accountIdState[1]
960
+ }
961
+ ) }),
962
+ /* @__PURE__ */ jsx13(Grid3.Col, { span: { base: 12, md: 7 }, children: /* @__PURE__ */ jsxs5(Stack3, { children: [
963
+ /* @__PURE__ */ jsx13(
964
+ Permission_ViewCheckMenuPermission,
965
+ {
966
+ roleOrUserId: parseInt(accountIdState[0]),
967
+ value: memuPermissionState[0],
968
+ onChange: memuPermissionState[1],
969
+ menuDataRoot: menuData2
970
+ }
971
+ ),
972
+ /* @__PURE__ */ jsx13(
973
+ Permission_SaveMenuPermission,
974
+ {
975
+ roleOrUserId: parseInt(accountIdState[0]),
976
+ values: memuPermissionState[0]
977
+ }
978
+ )
979
+ ] }) })
980
+ ] });
981
+ }
586
982
 
587
983
  // src/modules-features/admin/core/accessControlLevel/old/F_accessControlLevel.tsx
588
984
  import { Grid as Grid4, Paper as Paper3, ScrollArea as ScrollArea5 } from "@mantine/core";
@@ -5911,6 +6307,8 @@ export {
5911
6307
  F_workflowProcessDocs_Delete,
5912
6308
  F_workflowProcessDocs_Read,
5913
6309
  F_workflowProcessDocs_Update,
6310
+ Feat_accessControl,
6311
+ Feat_accessControlLevel,
5914
6312
  useS_accessControl,
5915
6313
  useS_authenticate,
5916
6314
  useS_moduleConfig,
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "types": "./dist/columns/index.d.mts"
43
43
  }
44
44
  },
45
- "version": "0.1.506",
45
+ "version": "0.1.507",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"
@@ -1,6 +1,3 @@
1
- import {
2
- createGenericStore
3
- } from "./chunk-U62R2QKJ.mjs";
4
1
  import {
5
2
  utils_pdf_download
6
3
  } from "./chunk-5U2JSHSJ.mjs";
@@ -15,6 +12,9 @@ import {
15
12
  import {
16
13
  utils_notification_show
17
14
  } from "./chunk-7ZCOFATU.mjs";
15
+ import {
16
+ createGenericStore
17
+ } from "./chunk-U62R2QKJ.mjs";
18
18
  import {
19
19
  __objRest,
20
20
  __spreadProps,