aq-fe-framework 0.1.581 → 0.1.583
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-XMZFBWJZ.mjs → chunk-KF3TBSGM.mjs} +7 -2
- package/dist/{chunk-ZGAQNIN2.mjs → chunk-PNUE345Y.mjs} +62 -4
- package/dist/{chunk-SGN4AFIG.mjs → chunk-TWGXCV4N.mjs} +1 -1
- package/dist/components/index.d.mts +3 -1
- package/dist/components/index.mjs +5 -1
- package/dist/core/index.mjs +3 -3
- package/dist/coreService/index.mjs +2 -2
- package/dist/modules-features/index.mjs +3 -3
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
MyFieldset,
|
|
4
4
|
MyFlexColumn,
|
|
5
5
|
MyFlexRow
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PNUE345Y.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useStore_Permission
|
|
9
9
|
} from "./chunk-PW6WTEVB.mjs";
|
|
@@ -197,12 +197,17 @@ var getActionConfig2 = (colorScheme) => ({
|
|
|
197
197
|
});
|
|
198
198
|
function MyButton(_a) {
|
|
199
199
|
var _b = _a, { children, actionType } = _b, rest = __objRest(_b, ["children", "actionType"]);
|
|
200
|
+
const currentPermission = useStore_Permission().state.currentPermissionPage;
|
|
200
201
|
const { colorScheme } = useMantineColorScheme2();
|
|
201
202
|
if (!actionType) {
|
|
202
203
|
return /* @__PURE__ */ jsx2(Button, __spreadProps(__spreadValues({}, rest), { children }));
|
|
203
204
|
}
|
|
204
205
|
const config = actionType ? getActionConfig2(colorScheme)[actionType] : {};
|
|
205
|
-
|
|
206
|
+
const shouldHide = (() => {
|
|
207
|
+
if (!actionType || !currentPermission) return false;
|
|
208
|
+
return actionType === "create" && currentPermission.isCreate === false || actionType === "update" && currentPermission.isUpdate === false || actionType === "delete" && currentPermission.isDelete === false || actionType === "print" && currentPermission.isPrint === false || actionType === "export" && currentPermission.isExport === false;
|
|
209
|
+
})();
|
|
210
|
+
return /* @__PURE__ */ jsx2(Button, __spreadValues(__spreadValues({ hidden: shouldHide }, config), rest));
|
|
206
211
|
}
|
|
207
212
|
|
|
208
213
|
// src/core/button/MyButtonCreateUpdate.tsx
|
|
@@ -1065,7 +1065,6 @@ function AQButtonExportData({
|
|
|
1065
1065
|
|
|
1066
1066
|
// src/components/Button/ButtonCRUD/MyButtonCreate.tsx
|
|
1067
1067
|
import { useDisclosure as useDisclosure7 } from "@mantine/hooks";
|
|
1068
|
-
import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
1069
1068
|
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1070
1069
|
function MyButtonCreate(_a) {
|
|
1071
1070
|
var _b = _a, {
|
|
@@ -1091,7 +1090,6 @@ function MyButtonCreate(_a) {
|
|
|
1091
1090
|
const permissionStore = useStore_Permission();
|
|
1092
1091
|
const defaultDisclosure = useDisclosure7();
|
|
1093
1092
|
const disclosure = externalDisclosure != null ? externalDisclosure : defaultDisclosure;
|
|
1094
|
-
const queryClient = useQueryClient3();
|
|
1095
1093
|
const mutation = useMyReactMutation({
|
|
1096
1094
|
axiosFn: (values) => {
|
|
1097
1095
|
const result = onSubmit(values);
|
|
@@ -1150,7 +1148,7 @@ function MyButtonCreate(_a) {
|
|
|
1150
1148
|
// src/components/Button/ButtonCRUD/MyButtonDeleteList.tsx
|
|
1151
1149
|
import { Group as Group5, Highlight as Highlight2 } from "@mantine/core";
|
|
1152
1150
|
import { useDisclosure as useDisclosure8 } from "@mantine/hooks";
|
|
1153
|
-
import { useMutation as useMutation2, useQueryClient as
|
|
1151
|
+
import { useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
1154
1152
|
import { useState as useState7 } from "react";
|
|
1155
1153
|
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1156
1154
|
function MyButtonDeleteList(_a) {
|
|
@@ -1165,7 +1163,7 @@ function MyButtonDeleteList(_a) {
|
|
|
1165
1163
|
"onError",
|
|
1166
1164
|
"contextData"
|
|
1167
1165
|
]);
|
|
1168
|
-
const queryClient =
|
|
1166
|
+
const queryClient = useQueryClient3();
|
|
1169
1167
|
const disc = useDisclosure8();
|
|
1170
1168
|
const loadingState = useState7();
|
|
1171
1169
|
const mutation = useMutation2({
|
|
@@ -7321,6 +7319,64 @@ function filterMenuByPermission(menuList, readablePageIds) {
|
|
|
7321
7319
|
return null;
|
|
7322
7320
|
}).filter((item) => item !== null);
|
|
7323
7321
|
}
|
|
7322
|
+
function getAllMenuWithPageId(menuList) {
|
|
7323
|
+
const result = [];
|
|
7324
|
+
const traverse = (items) => {
|
|
7325
|
+
for (const item of items) {
|
|
7326
|
+
if (item.pageId !== void 0) {
|
|
7327
|
+
result.push(item);
|
|
7328
|
+
}
|
|
7329
|
+
if (item.links && Array.isArray(item.links)) {
|
|
7330
|
+
traverse(item.links);
|
|
7331
|
+
}
|
|
7332
|
+
}
|
|
7333
|
+
};
|
|
7334
|
+
traverse(menuList);
|
|
7335
|
+
return result;
|
|
7336
|
+
}
|
|
7337
|
+
function generateEnumFromPageList(data, prefix = "") {
|
|
7338
|
+
const errors = [];
|
|
7339
|
+
data.forEach((item, index) => {
|
|
7340
|
+
if (item.pageId === 0 || item.pageId === void 0) {
|
|
7341
|
+
errors.push(`Item t\u1EA1i index ${index} c\xF3 pageId kh\xF4ng h\u1EE3p l\u1EC7: ${item.pageId}`);
|
|
7342
|
+
}
|
|
7343
|
+
if (!item.name) {
|
|
7344
|
+
errors.push(`Item t\u1EA1i index ${index} thi\u1EBFu name`);
|
|
7345
|
+
}
|
|
7346
|
+
});
|
|
7347
|
+
if (errors.length > 0) {
|
|
7348
|
+
throw new Error(`D\u1EEF li\u1EC7u kh\xF4ng h\u1EE3p l\u1EC7:
|
|
7349
|
+
- ${errors.join("\n- ")}`);
|
|
7350
|
+
}
|
|
7351
|
+
const validItems = data;
|
|
7352
|
+
const pageIdMap = {};
|
|
7353
|
+
for (const item of validItems) {
|
|
7354
|
+
if (!pageIdMap[item.pageId]) pageIdMap[item.pageId] = [];
|
|
7355
|
+
pageIdMap[item.pageId].push(item);
|
|
7356
|
+
}
|
|
7357
|
+
const duplicatedPageIds = Object.entries(pageIdMap).filter(([_5, items]) => items.length > 1).map(([id, items]) => `pageId ${id} d\xF9ng cho: ${items.map((i5) => `"${i5.name}"`).join(", ")}`);
|
|
7358
|
+
const nameMap = {};
|
|
7359
|
+
for (const item of validItems) {
|
|
7360
|
+
if (!nameMap[item.name]) nameMap[item.name] = [];
|
|
7361
|
+
nameMap[item.name].push(item);
|
|
7362
|
+
}
|
|
7363
|
+
const duplicatedNames = Object.entries(nameMap).filter(([_5, items]) => items.length > 1).map(([name, items]) => `name "${name}" d\xF9ng cho pageIds: ${items.map((i5) => i5.pageId).join(", ")}`);
|
|
7364
|
+
const allErrors = [...duplicatedPageIds, ...duplicatedNames];
|
|
7365
|
+
if (allErrors.length > 0) {
|
|
7366
|
+
throw new Error(`D\u1EEF li\u1EC7u kh\xF4ng h\u1EE3p l\u1EC7:
|
|
7367
|
+
- ${allErrors.join("\n- ")}`);
|
|
7368
|
+
}
|
|
7369
|
+
const enumLines = validItems.map((item) => {
|
|
7370
|
+
let key = item.name.replace(/[^a-zA-Z0-9]/g, "_").replace(/_{2,}/g, "_").replace(/^_|_$/g, "").toUpperCase();
|
|
7371
|
+
if (prefix) {
|
|
7372
|
+
key = `${prefix.toUpperCase()}_${key}`;
|
|
7373
|
+
}
|
|
7374
|
+
return ` ${key} = ${item.pageId},`;
|
|
7375
|
+
});
|
|
7376
|
+
return `export enum PageIdEnum {
|
|
7377
|
+
${enumLines.join("\n")}
|
|
7378
|
+
}`;
|
|
7379
|
+
}
|
|
7324
7380
|
|
|
7325
7381
|
// src/components/Layouts/BasicAppShell/BasicAppShell.tsx
|
|
7326
7382
|
import { jsx as jsx53, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
@@ -7852,6 +7908,8 @@ export {
|
|
|
7852
7908
|
findBreadcrumbPath,
|
|
7853
7909
|
getReadablePageIdSet,
|
|
7854
7910
|
filterMenuByPermission,
|
|
7911
|
+
getAllMenuWithPageId,
|
|
7912
|
+
generateEnumFromPageList,
|
|
7855
7913
|
BasicAppShell,
|
|
7856
7914
|
MyContainer,
|
|
7857
7915
|
useHeaderMegaMenuStore,
|
|
@@ -430,6 +430,8 @@ declare function useStore_BasicAppShell(): {
|
|
|
430
430
|
declare function findBreadcrumbPath(items: I_BasicAppShell_LinkItem[], currentPath: string, parents?: string[]): string[] | null;
|
|
431
431
|
declare function getReadablePageIdSet(permissions: IPagePermission[]): Set<number>;
|
|
432
432
|
declare function filterMenuByPermission(menuList: I_BasicAppShell_LinkItem[], readablePageIds: Set<number>): I_BasicAppShell_LinkItem[];
|
|
433
|
+
declare function getAllMenuWithPageId(menuList: I_BasicAppShell_LinkItem[]): I_BasicAppShell_LinkItem[];
|
|
434
|
+
declare function generateEnumFromPageList(data: I_BasicAppShell_LinkItem[], prefix?: string): string;
|
|
433
435
|
|
|
434
436
|
interface I$1 extends ContainerProps {
|
|
435
437
|
children?: ReactNode;
|
|
@@ -541,4 +543,4 @@ interface IMySkeletonTable extends SkeletonProps {
|
|
|
541
543
|
}
|
|
542
544
|
declare function MySkeletonTable({ h }: IMySkeletonTable): react_jsx_runtime.JSX.Element;
|
|
543
545
|
|
|
544
|
-
export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, AQStatCard2, BasicAppShell, BasicAppShellProps, Boxes, FaviconSetter, HeaderMegaMenu, type IAQCardProps, type IMyTextEditor, I_BasicAppShell_LinkItem, MyActionIcon, MyActionIconCheck, MyActionIconDelete, MyActionIconDownloadPDF, MyActionIconModal, MyActionIconUpdate, MyActionIconUpload, MyActionIconViewPDF, MyAnchorViewPDF, MyAppSpotlight, MyBoxesBackground, MyBoxesCore, MyButton, MyButtonCreate, MyButtonDeleteList, MyButtonImport, MyButtonModal, MyButtonPrintPDF, MyButtonPrintTablePDF, MyButtonRouterBack, MyButtonViewPDF, MyCalendar, MyCardInformation, MyCardioLoader, MyCenterFull, MyCheckbox, MyContainer, MyDataTable, type MyDataTableInternalProps, type MyDataTableProps, MyDataTableSelect, MyDateInput, MyFieldset, MyFileInput, MyFlexColumn, MyFlexEnd, MyFlexRow, MyHtmlWrapper, MyIconText, MyNumberFormatter, MyNumberInput, MyPageContent, MyScheduleX, MySelect, MySelectAPIGet, MySkeletonTable, MySwitchTheme, MyTab, MyTextArea, MyTextEditor, MyTextInput, SelectFieldModal, SelectFileModal, type SelectFileModalProps, filterMenuByPermission, findBreadcrumbPath, getReadablePageIdSet, useHeaderMegaMenuStore, useS_ButtonImport, useStore_BasicAppShell };
|
|
546
|
+
export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, AQStatCard2, BasicAppShell, BasicAppShellProps, Boxes, FaviconSetter, HeaderMegaMenu, type IAQCardProps, type IMyTextEditor, I_BasicAppShell_LinkItem, MyActionIcon, MyActionIconCheck, MyActionIconDelete, MyActionIconDownloadPDF, MyActionIconModal, MyActionIconUpdate, MyActionIconUpload, MyActionIconViewPDF, MyAnchorViewPDF, MyAppSpotlight, MyBoxesBackground, MyBoxesCore, MyButton, MyButtonCreate, MyButtonDeleteList, MyButtonImport, MyButtonModal, MyButtonPrintPDF, MyButtonPrintTablePDF, MyButtonRouterBack, MyButtonViewPDF, MyCalendar, MyCardInformation, MyCardioLoader, MyCenterFull, MyCheckbox, MyContainer, MyDataTable, type MyDataTableInternalProps, type MyDataTableProps, MyDataTableSelect, MyDateInput, MyFieldset, MyFileInput, MyFlexColumn, MyFlexEnd, MyFlexRow, MyHtmlWrapper, MyIconText, MyNumberFormatter, MyNumberInput, MyPageContent, MyScheduleX, MySelect, MySelectAPIGet, MySkeletonTable, MySwitchTheme, MyTab, MyTextArea, MyTextEditor, MyTextInput, SelectFieldModal, SelectFileModal, type SelectFileModalProps, filterMenuByPermission, findBreadcrumbPath, generateEnumFromPageList, getAllMenuWithPageId, getReadablePageIdSet, useHeaderMegaMenuStore, useS_ButtonImport, useStore_BasicAppShell };
|
|
@@ -62,11 +62,13 @@ import {
|
|
|
62
62
|
SelectFileModal,
|
|
63
63
|
filterMenuByPermission,
|
|
64
64
|
findBreadcrumbPath,
|
|
65
|
+
generateEnumFromPageList,
|
|
66
|
+
getAllMenuWithPageId,
|
|
65
67
|
getReadablePageIdSet,
|
|
66
68
|
useHeaderMegaMenuStore,
|
|
67
69
|
useS_ButtonImport,
|
|
68
70
|
useStore_BasicAppShell
|
|
69
|
-
} from "../chunk-
|
|
71
|
+
} from "../chunk-PNUE345Y.mjs";
|
|
70
72
|
import "../chunk-PW6WTEVB.mjs";
|
|
71
73
|
import "../chunk-5U2JSHSJ.mjs";
|
|
72
74
|
import "../chunk-OMJJAHOC.mjs";
|
|
@@ -138,6 +140,8 @@ export {
|
|
|
138
140
|
SelectFileModal,
|
|
139
141
|
filterMenuByPermission,
|
|
140
142
|
findBreadcrumbPath,
|
|
143
|
+
generateEnumFromPageList,
|
|
144
|
+
getAllMenuWithPageId,
|
|
141
145
|
getReadablePageIdSet,
|
|
142
146
|
useHeaderMegaMenuStore,
|
|
143
147
|
useS_ButtonImport,
|
package/dist/core/index.mjs
CHANGED
|
@@ -22,12 +22,12 @@ import {
|
|
|
22
22
|
MyStatsCard,
|
|
23
23
|
MyTextInput,
|
|
24
24
|
MyWeeklySessionSchedulerPicker
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-KF3TBSGM.mjs";
|
|
26
26
|
import "../chunk-GFEMKKFH.mjs";
|
|
27
27
|
import {
|
|
28
28
|
MyModalDelete
|
|
29
|
-
} from "../chunk-
|
|
30
|
-
import "../chunk-
|
|
29
|
+
} from "../chunk-TWGXCV4N.mjs";
|
|
30
|
+
import "../chunk-PNUE345Y.mjs";
|
|
31
31
|
import "../chunk-PW6WTEVB.mjs";
|
|
32
32
|
import "../chunk-5U2JSHSJ.mjs";
|
|
33
33
|
import "../chunk-OMJJAHOC.mjs";
|
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
MyButton as MyButton2,
|
|
16
16
|
MyTextInput as MyTextInput2
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-KF3TBSGM.mjs";
|
|
18
18
|
import {
|
|
19
19
|
const_object_documentTypes
|
|
20
20
|
} from "../chunk-GFEMKKFH.mjs";
|
|
21
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-TWGXCV4N.mjs";
|
|
22
22
|
import {
|
|
23
23
|
F_authenticate_Logout,
|
|
24
24
|
MyActionIconDelete,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
MyTab,
|
|
42
42
|
MyTextInput,
|
|
43
43
|
useS_authenticate
|
|
44
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-PNUE345Y.mjs";
|
|
45
45
|
import {
|
|
46
46
|
createGenericStore,
|
|
47
47
|
useStore_Permission
|