@monoui/vuejs 1.1.80 → 1.1.82

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": "@monoui/vuejs",
3
- "version": "1.1.80",
3
+ "version": "1.1.82",
4
4
  "description": "This project will contain MonoFor UI Framework",
5
5
  "main": "./dist/main.js",
6
6
  "repository": "git@gitlab.com:monoui/vuejs.git",
@@ -77,7 +77,8 @@
77
77
  :key="'time-frame-' + opt"
78
78
  @click.stop="
79
79
  applyTimeFrameFilter(
80
- opt
80
+ opt,
81
+ true
81
82
  )
82
83
  "
83
84
  >
@@ -97,7 +98,8 @@
97
98
  <b-dropdown-item
98
99
  @click.stop="
99
100
  applyTimeFrameFilter(
100
- 'Clear'
101
+ 'Clear',
102
+ true
101
103
  )
102
104
  "
103
105
  >
@@ -657,6 +659,9 @@ export default {
657
659
  created() {
658
660
  this.addPopStateListener();
659
661
  },
662
+ beforeDestroy() {
663
+ this.removePopStateListener();
664
+ },
660
665
  async mounted() {
661
666
  if (this.history) this.loadHistory();
662
667
 
@@ -698,7 +703,7 @@ export default {
698
703
  return lbl < 10 ? `\u00A0${lbl} months` : `${lbl} months`;
699
704
  },
700
705
 
701
- applyTimeFrameFilter(opt) {
706
+ applyTimeFrameFilter(opt, load = false) {
702
707
  const existingIndex = this.filters.findIndex(
703
708
  f => f.Column === this.finalTimeFrame.column
704
709
  );
@@ -714,22 +719,28 @@ export default {
714
719
  // Update existing filter
715
720
  this.$set(this.filters, existingIndex, {
716
721
  Column: this.finalTimeFrame.column,
717
- Value: -opt,
718
- Operator: 5,
719
- AddMonths: true
722
+ Value: this.calculateStartDate(opt),
723
+ Operator: 5
720
724
  });
721
725
  } else {
722
726
  // Add new filter
723
727
  this.filters.push({
724
728
  Column: this.finalTimeFrame.column,
725
- Value: -opt,
726
- Operator: 5,
727
- AddMonths: true
729
+ Value: this.calculateStartDate(opt),
730
+ Operator: 5
728
731
  });
729
732
  }
730
733
  }
731
734
 
732
- this.getValues();
735
+ if (load) {
736
+ this.getValues();
737
+ }
738
+ },
739
+
740
+ calculateStartDate(months) {
741
+ const date = new Date();
742
+ date.setMonth(date.getMonth() - months);
743
+ return date.toISOString().split("T")[0]; // Return in YYYY-MM-DD format
733
744
  },
734
745
 
735
746
  getCorrelationClass(row, tableData) {
@@ -777,6 +788,8 @@ export default {
777
788
  window.removeEventListener("popstate", this.popStateEvent);
778
789
  },
779
790
  async popStateEvent() {
791
+ if (!this.history) return;
792
+
780
793
  this.comingFromPopState = true;
781
794
  this.loadHistory();
782
795
  this.getValues(false);