aloha-vue 1.0.0
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/.babelrc +10 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +183 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/build/webpack.common.js +104 -0
- package/build/webpack.dev.js +16 -0
- package/build/webpack.prod.js +20 -0
- package/dist/index.js +9 -0
- package/docs/App.js +52 -0
- package/docs/App.pug +10 -0
- package/docs/App.scss +1 -0
- package/docs/App.vue +3 -0
- package/docs/components/TheMenu/TheMenu.js +49 -0
- package/docs/components/TheMenu/TheMenu.pug +7 -0
- package/docs/components/TheMenu/TheMenu.scss +39 -0
- package/docs/components/TheMenu/TheMenu.vue +3 -0
- package/docs/components/TheMenuItem/TheMenuItem.js +29 -0
- package/docs/components/TheMenuItem/TheMenuItem.pug +26 -0
- package/docs/components/TheMenuItem/TheMenuItem.vue +2 -0
- package/docs/components/TheNavbar/TheNavbar.js +57 -0
- package/docs/components/TheNavbar/TheNavbar.pug +34 -0
- package/docs/components/TheNavbar/TheNavbar.vue +2 -0
- package/docs/i18n/de.json +4 -0
- package/docs/i18n/en.json +4 -0
- package/docs/i18n/hr.json +4 -0
- package/docs/i18n/ru.json +4 -0
- package/docs/main.js +30 -0
- package/docs/router/index.js +70 -0
- package/docs/static/styles.css +7725 -0
- package/docs/store/index.js +17 -0
- package/docs/styles/base.scss +11 -0
- package/docs/styles/bootstrap.lazy.scss +5 -0
- package/docs/styles/bulma.lazy.scss +1 -0
- package/docs/styles/foundation.lazy.scss +2 -0
- package/docs/styles/uikit.lazy.scss +3 -0
- package/docs/views/About.vue +5 -0
- package/docs/views/NotFound.vue +3 -0
- package/docs/views/PageAJson/PageAJson.js +18 -0
- package/docs/views/PageAJson/PageAJson.pug +10 -0
- package/docs/views/PageAJson/PageAJson.vue +2 -0
- package/docs/views/PageAccordion/PageAccordion.js +68 -0
- package/docs/views/PageAccordion/PageAccordion.pug +27 -0
- package/docs/views/PageAccordion/PageAccordion.vue +2 -0
- package/docs/views/PageCloak/PageCloak.js +8 -0
- package/docs/views/PageCloak/PageCloak.pug +6 -0
- package/docs/views/PageCloak/PageCloak.vue +2 -0
- package/docs/views/PageCollapse/PageCollapse.js +8 -0
- package/docs/views/PageCollapse/PageCollapse.pug +22 -0
- package/docs/views/PageCollapse/PageCollapse.vue +2 -0
- package/docs/views/PageInput/PageInput.js +22 -0
- package/docs/views/PageInput/PageInput.pug +25 -0
- package/docs/views/PageInput/PageInput.vue +2 -0
- package/docs/views/PageSpinner/PageSpinner.js +8 -0
- package/docs/views/PageSpinner/PageSpinner.pug +12 -0
- package/docs/views/PageSpinner/PageSpinner.vue +2 -0
- package/docs/views/PageStart/PageStart.js +39 -0
- package/docs/views/PageStart/PageStart.pug +19 -0
- package/docs/views/PageStart/PageStart.vue +2 -0
- package/docs/views/PageTable/PageTable.js +68 -0
- package/docs/views/PageTable/PageTable.pug +10 -0
- package/docs/views/PageTable/PageTable.vue +2 -0
- package/package.json +55 -0
- package/public/index.html +11 -0
- package/src/AAccordion/AAccordion.js +442 -0
- package/src/AAccordion/AAccordion.pug +27 -0
- package/src/AAccordion/AAccordion.vue +2 -0
- package/src/AAccordion/AAccordionItem/AAccordionItem.js +162 -0
- package/src/AAccordion/AAccordionItem/AAccordionItem.pug +76 -0
- package/src/AAccordion/AAccordionItem/AAccordionItem.vue +2 -0
- package/src/ACloak/ACloak.js +116 -0
- package/src/ACollapse/ACollapse.js +103 -0
- package/src/ACollapse/ACollapse.pug +25 -0
- package/src/ACollapse/ACollapse.vue +2 -0
- package/src/AFormElement/AFormElementBtnClear/AFormElementBtnClear.js +58 -0
- package/src/AIcon/AIcon.js +81 -0
- package/src/AIcon/Icons/Aloha.js +20 -0
- package/src/AIcon/Icons/ChevronDown.js +3 -0
- package/src/AIcon/Icons/ChevronLeft.js +1 -0
- package/src/AIcon/Icons/ChevronRight.js +3 -0
- package/src/AIcon/Icons/ChevronUp.js +3 -0
- package/src/AIcon/Icons/Close.js +16 -0
- package/src/AIcon/Icons/Cross.js +14 -0
- package/src/AIcon/Icons/Pause.js +14 -0
- package/src/AIcon/Icons/Play.js +3 -0
- package/src/AIcon/Icons/Repeat.js +9 -0
- package/src/AIcon/Icons/Reset.js +11 -0
- package/src/AIcon/Incscape-icons/Aloha.svg +349 -0
- package/src/AIcon/Incscape-icons/aloha-copy.svg +80 -0
- package/src/AIcon/Incscape-icons/chevron-bottom.svg +61 -0
- package/src/AIcon/Incscape-icons/chevron-left.svg +61 -0
- package/src/AIcon/Incscape-icons/chevron-right.svg +61 -0
- package/src/AIcon/Incscape-icons/chevron-up.svg +61 -0
- package/src/AIcon/Incscape-icons/close.svg +74 -0
- package/src/AIcon/Incscape-icons/cross.svg +73 -0
- package/src/AIcon/Incscape-icons/pause.svg +70 -0
- package/src/AIcon/Incscape-icons/play.svg +72 -0
- package/src/AIcon/Incscape-icons/repeat.svg +84 -0
- package/src/AIcon/Incscape-icons/reset.svg +86 -0
- package/src/AIcon/Incscape-icons/th-large-outline.svg +95 -0
- package/src/AIcon/Incscape-icons/th-large-rund-outline.svg +90 -0
- package/src/AIcon/Incscape-icons/th-large-rund.svg +94 -0
- package/src/AIcon/Incscape-icons/th-large.svg +97 -0
- package/src/AIcon/SVG-icons/aloha.svg +28 -0
- package/src/AIcon/SVG-icons/chevron-bottom.svg +11 -0
- package/src/AIcon/SVG-icons/chevron-left.svg +11 -0
- package/src/AIcon/SVG-icons/chevron-right.svg +11 -0
- package/src/AIcon/SVG-icons/chevron-up.svg +11 -0
- package/src/AIcon/SVG-icons/close.svg +23 -0
- package/src/AIcon/SVG-icons/cross.svg +22 -0
- package/src/AIcon/SVG-icons/pause.svg +20 -0
- package/src/AIcon/SVG-icons/play.svg +11 -0
- package/src/AIcon/SVG-icons/repeat.svg +17 -0
- package/src/AIcon/SVG-icons/reset.svg +19 -0
- package/src/AIcon/SVG-icons/th-large-outline.svg +45 -0
- package/src/AIcon/SVG-icons/th-large.svg +41 -0
- package/src/AInput/AInput.js +177 -0
- package/src/AJson/AJson.js +356 -0
- package/src/ALabel/ALabel.js +81 -0
- package/src/API/frameworksApi.js +20 -0
- package/src/ASlot/ASlot.js +4 -0
- package/src/ASlot/ASlot.pug +1 -0
- package/src/ASlot/ASlot.vue +2 -0
- package/src/ASpinner/ASpinner.js +76 -0
- package/src/ATable/ATable.js +180 -0
- package/src/ATable/ATableCountProPage/ATableCountProPage.js +56 -0
- package/src/ATable/ATableHeader/ATableHeader.js +45 -0
- package/src/ATable/ATableHeaderTh/ATableHeaderTh.js +147 -0
- package/src/ATable/ATablePagination/ATablePagination.js +208 -0
- package/src/ATable/ATableTd/ATableTd.js +73 -0
- package/src/ATable/ATableTopPanel/ATableTopPanel.js +72 -0
- package/src/ATable/ATableTr/ATableTr.js +45 -0
- package/src/ATextarea/ATextarea.js +256 -0
- package/src/ATranslation/ATranslation.js +225 -0
- package/src/FormElements/AInputMixin.js +51 -0
- package/src/const/colors.js +10 -0
- package/src/const/frameworks.js +6 -0
- package/src/i18n/de.json +8 -0
- package/src/i18n/en.json +8 -0
- package/src/i18n/hr.json +8 -0
- package/src/i18n/ru.json +8 -0
- package/src/plugins/alohaPlugin.js +5 -0
- package/src/plugins/i18nPlugin.js +10 -0
- package/src/styles/components/ACloak.scss +12 -0
- package/src/styles/components/AFormElement/AFormElement.scss +21 -0
- package/src/styles/components/AFormElement/AInput.scss +0 -0
- package/src/styles/components/AFormElement/ATextarea.scss +6 -0
- package/src/styles/components/ASpinner.scss +24 -0
- package/src/styles/components/ATable.scss +0 -0
- package/src/styles/styles.scss +13 -0
- package/src/styles/utils/display.scss +30 -0
- package/src/styles/utils/flex.scss +50 -0
- package/src/styles/utils/paddingMargin.scss +28 -0
- package/src/styles/utils/utils.scss +19 -0
- package/src/styles/utils/widthHeight.scss +17 -0
- package/src/styles/variables.scss +96 -0
- package/src/utils/autosize.js +268 -0
- package/src/utils/utils.js +16 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import AAccordionItem from "./AAccordionItem/AAccordionItem.vue";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
computed,
|
|
5
|
+
provide,
|
|
6
|
+
toRefs,
|
|
7
|
+
} from "vue";
|
|
8
|
+
|
|
9
|
+
import frameworks from "../const/frameworks";
|
|
10
|
+
import {
|
|
11
|
+
frameworksApi,
|
|
12
|
+
} from "../API/frameworksApi";
|
|
13
|
+
import {
|
|
14
|
+
replaceTextTemplateToASlot,
|
|
15
|
+
} from "../utils/utils";
|
|
16
|
+
import {
|
|
17
|
+
cloneDeep,
|
|
18
|
+
filter,
|
|
19
|
+
startsWith,
|
|
20
|
+
uniqueId,
|
|
21
|
+
} from "lodash-es";
|
|
22
|
+
|
|
23
|
+
const FRAMEWORKS_PARAMETERS = {
|
|
24
|
+
bootstrap: {
|
|
25
|
+
main: {
|
|
26
|
+
tag: "div",
|
|
27
|
+
class: classProps => [
|
|
28
|
+
classProps,
|
|
29
|
+
"accordion",
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
item: {
|
|
33
|
+
tag: "div",
|
|
34
|
+
class: classProps => [
|
|
35
|
+
classProps,
|
|
36
|
+
"accordion-item",
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
itemHeader: {
|
|
40
|
+
tag: "div",
|
|
41
|
+
class: classProps => [
|
|
42
|
+
classProps,
|
|
43
|
+
"accordion-header",
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
itemHeaderButton: {
|
|
47
|
+
tag: "button",
|
|
48
|
+
class: (classProps, isOpen) => [
|
|
49
|
+
classProps,
|
|
50
|
+
"accordion-button",
|
|
51
|
+
{
|
|
52
|
+
collapsed: !isOpen,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
boxCollapse: {
|
|
57
|
+
tag: "div",
|
|
58
|
+
class: (classProps, isOpen) => [
|
|
59
|
+
classProps,
|
|
60
|
+
"accordion-collapse collapse",
|
|
61
|
+
{
|
|
62
|
+
show: isOpen,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
boxCollapseBody: {
|
|
67
|
+
tag: "div",
|
|
68
|
+
class: classProps => [
|
|
69
|
+
classProps,
|
|
70
|
+
"accordion-body",
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
foundation: {
|
|
75
|
+
main: {
|
|
76
|
+
tag: "ul",
|
|
77
|
+
class: classProps => [
|
|
78
|
+
classProps,
|
|
79
|
+
"accordion",
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
item: {
|
|
83
|
+
tag: "li",
|
|
84
|
+
class: (classProps, isOpen) => [
|
|
85
|
+
classProps,
|
|
86
|
+
"accordion-item",
|
|
87
|
+
{
|
|
88
|
+
"is-active": isOpen,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
itemHeader: {
|
|
93
|
+
tag: "template",
|
|
94
|
+
class: () => [],
|
|
95
|
+
},
|
|
96
|
+
itemHeaderButton: {
|
|
97
|
+
tag: "a",
|
|
98
|
+
class: classProps => [
|
|
99
|
+
classProps,
|
|
100
|
+
"accordion-title",
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
boxCollapse: {
|
|
104
|
+
tag: "div",
|
|
105
|
+
class: classProps => [
|
|
106
|
+
classProps,
|
|
107
|
+
"accordion-content",
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
boxCollapseBody: {
|
|
111
|
+
tag: "template",
|
|
112
|
+
class: () => [],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
uikit: {
|
|
116
|
+
main: {
|
|
117
|
+
tag: "ul",
|
|
118
|
+
class: classProps => [
|
|
119
|
+
classProps,
|
|
120
|
+
"uk-accordion",
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
item: {
|
|
124
|
+
tag: "li",
|
|
125
|
+
class: (classProps, isOpen) => [
|
|
126
|
+
classProps,
|
|
127
|
+
{
|
|
128
|
+
"uk-open": isOpen
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
itemHeader: {
|
|
133
|
+
tag: "template",
|
|
134
|
+
class: () => [],
|
|
135
|
+
},
|
|
136
|
+
itemHeaderButton: {
|
|
137
|
+
tag: "a",
|
|
138
|
+
class: classProps => [
|
|
139
|
+
classProps,
|
|
140
|
+
"uk-accordion-title",
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
boxCollapse: {
|
|
144
|
+
tag: "div",
|
|
145
|
+
class: (classProps, isOpen) => [
|
|
146
|
+
classProps,
|
|
147
|
+
"uk-accordion-content",
|
|
148
|
+
{
|
|
149
|
+
"uk-hidden": !isOpen,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
boxCollapseBody: {
|
|
154
|
+
tag: "template",
|
|
155
|
+
class: () => [],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
bulma: {
|
|
159
|
+
main: {
|
|
160
|
+
tag: "div",
|
|
161
|
+
class: classProps => [
|
|
162
|
+
classProps,
|
|
163
|
+
"",
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
item: {
|
|
167
|
+
tag: "div",
|
|
168
|
+
class: classProps => [
|
|
169
|
+
classProps,
|
|
170
|
+
"card",
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
itemHeader: {
|
|
174
|
+
tag: "header",
|
|
175
|
+
class: classProps => [
|
|
176
|
+
classProps,
|
|
177
|
+
"card-header",
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
itemHeaderButton: {
|
|
181
|
+
tag: "div",
|
|
182
|
+
class: (classProps, isOpen) => [
|
|
183
|
+
classProps,
|
|
184
|
+
"card-header-title is-clickable",
|
|
185
|
+
{
|
|
186
|
+
collapsed: !isOpen,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
boxCollapse: {
|
|
191
|
+
tag: "div",
|
|
192
|
+
class: (classProps, isOpen) => [
|
|
193
|
+
classProps,
|
|
194
|
+
"card-content",
|
|
195
|
+
{
|
|
196
|
+
"is-hidden": !isOpen,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
boxCollapseBody: {
|
|
201
|
+
tag: "div",
|
|
202
|
+
class: classProps => [
|
|
203
|
+
classProps,
|
|
204
|
+
"content",
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export default {
|
|
211
|
+
name: "AAccordion",
|
|
212
|
+
components: {
|
|
213
|
+
AAccordionItem,
|
|
214
|
+
},
|
|
215
|
+
provide() {
|
|
216
|
+
return {
|
|
217
|
+
id: computed(() => this.id),
|
|
218
|
+
indexesForOpen: computed(() => this.indexesForOpen),
|
|
219
|
+
keyList: computed(() => this.keyList),
|
|
220
|
+
keyLabel: computed(() => this.keyLabel),
|
|
221
|
+
keyContent: computed(() => this.keyContent),
|
|
222
|
+
classBoxCollapseBodyContent: computed(() => this.classBoxCollapseBodyContent),
|
|
223
|
+
};
|
|
224
|
+
},
|
|
225
|
+
props: {
|
|
226
|
+
alwaysOpen: {
|
|
227
|
+
type: Boolean,
|
|
228
|
+
required: false,
|
|
229
|
+
},
|
|
230
|
+
id: {
|
|
231
|
+
type: String,
|
|
232
|
+
required: false,
|
|
233
|
+
default: uniqueId("accordion_"),
|
|
234
|
+
},
|
|
235
|
+
items: {
|
|
236
|
+
type: Array,
|
|
237
|
+
required: true,
|
|
238
|
+
},
|
|
239
|
+
disabled: {
|
|
240
|
+
type: Boolean,
|
|
241
|
+
required: false,
|
|
242
|
+
},
|
|
243
|
+
keyList: {
|
|
244
|
+
type: String,
|
|
245
|
+
required: false,
|
|
246
|
+
default: "items",
|
|
247
|
+
},
|
|
248
|
+
keyLabel: {
|
|
249
|
+
type: String,
|
|
250
|
+
required: false,
|
|
251
|
+
default: "label",
|
|
252
|
+
},
|
|
253
|
+
keyContent: {
|
|
254
|
+
type: String,
|
|
255
|
+
required: false,
|
|
256
|
+
default: "content",
|
|
257
|
+
},
|
|
258
|
+
classMain: {
|
|
259
|
+
type: String,
|
|
260
|
+
required: false,
|
|
261
|
+
default: "",
|
|
262
|
+
},
|
|
263
|
+
classItem: {
|
|
264
|
+
type: String,
|
|
265
|
+
required: false,
|
|
266
|
+
default: "",
|
|
267
|
+
},
|
|
268
|
+
classItemHeader: {
|
|
269
|
+
type: String,
|
|
270
|
+
required: false,
|
|
271
|
+
default: "",
|
|
272
|
+
},
|
|
273
|
+
classItemHeaderButton: {
|
|
274
|
+
type: String,
|
|
275
|
+
required: false,
|
|
276
|
+
default: "",
|
|
277
|
+
},
|
|
278
|
+
classBoxCollapse: {
|
|
279
|
+
type: String,
|
|
280
|
+
required: false,
|
|
281
|
+
default: "",
|
|
282
|
+
},
|
|
283
|
+
classBoxCollapseBody: {
|
|
284
|
+
type: String,
|
|
285
|
+
required: false,
|
|
286
|
+
default: "",
|
|
287
|
+
},
|
|
288
|
+
classBoxCollapseBodyContent: {
|
|
289
|
+
type: String,
|
|
290
|
+
required: false,
|
|
291
|
+
default: "",
|
|
292
|
+
},
|
|
293
|
+
tag: {
|
|
294
|
+
type: String,
|
|
295
|
+
required: false,
|
|
296
|
+
},
|
|
297
|
+
tagItem: {
|
|
298
|
+
type: String,
|
|
299
|
+
required: false,
|
|
300
|
+
},
|
|
301
|
+
tagItemHeader: {
|
|
302
|
+
type: String,
|
|
303
|
+
required: false,
|
|
304
|
+
},
|
|
305
|
+
tagItemHeaderButton: {
|
|
306
|
+
type: String,
|
|
307
|
+
required: false,
|
|
308
|
+
},
|
|
309
|
+
tagBoxCollapse: {
|
|
310
|
+
type: String,
|
|
311
|
+
required: false,
|
|
312
|
+
},
|
|
313
|
+
tagBoxCollapseBody: {
|
|
314
|
+
type: String,
|
|
315
|
+
required: false,
|
|
316
|
+
},
|
|
317
|
+
tagBoxCollapseBodyContent: {
|
|
318
|
+
type: String,
|
|
319
|
+
required: false,
|
|
320
|
+
default: "div",
|
|
321
|
+
},
|
|
322
|
+
stop: {
|
|
323
|
+
type: Boolean,
|
|
324
|
+
required: false,
|
|
325
|
+
},
|
|
326
|
+
prevent: {
|
|
327
|
+
type: Boolean,
|
|
328
|
+
required: false,
|
|
329
|
+
},
|
|
330
|
+
framework: {
|
|
331
|
+
type: String,
|
|
332
|
+
required: false,
|
|
333
|
+
validator: framework => frameworks.indexOf(framework) !== -1,
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
emits: ["toggle"],
|
|
337
|
+
setup(props) {
|
|
338
|
+
const {
|
|
339
|
+
classMain,
|
|
340
|
+
classItem,
|
|
341
|
+
classItemHeader,
|
|
342
|
+
classItemHeaderButton,
|
|
343
|
+
classBoxCollapse,
|
|
344
|
+
classBoxCollapseBody,
|
|
345
|
+
tag,
|
|
346
|
+
tagItem,
|
|
347
|
+
tagItemHeader,
|
|
348
|
+
tagItemHeaderButton,
|
|
349
|
+
tagBoxCollapse,
|
|
350
|
+
tagBoxCollapseBody,
|
|
351
|
+
tagBoxCollapseBodyContent,
|
|
352
|
+
} = toRefs(props);
|
|
353
|
+
const {
|
|
354
|
+
frameworkLocal,
|
|
355
|
+
isBootstrap,
|
|
356
|
+
isFoundation,
|
|
357
|
+
} = frameworksApi(props);
|
|
358
|
+
|
|
359
|
+
provide("isBootstrap", isBootstrap);
|
|
360
|
+
provide("isFoundation", isFoundation);
|
|
361
|
+
|
|
362
|
+
const currentFrameworkOptions = computed(() => {
|
|
363
|
+
return FRAMEWORKS_PARAMETERS[frameworkLocal.value];
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
const tagsLocal = computed(() => {
|
|
367
|
+
return {
|
|
368
|
+
main: replaceTextTemplateToASlot(tag.value || currentFrameworkOptions.value.main.tag),
|
|
369
|
+
item: replaceTextTemplateToASlot(tagItem.value || currentFrameworkOptions.value.item.tag),
|
|
370
|
+
itemHeader: replaceTextTemplateToASlot(tagItemHeader.value || currentFrameworkOptions.value.itemHeader.tag),
|
|
371
|
+
itemHeaderButton: replaceTextTemplateToASlot(tagItemHeaderButton.value || currentFrameworkOptions.value.itemHeaderButton.tag),
|
|
372
|
+
boxCollapse: replaceTextTemplateToASlot(tagBoxCollapse.value || currentFrameworkOptions.value.boxCollapse.tag),
|
|
373
|
+
boxCollapseBody: replaceTextTemplateToASlot(tagBoxCollapseBody.value || currentFrameworkOptions.value.boxCollapseBody.tag),
|
|
374
|
+
boxCollapseBodyContent: replaceTextTemplateToASlot(tagBoxCollapseBodyContent.value),
|
|
375
|
+
};
|
|
376
|
+
});
|
|
377
|
+
provide("currentFrameworkOptions", currentFrameworkOptions);
|
|
378
|
+
provide("tagsLocal", tagsLocal);
|
|
379
|
+
|
|
380
|
+
const classMainLocal = computed(() => {
|
|
381
|
+
return currentFrameworkOptions.value.main.class(classMain.value);
|
|
382
|
+
});
|
|
383
|
+
provide("classMainLocal", classMainLocal);
|
|
384
|
+
provide("classItem", classItem);
|
|
385
|
+
provide("classItemHeader", classItemHeader);
|
|
386
|
+
provide("classItemHeaderButton", classItemHeaderButton);
|
|
387
|
+
provide("classBoxCollapse", classBoxCollapse);
|
|
388
|
+
provide("classBoxCollapseBody", classBoxCollapseBody);
|
|
389
|
+
return {
|
|
390
|
+
classMainLocal,
|
|
391
|
+
isBootstrap,
|
|
392
|
+
isFoundation,
|
|
393
|
+
tagsLocal,
|
|
394
|
+
};
|
|
395
|
+
},
|
|
396
|
+
data() {
|
|
397
|
+
return {
|
|
398
|
+
indexesForOpen: [],
|
|
399
|
+
};
|
|
400
|
+
},
|
|
401
|
+
methods: {
|
|
402
|
+
toggle({ indexes, isOpen, $event }) {
|
|
403
|
+
if (this.disabled) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const INDEXES = cloneDeep(indexes);
|
|
407
|
+
if (this.alwaysOpen) {
|
|
408
|
+
this.toggleWithAlwaysOpen({ indexes: INDEXES, isOpen });
|
|
409
|
+
} else {
|
|
410
|
+
this.toggleWithoutAlwaysOpen({ indexes: INDEXES, isOpen });
|
|
411
|
+
}
|
|
412
|
+
this.$emit("toggle");
|
|
413
|
+
|
|
414
|
+
if (this.stop) {
|
|
415
|
+
$event.stopPropagation();
|
|
416
|
+
}
|
|
417
|
+
if (this.prevent) {
|
|
418
|
+
$event.preventDefault();
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
|
|
422
|
+
toggleWithAlwaysOpen({ indexes, isOpen }) {
|
|
423
|
+
const CURRENT_INDEX = indexes.pop();
|
|
424
|
+
if (isOpen) {
|
|
425
|
+
this.indexesForOpen = filter(this.indexesForOpen, index => {
|
|
426
|
+
return !startsWith(index, CURRENT_INDEX);
|
|
427
|
+
});
|
|
428
|
+
} else {
|
|
429
|
+
this.indexesForOpen.push(CURRENT_INDEX);
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
|
|
433
|
+
toggleWithoutAlwaysOpen({ indexes, isOpen }) {
|
|
434
|
+
if (isOpen) {
|
|
435
|
+
indexes.pop();
|
|
436
|
+
this.indexesForOpen = indexes;
|
|
437
|
+
} else {
|
|
438
|
+
this.indexesForOpen = indexes;
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
)
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import ASlot from "../../ASlot/ASlot.vue";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
computed,
|
|
5
|
+
inject,
|
|
6
|
+
toRefs,
|
|
7
|
+
} from "vue";
|
|
8
|
+
import {
|
|
9
|
+
cloneDeep,
|
|
10
|
+
get,
|
|
11
|
+
} from "lodash-es";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
name: "AAccordionItem",
|
|
15
|
+
components: {
|
|
16
|
+
ASlot,
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
item: {
|
|
20
|
+
type: Object,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
itemIndex: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
isParentOpen: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
parentIndexes: {
|
|
32
|
+
type: Array,
|
|
33
|
+
required: false,
|
|
34
|
+
default: () => [],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
emits: ["toggle"],
|
|
38
|
+
inject: [
|
|
39
|
+
"classBoxCollapseBodyContent",
|
|
40
|
+
"id",
|
|
41
|
+
"indexesForOpen",
|
|
42
|
+
"isFoundation",
|
|
43
|
+
"keyList",
|
|
44
|
+
"keyLabel",
|
|
45
|
+
"keyContent",
|
|
46
|
+
"tagsLocal",
|
|
47
|
+
],
|
|
48
|
+
setup(props) {
|
|
49
|
+
const {
|
|
50
|
+
isParentOpen,
|
|
51
|
+
itemIndex,
|
|
52
|
+
parentIndexes,
|
|
53
|
+
} = toRefs(props);
|
|
54
|
+
const classMainLocal = inject("classMainLocal");
|
|
55
|
+
const currentFrameworkOptions = inject("currentFrameworkOptions");
|
|
56
|
+
const classItem = inject("classItem");
|
|
57
|
+
const classItemHeader = inject("classItemHeader");
|
|
58
|
+
const classItemHeaderButton = inject("classItemHeaderButton");
|
|
59
|
+
const classBoxCollapse = inject("classBoxCollapse");
|
|
60
|
+
const classBoxCollapseBody = inject("classBoxCollapseBody");
|
|
61
|
+
|
|
62
|
+
const indexesForOpen = inject("indexesForOpen");
|
|
63
|
+
const parentIndexesString = computed(() => {
|
|
64
|
+
return parentIndexes.value.join(".");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const currentIndex = computed(() => {
|
|
68
|
+
if (parentIndexesString.value) {
|
|
69
|
+
return `${ parentIndexesString.value }.${ itemIndex.value }`;
|
|
70
|
+
}
|
|
71
|
+
return `${ itemIndex.value }`;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const isOpen = computed(() => {
|
|
75
|
+
if (!isParentOpen.value) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return indexesForOpen.value.indexOf(currentIndex.value) !== -1;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const classItemLocal = computed(() => {
|
|
82
|
+
return currentFrameworkOptions.value.item.class(classItem.value, isOpen.value);
|
|
83
|
+
});
|
|
84
|
+
const classItemHeaderLocal = computed(() => {
|
|
85
|
+
return currentFrameworkOptions.value.itemHeader.class(classItemHeader.value, isOpen.value);
|
|
86
|
+
});
|
|
87
|
+
const classItemHeaderButtonLocal = computed(() => {
|
|
88
|
+
return currentFrameworkOptions.value.itemHeaderButton.class(classItemHeaderButton.value, isOpen.value);
|
|
89
|
+
});
|
|
90
|
+
const classBoxCollapseLocal = computed(() => {
|
|
91
|
+
return currentFrameworkOptions.value.boxCollapse.class(classBoxCollapse.value, isOpen.value);
|
|
92
|
+
});
|
|
93
|
+
const classBoxCollapseBodyLocal = computed(() => {
|
|
94
|
+
return currentFrameworkOptions.value.boxCollapseBody.class(classBoxCollapseBody.value, isOpen.value);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
classMainLocal,
|
|
99
|
+
classItemLocal,
|
|
100
|
+
classItemHeaderLocal,
|
|
101
|
+
classItemHeaderButtonLocal,
|
|
102
|
+
classBoxCollapseLocal,
|
|
103
|
+
classBoxCollapseBodyLocal,
|
|
104
|
+
currentIndex,
|
|
105
|
+
isOpen,
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
computed: {
|
|
109
|
+
hasChildren() {
|
|
110
|
+
return this.children.length !== 0;
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
children() {
|
|
114
|
+
return get(this.item, this.keyList, []) || [];
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
parentIndexesForChild() {
|
|
118
|
+
const PARENT_INDEXES = cloneDeep(this.parentIndexes);
|
|
119
|
+
PARENT_INDEXES.push(`${ this.currentIndex }`);
|
|
120
|
+
return PARENT_INDEXES;
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
ariaExpanded() {
|
|
124
|
+
return `${ this.isOpen }`;
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
idForCollapse() {
|
|
128
|
+
return `${ this.id }_${ this.currentIndex.replace(/\./g, "_") }`;
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
labelLocal() {
|
|
132
|
+
if (this.keyLabel) {
|
|
133
|
+
return get(this.item, this.keyLabel);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
contentLocal() {
|
|
138
|
+
if (this.keyContent) {
|
|
139
|
+
return get(this.item, this.keyContent);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
styleBoxCollapse() {
|
|
144
|
+
if (this.isFoundation && this.isOpen) {
|
|
145
|
+
return "display: block;";
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
methods: {
|
|
150
|
+
toggle($event) {
|
|
151
|
+
this.$emit("toggle", {
|
|
152
|
+
$event: $event,
|
|
153
|
+
indexes: this.parentIndexesForChild,
|
|
154
|
+
isOpen: this.isOpen,
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
toggleFromChild(arg) {
|
|
159
|
+
this.$emit("toggle", arg);
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
)
|