@sumaris-net/ngx-components 1.0.10 → 1.2.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 +52 -22
- 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/core/form/editor.class.js +4 -2
- package/esm2015/src/app/core/form/form.utils.js +2 -2
- package/esm2015/src/app/core/form/properties.form.js +2 -2
- package/esm2015/src/app/core/graphql/graphql.service.js +2 -2
- package/esm2015/src/app/core/install/install-upgrade-card.component.js +20 -8
- package/esm2015/src/app/core/services/base-graphql-service.class.js +3 -3
- package/esm2015/src/app/core/services/model/config.model.js +2 -2
- package/esm2015/src/app/core/services/model/entity.model.js +2 -2
- package/esm2015/src/app/core/services/pipes/department-to-string.pipe.js +2 -2
- package/esm2015/src/app/core/services/storage/entity-store.class.js +3 -3
- package/esm2015/src/app/shared/dates.js +9 -1
- package/esm2015/src/app/shared/form/field.component.js +2 -2
- package/esm2015/src/app/shared/functions.js +1 -1
- package/fesm2015/sumaris-net.ngx-components.js +41 -19
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/dates.d.ts +3 -1
- package/src/assets/i18n/en-US.json +26 -53
- package/src/assets/i18n/en.json +26 -53
- package/src/assets/i18n/fr.json +20 -51
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -2489,6 +2489,14 @@
|
|
|
2489
2489
|
DateUtils.max = function (date1, date2) {
|
|
2490
2490
|
return !date1 ? date2 : (!date2 || date1.isSameOrAfter(date2) ? date1 : date2);
|
|
2491
2491
|
};
|
|
2492
|
+
DateUtils.equals = function (date1, date2) {
|
|
2493
|
+
return DateUtils.isSame(date1, date2);
|
|
2494
|
+
};
|
|
2495
|
+
DateUtils.isSame = function (date1, date2, granularity) {
|
|
2496
|
+
var d1 = fromDateISOString(date1);
|
|
2497
|
+
var d2 = fromDateISOString(date2);
|
|
2498
|
+
return (!d1 && !d2) || d1.isSame(d2, granularity);
|
|
2499
|
+
};
|
|
2492
2500
|
return DateUtils;
|
|
2493
2501
|
}());
|
|
2494
2502
|
function toDateISOString(value) {
|
|
@@ -3714,7 +3722,7 @@
|
|
|
3714
3722
|
source = source.split('|');
|
|
3715
3723
|
}
|
|
3716
3724
|
// Skip if value is not an array
|
|
3717
|
-
if (!(source
|
|
3725
|
+
if (!Array.isArray(source) || control.length === 0) {
|
|
3718
3726
|
if (isNotEmptyArray(source))
|
|
3719
3727
|
console.warn("WARN: please resize the FormArray '" + path + "' to the same length of the input array");
|
|
3720
3728
|
return [];
|
|
@@ -8656,7 +8664,7 @@
|
|
|
8656
8664
|
};
|
|
8657
8665
|
AppFormField.prototype.computeValuesFromToken = function (token) {
|
|
8658
8666
|
var values = this.injector.get(token);
|
|
8659
|
-
return values
|
|
8667
|
+
return Array.isArray(values) ? values : [];
|
|
8660
8668
|
};
|
|
8661
8669
|
AppFormField.prototype.checkAndResolveFormControl = function () {
|
|
8662
8670
|
var _this = this;
|
|
@@ -9874,7 +9882,7 @@
|
|
|
9874
9882
|
}, {});
|
|
9875
9883
|
};
|
|
9876
9884
|
EntityUtils.getMapAsArray = function (source) {
|
|
9877
|
-
if (source
|
|
9885
|
+
if (Array.isArray(source))
|
|
9878
9886
|
return source;
|
|
9879
9887
|
return Object.getOwnPropertyNames(source || {})
|
|
9880
9888
|
.map(function (key) { return ({
|
|
@@ -12380,8 +12388,8 @@
|
|
|
12380
12388
|
])];
|
|
12381
12389
|
case 1:
|
|
12382
12390
|
res = _a.sent();
|
|
12383
|
-
values = res[0] && res[0]
|
|
12384
|
-
ids = res[1] && res[1]
|
|
12391
|
+
values = res[0] && Array.isArray(res[0]) ? res[0] : null;
|
|
12392
|
+
ids = res[1] && Array.isArray(res[1]) ? res[1] : null;
|
|
12385
12393
|
migration = false;
|
|
12386
12394
|
if (!this.isByIdMode) return [3 /*break*/, 5];
|
|
12387
12395
|
if (!isNotNil(ids)) return [3 /*break*/, 3];
|
|
@@ -13979,7 +13987,7 @@
|
|
|
13979
13987
|
.pipe(operators.catchError(function (error) { return _this.onApolloError(error, opts.error); }), operators.first()).toPromise()];
|
|
13980
13988
|
case 5:
|
|
13981
13989
|
res = _b.sent();
|
|
13982
|
-
if (res.errors
|
|
13990
|
+
if (Array.isArray(res.errors)) {
|
|
13983
13991
|
throw res.errors[0];
|
|
13984
13992
|
}
|
|
13985
13993
|
return [2 /*return*/, res.data];
|
|
@@ -14653,7 +14661,7 @@
|
|
|
14653
14661
|
if (!queries.length)
|
|
14654
14662
|
return;
|
|
14655
14663
|
queries.forEach(function (query) {
|
|
14656
|
-
if (opts.data
|
|
14664
|
+
if (Array.isArray(opts.data)) {
|
|
14657
14665
|
// Filter values, if a filter function exists
|
|
14658
14666
|
var data = query.insertFilterFn ? opts.data.filter(function (i) { return query.insertFilterFn(i); }) : opts.data;
|
|
14659
14667
|
if (isNotEmptyArray(data)) {
|
|
@@ -14691,7 +14699,7 @@
|
|
|
14691
14699
|
return;
|
|
14692
14700
|
console.debug("[base-data-service] Removing data from watching queries: ", queries);
|
|
14693
14701
|
return queries.map(function (query) {
|
|
14694
|
-
if (opts.ids
|
|
14702
|
+
if (Array.isArray(opts.ids)) {
|
|
14695
14703
|
return _this.graphql.removeFromCachedQueryByIds(cache, {
|
|
14696
14704
|
query: query.query,
|
|
14697
14705
|
variables: query.variables,
|
|
@@ -16089,7 +16097,7 @@
|
|
|
16089
16097
|
this.comments = source.comments;
|
|
16090
16098
|
this.creationDate = fromDateISOString(source.creationDate);
|
|
16091
16099
|
this.statusId = source.statusId;
|
|
16092
|
-
if (source.properties && source.properties
|
|
16100
|
+
if (source.properties && Array.isArray(source.properties)) {
|
|
16093
16101
|
this.properties = EntityUtils.getPropertyArrayAsObject(source.properties);
|
|
16094
16102
|
}
|
|
16095
16103
|
else {
|
|
@@ -21466,7 +21474,7 @@
|
|
|
21466
21474
|
AppPropertiesForm.decorators = [
|
|
21467
21475
|
{ type: i0.Component, args: [{
|
|
21468
21476
|
selector: 'app-properties-form',
|
|
21469
|
-
template: "\n<!-- Properties -->\n<form [formGroup]=\"form\" class=\"form-container\">\n <ion-grid *ngIf=\"!loading; else propertiesSkeleton\"\n formArrayName=\"properties\" class=\"ion-no-padding\" >\n <ion-row class=\"ion-no-padding\">\n <ion-col class=\"ion-no-padding ion-align-self-end\" size=\"12\">\n <span class=\"toolbar-spacer\"></span>\n\n <!-- Show more options -->\n <ion-button color=\"light\" *ngIf=\"formArray?.length === 0\"\n [title]=\"'SETTINGS.BTN_SHOW_MORE_HELP'|translate\"\n (click)=\"helper.add()\">\n <ion-label translate>COMMON.BTN_SHOW_MORE</ion-label>\n <mat-icon slot=\"end\">arrow_drop_down</mat-icon>\n </ion-button>\n </ion-col>\n </ion-row>\n\n <ng-container *ngFor=\"let fieldForm of fieldForms; let i=index\">\n <ion-row class=\"ion-no-padding\" [formGroupName]=\"i\">\n\n <!-- property key -->\n <ion-col size=\"6\" class=\"ion-no-padding\">\n <mat-form-field floatLabel=\"never\">\n <mat-select [formControl]=\"fieldForm.controls.key\"\n [placeholder]=\"'SETTINGS.PROPERTY_KEY'|translate\"\n (selectionChange)=\"updateDefinitionAt(i)\"\n [tabindex]=\"20+i*2\"\n required>\n\n <!-- When option's key not a well known option, add it as first select option -->\n <mat-option *ngIf=\"isUnknownField(fieldForm)\" [value]=\"fieldForm.controls.key.value\">\n {{fieldForm.controls.key.value}}\n </mat-option>\n\n <mat-option *ngFor=\"let item of definitions\" [value]=\"item.key\">{{ item.label | translate }}\n </mat-option>\n\n </mat-select>\n\n <mat-error *ngIf=\"fieldForm.controls.key.hasError('required') && !helper.isLast(i)\"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n </ion-col>\n\n <!-- property value -->\n <ion-col class=\"ion-no-padding\" padding-left >\n <app-form-field *ngIf=\"getDefinitionAt(i) else unknownValue; let definition; \"\n floatLabel=\"never\"\n [definition]=\"definition\"\n [formControl]=\"fieldForm.controls.value\"\n [placeholder]=\"'SETTINGS.PROPERTY_VALUE' | translate\"\n [required]=\"true\"\n [tabindex]=\"20+i*2 + 1\">\n </app-form-field>\n <ng-template #unknownValue>\n <mat-form-field floatLabel=\"never\">\n <input type=\"text\" matInput\n [placeholder]=\"'SETTINGS.PROPERTY_VALUE' | translate\"\n [formControl]=\"fieldForm.controls.value\"\n [required]=\"true\"\n [tabindex]=\"20+i*2 + 1\">\n </mat-form-field>\n </ng-template>\n </ion-col>\n\n <ion-col size=\"auto\" class=\"ion-no-padding\">\n <button type=\"button\" mat-icon-button color=\"light\"\n [disabled]=\"disabled\"\n [title]=\"'COMMON.BTN_DELETE'|translate\"\n (click)=\"removeAt(i)\">\n <mat-icon>close</mat-icon>\n </button>\n <button [hidden]=\"!helper.isLast(i)\"\n type=\"button\"\n mat-icon-button\n color=\"light\"\n [disabled]=\"disabled\"\n [title]=\"'
|
|
21477
|
+
template: "\n<!-- Properties -->\n<form [formGroup]=\"form\" class=\"form-container\">\n <ion-grid *ngIf=\"!loading; else propertiesSkeleton\"\n formArrayName=\"properties\" class=\"ion-no-padding\" >\n <ion-row class=\"ion-no-padding\">\n <ion-col class=\"ion-no-padding ion-align-self-end\" size=\"12\">\n <span class=\"toolbar-spacer\"></span>\n\n <!-- Show more options -->\n <ion-button color=\"light\" *ngIf=\"formArray?.length === 0\"\n [title]=\"'SETTINGS.BTN_SHOW_MORE_HELP'|translate\"\n (click)=\"helper.add()\">\n <ion-label translate>COMMON.BTN_SHOW_MORE</ion-label>\n <mat-icon slot=\"end\">arrow_drop_down</mat-icon>\n </ion-button>\n </ion-col>\n </ion-row>\n\n <ng-container *ngFor=\"let fieldForm of fieldForms; let i=index\">\n <ion-row class=\"ion-no-padding\" [formGroupName]=\"i\">\n\n <!-- property key -->\n <ion-col size=\"6\" class=\"ion-no-padding\">\n <mat-form-field floatLabel=\"never\">\n <mat-select [formControl]=\"fieldForm.controls.key\"\n [placeholder]=\"'SETTINGS.PROPERTY_KEY'|translate\"\n (selectionChange)=\"updateDefinitionAt(i)\"\n [tabindex]=\"20+i*2\"\n required>\n\n <!-- When option's key not a well known option, add it as first select option -->\n <mat-option *ngIf=\"isUnknownField(fieldForm)\" [value]=\"fieldForm.controls.key.value\">\n {{fieldForm.controls.key.value}}\n </mat-option>\n\n <mat-option *ngFor=\"let item of definitions\" [value]=\"item.key\">{{ item.label | translate }}\n </mat-option>\n\n </mat-select>\n\n <mat-error *ngIf=\"fieldForm.controls.key.hasError('required') && !helper.isLast(i)\"\n translate>ERROR.FIELD_REQUIRED\n </mat-error>\n </mat-form-field>\n </ion-col>\n\n <!-- property value -->\n <ion-col class=\"ion-no-padding\" padding-left >\n <app-form-field *ngIf=\"getDefinitionAt(i) else unknownValue; let definition; \"\n floatLabel=\"never\"\n [definition]=\"definition\"\n [formControl]=\"fieldForm.controls.value\"\n [placeholder]=\"'SETTINGS.PROPERTY_VALUE' | translate\"\n [required]=\"true\"\n [tabindex]=\"20+i*2 + 1\">\n </app-form-field>\n <ng-template #unknownValue>\n <mat-form-field floatLabel=\"never\">\n <input type=\"text\" matInput\n [placeholder]=\"'SETTINGS.PROPERTY_VALUE' | translate\"\n [formControl]=\"fieldForm.controls.value\"\n [required]=\"true\"\n [tabindex]=\"20+i*2 + 1\">\n </mat-form-field>\n </ng-template>\n </ion-col>\n\n <ion-col size=\"auto\" class=\"ion-no-padding\">\n <button type=\"button\" mat-icon-button color=\"light\"\n [disabled]=\"disabled\"\n [title]=\"'COMMON.BTN_DELETE'|translate\"\n (click)=\"removeAt(i)\">\n <mat-icon>close</mat-icon>\n </button>\n <button [hidden]=\"!helper.isLast(i)\"\n type=\"button\"\n mat-icon-button\n color=\"light\"\n [disabled]=\"disabled\"\n [title]=\"'SETTINGS.BTN_ADD_PROPERTY'|translate\"\n (click)=\"helper.add()\">\n <mat-icon>add</mat-icon>\n </button>\n </ion-col>\n </ion-row>\n </ng-container>\n </ion-grid>\n</form>\n\n<ng-template #propertiesSkeleton>\n\n <ion-grid class=\"ion-no-padding\">\n <ng-container *ngTemplateOutlet=\"propertyRowSkeleton\"></ng-container>\n <ng-container *ngTemplateOutlet=\"propertyRowSkeleton\"></ng-container>\n <ng-container *ngTemplateOutlet=\"propertyRowSkeleton\"></ng-container>\n </ion-grid>\n\n</ng-template>\n\n<ng-template #propertyRowSkeleton>\n\n <ion-row>\n <!-- property key -->\n <ion-col>\n <mat-form-field>\n <input matInput hidden>\n <ion-skeleton-text animated style=\"width: 60%\"></ion-skeleton-text>\n <ion-icon name=\"arrow-dropdown\" matSuffix></ion-icon>\n </mat-form-field>\n </ion-col>\n <!-- value -->\n <ion-col>\n <mat-form-field>\n <input matInput hidden>\n <ion-skeleton-text animated style=\"width: 60%\"></ion-skeleton-text>\n </mat-form-field>\n </ion-col>\n <!-- buttons -->\n <ion-col size=\"2\">\n <button type=\"button\" mat-icon-button color=\"light\"\n [disabled]=\"true\">\n <mat-icon>close</mat-icon>\n </button>\n </ion-col>\n </ion-row>\n\n</ng-template>\n",
|
|
21470
21478
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
21471
21479
|
},] }
|
|
21472
21480
|
];
|
|
@@ -21871,16 +21879,33 @@
|
|
|
21871
21879
|
AppInstallUpgradeCard.prototype.download = function (event, link) {
|
|
21872
21880
|
return __awaiter(this, void 0, void 0, function () {
|
|
21873
21881
|
return __generator(this, function (_a) {
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
|
|
21882
|
+
switch (_a.label) {
|
|
21883
|
+
case 0:
|
|
21884
|
+
if (!link || !link.url) {
|
|
21885
|
+
console.error('[install-upgrade-card] Missing required argument \'link.url\'');
|
|
21886
|
+
return [2 /*return*/]; // Skip
|
|
21887
|
+
}
|
|
21888
|
+
// Mark link as downloading
|
|
21889
|
+
link.downloading = true;
|
|
21890
|
+
this.markForCheck();
|
|
21891
|
+
_a.label = 1;
|
|
21892
|
+
case 1:
|
|
21893
|
+
_a.trys.push([1, , 3, 4]);
|
|
21894
|
+
return [4 /*yield*/, this.listenDownloadJob(link.url, this.platform.download({
|
|
21895
|
+
uri: link.url,
|
|
21896
|
+
title: link.title,
|
|
21897
|
+
filename: link.filename,
|
|
21898
|
+
mimeType: link.mimeType
|
|
21899
|
+
}))];
|
|
21900
|
+
case 2:
|
|
21901
|
+
_a.sent();
|
|
21902
|
+
return [3 /*break*/, 4];
|
|
21903
|
+
case 3:
|
|
21904
|
+
link.downloading = false;
|
|
21905
|
+
this.markForCheck();
|
|
21906
|
+
return [7 /*endfinally*/];
|
|
21907
|
+
case 4: return [2 /*return*/];
|
|
21877
21908
|
}
|
|
21878
|
-
return [2 /*return*/, this.listenDownloadJob(link.url, this.platform.download({
|
|
21879
|
-
uri: link.url,
|
|
21880
|
-
title: link.title,
|
|
21881
|
-
filename: link.filename,
|
|
21882
|
-
mimeType: link.mimeType
|
|
21883
|
-
}))];
|
|
21884
21909
|
});
|
|
21885
21910
|
});
|
|
21886
21911
|
};
|
|
@@ -22078,10 +22103,13 @@
|
|
|
22078
22103
|
_a.trys.push([1, 3, 4, 5]);
|
|
22079
22104
|
// Mark as downloading
|
|
22080
22105
|
if (!this.downloading) {
|
|
22081
|
-
console.info("[install-upgrade-card]
|
|
22106
|
+
console.info("[install-upgrade-card] Asking platform to download '" + url + "'...");
|
|
22082
22107
|
this.downloading = true;
|
|
22083
22108
|
this.markForCheck();
|
|
22084
22109
|
}
|
|
22110
|
+
else {
|
|
22111
|
+
console.info("[install-upgrade-card] Platform is already downloading!");
|
|
22112
|
+
}
|
|
22085
22113
|
return [4 /*yield*/, job.toPromise()];
|
|
22086
22114
|
case 2:
|
|
22087
22115
|
location = _a.sent();
|
|
@@ -22234,7 +22262,7 @@
|
|
|
22234
22262
|
function DepartmentToStringPipe() {
|
|
22235
22263
|
}
|
|
22236
22264
|
DepartmentToStringPipe.prototype.transform = function (value, separator) {
|
|
22237
|
-
if (value
|
|
22265
|
+
if (Array.isArray(value))
|
|
22238
22266
|
return departmentsToString(value, separator);
|
|
22239
22267
|
return departmentToString(value);
|
|
22240
22268
|
};
|
|
@@ -25826,10 +25854,12 @@
|
|
|
25826
25854
|
var _a;
|
|
25827
25855
|
if (this._loading) {
|
|
25828
25856
|
this._loading = false;
|
|
25829
|
-
if (!opts || opts.
|
|
25857
|
+
if (!opts || opts.onlySelf !== true) {
|
|
25830
25858
|
// Emit to children forms
|
|
25831
25859
|
// Tables should be changed by parent
|
|
25832
25860
|
(_a = this.forms) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsLoaded(opts); });
|
|
25861
|
+
}
|
|
25862
|
+
if (!opts || opts.emitEvent !== false) {
|
|
25833
25863
|
this.markForCheck();
|
|
25834
25864
|
}
|
|
25835
25865
|
}
|