@sumaris-net/ngx-components 1.17.0 → 1.17.1
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 +64 -45
- 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 +11 -7
- package/esm2015/src/app/shared/services/job.utils.js +32 -22
- package/fesm2015/sumaris-net.ngx-components.js +48 -37
- 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,15 +10023,24 @@
|
|
|
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
|
-
if (top && top.component['name'] !== merged.elementName)
|
|
10040
|
+
if (top && top.component['name'] !== merged.elementName) {
|
|
10041
|
+
e.preventDefault();
|
|
10033
10042
|
return [2 /*return*/];
|
|
10043
|
+
}
|
|
10034
10044
|
if (e instanceof KeyboardEvent && e.repeat)
|
|
10035
10045
|
return [2 /*return*/]; // skip when repeated
|
|
10036
10046
|
if (merged.preventDefault)
|
|
@@ -10057,7 +10067,7 @@
|
|
|
10057
10067
|
};
|
|
10058
10068
|
return Hotkeys;
|
|
10059
10069
|
}());
|
|
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" });
|
|
10070
|
+
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
10071
|
Hotkeys.decorators = [
|
|
10062
10072
|
{ type: i0.Injectable, args: [{
|
|
10063
10073
|
providedIn: 'root'
|
|
@@ -10067,7 +10077,8 @@
|
|
|
10067
10077
|
{ type: i1$6.EventManager },
|
|
10068
10078
|
{ type: i2.MatDialog },
|
|
10069
10079
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [i1$4.DOCUMENT,] }] },
|
|
10070
|
-
{ type: i1$5.ModalController }
|
|
10080
|
+
{ type: i1$5.ModalController },
|
|
10081
|
+
{ type: i1$5.PopoverController }
|
|
10071
10082
|
]; };
|
|
10072
10083
|
|
|
10073
10084
|
var SharedHotkeysModule = /** @class */ (function () {
|
|
@@ -10911,6 +10922,9 @@
|
|
|
10911
10922
|
EntityUtils.isLocalId = function (id) {
|
|
10912
10923
|
return isNotNil(id) && +id < 0;
|
|
10913
10924
|
};
|
|
10925
|
+
EntityUtils.isRemoteId = function (id) {
|
|
10926
|
+
return isNotNil(id) && +id >= 0;
|
|
10927
|
+
};
|
|
10914
10928
|
return EntityUtils;
|
|
10915
10929
|
}());
|
|
10916
10930
|
|
|
@@ -19773,7 +19787,7 @@
|
|
|
19773
19787
|
TextForm.decorators = [
|
|
19774
19788
|
{ type: i0.Component, args: [{
|
|
19775
19789
|
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",
|
|
19790
|
+
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
19791
|
styles: ["textarea.fixed-height{height:11.5em}"]
|
|
19778
19792
|
},] }
|
|
19779
19793
|
];
|
|
@@ -19893,7 +19907,7 @@
|
|
|
19893
19907
|
TextPopover.decorators = [
|
|
19894
19908
|
{ type: i0.Component, args: [{
|
|
19895
19909
|
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
|
|
19910
|
+
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
19911
|
},] }
|
|
19898
19912
|
];
|
|
19899
19913
|
TextPopover.ctorParameters = function () { return [
|
|
@@ -20281,53 +20295,59 @@
|
|
|
20281
20295
|
.then(function () {
|
|
20282
20296
|
if (opts === null || opts === void 0 ? void 0 : opts.maxProgression)
|
|
20283
20297
|
progression.next(opts.maxProgression);
|
|
20284
|
-
|
|
20285
|
-
opts.progression.complete();
|
|
20298
|
+
progression.complete();
|
|
20286
20299
|
})
|
|
20287
20300
|
.catch(function (err) { return progression.error(err); });
|
|
20288
20301
|
return progression;
|
|
20289
20302
|
};
|
|
20290
20303
|
JobUtils.fetchAllPages = function (loadPageFn, opts) {
|
|
20291
|
-
var _a;
|
|
20292
20304
|
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 (
|
|
20305
|
+
var maxProgression, progression, total, pageCount, progressionStep, currentPageDataCount, fetchSize, offset, data, res;
|
|
20306
|
+
return __generator(this, function (_a) {
|
|
20307
|
+
switch (_a.label) {
|
|
20296
20308
|
case 0:
|
|
20297
|
-
maxProgression = opts
|
|
20298
|
-
|
|
20309
|
+
maxProgression = toNumber(opts === null || opts === void 0 ? void 0 : opts.maxProgression, 100);
|
|
20310
|
+
progression = opts === null || opts === void 0 ? void 0 : opts.progression;
|
|
20311
|
+
fetchSize = toNumber(opts === null || opts === void 0 ? void 0 : opts.fetchSize, 1000);
|
|
20312
|
+
if (fetchSize <= 0)
|
|
20313
|
+
throw new Error('Unable to fetch pages: invalid fetchSize: ' + fetchSize);
|
|
20299
20314
|
offset = 0;
|
|
20300
20315
|
data = [];
|
|
20301
|
-
|
|
20316
|
+
_a.label = 1;
|
|
20302
20317
|
case 1:
|
|
20303
20318
|
if (opts && opts.logPrefix)
|
|
20304
20319
|
console.debug(opts.logPrefix + " Fetching page #" + offset / fetchSize + "...");
|
|
20305
20320
|
return [4 /*yield*/, loadPageFn(offset, fetchSize)];
|
|
20306
20321
|
case 2:
|
|
20307
|
-
res =
|
|
20322
|
+
res = _a.sent();
|
|
20323
|
+
// Concat to previous result
|
|
20308
20324
|
data = data.concat(res.data);
|
|
20325
|
+
// Compute variables, for next loop
|
|
20309
20326
|
currentPageDataCount = res.data && res.data.length || 0;
|
|
20310
20327
|
offset += currentPageDataCount;
|
|
20311
|
-
// Set total count (only
|
|
20328
|
+
// Set total count (only once)
|
|
20312
20329
|
if (isNil(total) && isNotNil(res.total)) {
|
|
20313
20330
|
total = res.total;
|
|
20314
20331
|
// Compute the number of page
|
|
20315
20332
|
pageCount = Math.round(res.total / fetchSize + 0.5); // Round to HALF_UP integer
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20333
|
+
// Compute step, by dividing maxProgression by number of page
|
|
20334
|
+
if (progression) {
|
|
20335
|
+
progressionStep = maxProgression / pageCount;
|
|
20336
|
+
// DEBUG
|
|
20337
|
+
if (opts && opts.logPrefix)
|
|
20338
|
+
console.debug(opts.logPrefix + " {pageCount: " + pageCount + ", progression: " + progression.value + ", pageProgressionStep: " + progressionStep + "}");
|
|
20339
|
+
}
|
|
20320
20340
|
}
|
|
20321
20341
|
// Increment progression on each iteration (if possible)
|
|
20322
|
-
if (
|
|
20323
|
-
|
|
20342
|
+
if (isNotNil(progressionStep)) {
|
|
20343
|
+
progression.next(progression.value + progressionStep);
|
|
20324
20344
|
}
|
|
20325
|
-
if (opts
|
|
20345
|
+
if (opts === null || opts === void 0 ? void 0 : opts.onPageLoaded)
|
|
20326
20346
|
opts.onPageLoaded(res);
|
|
20327
|
-
|
|
20347
|
+
_a.label = 3;
|
|
20328
20348
|
case 3:
|
|
20329
20349
|
if (currentPageDataCount > 0 && ((isNil(total) && currentPageDataCount === fetchSize) || (isNotNil(total) && (offset < total)))) return [3 /*break*/, 1];
|
|
20330
|
-
|
|
20350
|
+
_a.label = 4;
|
|
20331
20351
|
case 4:
|
|
20332
20352
|
// Complete progression to reach progressionStep value (because of round)
|
|
20333
20353
|
if (isNotNil(progressionStep)) {
|
|
@@ -20337,14 +20357,19 @@
|
|
|
20337
20357
|
total = data.length;
|
|
20338
20358
|
pageCount = Math.round(data.length / fetchSize + 0.5);
|
|
20339
20359
|
}
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
opts.progression.next(opts.progression.value + lastProgressionStep);
|
|
20343
|
-
}
|
|
20360
|
+
// Compute final increment, using the real page count
|
|
20361
|
+
progressionStep = Math.max(0, maxProgression - (progressionStep * pageCount));
|
|
20344
20362
|
}
|
|
20345
|
-
// Or increment once
|
|
20346
|
-
else if (
|
|
20347
|
-
|
|
20363
|
+
// Or increment once (e.g. when total is not known, in received LoadResult)
|
|
20364
|
+
else if (progression) {
|
|
20365
|
+
progressionStep = maxProgression;
|
|
20366
|
+
}
|
|
20367
|
+
// DEBUG
|
|
20368
|
+
if (opts && opts.logPrefix)
|
|
20369
|
+
console.debug(opts.logPrefix + " All pages fetched - {progression: " + progression.value + ", lastProgressionStep: " + progressionStep);
|
|
20370
|
+
// Final increment
|
|
20371
|
+
if (progression && progressionStep > 0) {
|
|
20372
|
+
progression.next(progression.value + progressionStep);
|
|
20348
20373
|
}
|
|
20349
20374
|
return [2 /*return*/, {
|
|
20350
20375
|
data: data,
|
|
@@ -23683,12 +23708,7 @@
|
|
|
23683
23708
|
this.appVersion = this.environment.version;
|
|
23684
23709
|
this.side = 'left';
|
|
23685
23710
|
this._debug = !environment.production;
|
|
23686
|
-
this.onResize();
|
|
23687
23711
|
}
|
|
23688
|
-
MenuComponent.prototype.onResize = function (event) {
|
|
23689
|
-
this._screenWidth = window.innerWidth;
|
|
23690
|
-
console.debug('[menu] Screen size (px): ' + this._screenWidth);
|
|
23691
|
-
};
|
|
23692
23712
|
MenuComponent.prototype.ngOnInit = function () {
|
|
23693
23713
|
return __awaiter(this, void 0, void 0, function () {
|
|
23694
23714
|
var _this = this;
|
|
@@ -23985,8 +24005,7 @@
|
|
|
23985
24005
|
appName: [{ type: i0.Input }],
|
|
23986
24006
|
appVersion: [{ type: i0.Input }],
|
|
23987
24007
|
side: [{ type: i0.Input }],
|
|
23988
|
-
splitPane: [{ type: i0.ViewChild, args: ['splitPane', { static: true },] }]
|
|
23989
|
-
onResize: [{ type: i0.HostListener, args: ['window:resize', ['$event'],] }]
|
|
24008
|
+
splitPane: [{ type: i0.ViewChild, args: ['splitPane', { static: true },] }]
|
|
23990
24009
|
};
|
|
23991
24010
|
|
|
23992
24011
|
var AppMenuModule = /** @class */ (function () {
|
|
@@ -29459,7 +29478,7 @@
|
|
|
29459
29478
|
fetchPolicy: 'network-only',
|
|
29460
29479
|
withTotal: (offset === 0),
|
|
29461
29480
|
toEntity: false
|
|
29462
|
-
}); },
|
|
29481
|
+
}); }, { progression: opts === null || opts === void 0 ? void 0 : opts.progression, maxProgression: maxProgression * 0.9 })];
|
|
29463
29482
|
case 1:
|
|
29464
29483
|
res = _a.sent();
|
|
29465
29484
|
// Save result locally
|