@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
|
@@ -2120,6 +2120,14 @@ class DateUtils {
|
|
|
2120
2120
|
static max(date1, date2) {
|
|
2121
2121
|
return !date1 ? date2 : (!date2 || date1.isSameOrAfter(date2) ? date1 : date2);
|
|
2122
2122
|
}
|
|
2123
|
+
static equals(date1, date2) {
|
|
2124
|
+
return DateUtils.isSame(date1, date2);
|
|
2125
|
+
}
|
|
2126
|
+
static isSame(date1, date2, granularity) {
|
|
2127
|
+
const d1 = fromDateISOString(date1);
|
|
2128
|
+
const d2 = fromDateISOString(date2);
|
|
2129
|
+
return (!d1 && !d2) || d1.isSame(d2, granularity);
|
|
2130
|
+
}
|
|
2123
2131
|
}
|
|
2124
2132
|
function toDateISOString(value) {
|
|
2125
2133
|
if (!value)
|
|
@@ -3185,7 +3193,7 @@ function adaptValueToControl(source, control, path) {
|
|
|
3185
3193
|
source = source.split('|');
|
|
3186
3194
|
}
|
|
3187
3195
|
// Skip if value is not an array
|
|
3188
|
-
if (!(source
|
|
3196
|
+
if (!Array.isArray(source) || control.length === 0) {
|
|
3189
3197
|
if (isNotEmptyArray(source))
|
|
3190
3198
|
console.warn(`WARN: please resize the FormArray '${path}' to the same length of the input array`);
|
|
3191
3199
|
return [];
|
|
@@ -7715,7 +7723,7 @@ class AppFormField {
|
|
|
7715
7723
|
}
|
|
7716
7724
|
computeValuesFromToken(token) {
|
|
7717
7725
|
const values = this.injector.get(token);
|
|
7718
|
-
return values
|
|
7726
|
+
return Array.isArray(values) ? values : [];
|
|
7719
7727
|
}
|
|
7720
7728
|
checkAndResolveFormControl() {
|
|
7721
7729
|
if (this.formControl)
|
|
@@ -8755,7 +8763,7 @@ class EntityUtils {
|
|
|
8755
8763
|
}, {});
|
|
8756
8764
|
}
|
|
8757
8765
|
static getMapAsArray(source) {
|
|
8758
|
-
if (source
|
|
8766
|
+
if (Array.isArray(source))
|
|
8759
8767
|
return source;
|
|
8760
8768
|
return Object.getOwnPropertyNames(source || {})
|
|
8761
8769
|
.map(key => ({
|
|
@@ -10866,8 +10874,8 @@ class EntityStore {
|
|
|
10866
10874
|
this.storage.get(this._storageKey),
|
|
10867
10875
|
this.storage.get(this.storageKeyById)
|
|
10868
10876
|
]);
|
|
10869
|
-
const values = res[0] && res[0]
|
|
10870
|
-
const ids = res[1] && res[1]
|
|
10877
|
+
const values = res[0] && Array.isArray(res[0]) ? res[0] : null;
|
|
10878
|
+
const ids = res[1] && Array.isArray(res[1]) ? res[1] : null;
|
|
10871
10879
|
let migration = false;
|
|
10872
10880
|
let oldKeysToClean;
|
|
10873
10881
|
// "Split by id" mode
|
|
@@ -12148,7 +12156,7 @@ class GraphqlService extends StartableService {
|
|
|
12148
12156
|
update: opts.update
|
|
12149
12157
|
})
|
|
12150
12158
|
.pipe(catchError(error => this.onApolloError(error, opts.error)), first()).toPromise();
|
|
12151
|
-
if (res.errors
|
|
12159
|
+
if (Array.isArray(res.errors)) {
|
|
12152
12160
|
throw res.errors[0];
|
|
12153
12161
|
}
|
|
12154
12162
|
return res.data;
|
|
@@ -12776,7 +12784,7 @@ class BaseGraphqlService extends StartableService {
|
|
|
12776
12784
|
if (!queries.length)
|
|
12777
12785
|
return;
|
|
12778
12786
|
queries.forEach(query => {
|
|
12779
|
-
if (opts.data
|
|
12787
|
+
if (Array.isArray(opts.data)) {
|
|
12780
12788
|
// Filter values, if a filter function exists
|
|
12781
12789
|
const data = query.insertFilterFn ? opts.data.filter(i => query.insertFilterFn(i)) : opts.data;
|
|
12782
12790
|
if (isNotEmptyArray(data)) {
|
|
@@ -12813,7 +12821,7 @@ class BaseGraphqlService extends StartableService {
|
|
|
12813
12821
|
return;
|
|
12814
12822
|
console.debug(`[base-data-service] Removing data from watching queries: `, queries);
|
|
12815
12823
|
return queries.map(query => {
|
|
12816
|
-
if (opts.ids
|
|
12824
|
+
if (Array.isArray(opts.ids)) {
|
|
12817
12825
|
return this.graphql.removeFromCachedQueryByIds(cache, {
|
|
12818
12826
|
query: query.query,
|
|
12819
12827
|
variables: query.variables,
|
|
@@ -14005,7 +14013,7 @@ let Software = Software_1 = class Software extends Entity {
|
|
|
14005
14013
|
this.comments = source.comments;
|
|
14006
14014
|
this.creationDate = fromDateISOString(source.creationDate);
|
|
14007
14015
|
this.statusId = source.statusId;
|
|
14008
|
-
if (source.properties && source.properties
|
|
14016
|
+
if (source.properties && Array.isArray(source.properties)) {
|
|
14009
14017
|
this.properties = EntityUtils.getPropertyArrayAsObject(source.properties);
|
|
14010
14018
|
}
|
|
14011
14019
|
else {
|
|
@@ -18621,7 +18629,7 @@ class AppPropertiesForm extends AppForm {
|
|
|
18621
18629
|
AppPropertiesForm.decorators = [
|
|
18622
18630
|
{ type: Component, args: [{
|
|
18623
18631
|
selector: 'app-properties-form',
|
|
18624
|
-
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]=\"'
|
|
18632
|
+
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",
|
|
18625
18633
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
18626
18634
|
},] }
|
|
18627
18635
|
];
|
|
@@ -18955,12 +18963,21 @@ class AppInstallUpgradeCard {
|
|
|
18955
18963
|
console.error('[install-upgrade-card] Missing required argument \'link.url\'');
|
|
18956
18964
|
return; // Skip
|
|
18957
18965
|
}
|
|
18958
|
-
|
|
18959
|
-
|
|
18960
|
-
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
|
|
18966
|
+
// Mark link as downloading
|
|
18967
|
+
link.downloading = true;
|
|
18968
|
+
this.markForCheck();
|
|
18969
|
+
try {
|
|
18970
|
+
yield this.listenDownloadJob(link.url, this.platform.download({
|
|
18971
|
+
uri: link.url,
|
|
18972
|
+
title: link.title,
|
|
18973
|
+
filename: link.filename,
|
|
18974
|
+
mimeType: link.mimeType
|
|
18975
|
+
}));
|
|
18976
|
+
}
|
|
18977
|
+
finally {
|
|
18978
|
+
link.downloading = false;
|
|
18979
|
+
this.markForCheck();
|
|
18980
|
+
}
|
|
18964
18981
|
});
|
|
18965
18982
|
}
|
|
18966
18983
|
tryOnline() {
|
|
@@ -19129,10 +19146,13 @@ class AppInstallUpgradeCard {
|
|
|
19129
19146
|
try {
|
|
19130
19147
|
// Mark as downloading
|
|
19131
19148
|
if (!this.downloading) {
|
|
19132
|
-
console.info(`[install-upgrade-card]
|
|
19149
|
+
console.info(`[install-upgrade-card] Asking platform to download '${url}'...`);
|
|
19133
19150
|
this.downloading = true;
|
|
19134
19151
|
this.markForCheck();
|
|
19135
19152
|
}
|
|
19153
|
+
else {
|
|
19154
|
+
console.info(`[install-upgrade-card] Platform is already downloading!`);
|
|
19155
|
+
}
|
|
19136
19156
|
const location = yield job.toPromise();
|
|
19137
19157
|
if (location) {
|
|
19138
19158
|
console.info('[install-upgrade-card] File downloaded at: ' + location);
|
|
@@ -19249,7 +19269,7 @@ AccountToStringPipe.decorators = [
|
|
|
19249
19269
|
|
|
19250
19270
|
class DepartmentToStringPipe {
|
|
19251
19271
|
transform(value, separator) {
|
|
19252
|
-
if (value
|
|
19272
|
+
if (Array.isArray(value))
|
|
19253
19273
|
return departmentsToString(value, separator);
|
|
19254
19274
|
return departmentToString(value);
|
|
19255
19275
|
}
|
|
@@ -22255,10 +22275,12 @@ class AppEditor {
|
|
|
22255
22275
|
var _a;
|
|
22256
22276
|
if (this._loading) {
|
|
22257
22277
|
this._loading = false;
|
|
22258
|
-
if (!opts || opts.
|
|
22278
|
+
if (!opts || opts.onlySelf !== true) {
|
|
22259
22279
|
// Emit to children forms
|
|
22260
22280
|
// Tables should be changed by parent
|
|
22261
22281
|
(_a = this.forms) === null || _a === void 0 ? void 0 : _a.forEach(c => c.markAsLoaded(opts));
|
|
22282
|
+
}
|
|
22283
|
+
if (!opts || opts.emitEvent !== false) {
|
|
22262
22284
|
this.markForCheck();
|
|
22263
22285
|
}
|
|
22264
22286
|
}
|