@tak-ps/vue-tabler 2.2.9 → 2.3.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/CHANGELOG.md +4 -0
- package/components/List.vue +33 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/components/List.vue
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="dropdown">
|
|
3
3
|
<label class='form-label' v-text='label'></label>
|
|
4
|
-
<div type="button" id="
|
|
5
|
-
<
|
|
4
|
+
<div type="button" ref='button' id="list-menu-button" data-bs-toggle="dropdown" aria-expanded="false" class='border rounded' style='height: 36px;'>
|
|
5
|
+
<div class='d-flex mx-2'>
|
|
6
|
+
<span v-if='ele' style='padding-top: 6px;' v-text='ele[namekey]'/>
|
|
7
|
+
<span v-else style='padding-top: 6px;'>Select <span v-text='label'/></span>
|
|
8
|
+
|
|
9
|
+
<div class='ms-auto'>
|
|
10
|
+
<SettingsIcon style='margin-top: 4px;'/>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
6
13
|
</div>
|
|
7
|
-
<ul class="dropdown-menu" aria-labelledby="
|
|
14
|
+
<ul class="dropdown-menu" aria-labelledby="list-menu-button" :style='{
|
|
15
|
+
"width": `${buttonHeight}px`
|
|
16
|
+
}'>
|
|
8
17
|
<div class='m-1'>
|
|
18
|
+
<TablerInput :disabled='disabled' placeholder='Name' v-model='filter'/>
|
|
9
19
|
<div @click='select(ele)' :key='ele.id' v-for='ele in list[listkey]'>
|
|
10
20
|
<div class="d-flex align-items-center my-1 cursor-pointer" v-text='ele[namekey]'></div>
|
|
11
21
|
</div>
|
|
@@ -16,6 +26,9 @@
|
|
|
16
26
|
|
|
17
27
|
<script>
|
|
18
28
|
import TablerInput from './Input.vue';
|
|
29
|
+
import {
|
|
30
|
+
SettingsIcon
|
|
31
|
+
} from 'vue-tabler-icons';
|
|
19
32
|
|
|
20
33
|
export default {
|
|
21
34
|
name: 'TablerList',
|
|
@@ -39,21 +52,36 @@ export default {
|
|
|
39
52
|
},
|
|
40
53
|
data: function() {
|
|
41
54
|
return {
|
|
55
|
+
ele: null,
|
|
56
|
+
isMounted: false,
|
|
42
57
|
filter: '',
|
|
43
58
|
list: {}
|
|
44
59
|
}
|
|
45
60
|
},
|
|
46
61
|
watch: {
|
|
62
|
+
ele: function() {
|
|
63
|
+
this.filter = '';
|
|
64
|
+
},
|
|
47
65
|
filter: async function() {
|
|
48
66
|
await this.fetchList();
|
|
49
67
|
}
|
|
50
68
|
},
|
|
51
69
|
mounted: async function() {
|
|
52
|
-
if (this.initial && this.initial[this.namekey]) this.
|
|
70
|
+
if (this.initial && this.initial[this.namekey]) this.ele = this.initial;
|
|
53
71
|
await this.fetchList();
|
|
72
|
+
this.isMounted = true;
|
|
73
|
+
},
|
|
74
|
+
computed: {
|
|
75
|
+
buttonHeight() {
|
|
76
|
+
if(!this.isMounted) return 100;
|
|
77
|
+
const buttonDOM = this.$refs.button
|
|
78
|
+
console.error(buttonDOM);
|
|
79
|
+
return buttonDOM ? buttonDOM.offsetWidth : 100;
|
|
80
|
+
},
|
|
54
81
|
},
|
|
55
82
|
methods: {
|
|
56
83
|
select: function(ele) {
|
|
84
|
+
this.ele = ele;
|
|
57
85
|
this.filter = ele[this.namekey];
|
|
58
86
|
this.$emit("selected", ele)
|
|
59
87
|
},
|
|
@@ -65,6 +93,7 @@ export default {
|
|
|
65
93
|
}
|
|
66
94
|
},
|
|
67
95
|
components: {
|
|
96
|
+
SettingsIcon,
|
|
68
97
|
TablerInput
|
|
69
98
|
}
|
|
70
99
|
}
|