myrta-ui 17.1.20 → 17.1.22
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/esm2022/lib/components/form/input-datepicker/helpers/value-parser.mjs +3 -3
- package/esm2022/lib/components/form/input-datepicker/input-datepicker.component.mjs +30 -11
- package/esm2022/lib/components/pdf-viewer/pdf-viewer.component.mjs +24 -11
- package/fesm2022/myrta-ui.mjs +54 -23
- package/fesm2022/myrta-ui.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2022/myrta-ui.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import { NgSelectModule } from '@ng-select/ng-select';
|
|
|
19
19
|
import { Subscription, asyncScheduler, delay, of, timer, Subject, filter, BehaviorSubject, EMPTY } from 'rxjs';
|
|
20
20
|
import isEqual from 'lodash-es/isEqual';
|
|
21
21
|
import * as i1$3 from '@angular/common/http';
|
|
22
|
-
import { HttpEventType, HttpClientModule } from '@angular/common/http';
|
|
22
|
+
import { HttpEventType, HttpClientModule, HttpHeaders } from '@angular/common/http';
|
|
23
23
|
import { cloneDeep } from 'lodash-es';
|
|
24
24
|
import * as i1$4 from 'ngx-toastr';
|
|
25
25
|
import { Toast, ToastrModule, ToastrService } from 'ngx-toastr';
|
|
@@ -9030,7 +9030,7 @@ const timeModelConstant$2 = {
|
|
|
9030
9030
|
};
|
|
9031
9031
|
|
|
9032
9032
|
const dateModelValueParse$1 = (value, format) => {
|
|
9033
|
-
const date = dayjs(value, format);
|
|
9033
|
+
const date = format === 'UTC' ? dayjs.utc(value) : dayjs(value, format);
|
|
9034
9034
|
const day = date.date();
|
|
9035
9035
|
const month = date.month() + 1;
|
|
9036
9036
|
const year = date.year();
|
|
@@ -9047,7 +9047,7 @@ const dateModelValueParse$1 = (value, format) => {
|
|
|
9047
9047
|
};
|
|
9048
9048
|
};
|
|
9049
9049
|
const timeModelValueParse$2 = (value, format) => {
|
|
9050
|
-
const date = dayjs(value, format);
|
|
9050
|
+
const date = format === 'UTC' ? dayjs.utc(value) : dayjs(value, format);
|
|
9051
9051
|
const hour = date.hour();
|
|
9052
9052
|
const minute = date.minute();
|
|
9053
9053
|
const second = '00';
|
|
@@ -9166,8 +9166,12 @@ class InputDatepickerComponent {
|
|
|
9166
9166
|
autoClose: true,
|
|
9167
9167
|
multipleDatesSeparator: ' - ',
|
|
9168
9168
|
timepicker: this.timepicker,
|
|
9169
|
-
minDate: this.minDate
|
|
9170
|
-
|
|
9169
|
+
minDate: this.minDate
|
|
9170
|
+
? this.format === 'UTC' ? new Date(this.minDate) : dayjs(this.minDate, this.format).toDate()
|
|
9171
|
+
: '',
|
|
9172
|
+
maxDate: this.maxDate
|
|
9173
|
+
? this.format === 'UTC' ? new Date(this.maxDate) : dayjs(this.maxDate, this.format).toDate()
|
|
9174
|
+
: '',
|
|
9171
9175
|
inline: this.inline,
|
|
9172
9176
|
position({ $datepicker, $target, $pointer, done }) {
|
|
9173
9177
|
let popper = createPopper($target, $datepicker, {
|
|
@@ -9216,7 +9220,7 @@ class InputDatepickerComponent {
|
|
|
9216
9220
|
if (changes['maxDate']) {
|
|
9217
9221
|
if (this.validationType === 'double') {
|
|
9218
9222
|
const invalid = this.innerInvalid;
|
|
9219
|
-
this.dt.update({ maxDate: this.maxDate ? dayjs(this.maxDate, this.format).toDate() : '' });
|
|
9223
|
+
this.dt.update({ maxDate: this.maxDate ? this.format === 'UTC' ? new Date(this.maxDate) : dayjs(this.maxDate, this.format).toDate() : '' });
|
|
9220
9224
|
this.value && this.dt.selectDate(dayjs(this.value, this.format).toDate(), { updateTime: this.timepicker, silent: true });
|
|
9221
9225
|
const isValid = this.checkingInvalid(this.value, this.maxDate, this.minDate);
|
|
9222
9226
|
if (invalid && isValid) {
|
|
@@ -9232,7 +9236,7 @@ class InputDatepickerComponent {
|
|
|
9232
9236
|
else if (changes['minDate']) {
|
|
9233
9237
|
if (this.validationType === 'double') {
|
|
9234
9238
|
const invalid = this.innerInvalid;
|
|
9235
|
-
this.dt.update({ minDate: this.minDate ? dayjs(this.minDate, this.format).toDate() : '' });
|
|
9239
|
+
this.dt.update({ minDate: this.minDate ? this.format === 'UTC' ? new Date(this.minDate) : dayjs(this.minDate, this.format).toDate() : '' });
|
|
9236
9240
|
this.value && this.dt.selectDate(dayjs(this.value, this.format).toDate(), { updateTime: this.timepicker, silent: true });
|
|
9237
9241
|
const isValid = this.checkingInvalid(this.value, this.maxDate, this.minDate);
|
|
9238
9242
|
if (invalid && isValid) {
|
|
@@ -9284,8 +9288,16 @@ class InputDatepickerComponent {
|
|
|
9284
9288
|
this.clickToIconClear();
|
|
9285
9289
|
}
|
|
9286
9290
|
else {
|
|
9287
|
-
|
|
9288
|
-
|
|
9291
|
+
let date;
|
|
9292
|
+
let formattingDate = '';
|
|
9293
|
+
if (this.format === 'UTC') {
|
|
9294
|
+
date = dayjs.utc(`${dateModel.year}-${dateModel.month}-${dateModel.day}T${timeModel.hour}:${timeModel.minute}:00`);
|
|
9295
|
+
formattingDate = date.format('YYYY-MM-DDTHH:mm:ss');
|
|
9296
|
+
}
|
|
9297
|
+
else {
|
|
9298
|
+
date = getDateDayjsObject$1(dateModel, timeModel, this.timepicker);
|
|
9299
|
+
formattingDate = date.format(this.format);
|
|
9300
|
+
}
|
|
9289
9301
|
const isValid = this.checkingInvalid(formattingDate, this.maxDate, this.minDate);
|
|
9290
9302
|
if (date.isValid() && isValid) {
|
|
9291
9303
|
this.dt.selectDate(getDateObject$1(dateModel, timeModel, this.timepicker), {
|
|
@@ -9328,19 +9340,26 @@ class InputDatepickerComponent {
|
|
|
9328
9340
|
this.invalidMessageOff();
|
|
9329
9341
|
return true;
|
|
9330
9342
|
}
|
|
9331
|
-
|
|
9343
|
+
const dateValue = this.format === 'UTC' ? dayjs(value).utc() : dayjs(value, this.format);
|
|
9344
|
+
const maxDateValue = maxDate
|
|
9345
|
+
? this.format === 'UTC' ? dayjs(maxDate).utc() : dayjs(maxDate, this.format)
|
|
9346
|
+
: null;
|
|
9347
|
+
const minDateValue = minDate
|
|
9348
|
+
? this.format === 'UTC' ? dayjs(minDate).utc() : dayjs(minDate, this.format)
|
|
9349
|
+
: null;
|
|
9350
|
+
if (maxDate && (dateValue.diff(maxDateValue) === 0)) {
|
|
9332
9351
|
this.invalidMessageOn('Дата и время окончания не может быть равна дате и времени начала');
|
|
9333
9352
|
return false;
|
|
9334
9353
|
}
|
|
9335
|
-
else if (maxDate && (
|
|
9354
|
+
else if (maxDate && (dateValue.diff(maxDateValue) > 0)) {
|
|
9336
9355
|
this.invalidMessageOn('Дата окончания не может быть раньше даты начала');
|
|
9337
9356
|
return false;
|
|
9338
9357
|
}
|
|
9339
|
-
else if (minDate && (
|
|
9358
|
+
else if (minDate && (dateValue.diff(minDateValue) === 0)) {
|
|
9340
9359
|
this.invalidMessageOn('Дата и время окончания не может быть равна дате и времени начала');
|
|
9341
9360
|
return false;
|
|
9342
9361
|
}
|
|
9343
|
-
else if (minDate &&
|
|
9362
|
+
else if (minDate && dateValue.diff(minDateValue) < 0) {
|
|
9344
9363
|
this.invalidMessageOn('Дата окончания не может быть раньше даты начала');
|
|
9345
9364
|
return false;
|
|
9346
9365
|
}
|
|
@@ -19126,24 +19145,36 @@ class PdfViewerComponent {
|
|
|
19126
19145
|
}
|
|
19127
19146
|
onDownloadClick() {
|
|
19128
19147
|
if (this.downloadFileName) {
|
|
19129
|
-
this._downloadFile(this.downloadFileName);
|
|
19148
|
+
this._downloadFile(this.downloadFileName).then();
|
|
19130
19149
|
}
|
|
19131
19150
|
else {
|
|
19151
|
+
const headers = new HttpHeaders();
|
|
19152
|
+
headers.set('Content-Disposition', 'Печатная форма заявки со штампом.pdf');
|
|
19132
19153
|
this._http.get(this.src, { responseType: 'blob', observe: 'response', })
|
|
19133
19154
|
.subscribe((response) => {
|
|
19134
19155
|
const contentDisposition = response.headers.get('Content-Disposition');
|
|
19135
|
-
if (contentDisposition) {
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
|
|
19141
|
-
|
|
19156
|
+
if (!contentDisposition) {
|
|
19157
|
+
this._downloadFile('document.pdf').then();
|
|
19158
|
+
return;
|
|
19159
|
+
}
|
|
19160
|
+
const encodingFileName = contentDisposition.match(/filename\*\s*=\s*([^;]+)/i);
|
|
19161
|
+
if (encodingFileName) {
|
|
19162
|
+
const parts = encodingFileName[1].split('\'\'');
|
|
19163
|
+
if (parts.length === 2) {
|
|
19164
|
+
const encoding = parts[0].toLowerCase();
|
|
19165
|
+
const fileName = parts[1];
|
|
19166
|
+
if (encoding === 'utf-8') {
|
|
19167
|
+
this._downloadFile(decodeURIComponent(fileName)).then();
|
|
19168
|
+
return;
|
|
19169
|
+
}
|
|
19142
19170
|
}
|
|
19143
19171
|
}
|
|
19144
|
-
|
|
19145
|
-
|
|
19172
|
+
const simpleFileName = contentDisposition.match(/filename\s*=\s*["']?([^;"']+)/i);
|
|
19173
|
+
if (simpleFileName) {
|
|
19174
|
+
this._downloadFile(simpleFileName[1]).then();
|
|
19175
|
+
return;
|
|
19146
19176
|
}
|
|
19177
|
+
this._downloadFile('document.pdf').then();
|
|
19147
19178
|
});
|
|
19148
19179
|
}
|
|
19149
19180
|
}
|