classcard-ui 0.2.492 → 0.2.495

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.492",
3
+ "version": "0.2.495",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,22 +1,26 @@
1
1
  <template>
2
2
  <div>
3
- <span class="-ml-px relative block sm:shadow-sm sm:hidden">
4
- <div>
3
+ <span class="relative -ml-px block sm:hidden sm:shadow-sm">
4
+ <div v-if="!hideDropdown">
5
5
  <button
6
6
  @click="showButtons = !showButtons"
7
7
  type="button"
8
- class="relative inline-flex items-center px-2 py-2 rounded-md border border-gray-300 bg-white text-sm font-medium text-gray-900 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-blue-600 focus:border-blue-600 sm:rounded-md sm:px-3"
8
+ class="focus:ring-blue-600 focus:border-blue-600 relative inline-flex items-center rounded-md border border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-900 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 sm:rounded-md sm:px-3"
9
9
  id="menu-3"
10
10
  aria-expanded="false"
11
11
  aria-haspopup="true"
12
12
  >
13
13
  <span class="">{{ buttonObject[0].label }}</span>
14
- <c-icon type="solid" name="chevron-down" class="h-5 w-5 ml-2"></c-icon>
14
+ <c-icon
15
+ type="solid"
16
+ name="chevron-down"
17
+ class="ml-2 h-5 w-5"
18
+ ></c-icon>
15
19
  </button>
16
20
  </div>
17
21
  <div
18
22
  v-show="showButtons"
19
- class="origin-top-right absolute mt-2 w-full z-10 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none"
23
+ class="absolute z-10 mt-2 w-full origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none"
20
24
  role="menu"
21
25
  aria-orientation="vertical"
22
26
  >
@@ -40,14 +44,15 @@
40
44
  </div>
41
45
  </div>
42
46
  </span>
43
- <span class="relative z-0 inline-flex rounded-md hidden sm:block">
47
+ <span class="z-0 relative inline-flex hidden rounded-md sm:block">
44
48
  <button
45
49
  v-for="(button, index) in buttonObject"
46
50
  v-bind:key="button.label"
47
51
  type="button"
48
- class="relative inline-flex items-center px-2 py-2 border-r border-l border-t border-b border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500"
52
+ class="relative inline-flex items-center border-r border-l border-t border-b border-gray-300 bg-white px-2 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:z-10 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500"
49
53
  :class="{
50
- 'rounded-r-md border-l-0 border-r rounded-l-none': index == buttonObject.length - 1,
54
+ 'rounded-r-md rounded-l-none border-l-0 border-r':
55
+ index == buttonObject.length - 1,
51
56
  'rounded-l-md': index == 0,
52
57
  'border-r-0': index == 0 && buttonObject.length != 2,
53
58
  'px-4': button.label,
@@ -80,6 +85,10 @@ export default {
80
85
  type: Array,
81
86
  required: true,
82
87
  },
88
+ hideDropdownIcon: {
89
+ type: Boolean,
90
+ default: false,
91
+ },
83
92
  },
84
93
  data() {
85
94
  return {
@@ -88,11 +97,11 @@ export default {
88
97
  },
89
98
  methods: {
90
99
  handleEvent(function_name) {
91
- if(function_name) function_name()
100
+ if (function_name) function_name();
92
101
  },
93
102
  buttonAction(event, value) {
94
103
  this.$emit("onClick", value);
95
- }
104
+ },
96
105
  },
97
106
  };
98
107
  </script>
@@ -212,10 +212,7 @@ export default {
212
212
  data() {
213
213
  return {
214
214
  toggleDropdown: false,
215
- selectedValue:
216
- this.value !== null && this.value.option
217
- ? this.value.option
218
- : this.value,
215
+ selectedValue: null,
219
216
  showSelectedValue: false,
220
217
  showFocus: false,
221
218
  selectSearch: null,
@@ -271,13 +268,19 @@ export default {
271
268
  watch: {
272
269
  value() {
273
270
  this.selectedValue =
274
- this.value !== null && this.value.option
275
- ? this.value.option
271
+ this.value !== null && this.value[this.renderOptionName]
272
+ ? this.value[this.renderOptionName]
276
273
  : this.value;
277
274
  },
278
275
  options() {
279
276
  this.renderOptions = this.options;
280
277
  },
281
278
  },
279
+ mounted() {
280
+ this.selectedValue =
281
+ this.value !== null && this.value[this.renderOptionName]
282
+ ? this.value[this.renderOptionName]
283
+ : this.value;
284
+ },
282
285
  };
283
286
  </script>