classcard-ui 0.2.792 → 0.2.793

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.792",
3
+ "version": "0.2.793",
4
4
  "main": "dist/classcard-ui.umd.min.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -75,7 +75,11 @@
75
75
  </div>
76
76
  <slot name="customDatePicker"></slot>
77
77
 
78
- <div v-if="enableDownload" @click="startDownload">
78
+ <!-- simple download button -->
79
+ <div
80
+ v-if="enableDownload && !downloadDropdown"
81
+ @click="startDownload"
82
+ >
79
83
  <c-button-icon
80
84
  type="white"
81
85
  :icon="
@@ -92,6 +96,64 @@
92
96
  :isLoading="downloadLoader"
93
97
  ></c-button-icon>
94
98
  </div>
99
+ <!-- download button with download options -->
100
+ <div v-else class="relative ml-3">
101
+ <div>
102
+ <button
103
+ @click="handleDownloadToggle"
104
+ class="inline-flex w-full justify-center rounded-md border border-gray-200 bg-white px-2 py-2 text-sm font-medium shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2"
105
+ aria-haspopup="true"
106
+ aria-expanded="true"
107
+ >
108
+ <c-icon
109
+ v-if="downloadOptionLoader"
110
+ cursorType="cursor-pointer"
111
+ class="mr-2 h-5 w-5 text-gray-400"
112
+ name="loader"
113
+ ></c-icon>
114
+ <c-icon
115
+ v-else
116
+ name="download-solid"
117
+ type="solid"
118
+ class="h-5 w-5 text-gray-400"
119
+ ></c-icon>
120
+ <c-icon
121
+ name="chevron-down"
122
+ type="solid"
123
+ class="ml-1 h-5 w-5 text-gray-400"
124
+ ></c-icon>
125
+ </button>
126
+ </div>
127
+ <!-- download options dropdown -->
128
+ <div
129
+ v-if="toggleDownloadDropdown"
130
+ @click="handleDownloadToggle"
131
+ class="fixed inset-0 z-20"
132
+ ></div>
133
+ <div
134
+ v-if="toggleDownloadDropdown"
135
+ class="absolute right-0 z-30 mt-2 -mr-1 max-h-96 w-64 origin-top-right overflow-y-auto rounded-md bg-white shadow-lg ring-1 ring-gray-900 ring-opacity-5"
136
+ tabindex="0"
137
+ >
138
+ <div
139
+ class="py-1"
140
+ role="menu"
141
+ aria-orientation="vertical"
142
+ aria-labelledby="option-menu"
143
+ >
144
+ <div
145
+ v-for="(item, index) in showDownloadDropdownList"
146
+ :key="index"
147
+ class="cursor-pointer px-4 py-2 text-sm text-gray-900 hover:bg-gray-100 hover:text-gray-900"
148
+ role="menuitem"
149
+ @click="downloadFromOption(item.value)"
150
+ >
151
+ <p>{{ item.title }}</p>
152
+ <p class="text-sm text-gray-400">{{ item.description }}</p>
153
+ </div>
154
+ </div>
155
+ </div>
156
+ </div>
95
157
  </div>
96
158
  </div>
97
159
  </div>
@@ -316,6 +378,10 @@ export default {
316
378
  showHideColumnList: {
317
379
  type: Array,
318
380
  },
381
+ // List of items to show download options
382
+ // showDownloadDropdownList: {
383
+ // type: Array,
384
+ // },
319
385
  // Function on changing page number
320
386
  onPageChange: {
321
387
  type: Function,
@@ -336,6 +402,13 @@ export default {
336
402
  downloadLoader: {
337
403
  type: Boolean,
338
404
  },
405
+ // Start the loader
406
+ downloadOptionLoader: {
407
+ type: Boolean,
408
+ },
409
+ downloadDropdown: {
410
+ type: Boolean,
411
+ },
339
412
  rowStyleClassFn: {
340
413
  type: Function,
341
414
  default: () => "",
@@ -373,11 +446,26 @@ export default {
373
446
  data() {
374
447
  return {
375
448
  toggleDropdown: false,
449
+ toggleDownloadDropdown: false,
376
450
  showLoader: this.isLoading,
377
451
  searchTerm: this.searchQuery ? this.searchQuery : "",
378
452
  paginationRecords: this.paginationData,
379
453
  reorderedArray: [...this.rows],
380
454
  controlClick: false,
455
+ showDownloadDropdownList: [
456
+ {
457
+ title: "Download",
458
+ value: "summary",
459
+ description:
460
+ "Downloads each invoice, as a separate row, with invoice items comma separated.",
461
+ },
462
+ {
463
+ title: "Detailed download",
464
+ value: "detailed",
465
+ description:
466
+ "Downloads each invoice line-item, as a separate row (recommended for importing into accounting softwares).",
467
+ },
468
+ ],
381
469
  };
382
470
  },
383
471
  methods: {
@@ -396,6 +484,9 @@ export default {
396
484
  handleToggle() {
397
485
  this.toggleDropdown = !this.toggleDropdown;
398
486
  },
487
+ handleDownloadToggle() {
488
+ this.toggleDownloadDropdown = !this.toggleDownloadDropdown;
489
+ },
399
490
  showHideColumn(value, name) {
400
491
  this.$emit("hideCols", value, name);
401
492
  },
@@ -459,6 +550,10 @@ export default {
459
550
  startDownload() {
460
551
  this.$emit("handleDownloadButton");
461
552
  },
553
+ downloadFromOption(value) {
554
+ this.toggleDownloadDropdown = false;
555
+ this.$emit("handleDownloadOptionButton", value);
556
+ },
462
557
  },
463
558
  watch: {
464
559
  isLoading() {