classcard-ui 0.2.1510 → 0.2.1512

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.1510",
3
+ "version": "0.2.1512",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -50,7 +50,8 @@
50
50
  @mouseleave="showTooltipIndex = null"
51
51
  >
52
52
  <a
53
- @mousedown.stop.prevent="dropdownAction(item)"
53
+ @mousedown.prevent
54
+ @click.stop="dropdownAction(item, index)"
54
55
  class="flex cursor-pointer justify-between px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 disabled:pointer-events-none disabled:opacity-50"
55
56
  :class="[
56
57
  item.class,
@@ -96,7 +97,9 @@
96
97
  <slot v-if="item.name" :name="item.name"></slot>
97
98
  </a>
98
99
  <c-tooltip
99
- v-if="item.tooltip && item.tooltip.text && showTooltipIndex === index"
100
+ v-if="
101
+ item.tooltip && item.tooltip.text && showTooltipIndex === index
102
+ "
100
103
  :tooltipText="item.tooltip.text"
101
104
  :isTopAligned="true"
102
105
  :classes="item.tooltip.classes"
@@ -114,10 +117,12 @@
114
117
  import { getActionID } from "../../helper";
115
118
  import CIcon from "../CIcon/CIcon.vue";
116
119
  import CTooltip from "../CToolTip/CToolTip.vue";
117
-
118
120
  export default {
119
121
  name: "CIconDropdown",
120
- components: { CIcon, CTooltip },
122
+ components: {
123
+ CIcon,
124
+ CTooltip,
125
+ },
121
126
  props: {
122
127
  id: {
123
128
  type: String,
@@ -164,6 +169,7 @@ export default {
164
169
  return {
165
170
  toggleDropdown: false,
166
171
  showTooltipIndex: null,
172
+ pendingCloseIndex: null,
167
173
  };
168
174
  },
169
175
  methods: {
@@ -192,12 +198,35 @@ export default {
192
198
  }
193
199
  }
194
200
  },
195
- dropdownAction(item) {
201
+ dropdownAction(item, index) {
196
202
  this.$emit("action", item);
197
- this.close();
203
+
204
+ this.$nextTick(() => {
205
+ const currentItem = this.items[index];
206
+ if (currentItem && currentItem.isLoading) {
207
+ this.pendingCloseIndex = index;
208
+ return;
209
+ }
210
+ this.close();
211
+ });
198
212
  },
199
213
  close() {
200
214
  this.toggleDropdown = false;
215
+ this.pendingCloseIndex = null;
216
+ },
217
+ },
218
+ watch: {
219
+ items: {
220
+ // Once the items are updated, check if the pending close index is not null and the item is not loading, if so, close the dropdown
221
+ handler(newItems) {
222
+ if (this.pendingCloseIndex === null) return;
223
+ const item = newItems[this.pendingCloseIndex];
224
+ if (!item || !item.isLoading) {
225
+ this.pendingCloseIndex = null;
226
+ this.close();
227
+ }
228
+ },
229
+ deep: true,
201
230
  },
202
231
  },
203
232
  };
package/src/icons.js CHANGED
@@ -867,4 +867,8 @@ export default {
867
867
  "M8.603 3.799A4.49 4.49 0 0 1 12 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 0 1 3.498 1.307 4.491 4.491 0 0 1 1.307 3.497A4.49 4.49 0 0 1 21.75 12a4.49 4.49 0 0 1-1.549 3.397 4.491 4.491 0 0 1-1.307 3.497 4.491 4.491 0 0 1-3.497 1.307A4.49 4.49 0 0 1 12 21.75a4.49 4.49 0 0 1-3.397-1.549 4.49 4.49 0 0 1-3.498-1.306 4.491 4.491 0 0 1-1.307-3.498A4.49 4.49 0 0 1 2.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 0 1 1.307-3.497 4.49 4.49 0 0 1 3.497-1.307Zm7.007 6.387a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",
868
868
  "arrow-right-solid-v2":
869
869
  "M12.97 3.97a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 1 1-1.06-1.06l6.22-6.22H3a.75.75 0 0 1 0-1.5h16.19l-6.22-6.22a.75.75 0 0 1 0-1.06Z",
870
+ "panel-right-open-outline-v2":
871
+ "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z M15 3v18 M10 15l-3-3 3-3", //lucid icon
872
+ "panel-left-open-outline-v2":
873
+ "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z M9 3v18 M14 9l3 3-3 3", //lucid icon
870
874
  };