monkey-style-guide 2.0.128 → 2.0.131
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/assets/scss/partials/_forms.scss +1 -1
- package/esm2020/lib/components/date-range-picker/date-range-picker.component.mjs +40 -46
- package/fesm2015/monkey-style-guide.mjs +39 -45
- package/fesm2015/monkey-style-guide.mjs.map +1 -1
- package/fesm2020/monkey-style-guide.mjs +39 -45
- package/fesm2020/monkey-style-guide.mjs.map +1 -1
- package/monkey-style-guide-2.0.131.tgz +0 -0
- package/package.json +2 -2
- package/monkey-style-guide-2.0.128.tgz +0 -0
|
@@ -3060,11 +3060,11 @@ class MonkeyDateRangePickerComponent {
|
|
|
3060
3060
|
this.helperMessage = '';
|
|
3061
3061
|
this.moveDaysForward = true;
|
|
3062
3062
|
this.onChange = new EventEmitter();
|
|
3063
|
-
this.today = moment().format('YYYY-MM-DD');
|
|
3063
|
+
this.today = moment.default().format('YYYY-MM-DD');
|
|
3064
3064
|
this.onModelChange = (value) => { };
|
|
3065
3065
|
this.onModelTouched = (value) => { };
|
|
3066
|
-
this._dateFirst = moment();
|
|
3067
|
-
this._dateSecond = moment().add(1, 'M');
|
|
3066
|
+
this._dateFirst = moment.default();
|
|
3067
|
+
this._dateSecond = moment.default().add(1, 'M');
|
|
3068
3068
|
this._id = `mecx-date-range-picker-${MonkeyUtils.getRandomString(10)}`;
|
|
3069
3069
|
this._daysArrFirst = [];
|
|
3070
3070
|
this._daysArrSecond = [];
|
|
@@ -3082,12 +3082,12 @@ class MonkeyDateRangePickerComponent {
|
|
|
3082
3082
|
}));
|
|
3083
3083
|
}
|
|
3084
3084
|
createCalendar(month) {
|
|
3085
|
-
let firstDay = moment(month).startOf('M');
|
|
3086
|
-
let lastDay = moment(month).endOf('M');
|
|
3085
|
+
let firstDay = moment.default(month).startOf('M');
|
|
3086
|
+
let lastDay = moment.default(month).endOf('M');
|
|
3087
3087
|
let days = Array.apply(null, { length: month.daysInMonth() })
|
|
3088
3088
|
.map(Number.call, Number)
|
|
3089
3089
|
.map((n) => {
|
|
3090
|
-
return moment(firstDay).add(n, 'd');
|
|
3090
|
+
return moment.default(firstDay).add(n, 'd');
|
|
3091
3091
|
});
|
|
3092
3092
|
let n = 0;
|
|
3093
3093
|
while (n < firstDay.weekday()) {
|
|
@@ -3125,8 +3125,8 @@ class MonkeyDateRangePickerComponent {
|
|
|
3125
3125
|
this.writeValue(this._dateForm.value);
|
|
3126
3126
|
}
|
|
3127
3127
|
navigateToToday() {
|
|
3128
|
-
this._dateFirst = moment();
|
|
3129
|
-
this._dateSecond = moment().add(1, 'M');
|
|
3128
|
+
this._dateFirst = moment.default();
|
|
3129
|
+
this._dateSecond = moment.default().add(1, 'M');
|
|
3130
3130
|
this.build();
|
|
3131
3131
|
}
|
|
3132
3132
|
ngOnInit() {
|
|
@@ -3181,14 +3181,14 @@ class MonkeyDateRangePickerComponent {
|
|
|
3181
3181
|
if (!day) {
|
|
3182
3182
|
return false;
|
|
3183
3183
|
}
|
|
3184
|
-
return moment().format('L') === day.format('L');
|
|
3184
|
+
return moment.default().format('L') === day.format('L');
|
|
3185
3185
|
}
|
|
3186
3186
|
isSelected(day) {
|
|
3187
3187
|
if (!day) {
|
|
3188
3188
|
return false;
|
|
3189
3189
|
}
|
|
3190
|
-
let startDateMoment = moment(this._dateForm.value.startDate, 'YYYY-MM-DD');
|
|
3191
|
-
let endDateMoment = moment(this._dateForm.value.endDate, 'YYYY-MM-DD');
|
|
3190
|
+
let startDateMoment = moment.default(this._dateForm.value.startDate, 'YYYY-MM-DD');
|
|
3191
|
+
let endDateMoment = moment.default(this._dateForm.value.endDate, 'YYYY-MM-DD');
|
|
3192
3192
|
if (this._dateForm.valid) {
|
|
3193
3193
|
return startDateMoment.isSameOrBefore(day) && endDateMoment.isSameOrAfter(day);
|
|
3194
3194
|
}
|
|
@@ -3199,7 +3199,7 @@ class MonkeyDateRangePickerComponent {
|
|
|
3199
3199
|
isDisabled(day) {
|
|
3200
3200
|
const { _minDate } = this;
|
|
3201
3201
|
if (_minDate) {
|
|
3202
|
-
const firstDay = moment(_minDate);
|
|
3202
|
+
const firstDay = moment.default(_minDate);
|
|
3203
3203
|
return day.isBefore(firstDay.subtract(1, 'day'));
|
|
3204
3204
|
}
|
|
3205
3205
|
return false;
|
|
@@ -3215,52 +3215,46 @@ class MonkeyDateRangePickerComponent {
|
|
|
3215
3215
|
return day?.isSame(endDate);
|
|
3216
3216
|
}
|
|
3217
3217
|
selectedDate(day) {
|
|
3218
|
-
|
|
3219
|
-
|
|
3218
|
+
if (this._disabled)
|
|
3219
|
+
return;
|
|
3220
|
+
const { _dateForm, _minDate } = this;
|
|
3221
|
+
let dayFormatted = day.format('YYYY-MM-DD');
|
|
3222
|
+
if (_minDate) {
|
|
3223
|
+
const firstDay = moment.default(_minDate);
|
|
3224
|
+
if (day.isBefore(firstDay.subtract(1, 'day')))
|
|
3220
3225
|
return;
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
this.clearDates();
|
|
3230
|
-
}
|
|
3231
|
-
let { startDate, endDate } = _dateForm.value;
|
|
3232
|
-
if (startDate) {
|
|
3233
|
-
if (moment(startDate).isAfter(moment(dayFormatted))) {
|
|
3234
|
-
endDate = startDate;
|
|
3235
|
-
startDate = dayFormatted;
|
|
3236
|
-
}
|
|
3237
|
-
else {
|
|
3238
|
-
endDate = dayFormatted;
|
|
3239
|
-
}
|
|
3240
|
-
}
|
|
3241
|
-
else
|
|
3226
|
+
}
|
|
3227
|
+
if (_dateForm.valid) {
|
|
3228
|
+
this.clearDates();
|
|
3229
|
+
}
|
|
3230
|
+
let { startDate, endDate } = _dateForm.value;
|
|
3231
|
+
if (startDate) {
|
|
3232
|
+
if (moment.default(startDate).isAfter(moment.default(dayFormatted))) {
|
|
3233
|
+
endDate = startDate;
|
|
3242
3234
|
startDate = dayFormatted;
|
|
3243
|
-
if (startDate) {
|
|
3244
|
-
_dateForm.get('startDate').patchValue(startDate);
|
|
3245
3235
|
}
|
|
3246
|
-
|
|
3247
|
-
|
|
3236
|
+
else {
|
|
3237
|
+
endDate = dayFormatted;
|
|
3248
3238
|
}
|
|
3249
|
-
console.log(_dateForm.value);
|
|
3250
|
-
this.writeValue(_dateForm.value);
|
|
3251
3239
|
}
|
|
3252
|
-
|
|
3253
|
-
|
|
3240
|
+
else
|
|
3241
|
+
startDate = dayFormatted;
|
|
3242
|
+
if (startDate) {
|
|
3243
|
+
_dateForm.get('startDate').patchValue(startDate);
|
|
3254
3244
|
}
|
|
3245
|
+
if (endDate) {
|
|
3246
|
+
_dateForm.get('endDate').patchValue(endDate);
|
|
3247
|
+
}
|
|
3248
|
+
this.writeValue(_dateForm.value);
|
|
3255
3249
|
}
|
|
3256
3250
|
selectRangeOfDays(days) {
|
|
3257
3251
|
if (this._disabled)
|
|
3258
3252
|
return;
|
|
3259
3253
|
const { _dateForm, _minDate, today, moveDaysForward } = this;
|
|
3260
3254
|
const { startDate } = _dateForm.value;
|
|
3261
|
-
const firstDay = moment(startDate || _minDate || today).format('YYYY-MM-DD');
|
|
3255
|
+
const firstDay = moment.default(startDate || _minDate || today).format('YYYY-MM-DD');
|
|
3262
3256
|
const method = moveDaysForward ? 'add' : 'subtract';
|
|
3263
|
-
const lastDay = moment(firstDay)[method](days, 'day').format('YYYY-MM-DD');
|
|
3257
|
+
const lastDay = moment.default(firstDay)[method](days, 'day').format('YYYY-MM-DD');
|
|
3264
3258
|
if (moveDaysForward) {
|
|
3265
3259
|
_dateForm.get('startDate').patchValue(firstDay);
|
|
3266
3260
|
_dateForm.get('endDate').patchValue(lastDay);
|