aloha-vue 1.0.99 → 1.0.101

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
3
  "description": "Project aloha",
4
- "version": "1.0.99",
4
+ "version": "1.0.101",
5
5
  "author": "Ilia Brykin",
6
6
  "scripts": {
7
7
  "build-icons": "node scriptsNode/iconsSvgToJs.js bootstrap3 && node scriptsNode/iconsSvgToJs.js bootstrap-1-9-1"
@@ -58,8 +58,8 @@ export default function AFiltersAPI() {
58
58
  return Link(value, { param, target });
59
59
  };
60
60
 
61
- const filterList = (value, { isHtml = true, listClass = "a_list_without_styles", keyLabel = "" } = {}) => {
62
- return list(value, { isHtml, listClass, keyLabel });
61
+ const filterList = (value, { isHtml = true, listClass = "a_list_without_styles", keyLabel = "", isListTree = false } = {}) => {
62
+ return list(value, { isHtml, listClass, keyLabel, isListTree });
63
63
  };
64
64
 
65
65
  const filterPropertyByValue = (value, { mapping = {}, defaultValue = "" } = {}) => {
@@ -4,7 +4,9 @@ import {
4
4
  get,
5
5
  } from "lodash-es";
6
6
 
7
- export default function(value, { isHtml = true, listClass = "a_list_without_styles", keyLabel = "" } = {}) {
7
+ export default filterList;
8
+
9
+ function filterList(value, { isHtml = true, listClass = "a_list_without_styles", keyLabel = "", isListTree = false } = {}) {
8
10
  if (!isArray(value)) {
9
11
  return value;
10
12
  }
@@ -20,8 +22,22 @@ export default function(value, { isHtml = true, listClass = "a_list_without_styl
20
22
  return result;
21
23
  }
22
24
  forEach(value, item => {
23
- const ITEM_TEXT = keyLabel ? get(item, keyLabel) : item;
24
- result += `<li>${ ITEM_TEXT }</li>`;
25
+ const ITEM = keyLabel ? get(item, keyLabel) : item;
26
+ if (isListTree && isArray(ITEM)) {
27
+ if (ITEM.length) {
28
+ result += `<li>`;
29
+ forEach(ITEM, itemChild => {
30
+ if (isArray(itemChild)) {
31
+ result += filterList(itemChild, { isHtml, listClass, keyLabel, isListTree });
32
+ } else {
33
+ result += itemChild;
34
+ }
35
+ });
36
+ result += `</li>`;
37
+ }
38
+ } else {
39
+ result += `<li>${ ITEM }</li>`;
40
+ }
25
41
  });
26
42
  return `<ul${ listClass ? ` class="${ listClass }"` : "" }>${ result }</ul>`;
27
43
  }