classcard-ui 0.2.139 → 0.2.143

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,6 +1,6 @@
1
1
  {
2
2
  "name": "classcard-ui",
3
- "version": "0.2.139",
3
+ "version": "0.2.143",
4
4
  "main": "dist/classcard-ui.common.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -13,7 +13,7 @@
13
13
  aria-labelledby="listbox-label"
14
14
  :value="inputValue"
15
15
  :placeholder="placeholder"
16
- @focus="showDropDown = true"
16
+ @focus="openDropDown()"
17
17
  @blur="closeDropDown()"
18
18
  @input="onInput"
19
19
  />
@@ -54,11 +54,22 @@
54
54
  aria-activedescendant="listbox-option-3"
55
55
  v-if="showDropDown && options.length > 0"
56
56
  >
57
+ <div
58
+ v-if="isSearching"
59
+ class="w-full h-8 relative block top-0 left-0 bg-white opacity-75 z-50"
60
+ >
61
+ <span
62
+ class="text-gray-500 opacity-75 top-1/4 my-0 mx-auto block relative w-0 h-0"
63
+ >
64
+ <c-icon name="loader" class="h-5 w-5"></c-icon>
65
+ </span>
66
+ </div>
57
67
  <!--
58
68
  Select option, manage highlight styles based on mouseenter/mouseleave and keyboard navigation.
59
69
 
60
70
  Highlighted: "text-white bg-indigo-600", Not Highlighted: "text-gray-900"
61
71
  -->
72
+
62
73
  <span v-for="option in options" :key="option.id">
63
74
  <li
64
75
  class="text-gray-900 cursor-default select-none relative py-2 pl-3 pr-9"
@@ -81,7 +92,7 @@
81
92
  subOption.label === value.label
82
93
  ? 'font-semibold'
83
94
  : 'font-normal',
84
- ' block truncate',
95
+ ' block break-words',
85
96
  ]"
86
97
  >
87
98
  {{ subOption.label }}
@@ -122,14 +133,17 @@
122
133
 
123
134
  <script>
124
135
  import { debounce } from "lodash-es";
136
+ import CIcon from "../CIcon/CIcon.vue";
125
137
 
126
138
  export default {
127
139
  name: "CGroupedSelect",
140
+ components: { CIcon },
128
141
  props: {
129
142
  label: String,
130
143
  options: Array,
131
144
  value: Object,
132
145
  placeholder: String,
146
+ isSearching: Boolean,
133
147
  },
134
148
  data() {
135
149
  return {
@@ -143,7 +157,11 @@ export default {
143
157
  this.emitSearch(e.target.value);
144
158
  },
145
159
  emitSearch: debounce(function (value) {
146
- this.$emit("search", value);
160
+ if (value !== this.value.label) {
161
+ this.$emit("search", value);
162
+ } else {
163
+ this.$emit("search", "");
164
+ }
147
165
  }, 500),
148
166
  handleOptionClick(option) {
149
167
  this.$emit("input", option);
@@ -153,6 +171,10 @@ export default {
153
171
  this.inputValue = this.value.label;
154
172
  this.showDropDown = false;
155
173
  },
174
+ openDropDown() {
175
+ this.showDropDown = true;
176
+ this.emitSearch("");
177
+ },
156
178
  },
157
179
  watch: {
158
180
  value(newValue) {