@acorex/components 20.2.0-next.5 → 20.2.0-next.8

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.
@@ -93,7 +93,7 @@ class MXCalendarBaseComponent extends MXBaseComponent {
93
93
  }
94
94
  set minValue(v) {
95
95
  if (this.calendarService.isValidDate(v)) {
96
- const value = this.calendarService.create(v);
96
+ const value = this.calendarService.create(v).date;
97
97
  this.setOption({
98
98
  name: 'minValue',
99
99
  value,
@@ -102,13 +102,22 @@ class MXCalendarBaseComponent extends MXBaseComponent {
102
102
  },
103
103
  });
104
104
  }
105
+ else {
106
+ this.setOption({
107
+ name: 'minValue',
108
+ value: undefined,
109
+ afterCallback: () => {
110
+ this.render();
111
+ },
112
+ });
113
+ }
105
114
  }
106
115
  get maxValue() {
107
116
  return this._maxValue;
108
117
  }
109
118
  set maxValue(v) {
110
119
  if (this.calendarService.isValidDate(v)) {
111
- const value = this.calendarService.create(v);
120
+ const value = this.calendarService.create(v).date;
112
121
  this.setOption({
113
122
  name: 'maxValue',
114
123
  value,
@@ -117,6 +126,15 @@ class MXCalendarBaseComponent extends MXBaseComponent {
117
126
  },
118
127
  });
119
128
  }
129
+ else {
130
+ this.setOption({
131
+ name: 'maxValue',
132
+ value: undefined,
133
+ afterCallback: () => {
134
+ this.render();
135
+ },
136
+ });
137
+ }
120
138
  }
121
139
  get disabledDates() {
122
140
  return this._disabledDates;
@@ -567,14 +585,20 @@ class AXCalendarComponent extends classes((MXValueComponent), MXInteractiveCompo
567
585
  * @ignore
568
586
  */
569
587
  internalSetValue(value) {
570
- if (!value)
588
+ if (!value || !this.calendarService.isValidDate(value)) {
571
589
  return null;
572
- const v = this.calendarService.convert(value);
573
- const isDisabled = this.isDisabled(v);
574
- if (isDisabled)
590
+ }
591
+ const v = this.calendarService.convert(value, this.calendar());
592
+ if (this.isDisabled(v)) {
575
593
  return null;
576
- else
577
- return v.date;
594
+ }
595
+ if (this.minValue && this.calendarService.isValidDate(this.minValue) && v.isBefore(this.minValue)) {
596
+ return this.minValue;
597
+ }
598
+ if (this.maxValue && this.calendarService.isValidDate(this.maxValue) && v.isAfter(this.maxValue)) {
599
+ return this.maxValue;
600
+ }
601
+ return v.date;
578
602
  }
579
603
  /**
580
604
  * @ignore