@deix/rossini-core 2.1.1 → 2.1.2

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 +1 @@
1
- {"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAsBtD,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAEL,MAAM,EACN,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAIrC,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AACD,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA+YnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAsBtD,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAEL,MAAM,EACN,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAIrC,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AACD,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAqZnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -47,6 +47,13 @@ const Sidebar = ({ links, open, isMobile, logo, onClose, }) => {
47
47
  if (sidebarItemOpen == undefined) {
48
48
  return null;
49
49
  }
50
+ // Function used to filter links that should not be displayed (because the
51
+ // user doesn't belong to the needed groups)
52
+ const isLinkVisible = (link) => {
53
+ return (!link.allowedGroups ||
54
+ link.allowedGroups.length < 1 ||
55
+ userInfo?.groups?.some((g) => link.allowedGroups?.includes(g)));
56
+ };
50
57
  // Function to generate sidebar items. To be called recursively
51
58
  const handler = (links, options) => {
52
59
  links.forEach((link) => {
@@ -65,9 +72,7 @@ const Sidebar = ({ links, open, isMobile, logo, onClose, }) => {
65
72
  return a.sidebarOrder > b.sidebarOrder ? 1 : -1;
66
73
  }
67
74
  })
68
- .filter((link) => !link.allowedGroups ||
69
- link.allowedGroups.length < 1 ||
70
- userInfo?.groups?.some((g) => link.allowedGroups?.includes(g)))
75
+ .filter(isLinkVisible)
71
76
  .map((link) => {
72
77
  const selected = pathname.startsWith(`${link.path}`);
73
78
  if (!link.subPages) {
@@ -158,6 +163,7 @@ const Sidebar = ({ links, open, isMobile, logo, onClose, }) => {
158
163
  return a.sidebarOrder > b.sidebarOrder ? 1 : -1;
159
164
  }
160
165
  })
166
+ .filter(isLinkVisible)
161
167
  .map((link) => {
162
168
  const selected = pathname.startsWith(link.path);
163
169
  if (link.subPages) {