classcard-ui 0.2.251 → 0.2.256

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.251",
3
+ "version": "0.2.256",
4
4
  "main": "dist/classcard-ui.common.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -15,8 +15,10 @@
15
15
  :options="options"
16
16
  @input="setSelectedOptions"
17
17
  @search="fetchOptions"
18
+ @search:focus="$emit('search:focus')"
18
19
  :label="optionLabel"
19
20
  :clearable="clearable"
21
+ :loading="loading"
20
22
  >
21
23
  <template #open-indicator="{ attributes }">
22
24
  <span v-bind="attributes">
@@ -41,6 +43,29 @@
41
43
  >
42
44
  <span v-else>No options found, try searching something else.</span>
43
45
  </template>
46
+ <template #spinner="{ loading }">
47
+ <svg
48
+ class="animate-spin h-5 w-5 text-gray-400"
49
+ xmlns="http://www.w3.org/2000/svg"
50
+ fill="none"
51
+ viewBox="0 0 24 24"
52
+ v-if="loading"
53
+ >
54
+ <circle
55
+ class="opacity-25"
56
+ cx="12"
57
+ cy="12"
58
+ r="10"
59
+ stroke="currentColor"
60
+ stroke-width="4"
61
+ ></circle>
62
+ <path
63
+ class="opacity-75"
64
+ fill="currentColor"
65
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
66
+ ></path>
67
+ </svg>
68
+ </template>
44
69
  <template slot="option" slot-scope="option">
45
70
  <slot name="custom-option" v-bind:option="option"></slot>
46
71
  </template>
@@ -137,6 +162,10 @@ export default {
137
162
  errorMessage: {
138
163
  type: String,
139
164
  },
165
+ loading: {
166
+ type: Boolean,
167
+ default: false,
168
+ },
140
169
  },
141
170
  computed: {},
142
171
  data() {
@@ -43,9 +43,9 @@
43
43
  :type="icon.type"
44
44
  >
45
45
  </c-icon>
46
- <span :class="showImage ? 'ml-3' : ''" class="block truncate">
47
- {{ selectedValue ? selectedValue :
48
- selectSearch && selectSearch.length > 0 ? null : placeholder
46
+ <span :class="showImage ? 'ml-3' : ''" class="block truncate text-sm">
47
+ {{ selectedValue ? selectedValue :
48
+ !selectSearch || selectSearch == '' ? placeholder : null
49
49
  }}
50
50
  </span>
51
51
  </span>
@@ -136,6 +136,7 @@
136
136
  <script>
137
137
  import CIcon from "../CIcon/CIcon.vue";
138
138
  import CAvatar from "../CAvatar/CAvatar.vue";
139
+ import { isNumber } from 'lodash';
139
140
  export default {
140
141
  name: "CSelect",
141
142
  components: { CIcon, CAvatar },
@@ -216,6 +217,7 @@ export default {
216
217
  },
217
218
  methods: {
218
219
  handleSelect(event, option) {
220
+ this.selectSearch = null;
219
221
  this.selectedValue = option[this.renderOptionName];
220
222
  this.$emit("onChangeValue", option);
221
223
  this.toggleDropdown = false;
@@ -224,18 +226,21 @@ export default {
224
226
  this.$emit("listAction", event);
225
227
  },
226
228
  close() {
229
+ this.selectSearch = null;
227
230
  this.toggleDropdown = false;
228
231
  this.type === "tertiary" ? (this.showFocus = false) : "";
229
232
  },
230
233
  search() {
234
+ this.selectedValue = null;
231
235
  if(!this.selectSearch && this.selectSearch == '') {
232
236
  this.renderOptions = this.options;
237
+ return;
233
238
  }
234
239
  let options = [...this.options];
235
240
  this.renderOptions = options.filter((option) => {
241
+ isNumber(option[this.renderOptionName]) ? option[this.renderOptionName] = option[this.renderOptionName].toString() : "";
236
242
  return option[this.renderOptionName].toLowerCase().includes(this.selectSearch.toLowerCase());
237
243
  });
238
- console.log(this.renderOptions);
239
244
  }
240
245
  },
241
246
  watch: {
@@ -243,6 +248,9 @@ export default {
243
248
  this.selectedValue =
244
249
  this.value !== null && this.value.option ? this.value.option : this.value;
245
250
  },
251
+ options() {
252
+ this.renderOptions = this.options;
253
+ },
246
254
  },
247
255
  };
248
256
  </script>