aloha-vue 1.2.190 → 1.2.191

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.
@@ -5,6 +5,7 @@ import PageGroupButtonDropdownActionsClasses from "./PageGroupButtonDropdownActi
5
5
  import PageGroupButtonDropdownBasic from "./PageGroupButtonDropdownBasic/PageGroupButtonDropdownBasic.vue";
6
6
  import PageGroupButtonDropdownDisabled from "./PageGroupButtonDropdownDisabled/PageGroupButtonDropdownDisabled.vue";
7
7
  import PageGroupButtonDropdownDropdownAttributes from "./PageGroupButtonDropdownDropdownAttributes/PageGroupButtonDropdownDropdownAttributes.vue";
8
+ import PageGroupButtonDropdownExtraClasses from "./PageGroupButtonDropdownExtraClasses/PageGroupButtonDropdownExtraClasses.vue";
8
9
  import PageGroupButtonDropdownHasDividerBeforeDropdown from "./PageGroupButtonDropdownHasDividerBeforeDropdown/PageGroupButtonDropdownHasDividerBeforeDropdown.vue";
9
10
  import PageGroupButtonDropdownIndexFirstDropdownAction from "./PageGroupButtonDropdownIndexFirstDropdownAction/PageGroupButtonDropdownIndexFirstDropdownAction.vue";
10
11
  import PageGroupButtonDropdownIndexFirstDropdownActionOne from "./PageGroupButtonDropdownIndexFirstDropdownActionOne/PageGroupButtonDropdownIndexFirstDropdownActionOne.vue";
@@ -25,6 +26,7 @@ export default {
25
26
  PageGroupButtonDropdownBasic,
26
27
  PageGroupButtonDropdownDisabled,
27
28
  PageGroupButtonDropdownDropdownAttributes,
29
+ PageGroupButtonDropdownExtraClasses,
28
30
  PageGroupButtonDropdownHasDividerBeforeDropdown,
29
31
  PageGroupButtonDropdownIndexFirstDropdownAction,
30
32
  PageGroupButtonDropdownIndexFirstDropdownActionOne,
@@ -23,6 +23,8 @@ aloha-page(
23
23
 
24
24
  page-group-button-dropdown-dropdown-attributes
25
25
 
26
+ page-group-button-dropdown-extra-classes
27
+
26
28
  //aloha-table-props(
27
29
  // :data="dataProps"
28
30
  //)
@@ -0,0 +1,67 @@
1
+ import AGroupButtonDropdown from "../../../../../src/AGroupButtonDropdown/AGroupButtonDropdown";
2
+ import AlohaExample from "../../../global/components/AlohaExample/AlohaExample.vue";
3
+
4
+ import HtmlAPI from "./compositionAPI/HtmlAPI";
5
+ import JsAPI from "./compositionAPI/JsAPI";
6
+
7
+ export default {
8
+ name: "PageGroupButtonDropdownExtraClasses",
9
+ components: {
10
+ AGroupButtonDropdown,
11
+ AlohaExample,
12
+ },
13
+ setup() {
14
+ const {
15
+ codeHtml,
16
+ } = HtmlAPI();
17
+
18
+ const {
19
+ codeJs,
20
+ } = JsAPI();
21
+
22
+ const actions = [
23
+ {
24
+ text: "Action 1",
25
+ type: "button",
26
+ callback: () => {},
27
+ classExtra: "test_action1",
28
+ },
29
+ {
30
+ text: "Action 2",
31
+ type: "button",
32
+ callback: () => {},
33
+ classExtra: "test_action2",
34
+ },
35
+ {
36
+ text: "Action 3",
37
+ type: "button",
38
+ callback: () => {},
39
+ classExtra: "test_action3",
40
+ },
41
+ {
42
+ text: "Action 4",
43
+ type: "button",
44
+ callback: () => {},
45
+ classExtra: "test_action4",
46
+ },
47
+ {
48
+ text: "Action 5",
49
+ type: "button",
50
+ callback: () => {},
51
+ classExtra: "test_action5",
52
+ },
53
+ {
54
+ text: "Action 6",
55
+ type: "button",
56
+ callback: () => {},
57
+ classExtra: "test_action6",
58
+ },
59
+ ];
60
+
61
+ return {
62
+ actions,
63
+ codeHtml,
64
+ codeJs,
65
+ };
66
+ },
67
+ };
@@ -0,0 +1,12 @@
1
+ aloha-example(
2
+ :code-html="codeHtml"
3
+ :code-js="codeJs"
4
+ header="_A_GROUP_BUTTON_DROPDOWN_GROUP_EXTRA_CLASSES_HEADER_"
5
+ description="_A_GROUP_BUTTON_DROPDOWN_GROUP_EXTRA_CLASSES_DESCRIPTION_"
6
+ :props="['actions.classExtra']"
7
+ )
8
+ a-group-button-dropdown(
9
+ :actions="actions"
10
+ :index-first-dropdown-action="2"
11
+ :index-first-dropdown-action-mobile="2"
12
+ )
@@ -0,0 +1,2 @@
1
+ <template lang="pug" src="./PageGroupButtonDropdownExtraClasses.pug"></template>
2
+ <script src="./PageGroupButtonDropdownExtraClasses.js"></script>
@@ -0,0 +1,11 @@
1
+ export default function HtmlAPI() {
2
+ const codeHtml = `<a-group-button-dropdown
3
+ :actions="actions"
4
+ :index-first-dropdown-action="2"
5
+ :index-first-dropdown-action-mobile="2"
6
+ ></a-group-button-dropdown>`;
7
+
8
+ return {
9
+ codeHtml,
10
+ };
11
+ }
@@ -0,0 +1,58 @@
1
+ export default function JsAPI() {
2
+ const codeJs = `import AGroupButtonDropdown from "aloha-vue/src/AGroupButtonDropdown/AGroupButtonDropdown";
3
+
4
+ export default {
5
+ name: "PageGroupButtonDropdownActionsClasses",
6
+ components: {
7
+ AGroupButtonDropdown,
8
+ },
9
+ setup() {
10
+ const actions = [
11
+ {
12
+ text: "Action 1",
13
+ type: "button",
14
+ callback: () => {},
15
+ classExtra: "test_action1",
16
+ },
17
+ {
18
+ text: "Action 2",
19
+ type: "button",
20
+ callback: () => {},
21
+ classExtra: "test_action2",
22
+ },
23
+ {
24
+ text: "Action 3",
25
+ type: "button",
26
+ callback: () => {},
27
+ classExtra: "test_action3",
28
+ },
29
+ {
30
+ text: "Action 4",
31
+ type: "button",
32
+ callback: () => {},
33
+ classExtra: "test_action4",
34
+ },
35
+ {
36
+ text: "Action 5",
37
+ type: "button",
38
+ callback: () => {},
39
+ classExtra: "test_action5",
40
+ },
41
+ {
42
+ text: "Action 6",
43
+ type: "button",
44
+ callback: () => {},
45
+ classExtra: "test_action6",
46
+ },
47
+ ];
48
+
49
+ return {
50
+ actions,
51
+ };
52
+ },
53
+ };`;
54
+
55
+ return {
56
+ codeJs,
57
+ };
58
+ }
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.190",
17
+ "version": "1.2.191",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -33,6 +33,8 @@ export default {
33
33
  ...this.attributesAction,
34
34
  isHidden: undefined,
35
35
  callback: undefined,
36
+ classButton: undefined,
37
+ classExtra: undefined,
36
38
  onClick: this.action.callback,
37
39
  }),
38
40
  ]);
@@ -51,6 +53,8 @@ export default {
51
53
  }, [
52
54
  h(ALink, {
53
55
  ...this.attributesAction,
56
+ classButton: undefined,
57
+ classExtra: undefined,
54
58
  isHidden: undefined,
55
59
  }),
56
60
  ]);
@@ -8,6 +8,10 @@ import ALink from "../../ALink/ALink";
8
8
 
9
9
  import DropdownAPI from "./compositionAPI/DropdownAPI";
10
10
 
11
+ import {
12
+ concatTwoStringsWithSpace,
13
+ } from "../../utils/actions";
14
+
11
15
  export default {
12
16
  name: "AGroupButtonDropdownItem",
13
17
  props: {
@@ -65,15 +69,22 @@ export default {
65
69
  class: "a_btn_group",
66
70
  }, [
67
71
  ...this.data.children.map(action => {
68
- const CLASS = action.classButton ? action.classButton : this.actionsClasses[action.actionNotDividerIndex];
72
+ let classLocal = action.classButton ? action.classButton : this.actionsClasses[action.actionNotDividerIndex];
73
+ if (action.classExtra) {
74
+ classLocal = concatTwoStringsWithSpace({
75
+ class1: classLocal,
76
+ class2: action.classExtra,
77
+ });
78
+ }
69
79
  const ID = action.id ? action.id : this.actionsIds[action.actionNotDividerIndex];
70
80
  const DISABLED = this.disabled || action.disabled;
71
81
  if (action.type === "button") {
72
82
  return h(AButton, {
73
83
  ...action,
74
84
  id: ID,
75
- class: CLASS,
85
+ class: classLocal,
76
86
  classButton: undefined,
87
+ classExtra: undefined,
77
88
  disabled: DISABLED,
78
89
  onClick: action.callback,
79
90
  callback: undefined,
@@ -86,8 +97,9 @@ export default {
86
97
  ...action,
87
98
  id: ID,
88
99
  classButton: undefined,
100
+ classExtra: undefined,
89
101
  disabled: DISABLED,
90
- class: CLASS,
102
+ class: classLocal,
91
103
  actionNotDividerIndex: undefined,
92
104
  isHidden: undefined,
93
105
  type: undefined,
@@ -98,7 +110,7 @@ export default {
98
110
  this.$slots[action.slotName]) {
99
111
  return this.$slots[action.slotName]({
100
112
  id: ID,
101
- class: CLASS,
113
+ class: classLocal,
102
114
  action: action,
103
115
  });
104
116
  }
@@ -6,6 +6,7 @@ import {
6
6
  import AMobileAPI from "../../compositionAPI/AMobileAPI";
7
7
 
8
8
  import {
9
+ concatTwoStringsWithSpace,
9
10
  filterActionsHiddenAndDivider,
10
11
  } from "../../utils/actions";
11
12
  import {
@@ -34,15 +35,23 @@ export default function ActionsAPI(props) {
34
35
  const ACTIONS = cloneDeep(actionsAllFiltered.value);
35
36
  forEach(ACTIONS, action => {
36
37
  // only for inline buttons
37
- action.classButton = concatenateTwoStringsWithSpace({
38
+ action.classButton = concatTwoStringsWithSpace({
38
39
  class1: action.classButton,
39
40
  class2: action.class,
40
41
  });
42
+
41
43
  // only for dropdown
42
- action.class = concatenateTwoStringsWithSpace({
44
+ action.class = concatTwoStringsWithSpace({
43
45
  class1: action.classDropdown,
44
46
  class2: action.class,
45
47
  });
48
+ delete action.classDropdown;
49
+ if (action.classExtra) {
50
+ action.class = concatTwoStringsWithSpace({
51
+ class1: action.classExtra,
52
+ class2: action.class,
53
+ });
54
+ }
46
55
  });
47
56
 
48
57
  return ACTIONS;
@@ -130,24 +139,3 @@ export default function ActionsAPI(props) {
130
139
  };
131
140
  }
132
141
 
133
- /**
134
- * Concatenates two strings with a space between them.
135
- *
136
- * @param {Object} options - The options for concatenation.
137
- * @param {string} options.class1 - The first class to concatenate.
138
- * @param {string} options.class2 - The second class to concatenate.
139
- * @param {string} [options.defaultValue=undefined] - The default value to return if both class1 and class2 are falsy.
140
- * @returns {string} The concatenated string or the defaultValue if both class1 and class2 are falsy.
141
- */
142
- export function concatenateTwoStringsWithSpace({ class1, class2, defaultValue = undefined }) {
143
- if (class1) {
144
- if (class2) {
145
- return `${ class1 } ${ class2 }`;
146
- }
147
- return class1;
148
- }
149
- if (class2) {
150
- return class2;
151
- }
152
- return defaultValue;
153
- }
@@ -41,3 +41,25 @@ export function filterActionsDivider({ actions }) {
41
41
 
42
42
  return ACTIONS_DIVIDER_FILTERED;
43
43
  }
44
+
45
+ /**
46
+ * Concatenates two strings with a space between them.
47
+ *
48
+ * @param {Object} options - The options for concatenation.
49
+ * @param {string} options.class1 - The first class to concatenate.
50
+ * @param {string} options.class2 - The second class to concatenate.
51
+ * @param {string} [options.defaultValue=undefined] - The default value to return if both class1 and class2 are falsy.
52
+ * @returns {string} The concatenated string or the defaultValue if both class1 and class2 are falsy.
53
+ */
54
+ export function concatTwoStringsWithSpace({ class1, class2, defaultValue = undefined }) {
55
+ if (class1) {
56
+ if (class2) {
57
+ return `${ class1 } ${ class2 }`;
58
+ }
59
+ return class1;
60
+ }
61
+ if (class2) {
62
+ return class2;
63
+ }
64
+ return defaultValue;
65
+ }