classcard-ui 0.2.318 → 0.2.321

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.318",
3
+ "version": "0.2.321",
4
4
  "main": "dist/classcard-ui.common.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <div>
3
3
  <div class="flex items-center">
4
- <label v-if="label" class="text-sm font-medium text-gray-900">{{ label }}</label>
4
+ <label v-if="label" class="text-sm font-medium text-gray-900">{{
5
+ label
6
+ }}</label>
5
7
  <!-- asterisk sign to render if field is required -->
6
8
  <p v-if="isRequired" class="ml-1 text-red-600">*</p>
7
9
  </div>
@@ -40,7 +42,9 @@
40
42
  </template>
41
43
  <!-- eslint-disable-next-line vue/no-unused-vars -->
42
44
  <template #no-options="{ search, searching, loading }">
43
- <span v-if="search.length < 1">Start typing to search for options...</span>
45
+ <span v-if="search.length < 1"
46
+ >Start typing to search for options...</span
47
+ >
44
48
  <span v-else>No options found, try searching something else.</span>
45
49
  </template>
46
50
  <template #spinner="{ loading }">
@@ -97,6 +101,7 @@
97
101
  <script>
98
102
  import vSelect from "vue-select";
99
103
  import CAvatar from "../CAvatar/CAvatar.vue";
104
+ import { debounce } from "lodash-es";
100
105
  // import Fuse from "fuse.js";
101
106
  import "vue-select/dist/vue-select.css";
102
107
  export default {
@@ -174,13 +179,23 @@ export default {
174
179
  data() {
175
180
  return {
176
181
  loaderSearching: true,
177
- value: this.optionsSelected && this.optionsSelected.length ? this.optionsSelected : [],
182
+ value:
183
+ this.optionsSelected && this.optionsSelected.length
184
+ ? this.optionsSelected
185
+ : [],
186
+ localSearch: "",
178
187
  };
179
188
  },
180
189
  methods: {
181
190
  fetchOptions(search, loaderSearching) {
191
+ this.localSearch = search;
182
192
  this.$emit("getOptions", search, loaderSearching);
183
193
  },
194
+ emitSearch() {
195
+ debounce(() => {
196
+ this.$emit("search", this.localSearch);
197
+ }, 500);
198
+ },
184
199
  setSelectedOptions(params) {
185
200
  this.value = params;
186
201
  this.$emit("onSelectOptions", params);
@@ -198,7 +213,7 @@ export default {
198
213
  @apply cursor-pointer;
199
214
  }
200
215
  .vs__dropdown-toggle {
201
- @apply focus:outline-none w-full rounded-md border border-gray-300 bg-white py-2 pl-3 text-left shadow-sm focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 sm:text-sm;
216
+ @apply w-full rounded-md border border-gray-300 bg-white py-2 pl-3 text-left shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 sm:text-sm;
202
217
  }
203
218
  .vs__selected-options {
204
219
  @apply flex-nowrap overflow-hidden;
@@ -221,7 +236,7 @@ export default {
221
236
  @apply pt-0 pr-3;
222
237
  }
223
238
  .vs__dropdown-menu {
224
- @apply focus:outline-none mt-2 max-h-60 overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-opacity-5 sm:text-sm;
239
+ @apply mt-2 max-h-60 overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-opacity-5 focus:outline-none sm:text-sm;
225
240
  }
226
241
  .vs__dropdown-option {
227
242
  @apply py-2;
@@ -1,6 +1,14 @@
1
1
  <template>
2
2
  <div>
3
- <div v-if="type === 'filestack'" :class="filestackClasses" id="filestack-uploader"></div>
3
+ <button
4
+ type="button"
5
+ class="inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm leading-4 font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
6
+ @click="initFilestack()"
7
+ v-if="displayMode == 'overlay'"
8
+ >
9
+ Upload
10
+ </button>
11
+ <div :class="filestackClasses" id="filestack-uploader"></div>
4
12
  <p v-if="!isValidate" class="mt-2 text-sm text-red-600">
5
13
  {{ errorMessage }}
6
14
  </p>
@@ -27,10 +35,6 @@ export default {
27
35
  errorMessage: {
28
36
  type: String,
29
37
  },
30
- type: {
31
- type: String,
32
- default: "default",
33
- },
34
38
  filestackApiKey: {
35
39
  type: String,
36
40
  default: "",
@@ -53,17 +57,20 @@ export default {
53
57
  type: Number,
54
58
  default: null,
55
59
  },
60
+ displayMode: {
61
+ type: String,
62
+ default: "inline",
63
+ },
56
64
  },
57
65
  data() {
58
66
  return {
59
- uploader: null,
60
67
  };
61
68
  },
62
69
  methods: {
63
70
  initFilestack() {
64
71
  const client = filestack.init(this.filestackApiKey);
65
72
  const options = {
66
- displayMode: "inline",
73
+ displayMode: this.displayMode,
67
74
  container: "#filestack-uploader",
68
75
  uploadInBackground: false,
69
76
  maxFiles: this.maxFiles,
@@ -93,7 +100,7 @@ export default {
93
100
  },
94
101
  },
95
102
  mounted() {
96
- if (this.type === "filestack") {
103
+ if (this.displayMode == "inline") {
97
104
  this.initFilestack();
98
105
  }
99
106
  },