aloha-vue 1.0.42 → 1.0.43
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
|
@@ -26,9 +26,10 @@ div
|
|
|
26
26
|
)
|
|
27
27
|
strong {{ item.content }}
|
|
28
28
|
|
|
29
|
-
h2
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
h2 readonly
|
|
30
|
+
a-accordion(
|
|
31
|
+
:items="items"
|
|
32
|
+
:readonly="true"
|
|
33
|
+
:is-caret="false"
|
|
34
|
+
class-button="a_color_link"
|
|
35
|
+
)
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
h,
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
|
-
import AAccordionItem from "./AAccordionItem
|
|
6
|
+
import AAccordionItem from "./AAccordionItem";
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
cloneDeep,
|
|
@@ -16,6 +16,7 @@ export default {
|
|
|
16
16
|
name: "AAccordion",
|
|
17
17
|
provide() {
|
|
18
18
|
return {
|
|
19
|
+
classButton: computed(() => this.classButton),
|
|
19
20
|
disabled: computed(() => this.disabled),
|
|
20
21
|
id: computed(() => this.id),
|
|
21
22
|
indexesForOpen: computed(() => this.indexesForOpen),
|
|
@@ -23,6 +24,7 @@ export default {
|
|
|
23
24
|
keyList: computed(() => this.keyList),
|
|
24
25
|
keyLabel: computed(() => this.keyLabel),
|
|
25
26
|
keyContent: computed(() => this.keyContent),
|
|
27
|
+
readonly: computed(() => this.readonly),
|
|
26
28
|
};
|
|
27
29
|
},
|
|
28
30
|
props: {
|
|
@@ -43,6 +45,10 @@ export default {
|
|
|
43
45
|
type: Boolean,
|
|
44
46
|
required: false,
|
|
45
47
|
},
|
|
48
|
+
readonly: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
required: false,
|
|
51
|
+
},
|
|
46
52
|
keyList: {
|
|
47
53
|
type: String,
|
|
48
54
|
required: false,
|
|
@@ -71,6 +77,11 @@ export default {
|
|
|
71
77
|
type: Boolean,
|
|
72
78
|
required: false,
|
|
73
79
|
},
|
|
80
|
+
classButton: {
|
|
81
|
+
type: [String, Object],
|
|
82
|
+
required: false,
|
|
83
|
+
default: undefined,
|
|
84
|
+
},
|
|
74
85
|
},
|
|
75
86
|
emits: ["toggle"],
|
|
76
87
|
data() {
|
|
@@ -34,6 +34,7 @@ export default {
|
|
|
34
34
|
},
|
|
35
35
|
emits: ["toggle"],
|
|
36
36
|
inject: [
|
|
37
|
+
"classButton",
|
|
37
38
|
"disabled",
|
|
38
39
|
"id",
|
|
39
40
|
"indexesForOpen",
|
|
@@ -41,6 +42,7 @@ export default {
|
|
|
41
42
|
"keyList",
|
|
42
43
|
"keyLabel",
|
|
43
44
|
"keyContent",
|
|
45
|
+
"readonly",
|
|
44
46
|
],
|
|
45
47
|
setup(props) {
|
|
46
48
|
const {
|
|
@@ -103,6 +105,29 @@ export default {
|
|
|
103
105
|
return get(this.item, this.keyContent);
|
|
104
106
|
}
|
|
105
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
|
+
},
|
|
106
131
|
},
|
|
107
132
|
methods: {
|
|
108
133
|
toggle($event) {
|
|
@@ -124,17 +149,7 @@ export default {
|
|
|
124
149
|
h("div", {
|
|
125
150
|
class: "a_accordion__header",
|
|
126
151
|
}, [
|
|
127
|
-
h(
|
|
128
|
-
class: ["a_accordion__button", {
|
|
129
|
-
a_accordion__button_collapsed: !this.isOpen,
|
|
130
|
-
a_accordion__button_has_not_caret: !this.isCaret,
|
|
131
|
-
}],
|
|
132
|
-
ariaExpanded: this.isOpen,
|
|
133
|
-
"aria-controls": this.idForCollapse,
|
|
134
|
-
type: "button",
|
|
135
|
-
disabled: this.disabled,
|
|
136
|
-
onClick: this.toggle,
|
|
137
|
-
}, [
|
|
152
|
+
h(this.buttonTag, this.buttonAttributes, [
|
|
138
153
|
this.$slots.button && this.$slots.button({
|
|
139
154
|
item: this.item,
|
|
140
155
|
itemIndex: this.itemIndex,
|