classcard-ui 0.2.508 → 0.2.511

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.508",
3
+ "version": "0.2.511",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -90,9 +90,11 @@
90
90
  }"
91
91
  >{{ getDayFromDate(date) }}</time
92
92
  >
93
- <span v-if="eventsArray" class="sr-only">0 events</span>
93
+ <span v-if="eventsCount" class="sr-only"
94
+ >{{ getEventsCountForDate(date) }} events</span
95
+ >
94
96
  <span
95
- v-if="eventsArray"
97
+ v-if="eventsCount"
96
98
  class="-mx-0.5 mt-auto flex flex-wrap-reverse"
97
99
  >
98
100
  <span
@@ -103,9 +105,12 @@
103
105
  </div>
104
106
  </div>
105
107
  </div>
106
- <section class="mt-12">
108
+ <section v-if="eventData" class="mt-12">
107
109
  <h2 class="font-semibold text-gray-900">
108
- Schedule for <time datetime="2022-01-21">January 21, 2022</time>
110
+ Schedule for
111
+ <time :datetime="selectedDateForDateTime">{{
112
+ formattedSelectedDate
113
+ }}</time>
109
114
  </h2>
110
115
  <ol class="mt-4 space-y-1 text-sm leading-6 text-gray-500">
111
116
  <li
@@ -210,7 +215,11 @@ export default {
210
215
  type: [String, Date],
211
216
  default: () => null,
212
217
  },
213
- eventsArray: {
218
+ eventsCount: {
219
+ type: Array,
220
+ default: () => null,
221
+ },
222
+ eventsData: {
214
223
  type: Array,
215
224
  default: () => null,
216
225
  },
@@ -245,6 +254,16 @@ export default {
245
254
  formatForDateTime(date) {
246
255
  return dayjs(date).format("YYYY-MM-DD");
247
256
  },
257
+ getEventsCountForDate(date) {
258
+ let eventsCountObj = this.eventsCount.find((event) =>
259
+ dayjs(date).isSame(dayjs(event.date))
260
+ );
261
+ if (eventsCountObj) {
262
+ return eventsCountObj.eventsCount;
263
+ } else {
264
+ return 0;
265
+ }
266
+ },
248
267
  },
249
268
  computed: {
250
269
  currentMonthAndYear() {
@@ -275,6 +294,12 @@ export default {
275
294
  }
276
295
  return dates;
277
296
  },
297
+ formattedSelectedDate() {
298
+ return dayjs(this.value ?? dayjs()).format("MMMM D, YYYY");
299
+ },
300
+ selectedDateForDateTime() {
301
+ return dayjs(this.value ?? dayjs()).format("YYYY-MM-DD");
302
+ },
278
303
  },
279
304
  mounted() {
280
305
  if (this.value) {
@@ -31,24 +31,20 @@
31
31
 
32
32
  <div class="pointer-events-none absolute top-2 left-3 flex">
33
33
  <span class="flex items-center" :style="selectedOptionStyles">
34
- <c-avatar
35
- v-if="showImage && !selectSearch && value && value.photo"
36
- size="extraextrasmall"
37
- :image="value.photo"
38
- :rounded="true"
39
- ></c-avatar>
40
- <c-avatar
41
- v-if="
42
- showImage &&
43
- !selectSearch &&
44
- value &&
45
- value.initials &&
46
- value.type !== location
47
- "
48
- size="extraextrasmall"
49
- :nameInitials="value.initials"
50
- :rounded="true"
51
- ></c-avatar>
34
+ <div v-if="showImage && !selectSearch && value">
35
+ <c-avatar
36
+ v-if="value.photo"
37
+ size="extraextrasmall"
38
+ :image="value.photo"
39
+ :rounded="true"
40
+ ></c-avatar>
41
+ <c-avatar
42
+ v-else
43
+ size="extraextrasmall"
44
+ :nameInitials="value.initials"
45
+ :rounded="true"
46
+ ></c-avatar>
47
+ </div>
52
48
  <c-icon
53
49
  v-if="icon && !showImage"
54
50
  :class="icon.class"
@@ -115,31 +111,29 @@
115
111
  :class="option.isDisabled ? 'pointer-events-none opacity-50' : ''"
116
112
  >
117
113
  <span class="flex items-center">
118
- <c-avatar
119
- v-if="showImage && option.photo"
120
- size="extraextrasmall"
121
- :image="option.photo"
122
- :rounded="true"
123
- ></c-avatar>
124
- <c-avatar
125
- v-if="
126
- showImage && option.initials && option.type !== location
127
- "
128
- size="extraextrasmall"
129
- :nameInitials="option.initials"
130
- :rounded="true"
131
- ></c-avatar>
114
+ <div v-if="option.showImage">
115
+ <c-avatar
116
+ v-if="option.photo"
117
+ size="extraextrasmall"
118
+ :image="option.photo"
119
+ :rounded="true"
120
+ ></c-avatar>
121
+ <c-avatar
122
+ v-else
123
+ size="extraextrasmall"
124
+ :nameInitials="option.initials"
125
+ :rounded="true"
126
+ ></c-avatar>
127
+ </div>
132
128
  <c-icon
133
- v-if="icon && !showImage"
134
- :class="icon.class"
135
- :name="icon.name"
136
- :type="icon.type"
129
+ v-if="option.showIcon && option.icon"
130
+ :class="option.icon.class"
131
+ :name="option.icon.name"
132
+ :type="option.icon.type"
137
133
  >
138
134
  </c-icon>
139
135
  <span
140
- :class="
141
- (showImage && option.photo) || option.initials ? 'ml-3' : ''
142
- "
136
+ :class="option.photo || option.initials ? 'ml-3' : ''"
143
137
  class="list-options block break-words font-normal"
144
138
  >{{ option[renderOptionName] }}
145
139
  </span>