@bizdoc/core 1.11.0-next.7 → 1.11.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.
- package/esm2020/lib/compose/form.component.mjs +3 -5
- package/esm2020/lib/core/controls/file.input.mjs +37 -10
- package/esm2020/lib/core/mailbox.service.mjs +3 -3
- package/fesm2015/bizdoc-core.mjs +39 -15
- package/fesm2015/bizdoc-core.mjs.map +1 -1
- package/fesm2020/bizdoc-core.mjs +39 -15
- package/fesm2020/bizdoc-core.mjs.map +1 -1
- package/lib/core/controls/file.input.d.ts +1 -0
- package/package.json +1 -1
package/fesm2020/bizdoc-core.mjs
CHANGED
@@ -3,7 +3,7 @@ import * as i0 from '@angular/core';
|
|
3
3
|
import { InjectionToken, Injectable, Inject, Directive, Component, ViewChild, Pipe, Optional, Self, HostBinding, Input, EventEmitter, Output, ViewContainerRef, Injector, TemplateRef, NgModule, ElementRef, HostListener, ViewChildren, Host, SkipSelf, APP_INITIALIZER } from '@angular/core';
|
4
4
|
import * as i1 from '@angular/common/http';
|
5
5
|
import { HttpRequest, HttpResponse, HttpEventType, HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
|
6
|
-
import { Subject, Observable, of, fromEvent, forkJoin, BehaviorSubject, filter as filter$1, debounceTime as debounceTime$1, takeUntil as takeUntil$1, from, merge, throwError, interval, first as first$1, map as map$1, switchMap as switchMap$1, isObservable, tap as tap$1, EMPTY } from 'rxjs';
|
6
|
+
import { Subject, Observable, of, fromEvent, forkJoin, BehaviorSubject, filter as filter$1, debounceTime as debounceTime$1, takeUntil as takeUntil$1, from, merge, throwError, interval, first as first$1, map as map$1, switchMap as switchMap$1, isObservable, tap as tap$1, catchError as catchError$1, EMPTY } from 'rxjs';
|
7
7
|
import { map, tap, switchMap, takeUntil, shareReplay, debounceTime, filter, startWith, first, take, finalize, catchError } from 'rxjs/operators';
|
8
8
|
import { HubConnectionBuilder, HubConnectionState } from '@microsoft/signalr';
|
9
9
|
import dayjs from 'dayjs';
|
@@ -1330,7 +1330,7 @@ class MailboxService {
|
|
1330
1330
|
observe.complete();
|
1331
1331
|
}
|
1332
1332
|
}, e => {
|
1333
|
-
observe.error(
|
1333
|
+
observe.error(e);
|
1334
1334
|
observe.complete();
|
1335
1335
|
});
|
1336
1336
|
return {
|
@@ -1375,7 +1375,7 @@ class MailboxService {
|
|
1375
1375
|
observe.complete();
|
1376
1376
|
}
|
1377
1377
|
}, e => {
|
1378
|
-
observe.error(
|
1378
|
+
observe.error(e);
|
1379
1379
|
observe.complete();
|
1380
1380
|
});
|
1381
1381
|
return {
|
@@ -8221,7 +8221,6 @@ class ComposeFormComponent {
|
|
8221
8221
|
this.working = true;
|
8222
8222
|
this.workingChange.emit(true);
|
8223
8223
|
let exists;
|
8224
|
-
const fileMap = {};
|
8225
8224
|
files.forEach(f => {
|
8226
8225
|
if (!exists)
|
8227
8226
|
exists = this.model.attachments.some(a => a.fileName === f.name && !a.deleted && !a.failed);
|
@@ -8229,14 +8228,13 @@ class ComposeFormComponent {
|
|
8229
8228
|
if (retry > -1)
|
8230
8229
|
this.model.attachments.splice(retry, 1);
|
8231
8230
|
const model = this._constructAttachment(f);
|
8232
|
-
fileMap[f.name] = model;
|
8233
8231
|
this.model.attachments.push(model);
|
8234
8232
|
});
|
8235
8233
|
return this._mailbox.upload(this.model.id, this.model.formId, this.model.version, files).
|
8236
8234
|
pipe(tap((r) => {
|
8237
8235
|
files.length === 1 ? this._sb.toast(!exists ? 'UploadOk' : 'UploadVersionOk', files[0].name) :
|
8238
8236
|
this._sb.toast('UploadMany', files.length);
|
8239
|
-
r.forEach(i => Object.assign(
|
8237
|
+
r.forEach(i => Object.assign(this.model.attachments.find(a => a.fileName == i.fileName && !a.id), i, { progress: null, }, i));
|
8240
8238
|
this.working = false;
|
8241
8239
|
this.workingChange.emit(false);
|
8242
8240
|
}, e => {
|
@@ -8437,7 +8435,7 @@ class ComposeFormComponent {
|
|
8437
8435
|
case 409: // version change
|
8438
8436
|
{
|
8439
8437
|
const obj = response.error /* serialized model */;
|
8440
|
-
this._assign(obj);
|
8438
|
+
obj && this._assign(obj);
|
8441
8439
|
this._reset();
|
8442
8440
|
this._sb.error('VersionErr', this.model.number);
|
8443
8441
|
break;
|
@@ -25809,7 +25807,7 @@ class FileInput {
|
|
25809
25807
|
//}
|
25810
25808
|
Object.assign(item, a, { progress: null, checkedOut: null });
|
25811
25809
|
this._sb.toast(this._translate.get('CheckedIn', item.fileName));
|
25812
|
-
},
|
25810
|
+
}, e => this._handleError(e));
|
25813
25811
|
});
|
25814
25812
|
}
|
25815
25813
|
checkOut(item) {
|
@@ -25833,12 +25831,28 @@ class FileInput {
|
|
25833
25831
|
this._value = this.items = null;
|
25834
25832
|
this._onChange(this._value);
|
25835
25833
|
this._model.attachments.remove(item);
|
25836
|
-
},
|
25834
|
+
}, e => this._handleError(e));
|
25837
25835
|
if (this._model.draft)
|
25838
25836
|
task();
|
25839
25837
|
else
|
25840
25838
|
this._sb.ask('DeleteFileAsk', 'DeleteFile', { color: 'warn' }).subscribe(ok => ok && task());
|
25841
25839
|
}
|
25840
|
+
_handleError(response) {
|
25841
|
+
switch (response.status) {
|
25842
|
+
case 401:
|
25843
|
+
break;
|
25844
|
+
case 409: // version change
|
25845
|
+
{
|
25846
|
+
this._sb.error('VersionErr', this._model.number);
|
25847
|
+
break;
|
25848
|
+
}
|
25849
|
+
case 406: // validation exception
|
25850
|
+
this._sb.errorString(response.error);
|
25851
|
+
break;
|
25852
|
+
default:
|
25853
|
+
this._sb.error();
|
25854
|
+
}
|
25855
|
+
}
|
25842
25856
|
ngOnInit() {
|
25843
25857
|
const container = this._dropableElement.nativeElement;
|
25844
25858
|
this._dragDrop.subscribe(ok => {
|
@@ -25870,14 +25884,21 @@ class FileInput {
|
|
25870
25884
|
for (let item of checkedOut) {
|
25871
25885
|
let file = files.find(f => f.name.startsWith(item.fileName));
|
25872
25886
|
if (file) {
|
25873
|
-
let observable = this._mailbox.checkIn(this._model.id, this._model.version, item.id, file).
|
25887
|
+
let observable = this._mailbox.checkIn(this._model.id, this._model.version, item.id, file).
|
25888
|
+
pipe(tap$1(e => {
|
25874
25889
|
//Object.assign(item, a, { progress: null });
|
25890
|
+
}), catchError$1(e => {
|
25891
|
+
this._handleError(e);
|
25892
|
+
return of(false);
|
25875
25893
|
}));
|
25876
25894
|
observables.push(observable);
|
25877
25895
|
}
|
25878
25896
|
}
|
25879
|
-
forkJoin(observables).subscribe(
|
25880
|
-
|
25897
|
+
forkJoin(observables).subscribe(e => {
|
25898
|
+
const attachments = e.filter(e => e);
|
25899
|
+
attachments.length && this._sb.toast(attachments.length > 1 ? this._translate.get('CheckedInN', attachments.length) :
|
25900
|
+
this._translate.get('CheckedIn', attachments[0].fileName));
|
25901
|
+
});
|
25881
25902
|
}
|
25882
25903
|
else
|
25883
25904
|
this._upload(files);
|
@@ -25992,7 +26013,10 @@ class FileInput {
|
|
25992
26013
|
pipe(tap$1(e => {
|
25993
26014
|
// if (e.progress) {
|
25994
26015
|
// }
|
25995
|
-
}), map$1(e => e[0])
|
26016
|
+
}), map$1(e => e[0]), catchError$1(e => {
|
26017
|
+
this._handleError(e);
|
26018
|
+
return of(false);
|
26019
|
+
}));
|
25996
26020
|
observables.push(observable);
|
25997
26021
|
}
|
25998
26022
|
this._input.nativeElement.value = null;
|
@@ -26001,14 +26025,14 @@ class FileInput {
|
|
26001
26025
|
if (!this.items)
|
26002
26026
|
this.items = [];
|
26003
26027
|
e.forEach(a => {
|
26028
|
+
if (!a)
|
26029
|
+
return;
|
26004
26030
|
ids.push(a.id);
|
26005
26031
|
this._model.attachments.push(a);
|
26006
26032
|
this.items.push(this._createItem(a.id));
|
26007
26033
|
});
|
26008
26034
|
this._value = this.multiple ? ids : ids[0];
|
26009
26035
|
this._onChange(this._value);
|
26010
|
-
}, e => {
|
26011
|
-
this._sb.error();
|
26012
26036
|
});
|
26013
26037
|
}
|
26014
26038
|
ngOnDestroy() {
|