aloha-vue 1.2.76 → 1.2.78

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.
@@ -2,5 +2,5 @@
2
2
  "_PAGE_FILTER_LIMIT_TO_ARGUMENTS_TEXT_": "Der Eingangsstring, der beschnitten werden soll",
3
3
  "_PAGE_FILTER_LIMIT_TO_ARGUMENTS_LIMIT_": "Die maximale Länge des zurückgegebenen Strings",
4
4
  "_PAGE_FILTER_LIMIT_TO_ARGUMENTS_MAX_THREE_DOTS_": "Gibt an, ob maximal drei Punkten am Ende des Strings angezeigt werden",
5
- "_PAGE_FILTER_LIMIT_TO_DESCRIPTION_": "Die Funktion <strong>filterLimitTo</strong> dient dazu, einen Eingangsstring auf eine bestimmte maximale Länge zu beschränken und optional eine spezielle Punktelogik am Ende des Strings anzuwenden."
5
+ "_PAGE_FILTER_LIMIT_TO_DESCRIPTION_": "Die Funktion <strong>filterLimitTo</strong> dient dazu, einen Eingabestring auf eine bestimmte maximale Länge zu begrenzen und optional eine spezielle Logik für Auslassungspunkte am Ende des Strings anzuwenden."
6
6
  }
@@ -2,5 +2,5 @@
2
2
  "_PAGE_FILTER_LIMIT_TO_ARGUMENTS_TEXT_": "Входная строка, которую нужно обрезать",
3
3
  "_PAGE_FILTER_LIMIT_TO_ARGUMENTS_LIMIT_": "Максимальная длина возвращаемой строки",
4
4
  "_PAGE_FILTER_LIMIT_TO_ARGUMENTS_MAX_THREE_DOTS_": "Определяет, должны ли отображаться максимум три точки в конце строки",
5
- "_PAGE_FILTER_LIMIT_TO_DESCRIPTION_": "Функция <strong>filterLimitTo</strong> предназначена для ограничения входной строки определенной максимальной длиной и по желанию применения специальной логики точек в конце строки."
5
+ "_PAGE_FILTER_LIMIT_TO_DESCRIPTION_": "Функция <strong>filterLimitTo</strong> предназначена для ограничения входной строки определенной максимальной длиной и, по желанию, применения специальной логики многоточия в конце строки."
6
6
  }
@@ -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/jest.config.js CHANGED
@@ -3,14 +3,16 @@
3
3
 
4
4
  module.exports = {
5
5
  coverageDirectory: "coverage",
6
- moduleNameMapper: {
7
- "@/(.*)$": "<rootDir>/src/$1"
8
- },
9
- testEnvironment: "node",
10
- transform: {
11
- "^.+\\.jsx?$": "babel-jest"
12
- },
13
6
  transformIgnorePatterns: [
14
7
  "<rootDir>/node_modules/(?!lodash-es)"
15
8
  ],
9
+ globals: {},
10
+ testEnvironment: "jsdom",
11
+ testEnvironmentOptions: {
12
+ customExportConditions: ["node", "node-addons"],
13
+ },
14
+ transform: {
15
+ "^.+\\js$": "babel-jest"
16
+ },
17
+ moduleFileExtensions: ["vue", "js", "json", "jsx", "ts", "tsx", "node"]
16
18
  };
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.2.76",
17
+ "version": "1.2.78",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -55,6 +55,7 @@
55
55
  "@vue/test-utils": "^2.4.3",
56
56
  "eslint-plugin-jest": "^27.6.1",
57
57
  "jest": "^29.7.0",
58
+ "jest-environment-jsdom": "^29.7.0",
58
59
  "lodash": "^4.17.21",
59
60
  "@babel/cli": "^7.23.4",
60
61
  "@babel/core": "^7.23.7",
@@ -98,7 +98,7 @@ export default {
98
98
  withDirectives(h(this.labelTag), [
99
99
  [ASafeHtml, this.label]
100
100
  ]),
101
- this.hasChildren && h(AList, {
101
+ this.hasChildren ? h(AList, {
102
102
  classItem: this.classItem,
103
103
  classMain: this.classMain,
104
104
  data: this.children,
@@ -110,7 +110,7 @@ export default {
110
110
  labelTag: this.labelTag,
111
111
  listItemTag: this.listItemTag,
112
112
  tag: this.tag,
113
- }, this.$slots),
113
+ }, this.$slots) : "",
114
114
  ]);
115
115
  },
116
116
  };
@@ -0,0 +1,30 @@
1
+ import {
2
+ mount,
3
+ } from "@vue/test-utils";
4
+
5
+ import AList from "../AList";
6
+
7
+ describe("AList", () => {
8
+ test("displays message", () => {
9
+ const ITEMS = [
10
+ { label: "label 1" },
11
+ { label: "label 2" },
12
+ { label: "label 3" },
13
+ { label: "label 4" },
14
+ ];
15
+
16
+ const wrapper = mount(AList, {
17
+ props: {
18
+ data: ITEMS,
19
+ keyLabel: "label",
20
+ },
21
+ });
22
+ console.log("component.text()", wrapper.text());
23
+
24
+ // Assert the rendered text of the component
25
+ expect(wrapper.findAll("li")).toHaveLength(4);
26
+ expect(wrapper.text()).toContain("label 1label 2label 3label 4");
27
+ expect(wrapper.html({ raw: true })).toBe("<ul><li><span>label 1</span></li><li><span>label 2</span></li><li><span>label 3</span></li><li><span>label 4</span></li></ul>");
28
+ });
29
+ });
30
+
@@ -62,7 +62,7 @@ export default {
62
62
  buttonToggleClass: {
63
63
  type: [String, Object],
64
64
  required: false,
65
- default: "a_btn a_btn_secondary",
65
+ default: "a_btn a_btn_transparent_secondary a_btn_small",
66
66
  },
67
67
  buttonToggleProps: {
68
68
  type: Object,
@@ -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, extra }) {
35
+ export function addNotification({ text, type = "success", timeout, extra, 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
  extra,
@@ -2,31 +2,38 @@ import filterFileSize from "../filterFileSize.js";
2
2
 
3
3
  describe("filterFileSize", () => {
4
4
  test("default", () => {
5
- expect(filterFileSize(1024)).toBe("1,00 _A_FILE_SIZE_KB_");
6
- expect(filterFileSize(0)).toBe("0,00 _A_FILE_SIZE_KB_");
7
- expect(filterFileSize(500)).toBe("0,49 _A_FILE_SIZE_KB_");
8
- expect(filterFileSize(504547643)).toBe("492.722,31 _A_FILE_SIZE_KB_");
5
+ expect(filterFileSize(1024)).toBe("1,00 _A_FILE_SIZE_KB_");
6
+ expect(filterFileSize(0)).toBe("0,00 _A_FILE_SIZE_KB_");
7
+ expect(filterFileSize(500)).toBe("0,49 _A_FILE_SIZE_KB_");
8
+ expect(filterFileSize(504547643)).toBe("492.722,31 _A_FILE_SIZE_KB_");
9
9
  });
10
10
 
11
11
  test("units", () => {
12
- expect(filterFileSize(1048576, { units: "mb" })).toBe("1,00 _A_FILE_SIZE_MB_");
13
- expect(filterFileSize(0, { units: "mb" })).toBe("0,00 _A_FILE_SIZE_MB_");
14
- expect(filterFileSize(9226889999, { units: "gb" })).toBe("8,59 _A_FILE_SIZE_GB_");
15
- expect(filterFileSize(1024, { units: "" })).toBe("1,00 _A_FILE_SIZE_KB_");
16
- })
12
+ expect(filterFileSize(1048576, { units: "mb" })).toBe("1,00 _A_FILE_SIZE_MB_");
13
+ expect(filterFileSize(0, { units: "mb" })).toBe("0,00 _A_FILE_SIZE_MB_");
14
+ expect(filterFileSize(9226889999, { units: "gb" })).toBe("8,59 _A_FILE_SIZE_GB_");
15
+ expect(filterFileSize(1024, { units: "" })).toBe("1,00 _A_FILE_SIZE_KB_");
16
+ expect(filterFileSize(0, { units: "" })).toBe("0,00 _A_FILE_SIZE_B_");
17
+ });
17
18
 
18
19
  test("sourceUnits", () => {
19
- expect(filterFileSize(1, { units: "mb", sourceUnits: "mb"})).toBe("1,00 _A_FILE_SIZE_MB_");
20
- expect(filterFileSize(1, { units: "kb", sourceUnits: "gb"})).toBe("1.048.576,00 _A_FILE_SIZE_KB_");
21
- expect(filterFileSize(0, { sourceUnits: "mb" })).toBe("0,00 _A_FILE_SIZE_KB_");
22
- expect(filterFileSize(1024, { sourceUnits: "b" })).toBe("1,00 _A_FILE_SIZE_KB_");
23
- expect(filterFileSize(12, { units: "tb", sourceUnits: "pb" })).toBe("12.288,00 _A_FILE_SIZE_TB_");
24
- })
20
+ expect(filterFileSize(1, { units: "mb", sourceUnits: "mb" })).toBe("1,00 _A_FILE_SIZE_MB_");
21
+ expect(filterFileSize(1, { units: "kb", sourceUnits: "gb" })).toBe("1.048.576,00 _A_FILE_SIZE_KB_");
22
+ expect(filterFileSize(0, { sourceUnits: "mb" })).toBe("0,00 _A_FILE_SIZE_KB_");
23
+ expect(filterFileSize(1024, { sourceUnits: "b" })).toBe("1,00 _A_FILE_SIZE_KB_");
24
+ expect(filterFileSize(12, { units: "tb", sourceUnits: "pb" })).toBe("12.288,00 _A_FILE_SIZE_TB_");
25
+ });
26
+
25
27
  test("digits", () => {
26
- expect(filterFileSize(1024, { digits: 0})).toBe("1 _A_FILE_SIZE_KB_");
27
- expect(filterFileSize(500, { digits: 1})).toBe("0,5 _A_FILE_SIZE_KB_");
28
- })
28
+ expect(filterFileSize(1024, { digits: 0 })).toBe("1 _A_FILE_SIZE_KB_");
29
+ expect(filterFileSize(500, { digits: 1 })).toBe("0,5 _A_FILE_SIZE_KB_");
30
+ });
31
+
29
32
  test("combined", () => {
30
- expect(filterFileSize(133889, { units: "tb", sourceUnits: "mb", digits: 3})).toBe("0,128 _A_FILE_SIZE_TB_");
33
+ expect(filterFileSize(133889, { units: "tb", sourceUnits: "mb", digits: 3 })).toBe("0,128 _A_FILE_SIZE_TB_");
34
+ });
35
+
36
+ test("value (String)", () => {
37
+ expect(filterFileSize("1024.1")).toBe("1,00 _A_FILE_SIZE_KB_");
31
38
  });
32
- });
39
+ });
@@ -1,9 +1,10 @@
1
- import filterCurrency from "./filterCurrency";
1
+ import filterFloat from "./filterFloat";
2
2
  import {
3
3
  getTranslatedText,
4
4
  } from "../ATranslation/compositionAPI/UtilsAPI";
5
5
  import {
6
- isNumber,
6
+ isNaN,
7
+ toNumber,
7
8
  toUpper,
8
9
  } from "lodash-es";
9
10
 
@@ -20,26 +21,34 @@ export default function(value, { units = "kb", sourceUnits = "b", digits = 2 } =
20
21
  "zb",
21
22
  "yb",
22
23
  ];
24
+ const VALUE_NUMBER = toNumber(value);
25
+ if (isNaN(VALUE_NUMBER)) {
26
+ return "";
27
+ }
28
+
23
29
  const INDEX_SOURCE_UNITS = UNITS_ORDER.indexOf(sourceUnits);
24
30
  let indexUnits = UNITS_ORDER.indexOf(units);
25
31
  if (INDEX_SOURCE_UNITS === -1) {
26
32
  return "";
27
33
  }
28
- const VALUE_IN_BYTES = value * Math.pow(KB, INDEX_SOURCE_UNITS);
34
+ const VALUE_IN_BYTES = VALUE_NUMBER * Math.pow(KB, INDEX_SOURCE_UNITS);
29
35
  if (indexUnits === -1) {
30
36
  indexUnits = Math.floor(Math.log(VALUE_IN_BYTES) / Math.log(KB));
37
+ if (indexUnits < 0) {
38
+ indexUnits = 0;
39
+ }
31
40
  units = UNITS_ORDER[indexUnits];
32
41
  }
33
42
 
34
43
  const UNITS_TRANSLATED = getTranslatedText({ placeholder: `_A_FILE_SIZE_${ toUpper(units) }_` });
35
44
 
36
- if (!isNumber(value) || value === 0) {
37
- return filterCurrency(0, { suffix: UNITS_TRANSLATED, digits });
45
+ if (VALUE_NUMBER === 0) {
46
+ return filterFloat(0, { suffix: UNITS_TRANSLATED, digits });
38
47
  }
39
48
  if (INDEX_SOURCE_UNITS === indexUnits) {
40
- return filterCurrency(value, { suffix: UNITS_TRANSLATED, digits });
49
+ return filterFloat(VALUE_NUMBER, { suffix: UNITS_TRANSLATED, digits });
41
50
  }
42
51
  const size = VALUE_IN_BYTES / Math.pow(KB, Math.abs(indexUnits));
43
52
 
44
- return filterCurrency(size, { suffix: UNITS_TRANSLATED, digits });
53
+ return filterFloat(size, { suffix: UNITS_TRANSLATED, digits });
45
54
  }
@@ -14,18 +14,23 @@
14
14
  .a_menu_2 {
15
15
  --a_menu_2_width: var(--a_menu_2_width_expanded);
16
16
  --a_menu_2_top: 0;
17
- --a_menu_2_navbar_top_height: 65px;
18
- --a_menu_2_navbar_top_padding: .5rem;
17
+ --a_menu_2_navbar_top_height: 50px;
18
+ --a_menu_2_navbar_top_padding: .7rem .5rem .5rem .5rem;;
19
19
  --a_menu_2_navbar_top_margin_bottom: .5rem;
20
20
  --a_menu_2_background: var(--a_color_white);
21
21
  --a_menu_2_border_color: var(--a_color_gray_300);
22
+ --a_menu_2_box_shadow_color: var(--a_color_gray_600);
23
+ --a_menu_2_box_shadow_size: 2px 0 6px 1px;
22
24
  --a_menu_2_panel_child_offset: 100%;
23
25
  --a_menu_2_panel_parent_offset: -30%;
24
26
  --a_menu_2_panel_iconpanel_size: var(--a_menu_2_width_collapsed);
25
27
  --a_menu_2_panel_color: var(--a_color_gray_600);
28
+ --a_menu_2_panel_secondary_bg: var(--a_color_white);
29
+ --a_menu_2_panel_main_link_hover_color: var(--a_color_gray_900);
30
+ --a_menu_2_panel_main_link_hover_bg: var(--a_color_gray_300);
26
31
  --a_menu_2_link_color: var(--a_color_gray_900);
27
32
  --a_menu_2_link_hover_color: var(--a_color_gray_900);
28
- --a_menu_2_link_hover_bg: var(--a_color_gray_200);
33
+ --a_menu_2_link_hover_bg: var(--a_color_gray_300);
29
34
  --a_menu_2_listitem_padding: .3rem;
30
35
  --a_menu_2_listitem_panel_secondary_padding_x: .6rem;
31
36
  --a_menu_2_listitem_panel_secondary_padding_y: .3rem;
@@ -45,7 +50,7 @@
45
50
  --a_menu_2_submenu_open_color: var(--a_color_white);
46
51
  --a_menu_2_submenu_border_radius: 1rem;
47
52
  --a_menu_2_submenu_border_width: 2px;
48
- --a_menu_2_search_height: 50px;
53
+ --a_menu_2_search_height: auto;
49
54
  --a_menu_2_search_link_focus_size: inset 0 0 1px 2px;
50
55
  --a_menu_2_close_panel_width: 300px;
51
56
  --a_menu_2_close_panel_max_height: 400px;
@@ -69,6 +74,7 @@
69
74
  padding: 0;
70
75
  border-right: 1px solid var(--a_menu_2_border_color);
71
76
  z-index: 2;
77
+ box-shadow: var(--a_menu_2_box_shadow_size) var(--a_menu_2_box_shadow_color);
72
78
  }
73
79
  .a_menu_2__page {
74
80
  background-color: var(--a_menu_2_page_bg);
@@ -152,7 +158,7 @@
152
158
  }
153
159
  &:hover {
154
160
  outline: 0;
155
- color: var(--a_menu_2_link_color);
161
+ color: var(--a_menu_2_link_hover_color);
156
162
  background-color: var(--a_menu_2_link_hover_bg);
157
163
  }
158
164
  &.a_menu_2__link_active {
@@ -251,13 +257,13 @@
251
257
  }
252
258
 
253
259
  .a_menu_2__btn_toggle {
254
- --a_menu_2_btn_toggle_width: 50px;
255
- --a_menu_2_btn_toggle_height: 50px;
256
- --a_menu_2_btn_toggle_bar_width: 22px;
260
+ --a_menu_2_btn_toggle_width: 38px;
261
+ --a_menu_2_btn_toggle_height: 38px;
262
+ --a_menu_2_btn_toggle_bar_width: 18px;
257
263
  --a_menu_2_btn_toggle_bar_height: 2px;
258
- --a_menu_2_btn_toggle_bar_1_top: 18px;
264
+ --a_menu_2_btn_toggle_bar_1_top: 12px;
259
265
  --a_menu_2_btn_toggle_bar_2_top: calc(var(--a_menu_2_btn_toggle_height) / 2 - var(--a_menu_2_btn_toggle_bar_height) / 2);
260
- --a_menu_2_btn_toggle_bar_3_top: 30px;
266
+ --a_menu_2_btn_toggle_bar_3_top: 24px;
261
267
  --a_menu_2_btn_toggle_bar_bg: var(--a_btn_color, var(--a_color_white));
262
268
 
263
269
  height: var(--a_menu_2_btn_toggle_height);
@@ -419,6 +425,7 @@
419
425
  }
420
426
  .a_menu_2__panel_secondary {
421
427
  display: none;
428
+ background-color: var(--a_menu_2_panel_secondary_bg);
422
429
  &.a_menu_2__panel_opened {
423
430
  display: block;
424
431
  border-left: var(--a_menu_2_submenu_border_width) solid var(--a_menu_2_submenu_open_bg);
@@ -451,6 +458,10 @@
451
458
  }
452
459
  .a_menu_2__panel_main {
453
460
  position: relative;
461
+ .a_menu_2__link:hover {
462
+ --a_menu_2_link_hover_color: var(--a_menu_2_panel_main_link_hover_color);
463
+ --a_menu_2_link_hover_bg: var(--a_menu_2_panel_main_link_hover_bg);
464
+ }
454
465
  }
455
466
 
456
467
  // menu closed
@@ -65,3 +65,13 @@ export function isArrayOfArrays(array) {
65
65
 
66
66
  return every(array, isArray);
67
67
  }
68
+
69
+ export function createListFromObject(obj) { // TODO: filterList, soll gelöscht werden
70
+ const keys = Object.keys(obj);
71
+ if (keys.length === 0) {
72
+ return "";
73
+ }
74
+
75
+ const items = keys.map(key => `<li>${ obj[key] }</li>`).join("");
76
+ return `<ul class="a_list_without_styles">${ items }</ul>`;
77
+ }