aloha-vue 1.1.5 → 1.1.6

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.
@@ -8,5 +8,9 @@ div
8
8
  :text="'_ADD_NOTIFICATION_{{type}}_'"
9
9
  :extra="{type: type}"
10
10
  @click="addNotificationLocal(type)"
11
- text="Open Modal"
12
11
  )
12
+ .a_mt_4
13
+ a-button.a_btn.a_btn_primary(
14
+ text="Object"
15
+ @click="addNotificationLocal({ sdf: 'x', abc: 'y', aloha: 'z' })"
16
+ )
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "Vue.js"
15
15
  ],
16
16
  "homepage": "https://github.com/ilia-brykin/aloha/#README.md",
17
- "version": "1.1.5",
17
+ "version": "1.1.6",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -3,8 +3,12 @@ import {
3
3
  ref,
4
4
  } from "vue";
5
5
 
6
+ import {
7
+ createListFromObject,
8
+ } from "../utils/utils";
6
9
  import {
7
10
  isNil,
11
+ isPlainObject,
8
12
  values,
9
13
  } from "lodash-es";
10
14
 
@@ -28,13 +32,17 @@ export function setNotificationTimeout(timeout) {
28
32
  notificationTimeout = timeout;
29
33
  }
30
34
 
31
- export function addNotification({ text, type = "success", timeout }) {
35
+ export function addNotification({ text, type = "success", timeout, useValuesFromObject = true }) {
32
36
  const TIMEOUT_LOCAL = isNil(timeout) ? notificationTimeout : timeout;
33
37
  const CURRENT_INDEX = notificationsCount;
34
38
  const TYPE = type === "error" ? "danger" : type;
39
+ let textLocal = text;
40
+ if (isPlainObject(text) && useValuesFromObject) {
41
+ textLocal = createListFromObject(text); // TODO: filterList
42
+ }
35
43
 
36
44
  notificationsObj.value[CURRENT_INDEX] = {
37
- text,
45
+ text: textLocal,
38
46
  type: TYPE,
39
47
  index: CURRENT_INDEX,
40
48
  };
@@ -47,3 +47,13 @@ export function concatenateTwoStringsWithSpace({ class1, class2, defaultValue =
47
47
  }
48
48
  return defaultValue;
49
49
  }
50
+
51
+ export function createListFromObject(obj) { // TODO: filterList, soll gelöscht werden
52
+ const keys = Object.keys(obj);
53
+ if (keys.length === 0) {
54
+ return "";
55
+ }
56
+
57
+ const items = keys.map(key => `<li>${ obj[key] }</li>`).join("");
58
+ return `<ul class="a_list_without_styles">${ items }</ul>`;
59
+ }