@monoui/vuejs 1.1.77 → 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 +129 -0
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"
|
|
@@ -365,6 +417,15 @@ import IconArrowDownLong from "./Icons/ArrowDownLong.vue";
|
|
|
365
417
|
import IconSorting from "./Icons/Sorting.vue";
|
|
366
418
|
import IconSortingAZ from "./Icons/SortingAZ.vue";
|
|
367
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
|
+
|
|
368
429
|
export default {
|
|
369
430
|
name: "mui-table",
|
|
370
431
|
components: {
|
|
@@ -537,6 +598,11 @@ export default {
|
|
|
537
598
|
type: Boolean,
|
|
538
599
|
required: false,
|
|
539
600
|
default: false
|
|
601
|
+
},
|
|
602
|
+
timeFrame: {
|
|
603
|
+
type: Object,
|
|
604
|
+
required: false,
|
|
605
|
+
default: () => ({})
|
|
540
606
|
}
|
|
541
607
|
},
|
|
542
608
|
watch: {
|
|
@@ -567,6 +633,13 @@ export default {
|
|
|
567
633
|
};
|
|
568
634
|
},
|
|
569
635
|
computed: {
|
|
636
|
+
finalTimeFrame() {
|
|
637
|
+
return {
|
|
638
|
+
...defaultTimeFrame,
|
|
639
|
+
...this.timeFrame
|
|
640
|
+
};
|
|
641
|
+
},
|
|
642
|
+
|
|
570
643
|
filteredPerPageValues() {
|
|
571
644
|
const values = [];
|
|
572
645
|
for (const value of this.perPageValues) {
|
|
@@ -595,11 +668,63 @@ export default {
|
|
|
595
668
|
async mounted() {
|
|
596
669
|
if (this.history) this.loadHistory();
|
|
597
670
|
|
|
671
|
+
if (this.finalTimeFrame && this.finalTimeFrame.enabled) {
|
|
672
|
+
this.applyTimeFrameFilter(this.finalTimeFrame.frame);
|
|
673
|
+
}
|
|
674
|
+
|
|
598
675
|
if (this.autoLoad) {
|
|
599
676
|
await this.getValues(true, true);
|
|
600
677
|
}
|
|
601
678
|
},
|
|
602
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
|
+
|
|
603
728
|
getCorrelationClass(row, tableData) {
|
|
604
729
|
var correlationCount = 0;
|
|
605
730
|
tableData.forEach(element => {
|
|
@@ -663,6 +788,10 @@ export default {
|
|
|
663
788
|
}
|
|
664
789
|
this.loadHistoryFilters();
|
|
665
790
|
this.loadHistorySorting();
|
|
791
|
+
|
|
792
|
+
if (this.finalTimeFrame && this.finalTimeFrame.enabled) {
|
|
793
|
+
this.applyTimeFrameFilter(this.finalTimeFrame.frame);
|
|
794
|
+
}
|
|
666
795
|
},
|
|
667
796
|
sortableIcon(column) {
|
|
668
797
|
const currentSort = this.sorting.find(x => x.Column === column);
|