aq-fe-framework 0.1.582 → 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.
@@ -3,7 +3,7 @@ import {
3
3
  MyFieldset,
4
4
  MyFlexColumn,
5
5
  MyFlexRow
6
- } from "./chunk-ZTANJ4MB.mjs";
6
+ } from "./chunk-PNUE345Y.mjs";
7
7
  import {
8
8
  useStore_Permission
9
9
  } from "./chunk-PW6WTEVB.mjs";
@@ -7319,6 +7319,64 @@ function filterMenuByPermission(menuList, readablePageIds) {
7319
7319
  return null;
7320
7320
  }).filter((item) => item !== null);
7321
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
+ }
7322
7380
 
7323
7381
  // src/components/Layouts/BasicAppShell/BasicAppShell.tsx
7324
7382
  import { jsx as jsx53, jsxs as jsxs30 } from "react/jsx-runtime";
@@ -7850,6 +7908,8 @@ export {
7850
7908
  findBreadcrumbPath,
7851
7909
  getReadablePageIdSet,
7852
7910
  filterMenuByPermission,
7911
+ getAllMenuWithPageId,
7912
+ generateEnumFromPageList,
7853
7913
  BasicAppShell,
7854
7914
  MyContainer,
7855
7915
  useHeaderMegaMenuStore,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MyButton
3
- } from "./chunk-ZTANJ4MB.mjs";
3
+ } from "./chunk-PNUE345Y.mjs";
4
4
  import {
5
5
  __objRest,
6
6
  __spreadProps,
@@ -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-ZTANJ4MB.mjs";
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,
@@ -22,12 +22,12 @@ import {
22
22
  MyStatsCard,
23
23
  MyTextInput,
24
24
  MyWeeklySessionSchedulerPicker
25
- } from "../chunk-MQOXO6NB.mjs";
25
+ } from "../chunk-KF3TBSGM.mjs";
26
26
  import "../chunk-GFEMKKFH.mjs";
27
27
  import {
28
28
  MyModalDelete
29
- } from "../chunk-IXLNDX6O.mjs";
30
- import "../chunk-ZTANJ4MB.mjs";
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";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MyModalDelete
3
- } from "../chunk-IXLNDX6O.mjs";
4
- import "../chunk-ZTANJ4MB.mjs";
3
+ } from "../chunk-TWGXCV4N.mjs";
4
+ import "../chunk-PNUE345Y.mjs";
5
5
  import "../chunk-PW6WTEVB.mjs";
6
6
  import "../chunk-5U2JSHSJ.mjs";
7
7
  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-MQOXO6NB.mjs";
17
+ } from "../chunk-KF3TBSGM.mjs";
18
18
  import {
19
19
  const_object_documentTypes
20
20
  } from "../chunk-GFEMKKFH.mjs";
21
- import "../chunk-IXLNDX6O.mjs";
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-ZTANJ4MB.mjs";
44
+ } from "../chunk-PNUE345Y.mjs";
45
45
  import {
46
46
  createGenericStore,
47
47
  useStore_Permission
package/package.json CHANGED
@@ -50,7 +50,7 @@
50
50
  "types": "./dist/types/index.d.mts"
51
51
  }
52
52
  },
53
- "version": "0.1.582",
53
+ "version": "0.1.583",
54
54
  "private": false,
55
55
  "files": [
56
56
  "dist"