aloha-vue 1.0.41 → 1.0.44

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/docs/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@popperjs/core": "2.11.6",
15
- "aloha-css": "1.0.41",
15
+ "aloha-css": "1.0.43",
16
16
  "lodash-es": "^4.17.21",
17
17
  "vue": "3.2.31",
18
18
  "vue-router": "4.0.14",
@@ -25,3 +25,11 @@ div
25
25
  v-slot:content="{ item, itemIndex }"
26
26
  )
27
27
  strong {{ item.content }}
28
+
29
+ h2 readonly
30
+ a-accordion(
31
+ :items="items"
32
+ :readonly="true"
33
+ :is-caret="false"
34
+ class-button="a_color_link"
35
+ )
@@ -60,6 +60,7 @@ export default {
60
60
  id: "aloha1",
61
61
  classColumn: "a_column_8",
62
62
  required: true,
63
+ isHide: true,
63
64
  },
64
65
  {
65
66
  type: "text",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
3
  "description": "Project aloha",
4
- "version": "1.0.41",
4
+ "version": "1.0.44",
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"
@@ -3,7 +3,7 @@ import {
3
3
  h,
4
4
  } from "vue";
5
5
 
6
- import AAccordionItem from "./AAccordionItem/AAccordionItem";
6
+ import AAccordionItem from "./AAccordionItem";
7
7
 
8
8
  import {
9
9
  cloneDeep,
@@ -16,11 +16,15 @@ export default {
16
16
  name: "AAccordion",
17
17
  provide() {
18
18
  return {
19
+ classButton: computed(() => this.classButton),
20
+ disabled: computed(() => this.disabled),
19
21
  id: computed(() => this.id),
20
22
  indexesForOpen: computed(() => this.indexesForOpen),
23
+ isCaret: computed(() => this.isCaret),
21
24
  keyList: computed(() => this.keyList),
22
25
  keyLabel: computed(() => this.keyLabel),
23
26
  keyContent: computed(() => this.keyContent),
27
+ readonly: computed(() => this.readonly),
24
28
  };
25
29
  },
26
30
  props: {
@@ -41,6 +45,10 @@ export default {
41
45
  type: Boolean,
42
46
  required: false,
43
47
  },
48
+ readonly: {
49
+ type: Boolean,
50
+ required: false,
51
+ },
44
52
  keyList: {
45
53
  type: String,
46
54
  required: false,
@@ -56,6 +64,11 @@ export default {
56
64
  required: false,
57
65
  default: "content",
58
66
  },
67
+ isCaret: {
68
+ type: Boolean,
69
+ required: false,
70
+ default: true,
71
+ },
59
72
  stop: {
60
73
  type: Boolean,
61
74
  required: false,
@@ -64,6 +77,11 @@ export default {
64
77
  type: Boolean,
65
78
  required: false,
66
79
  },
80
+ classButton: {
81
+ type: [String, Object],
82
+ required: false,
83
+ default: undefined,
84
+ },
67
85
  },
68
86
  emits: ["toggle"],
69
87
  data() {
@@ -34,11 +34,15 @@ export default {
34
34
  },
35
35
  emits: ["toggle"],
36
36
  inject: [
37
+ "classButton",
38
+ "disabled",
37
39
  "id",
38
40
  "indexesForOpen",
41
+ "isCaret",
39
42
  "keyList",
40
43
  "keyLabel",
41
44
  "keyContent",
45
+ "readonly",
42
46
  ],
43
47
  setup(props) {
44
48
  const {
@@ -101,6 +105,29 @@ export default {
101
105
  return get(this.item, this.keyContent);
102
106
  }
103
107
  },
108
+
109
+ buttonTag() {
110
+ return this.readonly ? "div" : "button";
111
+ },
112
+
113
+ buttonAttributes() {
114
+ const ATTRIBUTES = {
115
+ class: ["a_accordion__button", this.classButton, {
116
+ a_accordion__button_collapsed: !this.isOpen,
117
+ a_accordion__button_has_not_caret: !this.isCaret,
118
+ }],
119
+ };
120
+
121
+ if (!this.readonly) {
122
+ ATTRIBUTES.ariaExpanded = this.isOpen;
123
+ ATTRIBUTES["aria-controls"] = this.idForCollapse;
124
+ ATTRIBUTES.type = "button";
125
+ ATTRIBUTES.disabled = this.disabled;
126
+ ATTRIBUTES.onClick = this.toggle;
127
+ }
128
+
129
+ return ATTRIBUTES;
130
+ },
104
131
  },
105
132
  methods: {
106
133
  toggle($event) {
@@ -122,15 +149,7 @@ export default {
122
149
  h("div", {
123
150
  class: "a_accordion__header",
124
151
  }, [
125
- h("button", {
126
- class: ["a_accordion__button", {
127
- a_accordion__button_collapsed: !this.isOpen,
128
- }],
129
- ariaExpanded: this.isOpen,
130
- "aria-controls": this.idForCollapse,
131
- type: "button",
132
- onClick: this.toggle,
133
- }, [
152
+ h(this.buttonTag, this.buttonAttributes, [
134
153
  this.$slots.button && this.$slots.button({
135
154
  item: this.item,
136
155
  itemIndex: this.itemIndex,
@@ -95,7 +95,7 @@ export default {
95
95
  };
96
96
  },
97
97
  render() {
98
- return h("div", {
98
+ return !this.isHide && h("div", {
99
99
  style: this.componentStyleHideDependencies,
100
100
  }, [
101
101
  h("div", {
@@ -68,7 +68,7 @@ export default {
68
68
  };
69
69
  },
70
70
  render() {
71
- return h("div", {
71
+ return !this.isHide && h("div", {
72
72
  style: this.componentStyleHideDependencies,
73
73
  }, [
74
74
  h("fieldset", {
@@ -122,7 +122,7 @@ export default {
122
122
  };
123
123
  },
124
124
  render() {
125
- return h("div", {
125
+ return !this.isHide && h("div", {
126
126
  style: this.componentStyleHideDependencies,
127
127
  }, [
128
128
  h("div", {
@@ -89,7 +89,7 @@ export default {
89
89
  };
90
90
  },
91
91
  render() {
92
- return h("div", {
92
+ return !this.isHide && h("div", {
93
93
  style: this.componentStyleHideDependencies,
94
94
  }, [
95
95
  h("div", {
@@ -100,7 +100,7 @@ export default {
100
100
  };
101
101
  },
102
102
  render() {
103
- return h("div", {
103
+ return !this.isHide && h("div", {
104
104
  style: this.componentStyleHideDependencies,
105
105
  }, [
106
106
  h("div", {
@@ -355,7 +355,7 @@ export default {
355
355
  };
356
356
  },
357
357
  render() {
358
- return h("div", {
358
+ return !this.isHide && h("div", {
359
359
  style: this.componentStyleHideDependencies,
360
360
  }, [
361
361
  h("div", {
@@ -84,6 +84,8 @@ export default function ASelectToggleAPI(props, {
84
84
  } else if (KEY_CODE === AKeysCode.escape) {
85
85
  closePopover();
86
86
  setFocusToButton();
87
+ $event.preventDefault();
88
+ $event.stopPropagation();
87
89
  } else if (KEY_CODE === AKeysCode.tab) {
88
90
  closePopover();
89
91
  setFocusToButton();
@@ -179,7 +179,7 @@ export default {
179
179
  };
180
180
  },
181
181
  render() {
182
- return h("div", {
182
+ return !this.isHide && h("div", {
183
183
  style: this.componentStyleHideDependencies,
184
184
  }, [
185
185
  h("div", {
@@ -38,7 +38,7 @@ export default {
38
38
  };
39
39
  },
40
40
  render() {
41
- return h("div", {
41
+ return !this.isHide && h("div", {
42
42
  class: "a_template",
43
43
  ...this.attributesWithHtml,
44
44
  }, this.$slots[this.slotName] &&
@@ -157,7 +157,7 @@ export default {
157
157
  };
158
158
  },
159
159
  render() {
160
- return h("div", null, [
160
+ return !this.isHide && h("div", null, [
161
161
  h("div", {
162
162
  class: ["a_form_element__parent", {
163
163
  a_form_element__parent_float: this.isLabelFloat,
@@ -91,6 +91,10 @@ export default {
91
91
  type: String,
92
92
  required: false,
93
93
  },
94
+ isHide: {
95
+ type: Boolean,
96
+ required: false,
97
+ },
94
98
  },
95
99
  emits: [
96
100
  "update:modelValue",
@@ -1,27 +0,0 @@
1
- component.a_accordion(
2
- :is="tagsLocal.main"
3
- :class="classMainLocal"
4
- )
5
- a-accordion-item(
6
- v-for="(item, itemIndex) in items"
7
- :key="itemIndex"
8
- :item="item"
9
- :item-index="itemIndex"
10
- :is-parent-open="true"
11
- @toggle="toggle"
12
- )
13
- template(
14
- v-slot:button="slotProps"
15
- )
16
- slot(
17
- name="button"
18
- v-bind="slotProps"
19
- )
20
-
21
- template(
22
- v-slot:content="slotProps"
23
- )
24
- slot(
25
- name="content"
26
- v-bind="slotProps"
27
- )
@@ -1,2 +0,0 @@
1
- <template lang="pug" src="./AAccordion.pug"></template>
2
- <script src="./AAccordion.js"></script>
@@ -1,76 +0,0 @@
1
- component.a_accordion__item(
2
- :is="tagsLocal.item"
3
- :class="classItemLocal"
4
- )
5
- component.a_accordion__item__header(
6
- :is="tagsLocal.itemHeader"
7
- :class="classItemHeaderLocal"
8
- )
9
- component.a_accordion__item__header_btn(
10
- :is="tagsLocal.itemHeaderButton"
11
- :class="classItemHeaderButtonLocal"
12
- :aria-expanded="ariaExpanded"
13
- :aria-controls="idForCollapse"
14
- @click="toggle"
15
- )
16
- slot(
17
- name="button"
18
- :item="item"
19
- :item-index="itemIndex"
20
- :parent-indexes="parentIndexes"
21
- )
22
- span(
23
- v-if="labelLocal"
24
- ) {{ labelLocal }}
25
-
26
- component.a_accordion__box_collapse(
27
- :is="tagsLocal.boxCollapse"
28
- :id="idForCollapse"
29
- :class="classBoxCollapseLocal"
30
- :style="styleBoxCollapse"
31
- )
32
- component.a_accordion__box_collapse__body(
33
- :is="tagsLocal.boxCollapseBody"
34
- :class="classBoxCollapseBodyLocal"
35
- )
36
- slot(
37
- name="content"
38
- :item="item"
39
- :item-index="itemIndex"
40
- :parent-indexes="parentIndexes"
41
- )
42
- component.a_accordion__box_collapse__body__content(
43
- :is="tagsLocal.boxCollapseBodyContent"
44
- v-if="contentLocal"
45
- :class="classBoxCollapseBodyContent"
46
- v-html="contentLocal"
47
- )
48
- component.a_accordion(
49
- :is="tagsLocal.main"
50
- v-if="hasChildren"
51
- :class="classMainLocal"
52
- )
53
- a-accordion-item(
54
- v-for="(itemChild, itemChildIndex) in children"
55
- :key="itemChildIndex"
56
- :item="itemChild"
57
- :item-index="itemChildIndex"
58
- :is-parent-open="isOpen"
59
- :parent-indexes="parentIndexesForChild"
60
- @toggle="toggleFromChild"
61
- )
62
- template(
63
- v-slot:button="slotProps"
64
- )
65
- slot(
66
- name="button"
67
- v-bind="slotProps"
68
- )
69
-
70
- template(
71
- v-slot:content="slotProps"
72
- )
73
- slot(
74
- name="content"
75
- v-bind="slotProps"
76
- )
@@ -1,2 +0,0 @@
1
- <template lang="pug" src="./AAccordionItem.pug"></template>
2
- <script src="./AAccordionItem.js"></script>