@mapomodule/utils 1.0.0-alpha.45 → 1.0.0-alpha.49

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-alpha.49](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.48...v1.0.0-alpha.49) (2023-07-27)
7
+
8
+
9
+ ### Features
10
+
11
+ * added max-depth prop to menu manager to give the possibility of set a limit in depth for nesting ([e4ab7a1](https://github.com/lotrekagency/mapo/commit/e4ab7a137cbb392e709e8865404105d7707a7634))
12
+
13
+
14
+
15
+
16
+
6
17
  # [1.0.0-alpha.45](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.44...v1.0.0-alpha.45) (2023-06-10)
7
18
 
8
19
 
@@ -0,0 +1,15 @@
1
+ function calcMaxMenuNestDepth(node, currentDepth = 0) {
2
+ if (!node?.nodes || node?.nodes?.length === 0) {
3
+ return currentDepth;
4
+ }
5
+ let maxDepth = currentDepth;
6
+ for (const childNode of node.nodes) {
7
+ const childDepth = calcMaxMenuNestDepth(childNode, currentDepth + 1);
8
+ maxDepth = Math.max(maxDepth, childDepth);
9
+ }
10
+ return maxDepth;
11
+ }
12
+
13
+ module.exports = {
14
+ calcMaxMenuNestDepth
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapomodule/utils",
3
- "version": "1.0.0-alpha.45",
3
+ "version": "1.0.0-alpha.49",
4
4
  "license": "MIT",
5
5
  "description": "This is part of Mapo nuxt module. Provides a set of utils for the project.",
6
6
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
@@ -9,5 +9,5 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "gitHead": "14f60bfff75726de0f9353e601de37dc27143efd"
12
+ "gitHead": "5abcaf4c178b79ed2ad4ed555e22b5727cffa6fe"
13
13
  }