@monoui/vuejs 1.1.77 → 1.1.79
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 +2 -2
- package/package.json +1 -1
- package/src/components/Table/Table.vue +137 -1
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,7 @@ 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
|
+
|
|
368
421
|
export default {
|
|
369
422
|
name: "mui-table",
|
|
370
423
|
components: {
|
|
@@ -537,6 +590,11 @@ export default {
|
|
|
537
590
|
type: Boolean,
|
|
538
591
|
required: false,
|
|
539
592
|
default: false
|
|
593
|
+
},
|
|
594
|
+
timeFrame: {
|
|
595
|
+
type: Object,
|
|
596
|
+
required: false,
|
|
597
|
+
default: () => ({})
|
|
540
598
|
}
|
|
541
599
|
},
|
|
542
600
|
watch: {
|
|
@@ -563,7 +621,14 @@ export default {
|
|
|
563
621
|
comingFromPopState: false,
|
|
564
622
|
skipWatch: false,
|
|
565
623
|
selectedCorrelationId: null,
|
|
566
|
-
emptyGuid: "00000000-0000-0000-0000-000000000000"
|
|
624
|
+
emptyGuid: "00000000-0000-0000-0000-000000000000",
|
|
625
|
+
finalTimeFrame: {
|
|
626
|
+
enabled: false,
|
|
627
|
+
column: "CreatedDate",
|
|
628
|
+
title: "All",
|
|
629
|
+
frame: 3,
|
|
630
|
+
options: [3, 6, 9, 12, "Clear"]
|
|
631
|
+
}
|
|
567
632
|
};
|
|
568
633
|
},
|
|
569
634
|
computed: {
|
|
@@ -595,11 +660,78 @@ export default {
|
|
|
595
660
|
async mounted() {
|
|
596
661
|
if (this.history) this.loadHistory();
|
|
597
662
|
|
|
663
|
+
if (this.timeFrame) {
|
|
664
|
+
if (this.timeFrame.enabled) this.finalTimeFrame.enabled = true;
|
|
665
|
+
|
|
666
|
+
if (this.timeFrame.column)
|
|
667
|
+
this.finalTimeFrame.column = this.timeFrame.column;
|
|
668
|
+
|
|
669
|
+
if (this.timeFrame.title)
|
|
670
|
+
this.finalTimeFrame.title = this.timeFrame.title;
|
|
671
|
+
|
|
672
|
+
if (this.timeFrame.frame)
|
|
673
|
+
this.finalTimeFrame.frame = this.timeFrame.frame;
|
|
674
|
+
|
|
675
|
+
if (this.timeFrame.options && this.timeFrame.options.length > 0)
|
|
676
|
+
this.finalTimeFrame.options = this.timeFrame.options;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
if (this.finalTimeFrame && this.finalTimeFrame.enabled) {
|
|
680
|
+
this.applyTimeFrameFilter(this.finalTimeFrame.frame);
|
|
681
|
+
}
|
|
682
|
+
|
|
598
683
|
if (this.autoLoad) {
|
|
599
684
|
await this.getValues(true, true);
|
|
600
685
|
}
|
|
601
686
|
},
|
|
602
687
|
methods: {
|
|
688
|
+
getTimeFrameTitle() {
|
|
689
|
+
if (this.finalTimeFrame.frame)
|
|
690
|
+
return this.getMonthLabel(this.finalTimeFrame.frame, true);
|
|
691
|
+
return this.finalTimeFrame.title;
|
|
692
|
+
},
|
|
693
|
+
|
|
694
|
+
getMonthLabel(lbl, align = false) {
|
|
695
|
+
if (lbl === "Clear") return lbl;
|
|
696
|
+
|
|
697
|
+
if (!align) return `${lbl} months`;
|
|
698
|
+
return lbl < 10 ? `\u00A0${lbl} months` : `${lbl} months`;
|
|
699
|
+
},
|
|
700
|
+
|
|
701
|
+
applyTimeFrameFilter(opt) {
|
|
702
|
+
const existingIndex = this.filters.findIndex(
|
|
703
|
+
f => f.Column === this.finalTimeFrame.column
|
|
704
|
+
);
|
|
705
|
+
|
|
706
|
+
if (opt === "Clear") {
|
|
707
|
+
this.finalTimeFrame.frame = null;
|
|
708
|
+
if (existingIndex !== -1) {
|
|
709
|
+
this.filters.splice(existingIndex, 1);
|
|
710
|
+
}
|
|
711
|
+
} else {
|
|
712
|
+
this.finalTimeFrame.frame = opt;
|
|
713
|
+
if (existingIndex !== -1) {
|
|
714
|
+
// Update existing filter
|
|
715
|
+
this.$set(this.filters, existingIndex, {
|
|
716
|
+
Column: this.finalTimeFrame.column,
|
|
717
|
+
Value: -opt,
|
|
718
|
+
Operator: 5,
|
|
719
|
+
AddMonths: true
|
|
720
|
+
});
|
|
721
|
+
} else {
|
|
722
|
+
// Add new filter
|
|
723
|
+
this.filters.push({
|
|
724
|
+
Column: this.finalTimeFrame.column,
|
|
725
|
+
Value: -opt,
|
|
726
|
+
Operator: 5,
|
|
727
|
+
AddMonths: true
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
this.getValues();
|
|
733
|
+
},
|
|
734
|
+
|
|
603
735
|
getCorrelationClass(row, tableData) {
|
|
604
736
|
var correlationCount = 0;
|
|
605
737
|
tableData.forEach(element => {
|
|
@@ -663,6 +795,10 @@ export default {
|
|
|
663
795
|
}
|
|
664
796
|
this.loadHistoryFilters();
|
|
665
797
|
this.loadHistorySorting();
|
|
798
|
+
|
|
799
|
+
if (this.finalTimeFrame && this.finalTimeFrame.enabled) {
|
|
800
|
+
this.applyTimeFrameFilter(this.finalTimeFrame.frame);
|
|
801
|
+
}
|
|
666
802
|
},
|
|
667
803
|
sortableIcon(column) {
|
|
668
804
|
const currentSort = this.sorting.find(x => x.Column === column);
|