@monoui/vuejs 1.1.76 → 1.1.78
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/dist/main.js +5 -5
- package/package.json +1 -1
- package/src/components/Table/Table.vue +149 -12
package/package.json
CHANGED
|
@@ -57,6 +57,58 @@
|
|
|
57
57
|
>
|
|
58
58
|
{{ columnKey }}
|
|
59
59
|
</small>
|
|
60
|
+
|
|
61
|
+
<b-dropdown
|
|
62
|
+
boundary="window"
|
|
63
|
+
v-if="
|
|
64
|
+
finalTimeFrame &&
|
|
65
|
+
finalTimeFrame.enabled &&
|
|
66
|
+
finalTimeFrame.column ===
|
|
67
|
+
columnKey
|
|
68
|
+
"
|
|
69
|
+
:text="getTimeFrameTitle()"
|
|
70
|
+
size="sm"
|
|
71
|
+
variant="light"
|
|
72
|
+
>
|
|
73
|
+
<b-dropdown-item
|
|
74
|
+
v-for="opt in finalTimeFrame.options.filter(
|
|
75
|
+
q => q !== 'Clear'
|
|
76
|
+
)"
|
|
77
|
+
:key="'time-frame-' + opt"
|
|
78
|
+
@click.stop="
|
|
79
|
+
applyTimeFrameFilter(
|
|
80
|
+
opt
|
|
81
|
+
)
|
|
82
|
+
"
|
|
83
|
+
>
|
|
84
|
+
<span>{{
|
|
85
|
+
getMonthLabel(opt)
|
|
86
|
+
}}</span>
|
|
87
|
+
</b-dropdown-item>
|
|
88
|
+
|
|
89
|
+
<template
|
|
90
|
+
v-if="
|
|
91
|
+
finalTimeFrame.options.some(
|
|
92
|
+
q => q === 'Clear'
|
|
93
|
+
)
|
|
94
|
+
"
|
|
95
|
+
>
|
|
96
|
+
<b-dropdown-divider></b-dropdown-divider>
|
|
97
|
+
<b-dropdown-item
|
|
98
|
+
@click.stop="
|
|
99
|
+
applyTimeFrameFilter(
|
|
100
|
+
'Clear'
|
|
101
|
+
)
|
|
102
|
+
"
|
|
103
|
+
>
|
|
104
|
+
<i
|
|
105
|
+
class="fa fa-trash mr-1"
|
|
106
|
+
/>
|
|
107
|
+
Clear
|
|
108
|
+
</b-dropdown-item>
|
|
109
|
+
</template>
|
|
110
|
+
</b-dropdown>
|
|
111
|
+
|
|
60
112
|
<span
|
|
61
113
|
v-if="isSortable(columnKey)"
|
|
62
114
|
class="sort-position"
|
|
@@ -92,18 +144,26 @@
|
|
|
92
144
|
</th>
|
|
93
145
|
</tr>
|
|
94
146
|
</template>
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
147
|
+
<template
|
|
148
|
+
v-if="
|
|
149
|
+
$slots['header-row-raw'] ||
|
|
150
|
+
$slots['header-row'] ||
|
|
151
|
+
$slots['header-row-column']
|
|
152
|
+
"
|
|
153
|
+
>
|
|
154
|
+
<slot name="header-row-raw">
|
|
155
|
+
<tr>
|
|
156
|
+
<slot name="header-row">
|
|
157
|
+
<th
|
|
158
|
+
class="p-0 p-t-1 p-b-1"
|
|
159
|
+
:colspan="Object.keys(columns).length"
|
|
160
|
+
>
|
|
161
|
+
<slot name="header-row-column" />
|
|
162
|
+
</th>
|
|
163
|
+
</slot>
|
|
164
|
+
</tr>
|
|
165
|
+
</slot>
|
|
166
|
+
</template>
|
|
107
167
|
</thead>
|
|
108
168
|
<tbody>
|
|
109
169
|
<tr class="text-center" v-if="isDataEmpty && !isLoading">
|
|
@@ -357,6 +417,15 @@ import IconArrowDownLong from "./Icons/ArrowDownLong.vue";
|
|
|
357
417
|
import IconSorting from "./Icons/Sorting.vue";
|
|
358
418
|
import IconSortingAZ from "./Icons/SortingAZ.vue";
|
|
359
419
|
import IconSortingArrows from "./Icons/SortingArrows.vue";
|
|
420
|
+
|
|
421
|
+
const defaultTimeFrame = {
|
|
422
|
+
enabled: false,
|
|
423
|
+
title: "All",
|
|
424
|
+
column: "CreatedDate",
|
|
425
|
+
frame: 3,
|
|
426
|
+
options: [3, 6, 9, 12, "Clear"]
|
|
427
|
+
};
|
|
428
|
+
|
|
360
429
|
export default {
|
|
361
430
|
name: "mui-table",
|
|
362
431
|
components: {
|
|
@@ -529,6 +598,11 @@ export default {
|
|
|
529
598
|
type: Boolean,
|
|
530
599
|
required: false,
|
|
531
600
|
default: false
|
|
601
|
+
},
|
|
602
|
+
timeFrame: {
|
|
603
|
+
type: Object,
|
|
604
|
+
required: false,
|
|
605
|
+
default: () => ({})
|
|
532
606
|
}
|
|
533
607
|
},
|
|
534
608
|
watch: {
|
|
@@ -559,6 +633,13 @@ export default {
|
|
|
559
633
|
};
|
|
560
634
|
},
|
|
561
635
|
computed: {
|
|
636
|
+
finalTimeFrame() {
|
|
637
|
+
return {
|
|
638
|
+
...defaultTimeFrame,
|
|
639
|
+
...this.timeFrame
|
|
640
|
+
};
|
|
641
|
+
},
|
|
642
|
+
|
|
562
643
|
filteredPerPageValues() {
|
|
563
644
|
const values = [];
|
|
564
645
|
for (const value of this.perPageValues) {
|
|
@@ -587,11 +668,63 @@ export default {
|
|
|
587
668
|
async mounted() {
|
|
588
669
|
if (this.history) this.loadHistory();
|
|
589
670
|
|
|
671
|
+
if (this.finalTimeFrame && this.finalTimeFrame.enabled) {
|
|
672
|
+
this.applyTimeFrameFilter(this.finalTimeFrame.frame);
|
|
673
|
+
}
|
|
674
|
+
|
|
590
675
|
if (this.autoLoad) {
|
|
591
676
|
await this.getValues(true, true);
|
|
592
677
|
}
|
|
593
678
|
},
|
|
594
679
|
methods: {
|
|
680
|
+
getMonthLabel(lbl, align = false) {
|
|
681
|
+
if (lbl === "Clear") return lbl;
|
|
682
|
+
|
|
683
|
+
if (!align) return `${lbl} months`;
|
|
684
|
+
return lbl < 10 ? `\u00A0${lbl} months` : `${lbl} months`;
|
|
685
|
+
},
|
|
686
|
+
|
|
687
|
+
getTimeFrameTitle() {
|
|
688
|
+
if (this.finalTimeFrame.frame)
|
|
689
|
+
return this.getMonthLabel(this.finalTimeFrame.frame, true);
|
|
690
|
+
return this.finalTimeFrame.title;
|
|
691
|
+
},
|
|
692
|
+
|
|
693
|
+
applyTimeFrameFilter(opt) {
|
|
694
|
+
const existingIndex = this.filters.findIndex(
|
|
695
|
+
f => f.Column === this.finalTimeFrame.column
|
|
696
|
+
);
|
|
697
|
+
|
|
698
|
+
if (opt === "Clear") {
|
|
699
|
+
this.finalTimeFrame.frame = null;
|
|
700
|
+
if (existingIndex !== -1) {
|
|
701
|
+
this.filters.splice(existingIndex, 1);
|
|
702
|
+
}
|
|
703
|
+
} else {
|
|
704
|
+
this.finalTimeFrame.frame = opt;
|
|
705
|
+
|
|
706
|
+
if (existingIndex !== -1) {
|
|
707
|
+
// Update existing filter
|
|
708
|
+
this.$set(this.filters, existingIndex, {
|
|
709
|
+
Column: this.finalTimeFrame.column,
|
|
710
|
+
Value: -opt,
|
|
711
|
+
Operator: 5,
|
|
712
|
+
AddMonths: true
|
|
713
|
+
});
|
|
714
|
+
} else {
|
|
715
|
+
// Add new filter
|
|
716
|
+
this.filters.push({
|
|
717
|
+
Column: this.finalTimeFrame.column,
|
|
718
|
+
Value: -opt,
|
|
719
|
+
Operator: 5,
|
|
720
|
+
AddMonths: true
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
this.getValues();
|
|
726
|
+
},
|
|
727
|
+
|
|
595
728
|
getCorrelationClass(row, tableData) {
|
|
596
729
|
var correlationCount = 0;
|
|
597
730
|
tableData.forEach(element => {
|
|
@@ -655,6 +788,10 @@ export default {
|
|
|
655
788
|
}
|
|
656
789
|
this.loadHistoryFilters();
|
|
657
790
|
this.loadHistorySorting();
|
|
791
|
+
|
|
792
|
+
if (this.finalTimeFrame && this.finalTimeFrame.enabled) {
|
|
793
|
+
this.applyTimeFrameFilter(this.finalTimeFrame.frame);
|
|
794
|
+
}
|
|
658
795
|
},
|
|
659
796
|
sortableIcon(column) {
|
|
660
797
|
const currentSort = this.sorting.find(x => x.Column === column);
|