@sumaris-net/ngx-components 1.17.0 → 1.17.1-rc1
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/bundles/sumaris-net.ngx-components.umd.js +61 -44
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/admin/services/person.service.js +2 -2
- package/esm2015/src/app/core/menu/menu.component.js +3 -9
- package/esm2015/src/app/core/services/model/entity.model.js +4 -1
- package/esm2015/src/app/core/text-popover/text-form.component.js +2 -2
- package/esm2015/src/app/core/text-popover/text-popover.component.js +2 -2
- package/esm2015/src/app/shared/hotkeys/hotkeys.service.js +8 -6
- package/esm2015/src/app/shared/services/job.utils.js +32 -22
- package/fesm2015/sumaris-net.ngx-components.js +45 -36
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/admin/services/person.service.d.ts +1 -1
- package/src/app/core/menu/menu.component.d.ts +0 -2
- package/src/app/core/services/model/entity.model.d.ts +1 -0
- package/src/app/shared/hotkeys/hotkeys.service.d.ts +3 -2
- package/src/app/shared/services/job.utils.d.ts +2 -2
- package/src/assets/i18n/en-US.json +1 -0
- package/src/assets/i18n/en.json +1 -0
- package/src/assets/i18n/fr.json +1 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -9988,12 +9988,13 @@
|
|
|
9988
9988
|
]; };
|
|
9989
9989
|
|
|
9990
9990
|
var Hotkeys = /** @class */ (function () {
|
|
9991
|
-
function Hotkeys(eventManager, dialog, document, modalController) {
|
|
9991
|
+
function Hotkeys(eventManager, dialog, document, modalController, popoverController) {
|
|
9992
9992
|
var _this = this;
|
|
9993
9993
|
this.eventManager = eventManager;
|
|
9994
9994
|
this.dialog = dialog;
|
|
9995
9995
|
this.document = document;
|
|
9996
9996
|
this.modalController = modalController;
|
|
9997
|
+
this.popoverController = popoverController;
|
|
9997
9998
|
this._debug = false;
|
|
9998
9999
|
this._hotkeys = new Map();
|
|
9999
10000
|
this._defaults = {
|
|
@@ -10022,12 +10023,19 @@
|
|
|
10022
10023
|
}
|
|
10023
10024
|
return new rxjs.Observable(function (observer) {
|
|
10024
10025
|
var handler = function (e) { return __awaiter(_this, void 0, void 0, function () {
|
|
10025
|
-
var top;
|
|
10026
|
-
return __generator(this, function (
|
|
10027
|
-
switch (
|
|
10026
|
+
var top, _a;
|
|
10027
|
+
return __generator(this, function (_b) {
|
|
10028
|
+
switch (_b.label) {
|
|
10028
10029
|
case 0: return [4 /*yield*/, this.modalController.getTop()];
|
|
10029
10030
|
case 1:
|
|
10030
|
-
|
|
10031
|
+
_a = (_b.sent());
|
|
10032
|
+
if (_a) return [3 /*break*/, 3];
|
|
10033
|
+
return [4 /*yield*/, this.popoverController.getTop()];
|
|
10034
|
+
case 2:
|
|
10035
|
+
_a = (_b.sent());
|
|
10036
|
+
_b.label = 3;
|
|
10037
|
+
case 3:
|
|
10038
|
+
top = _a;
|
|
10031
10039
|
// If modal present, check its component name against hotkey element name (fix #181)
|
|
10032
10040
|
if (top && top.component['name'] !== merged.elementName)
|
|
10033
10041
|
return [2 /*return*/];
|
|
@@ -10057,7 +10065,7 @@
|
|
|
10057
10065
|
};
|
|
10058
10066
|
return Hotkeys;
|
|
10059
10067
|
}());
|
|
10060
|
-
Hotkeys.ɵprov = i0.ɵɵdefineInjectable({ factory: function Hotkeys_Factory() { return new Hotkeys(i0.ɵɵinject(i1$6.EventManager), i0.ɵɵinject(i2.MatDialog), i0.ɵɵinject(i1$4.DOCUMENT), i0.ɵɵinject(i1$5.ModalController)); }, token: Hotkeys, providedIn: "root" });
|
|
10068
|
+
Hotkeys.ɵprov = i0.ɵɵdefineInjectable({ factory: function Hotkeys_Factory() { return new Hotkeys(i0.ɵɵinject(i1$6.EventManager), i0.ɵɵinject(i2.MatDialog), i0.ɵɵinject(i1$4.DOCUMENT), i0.ɵɵinject(i1$5.ModalController), i0.ɵɵinject(i1$5.PopoverController)); }, token: Hotkeys, providedIn: "root" });
|
|
10061
10069
|
Hotkeys.decorators = [
|
|
10062
10070
|
{ type: i0.Injectable, args: [{
|
|
10063
10071
|
providedIn: 'root'
|
|
@@ -10067,7 +10075,8 @@
|
|
|
10067
10075
|
{ type: i1$6.EventManager },
|
|
10068
10076
|
{ type: i2.MatDialog },
|
|
10069
10077
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [i1$4.DOCUMENT,] }] },
|
|
10070
|
-
{ type: i1$5.ModalController }
|
|
10078
|
+
{ type: i1$5.ModalController },
|
|
10079
|
+
{ type: i1$5.PopoverController }
|
|
10071
10080
|
]; };
|
|
10072
10081
|
|
|
10073
10082
|
var SharedHotkeysModule = /** @class */ (function () {
|
|
@@ -10911,6 +10920,9 @@
|
|
|
10911
10920
|
EntityUtils.isLocalId = function (id) {
|
|
10912
10921
|
return isNotNil(id) && +id < 0;
|
|
10913
10922
|
};
|
|
10923
|
+
EntityUtils.isRemoteId = function (id) {
|
|
10924
|
+
return isNotNil(id) && +id >= 0;
|
|
10925
|
+
};
|
|
10914
10926
|
return EntityUtils;
|
|
10915
10927
|
}());
|
|
10916
10928
|
|
|
@@ -19773,7 +19785,7 @@
|
|
|
19773
19785
|
TextForm.decorators = [
|
|
19774
19786
|
{ type: i0.Component, args: [{
|
|
19775
19787
|
selector: 'app-text-form',
|
|
19776
|
-
template: "<form class=\"form-container\" [formGroup]=\"form\" (ngSubmit)=\"doSubmit($event)\">\n <mat-form-field *ngIf=\"multiline; else monoline\">\n <textarea\n #textArea\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [readonly]=\"control.disabled\"\n [class.fixed-height]=\"!autoHeight\"\n [cdkTextareaAutosize]=\"autoHeight\"\n (keyup)=\"textAreaChanged($event)\"\n (keydown.control.enter)=\"onSubmit.emit($event)\"\n [autofocus]=\"autofocus\"\n ></textarea>\n <mat-error *ngIf=\"control.hasError('maxlength')\">\n {{ 'ERROR.FIELD_MAX_LENGTH' | translate: control.errors['maxlength'] }}\n </mat-error>\n <mat-hint *ngIf=\"maxLength\" align=\"end\">\n {{ 'INFO.TEXT_PROGRESS' | translate: { current: textArea.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n <ng-template #monoline>\n <mat-form-field>\n <input\n #textInput\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [readonly]=\"disabled\"\n [appAutofocus]=\"autofocus\"\n />\n <mat-error *ngIf=\"control.hasError('maxlength')\">\n {{ 'ERROR.FIELD_MAX_LENGTH' | translate: control.errors['maxlength'] }}\n </mat-error>\n <mat-hint *ngIf=\"maxLength\" align=\"end\">\n {{ 'INFO.TEXT_PROGRESS' | translate: { current: textInput.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n </ng-template>\n</form>\n",
|
|
19788
|
+
template: "<form class=\"form-container\" [formGroup]=\"form\" (ngSubmit)=\"doSubmit($event)\">\n <mat-form-field *ngIf=\"multiline; else monoline\">\n <textarea\n #textArea\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [readonly]=\"control.disabled\"\n [class.fixed-height]=\"!autoHeight\"\n [cdkTextareaAutosize]=\"autoHeight\"\n (keyup)=\"textAreaChanged($event)\"\n (keydown.control.enter)=\"onSubmit.emit($event)\"\n [autofocus]=\"autofocus\"\n ></textarea>\n <mat-error *ngIf=\"control.hasError('maxlength')\">\n {{ 'ERROR.FIELD_MAX_LENGTH' | translate: control.errors['maxlength'] }}\n </mat-error>\n <mat-hint *ngIf=\"maxLength\" align=\"end\">\n {{ 'INFO.TEXT_PROGRESS' | translate: { current: textArea.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n <ng-template #monoline>\n <mat-form-field>\n <input\n #textInput\n matInput\n [formControl]=\"control\"\n [placeholder]=\"placeholder\"\n [readonly]=\"disabled\"\n [appAutofocus]=\"autofocus\"\n (keydown.control.enter)=\"onSubmit.emit($event)\"\n />\n <mat-error *ngIf=\"control.hasError('maxlength')\">\n {{ 'ERROR.FIELD_MAX_LENGTH' | translate: control.errors['maxlength'] }}\n </mat-error>\n <mat-hint *ngIf=\"maxLength\" align=\"end\">\n {{ 'INFO.TEXT_PROGRESS' | translate: { current: textInput.value?.length || 0, max: maxLength } }}\n </mat-hint>\n </mat-form-field>\n </ng-template>\n</form>\n",
|
|
19777
19789
|
styles: ["textarea.fixed-height{height:11.5em}"]
|
|
19778
19790
|
},] }
|
|
19779
19791
|
];
|
|
@@ -19893,7 +19905,7 @@
|
|
|
19893
19905
|
TextPopover.decorators = [
|
|
19894
19906
|
{ type: i0.Component, args: [{
|
|
19895
19907
|
selector: 'app-text-popover',
|
|
19896
|
-
template: "\n<ion-content class=\"ion-padding\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <ion-item *ngIf=\"form.error\" visible-xs visible-sm visible-mobile lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"error\" [innerHTML]=\"form.error|translate\"></ion-label>\n </ion-item>\n\n <app-text-form #form [placeholder]=\"placeholder\"\n [multiline]=\"multiline\"\n [maxLength]=\"maxLength\"\n [autofocus]=\"editing && autofocus\"\n (onSubmit)=\"onValidate($event)\"\n ></app-text-form>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col>\n\n </ion-col>\n\n <ion-col size=\"auto\">\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"cancel()\">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n <ion-button\n [fill]=\"disabled ? 'clear' : 'solid'\"\n (click)=\"onValidate($event)\"\n (keyup.enter)=\"onValidate($event)\"\n color=\"tertiary\"\n [disabled]=\"disabled\"\n
|
|
19908
|
+
template: "\n<ion-content class=\"ion-padding\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n <ion-item *ngIf=\"form.error\" visible-xs visible-sm visible-mobile lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"error\" [innerHTML]=\"form.error|translate\"></ion-label>\n </ion-item>\n\n <app-text-form #form [placeholder]=\"placeholder\"\n [multiline]=\"multiline\"\n [maxLength]=\"maxLength\"\n [autofocus]=\"editing && autofocus\"\n (onSubmit)=\"onValidate($event)\"\n ></app-text-form>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col>\n\n </ion-col>\n\n <ion-col size=\"auto\">\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"cancel()\">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n <ion-button\n [fill]=\"disabled ? 'clear' : 'solid'\"\n (click)=\"onValidate($event)\"\n (keyup.enter)=\"onValidate($event)\"\n color=\"tertiary\"\n [disabled]=\"disabled\"\n [title]=\"'COMMON.BTN_VALIDATE_WITH_SHORTCUT_HELP'|translate\">\n <ion-label translate>COMMON.BTN_VALIDATE</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n"
|
|
19897
19909
|
},] }
|
|
19898
19910
|
];
|
|
19899
19911
|
TextPopover.ctorParameters = function () { return [
|
|
@@ -20281,53 +20293,59 @@
|
|
|
20281
20293
|
.then(function () {
|
|
20282
20294
|
if (opts === null || opts === void 0 ? void 0 : opts.maxProgression)
|
|
20283
20295
|
progression.next(opts.maxProgression);
|
|
20284
|
-
|
|
20285
|
-
opts.progression.complete();
|
|
20296
|
+
progression.complete();
|
|
20286
20297
|
})
|
|
20287
20298
|
.catch(function (err) { return progression.error(err); });
|
|
20288
20299
|
return progression;
|
|
20289
20300
|
};
|
|
20290
20301
|
JobUtils.fetchAllPages = function (loadPageFn, opts) {
|
|
20291
|
-
var _a;
|
|
20292
20302
|
return __awaiter(this, void 0, void 0, function () {
|
|
20293
|
-
var maxProgression, total, pageCount, progressionStep, currentPageDataCount, fetchSize, offset, data, res
|
|
20294
|
-
return __generator(this, function (
|
|
20295
|
-
switch (
|
|
20303
|
+
var maxProgression, progression, total, pageCount, progressionStep, currentPageDataCount, fetchSize, offset, data, res;
|
|
20304
|
+
return __generator(this, function (_a) {
|
|
20305
|
+
switch (_a.label) {
|
|
20296
20306
|
case 0:
|
|
20297
|
-
maxProgression = opts
|
|
20298
|
-
|
|
20307
|
+
maxProgression = toNumber(opts === null || opts === void 0 ? void 0 : opts.maxProgression, 100);
|
|
20308
|
+
progression = opts === null || opts === void 0 ? void 0 : opts.progression;
|
|
20309
|
+
fetchSize = toNumber(opts === null || opts === void 0 ? void 0 : opts.fetchSize, 1000);
|
|
20310
|
+
if (fetchSize <= 0)
|
|
20311
|
+
throw new Error('Unable to fetch pages: invalid fetchSize: ' + fetchSize);
|
|
20299
20312
|
offset = 0;
|
|
20300
20313
|
data = [];
|
|
20301
|
-
|
|
20314
|
+
_a.label = 1;
|
|
20302
20315
|
case 1:
|
|
20303
20316
|
if (opts && opts.logPrefix)
|
|
20304
20317
|
console.debug(opts.logPrefix + " Fetching page #" + offset / fetchSize + "...");
|
|
20305
20318
|
return [4 /*yield*/, loadPageFn(offset, fetchSize)];
|
|
20306
20319
|
case 2:
|
|
20307
|
-
res =
|
|
20320
|
+
res = _a.sent();
|
|
20321
|
+
// Concat to previous result
|
|
20308
20322
|
data = data.concat(res.data);
|
|
20323
|
+
// Compute variables, for next loop
|
|
20309
20324
|
currentPageDataCount = res.data && res.data.length || 0;
|
|
20310
20325
|
offset += currentPageDataCount;
|
|
20311
|
-
// Set total count (only
|
|
20326
|
+
// Set total count (only once)
|
|
20312
20327
|
if (isNil(total) && isNotNil(res.total)) {
|
|
20313
20328
|
total = res.total;
|
|
20314
20329
|
// Compute the number of page
|
|
20315
20330
|
pageCount = Math.round(res.total / fetchSize + 0.5); // Round to HALF_UP integer
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20331
|
+
// Compute step, by dividing maxProgression by number of page
|
|
20332
|
+
if (progression) {
|
|
20333
|
+
progressionStep = maxProgression / pageCount;
|
|
20334
|
+
// DEBUG
|
|
20335
|
+
if (opts && opts.logPrefix)
|
|
20336
|
+
console.debug(opts.logPrefix + " {pageCount: " + pageCount + ", progression: " + progression.value + ", pageProgressionStep: " + progressionStep + "}");
|
|
20337
|
+
}
|
|
20320
20338
|
}
|
|
20321
20339
|
// Increment progression on each iteration (if possible)
|
|
20322
|
-
if (
|
|
20323
|
-
|
|
20340
|
+
if (isNotNil(progressionStep)) {
|
|
20341
|
+
progression.next(progression.value + progressionStep);
|
|
20324
20342
|
}
|
|
20325
|
-
if (opts
|
|
20343
|
+
if (opts === null || opts === void 0 ? void 0 : opts.onPageLoaded)
|
|
20326
20344
|
opts.onPageLoaded(res);
|
|
20327
|
-
|
|
20345
|
+
_a.label = 3;
|
|
20328
20346
|
case 3:
|
|
20329
20347
|
if (currentPageDataCount > 0 && ((isNil(total) && currentPageDataCount === fetchSize) || (isNotNil(total) && (offset < total)))) return [3 /*break*/, 1];
|
|
20330
|
-
|
|
20348
|
+
_a.label = 4;
|
|
20331
20349
|
case 4:
|
|
20332
20350
|
// Complete progression to reach progressionStep value (because of round)
|
|
20333
20351
|
if (isNotNil(progressionStep)) {
|
|
@@ -20337,14 +20355,19 @@
|
|
|
20337
20355
|
total = data.length;
|
|
20338
20356
|
pageCount = Math.round(data.length / fetchSize + 0.5);
|
|
20339
20357
|
}
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
|
|
20343
|
-
|
|
20358
|
+
// Compute final increment, using the real page count
|
|
20359
|
+
progressionStep = Math.max(0, maxProgression - (progressionStep * pageCount));
|
|
20360
|
+
}
|
|
20361
|
+
// Or increment once (e.g. when total is not known, in received LoadResult)
|
|
20362
|
+
else if (progression) {
|
|
20363
|
+
progressionStep = maxProgression;
|
|
20344
20364
|
}
|
|
20345
|
-
//
|
|
20346
|
-
|
|
20347
|
-
|
|
20365
|
+
// DEBUG
|
|
20366
|
+
if (opts && opts.logPrefix)
|
|
20367
|
+
console.debug(opts.logPrefix + " All pages fetched - {progression: " + progression.value + ", lastProgressionStep: " + progressionStep);
|
|
20368
|
+
// Final increment
|
|
20369
|
+
if (progression && progressionStep > 0) {
|
|
20370
|
+
progression.next(progression.value + progressionStep);
|
|
20348
20371
|
}
|
|
20349
20372
|
return [2 /*return*/, {
|
|
20350
20373
|
data: data,
|
|
@@ -23683,12 +23706,7 @@
|
|
|
23683
23706
|
this.appVersion = this.environment.version;
|
|
23684
23707
|
this.side = 'left';
|
|
23685
23708
|
this._debug = !environment.production;
|
|
23686
|
-
this.onResize();
|
|
23687
23709
|
}
|
|
23688
|
-
MenuComponent.prototype.onResize = function (event) {
|
|
23689
|
-
this._screenWidth = window.innerWidth;
|
|
23690
|
-
console.debug('[menu] Screen size (px): ' + this._screenWidth);
|
|
23691
|
-
};
|
|
23692
23710
|
MenuComponent.prototype.ngOnInit = function () {
|
|
23693
23711
|
return __awaiter(this, void 0, void 0, function () {
|
|
23694
23712
|
var _this = this;
|
|
@@ -23985,8 +24003,7 @@
|
|
|
23985
24003
|
appName: [{ type: i0.Input }],
|
|
23986
24004
|
appVersion: [{ type: i0.Input }],
|
|
23987
24005
|
side: [{ type: i0.Input }],
|
|
23988
|
-
splitPane: [{ type: i0.ViewChild, args: ['splitPane', { static: true },] }]
|
|
23989
|
-
onResize: [{ type: i0.HostListener, args: ['window:resize', ['$event'],] }]
|
|
24006
|
+
splitPane: [{ type: i0.ViewChild, args: ['splitPane', { static: true },] }]
|
|
23990
24007
|
};
|
|
23991
24008
|
|
|
23992
24009
|
var AppMenuModule = /** @class */ (function () {
|
|
@@ -29459,7 +29476,7 @@
|
|
|
29459
29476
|
fetchPolicy: 'network-only',
|
|
29460
29477
|
withTotal: (offset === 0),
|
|
29461
29478
|
toEntity: false
|
|
29462
|
-
}); },
|
|
29479
|
+
}); }, { progression: opts === null || opts === void 0 ? void 0 : opts.progression, maxProgression: maxProgression * 0.9 })];
|
|
29463
29480
|
case 1:
|
|
29464
29481
|
res = _a.sent();
|
|
29465
29482
|
// Save result locally
|