monkey-style-guide 2.0.126 → 2.0.129
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/components/_snackbar.scss +1 -0
- package/esm2020/lib/components/date-range-picker/date-range-picker.component.mjs +40 -46
- package/esm2020/lib/core/services/snackbar/mokey-style-guide-snackbar.service.mjs +7 -3
- package/fesm2015/monkey-style-guide.mjs +45 -47
- package/fesm2015/monkey-style-guide.mjs.map +1 -1
- package/fesm2020/monkey-style-guide.mjs +45 -47
- package/fesm2020/monkey-style-guide.mjs.map +1 -1
- package/lib/core/services/snackbar/mokey-style-guide-snackbar.service.d.ts +2 -0
- package/monkey-style-guide-2.0.129.tgz +0 -0
- package/package.json +1 -1
- package/monkey-style-guide-2.0.126.tgz +0 -0
|
@@ -531,14 +531,18 @@ class MonkeyStyleGuideSnackbarService {
|
|
|
531
531
|
}
|
|
532
532
|
if (actionCancelElement) {
|
|
533
533
|
actionCancelElement.addEventListener('click', () => {
|
|
534
|
-
|
|
534
|
+
if (!cancel?.keepOnAction) {
|
|
535
|
+
this.close(id);
|
|
536
|
+
}
|
|
535
537
|
cancel.action();
|
|
536
538
|
});
|
|
537
539
|
actionElement.appendChild(actionCancelElement);
|
|
538
540
|
}
|
|
539
541
|
if (actionConfirmElement) {
|
|
540
542
|
actionConfirmElement.addEventListener('click', () => {
|
|
541
|
-
|
|
543
|
+
if (!confirm?.keepOnAction) {
|
|
544
|
+
this.close(id);
|
|
545
|
+
}
|
|
542
546
|
confirm.action();
|
|
543
547
|
});
|
|
544
548
|
actionElement.appendChild(actionConfirmElement);
|
|
@@ -3056,11 +3060,11 @@ class MonkeyDateRangePickerComponent {
|
|
|
3056
3060
|
this.helperMessage = '';
|
|
3057
3061
|
this.moveDaysForward = true;
|
|
3058
3062
|
this.onChange = new EventEmitter();
|
|
3059
|
-
this.today = moment().format('YYYY-MM-DD');
|
|
3063
|
+
this.today = moment.default().format('YYYY-MM-DD');
|
|
3060
3064
|
this.onModelChange = (value) => { };
|
|
3061
3065
|
this.onModelTouched = (value) => { };
|
|
3062
|
-
this._dateFirst = moment();
|
|
3063
|
-
this._dateSecond = moment().add(1, 'M');
|
|
3066
|
+
this._dateFirst = moment.default();
|
|
3067
|
+
this._dateSecond = moment.default().add(1, 'M');
|
|
3064
3068
|
this._id = `mecx-date-range-picker-${MonkeyUtils.getRandomString(10)}`;
|
|
3065
3069
|
this._daysArrFirst = [];
|
|
3066
3070
|
this._daysArrSecond = [];
|
|
@@ -3078,12 +3082,12 @@ class MonkeyDateRangePickerComponent {
|
|
|
3078
3082
|
}));
|
|
3079
3083
|
}
|
|
3080
3084
|
createCalendar(month) {
|
|
3081
|
-
let firstDay = moment(month).startOf('M');
|
|
3082
|
-
let lastDay = moment(month).endOf('M');
|
|
3085
|
+
let firstDay = moment.default(month).startOf('M');
|
|
3086
|
+
let lastDay = moment.default(month).endOf('M');
|
|
3083
3087
|
let days = Array.apply(null, { length: month.daysInMonth() })
|
|
3084
3088
|
.map(Number.call, Number)
|
|
3085
3089
|
.map((n) => {
|
|
3086
|
-
return moment(firstDay).add(n, 'd');
|
|
3090
|
+
return moment.default(firstDay).add(n, 'd');
|
|
3087
3091
|
});
|
|
3088
3092
|
let n = 0;
|
|
3089
3093
|
while (n < firstDay.weekday()) {
|
|
@@ -3121,8 +3125,8 @@ class MonkeyDateRangePickerComponent {
|
|
|
3121
3125
|
this.writeValue(this._dateForm.value);
|
|
3122
3126
|
}
|
|
3123
3127
|
navigateToToday() {
|
|
3124
|
-
this._dateFirst = moment();
|
|
3125
|
-
this._dateSecond = moment().add(1, 'M');
|
|
3128
|
+
this._dateFirst = moment.default();
|
|
3129
|
+
this._dateSecond = moment.default().add(1, 'M');
|
|
3126
3130
|
this.build();
|
|
3127
3131
|
}
|
|
3128
3132
|
ngOnInit() {
|
|
@@ -3177,14 +3181,14 @@ class MonkeyDateRangePickerComponent {
|
|
|
3177
3181
|
if (!day) {
|
|
3178
3182
|
return false;
|
|
3179
3183
|
}
|
|
3180
|
-
return moment().format('L') === day.format('L');
|
|
3184
|
+
return moment.default().format('L') === day.format('L');
|
|
3181
3185
|
}
|
|
3182
3186
|
isSelected(day) {
|
|
3183
3187
|
if (!day) {
|
|
3184
3188
|
return false;
|
|
3185
3189
|
}
|
|
3186
|
-
let startDateMoment = moment(this._dateForm.value.startDate, 'YYYY-MM-DD');
|
|
3187
|
-
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');
|
|
3188
3192
|
if (this._dateForm.valid) {
|
|
3189
3193
|
return startDateMoment.isSameOrBefore(day) && endDateMoment.isSameOrAfter(day);
|
|
3190
3194
|
}
|
|
@@ -3195,7 +3199,7 @@ class MonkeyDateRangePickerComponent {
|
|
|
3195
3199
|
isDisabled(day) {
|
|
3196
3200
|
const { _minDate } = this;
|
|
3197
3201
|
if (_minDate) {
|
|
3198
|
-
const firstDay = moment(_minDate);
|
|
3202
|
+
const firstDay = moment.default(_minDate);
|
|
3199
3203
|
return day.isBefore(firstDay.subtract(1, 'day'));
|
|
3200
3204
|
}
|
|
3201
3205
|
return false;
|
|
@@ -3211,52 +3215,46 @@ class MonkeyDateRangePickerComponent {
|
|
|
3211
3215
|
return day?.isSame(endDate);
|
|
3212
3216
|
}
|
|
3213
3217
|
selectedDate(day) {
|
|
3214
|
-
|
|
3215
|
-
|
|
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')))
|
|
3216
3225
|
return;
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
this.clearDates();
|
|
3226
|
-
}
|
|
3227
|
-
let { startDate, endDate } = _dateForm.value;
|
|
3228
|
-
if (startDate) {
|
|
3229
|
-
if (moment(startDate).isAfter(moment(dayFormatted))) {
|
|
3230
|
-
endDate = startDate;
|
|
3231
|
-
startDate = dayFormatted;
|
|
3232
|
-
}
|
|
3233
|
-
else {
|
|
3234
|
-
endDate = dayFormatted;
|
|
3235
|
-
}
|
|
3236
|
-
}
|
|
3237
|
-
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;
|
|
3238
3234
|
startDate = dayFormatted;
|
|
3239
|
-
if (startDate) {
|
|
3240
|
-
_dateForm.get('startDate').patchValue(startDate);
|
|
3241
3235
|
}
|
|
3242
|
-
|
|
3243
|
-
|
|
3236
|
+
else {
|
|
3237
|
+
endDate = dayFormatted;
|
|
3244
3238
|
}
|
|
3245
|
-
console.log(_dateForm.value);
|
|
3246
|
-
this.writeValue(_dateForm.value);
|
|
3247
3239
|
}
|
|
3248
|
-
|
|
3249
|
-
|
|
3240
|
+
else
|
|
3241
|
+
startDate = dayFormatted;
|
|
3242
|
+
if (startDate) {
|
|
3243
|
+
_dateForm.get('startDate').patchValue(startDate);
|
|
3250
3244
|
}
|
|
3245
|
+
if (endDate) {
|
|
3246
|
+
_dateForm.get('endDate').patchValue(endDate);
|
|
3247
|
+
}
|
|
3248
|
+
this.writeValue(_dateForm.value);
|
|
3251
3249
|
}
|
|
3252
3250
|
selectRangeOfDays(days) {
|
|
3253
3251
|
if (this._disabled)
|
|
3254
3252
|
return;
|
|
3255
3253
|
const { _dateForm, _minDate, today, moveDaysForward } = this;
|
|
3256
3254
|
const { startDate } = _dateForm.value;
|
|
3257
|
-
const firstDay = moment(startDate || _minDate || today).format('YYYY-MM-DD');
|
|
3255
|
+
const firstDay = moment.default(startDate || _minDate || today).format('YYYY-MM-DD');
|
|
3258
3256
|
const method = moveDaysForward ? 'add' : 'subtract';
|
|
3259
|
-
const lastDay = moment(firstDay)[method](days, 'day').format('YYYY-MM-DD');
|
|
3257
|
+
const lastDay = moment.default(firstDay)[method](days, 'day').format('YYYY-MM-DD');
|
|
3260
3258
|
if (moveDaysForward) {
|
|
3261
3259
|
_dateForm.get('startDate').patchValue(firstDay);
|
|
3262
3260
|
_dateForm.get('endDate').patchValue(lastDay);
|