@itfin/components 1.3.18 → 1.3.19
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/package.json
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
<!--template>
|
|
2
|
-
|
|
3
|
-
<div class="itf-dropdown" :class="`drop${placement}`">
|
|
4
|
-
<div v-if="disabled"><slot name="button">{{label}}</slot></div>
|
|
5
|
-
<itf-button
|
|
6
|
-
v-else-if="!text"
|
|
7
|
-
:class="{ 'dropdown-toggle': toggle }"
|
|
8
|
-
v-bind="buttonOptions"
|
|
9
|
-
ref="toggle"
|
|
10
|
-
:id="modalId"
|
|
11
|
-
data-bs-toggle="dropdown"
|
|
12
|
-
aria-expanded="false"
|
|
13
|
-
>
|
|
14
|
-
<slot name="button">{{label}}</slot>
|
|
15
|
-
</itf-button>
|
|
16
|
-
<div v-else :class="{ 'dropdown-toggle': toggle }" ref="toggle" :id="modalId" data-bs-toggle="dropdown" aria-expanded="false">
|
|
17
|
-
<slot name="button">{{label}}</slot>
|
|
18
|
-
</div>
|
|
19
|
-
<div
|
|
20
|
-
class="itf-dropdown__menu dropdown-menu"
|
|
21
|
-
:class="{'dropdown-menu-end': right, 'shadow': shadow}"
|
|
22
|
-
ref="dropdown"
|
|
23
|
-
v-bind="menuOptions"
|
|
24
|
-
:aria-labelledby="modalId">
|
|
25
|
-
<slot></slot>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
</template-->
|
|
30
1
|
<script>
|
|
31
2
|
import { Vue, Component, Prop, Watch, PropSync } from 'vue-property-decorator';
|
|
32
3
|
import itfButton from '../button/Button';
|
|
@@ -49,7 +20,7 @@ class itfDropdown extends Vue {
|
|
|
49
20
|
@Prop({ type: Boolean }) shadow;
|
|
50
21
|
@Prop({ type: Boolean }) disabled;
|
|
51
22
|
@Prop({ type: Boolean }) text;
|
|
52
|
-
@Prop({ type: Boolean }) appendToBody;
|
|
23
|
+
@Prop({ type: Boolean, default: true }) appendToBody;
|
|
53
24
|
@Prop({ validator: (value) => [true, false, 'inside', 'outside'].includes(value), default: true }) autoclose;
|
|
54
25
|
@Prop({ type: Object, default: () => ({}) }) buttonOptions;
|
|
55
26
|
@Prop({ type: Object, default: () => ({}) }) menuOptions;
|
|
@@ -80,23 +51,24 @@ class itfDropdown extends Vue {
|
|
|
80
51
|
staticClass: 'dropdown'
|
|
81
52
|
}, [
|
|
82
53
|
createElement(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
54
|
+
'itf-button',
|
|
55
|
+
{
|
|
56
|
+
props: this.buttonOptions || {},
|
|
57
|
+
class: { 'dropdown-toggle': this.toggle },
|
|
58
|
+
attrs: { id: modalId, 'data-bs-toggle': 'dropdown', 'aria-expanded': 'false' },
|
|
59
|
+
ref: 'toggle',
|
|
60
|
+
},
|
|
61
|
+
this.$slots.button || label
|
|
91
62
|
),
|
|
92
63
|
createElement(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
64
|
+
'div',
|
|
65
|
+
{
|
|
66
|
+
attrs: { rel: 'dropdown' , 'aria-labelledby': modalId},
|
|
67
|
+
class: { 'dropdown-menu-end': right, 'shadow': shadow },
|
|
68
|
+
staticClass: 'itf-dropdown__menu dropdown-menu',
|
|
69
|
+
ref: 'dropdown',
|
|
70
|
+
},
|
|
71
|
+
this.$slots.default
|
|
100
72
|
)
|
|
101
73
|
]);
|
|
102
74
|
}
|
|
@@ -116,6 +88,7 @@ class itfDropdown extends Vue {
|
|
|
116
88
|
autoClose: this.autoclose
|
|
117
89
|
});
|
|
118
90
|
let context = document.body;
|
|
91
|
+
console.info(this.$refs.dropdown);
|
|
119
92
|
if (this.appendToBody && this.$refs.dropdown instanceof Node && this.$refs.dropdown.parentNode) {
|
|
120
93
|
this.$refs.dropdown.parentNode.removeChild(this.$refs.dropdown);
|
|
121
94
|
context.appendChild(this.$refs.dropdown); // should append only to body
|