@tak-ps/vue-tabler 2.2.9 → 2.3.1

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 CHANGED
@@ -10,6 +10,14 @@
10
10
 
11
11
  ## Version History
12
12
 
13
+ ### v2.3.1
14
+
15
+ - :rocket: Remove Debug Code
16
+
17
+ ### v2.3.0
18
+
19
+ - :rocket: Improved List Component
20
+
13
21
  ### v2.2.9
14
22
 
15
23
  - :rocket: Toggle: Centre Label
@@ -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="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
5
- <TablerInput :disabled='disabled' placeholder='Name' v-model='filter'/>
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="dropdownMenuButton1">
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,35 @@ 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.filter = this.initial[this.namekey];
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
+ return buttonDOM ? buttonDOM.offsetWidth : 100;
79
+ },
54
80
  },
55
81
  methods: {
56
82
  select: function(ele) {
83
+ this.ele = ele;
57
84
  this.filter = ele[this.namekey];
58
85
  this.$emit("selected", ele)
59
86
  },
@@ -65,6 +92,7 @@ export default {
65
92
  }
66
93
  },
67
94
  components: {
95
+ SettingsIcon,
68
96
  TablerInput
69
97
  }
70
98
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/vue-tabler",
3
3
  "type": "module",
4
- "version": "2.2.9",
4
+ "version": "2.3.1",
5
5
  "main": "lib.js",
6
6
  "module": "lib.js",
7
7
  "description": "Tabler UI components for Vue3",