@sumaris-net/ngx-components 1.3.10 → 1.4.2
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 +33 -28
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/form/form.utils.js +4 -4
- package/esm2015/src/app/core/services/base-entity-service.class.js +2 -2
- package/esm2015/src/app/shared/functions.js +15 -5
- package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +5 -3
- package/esm2015/src/app/shared/material/boolean/material.boolean.js +4 -15
- package/esm2015/src/app/shared/material/datetime/material.datetime.js +5 -4
- package/esm2015/src/app/shared/toolbar/toolbar.js +4 -2
- package/fesm2015/sumaris-net.ngx-components.js +30 -27
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/functions.d.ts +2 -2
- package/src/app/shared/material/autocomplete/material.autocomplete.d.ts +1 -0
- package/src/app/shared/material/boolean/material.boolean.d.ts +2 -4
- package/src/app/shared/material/datetime/material.datetime.d.ts +3 -3
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -511,9 +511,12 @@
|
|
|
511
511
|
return value.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
|
|
512
512
|
}
|
|
513
513
|
function removeDiacritics(text) {
|
|
514
|
-
return text.normalize('NFD')
|
|
514
|
+
return text.normalize('NFD')
|
|
515
|
+
//
|
|
516
|
+
.replace(/[\u0300-\u036f]/g, '');
|
|
515
517
|
}
|
|
516
518
|
function suggestFromArray(items, value, opts) {
|
|
519
|
+
var _this = this;
|
|
517
520
|
if (isNotNil(value) && typeof value === 'object')
|
|
518
521
|
return { data: [value] };
|
|
519
522
|
value = (typeof value === 'string' && value !== '*') && value.toUpperCase() || undefined;
|
|
@@ -543,19 +546,28 @@
|
|
|
543
546
|
target = target.slice();
|
|
544
547
|
target.sort(propertiesPathComparator(keys));
|
|
545
548
|
var total = items.length || 0;
|
|
549
|
+
var fetchMore;
|
|
546
550
|
// Truncate if need
|
|
547
551
|
if (opts) {
|
|
548
|
-
if (opts.offset > 0) {
|
|
552
|
+
if (isNil(opts.offset) && opts.offset > 0) {
|
|
549
553
|
items = items.slice(opts.offset);
|
|
550
554
|
}
|
|
551
|
-
if (isNotNil(opts.size)) {
|
|
555
|
+
if (isNotNil(opts.size) && items.length > opts.size) {
|
|
552
556
|
items = items.slice(0, opts.size);
|
|
553
557
|
}
|
|
554
558
|
}
|
|
555
|
-
|
|
559
|
+
var res = {
|
|
556
560
|
data: items,
|
|
557
561
|
total: total
|
|
558
562
|
};
|
|
563
|
+
// Add fetch more capability, if total was fetched
|
|
564
|
+
var nextOffset = (opts && opts.offset || 0) + items.length;
|
|
565
|
+
if (nextOffset < total) {
|
|
566
|
+
res.fetchMore = function (_) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
567
|
+
return [2 /*return*/, suggestFromArray(items, value, Object.assign({ offset: nextOffset }, opts))];
|
|
568
|
+
}); }); };
|
|
569
|
+
}
|
|
570
|
+
return res;
|
|
559
571
|
}
|
|
560
572
|
function suggestFromStringArray(values, value, options) {
|
|
561
573
|
value = (typeof value === 'string' && value !== '*') && value.toUpperCase() || undefined;
|
|
@@ -1254,7 +1266,6 @@
|
|
|
1254
1266
|
this.required = false;
|
|
1255
1267
|
this.clearable = false;
|
|
1256
1268
|
this.debounceTime = null;
|
|
1257
|
-
this.highlightAccent = false;
|
|
1258
1269
|
this.i18nPrefix = 'REFERENTIAL.';
|
|
1259
1270
|
this.noResultMessage = 'COMMON.NO_RESULT';
|
|
1260
1271
|
this.matAutocompletePosition = 'auto';
|
|
@@ -1389,9 +1400,10 @@
|
|
|
1389
1400
|
this.mobile = toBoolean(this.mobile, this.config.mobile);
|
|
1390
1401
|
this.suggestLengthThreshold = toNumber(this.suggestLengthThreshold, this.config.suggestLengthThreshold || 0);
|
|
1391
1402
|
this.showAllOnFocus = toBoolean(this.showAllOnFocus, toBoolean(this.config.showAllOnFocus, this.suggestLengthThreshold === 0));
|
|
1392
|
-
this.showPanelOnFocus = toBoolean(this.showPanelOnFocus, toBoolean(this.config.showPanelOnFocus
|
|
1403
|
+
this.showPanelOnFocus = toBoolean(this.showPanelOnFocus, toBoolean(this.config.showPanelOnFocus));
|
|
1393
1404
|
this.classList = this.classList || this.config.class;
|
|
1394
1405
|
this.debounceTime = toNumber(this.debounceTime, this.config.debounceTime);
|
|
1406
|
+
this.highlightAccent = toBoolean(this.highlightAccent, toBoolean(this.config.highlightAccent));
|
|
1395
1407
|
}
|
|
1396
1408
|
// Default values
|
|
1397
1409
|
this.displayAttributes = this.displayAttributes || ((_a = this.filter) === null || _a === void 0 ? void 0 : _a.attributes) || ['label', 'name'];
|
|
@@ -1419,7 +1431,9 @@
|
|
|
1419
1431
|
|| (classList.includes('min-width-large') && '400px')
|
|
1420
1432
|
|| (classList.includes('min-width-xlarge') && '450px')
|
|
1421
1433
|
|| (classList.includes('mat-autocomplete-panel-full-size') && '100vw')));
|
|
1434
|
+
this.showPanelOnFocus = toBoolean(this.showPanelOnFocus, true);
|
|
1422
1435
|
this.debounceTime = toNumber(this.debounceTime, 250);
|
|
1436
|
+
this.highlightAccent = toBoolean(this.highlightAccent, false);
|
|
1423
1437
|
this.suggestLengthThreshold = this.suggestLengthThreshold || 0;
|
|
1424
1438
|
// No suggestFn: filter on the given items
|
|
1425
1439
|
if (!this.suggestFn) {
|
|
@@ -3780,7 +3794,7 @@
|
|
|
3780
3794
|
Object.keys(control.errors).forEach(function (error) { return console.warn(logPrefix + " -> " + (path || '') + " (" + error + ")"); });
|
|
3781
3795
|
}
|
|
3782
3796
|
if (control.controls) {
|
|
3783
|
-
Object.keys(control.controls).forEach(function (child) { return logFormErrors(control.controls[child], logPrefix, (path ? path + "
|
|
3797
|
+
Object.keys(control.controls).forEach(function (child) { return logFormErrors(control.controls[child], logPrefix, (path ? path + "." + child : child)); } // Recursive call
|
|
3784
3798
|
);
|
|
3785
3799
|
}
|
|
3786
3800
|
}
|
|
@@ -3790,7 +3804,7 @@
|
|
|
3790
3804
|
Object.keys(control.errors).forEach(function (error) { return console.warn(logPrefix + " -> " + (path || '') + " (" + error + ")"); });
|
|
3791
3805
|
}
|
|
3792
3806
|
control.controls.forEach(function (child, index) {
|
|
3793
|
-
logFormErrors(child, logPrefix, (path ? path + "
|
|
3807
|
+
logFormErrors(child, logPrefix, (path ? path + "." + index : "" + index)); // Recursive call
|
|
3794
3808
|
});
|
|
3795
3809
|
}
|
|
3796
3810
|
// Other control's errors
|
|
@@ -3828,7 +3842,7 @@
|
|
|
3828
3842
|
// Form array
|
|
3829
3843
|
else if (control instanceof i1.FormArray) {
|
|
3830
3844
|
control.controls.forEach(function (child, index) {
|
|
3831
|
-
getFormErrors(child, Object.assign(Object.assign({}, opts), { controlName: (opts.controlName || '') + '
|
|
3845
|
+
getFormErrors(child, Object.assign(Object.assign({}, opts), { controlName: (opts.controlName || '') + '.' + index, result: opts.result // Make sure to keep the same result object
|
|
3832
3846
|
}));
|
|
3833
3847
|
});
|
|
3834
3848
|
}
|
|
@@ -5298,6 +5312,7 @@
|
|
|
5298
5312
|
this.compact = false;
|
|
5299
5313
|
this.placeholderChar = DEFAULT_PLACEHOLDER_CHAR;
|
|
5300
5314
|
this.autofocus = false;
|
|
5315
|
+
this.startDate = null;
|
|
5301
5316
|
this.clearable = false;
|
|
5302
5317
|
this.locale = (translate.currentLang || translate.defaultLang).substr(0, 2);
|
|
5303
5318
|
}
|
|
@@ -5665,19 +5680,19 @@
|
|
|
5665
5680
|
{ type: i1.FormGroupDirective, decorators: [{ type: i0.Optional }] }
|
|
5666
5681
|
]; };
|
|
5667
5682
|
MatDateTime.propDecorators = {
|
|
5668
|
-
mobile: [{ type: i0.Input }],
|
|
5669
5683
|
formControl: [{ type: i0.Input }],
|
|
5670
5684
|
formControlName: [{ type: i0.Input }],
|
|
5671
5685
|
placeholder: [{ type: i0.Input }],
|
|
5672
5686
|
floatLabel: [{ type: i0.Input }],
|
|
5673
5687
|
required: [{ type: i0.Input }],
|
|
5688
|
+
mobile: [{ type: i0.Input }],
|
|
5674
5689
|
compact: [{ type: i0.Input }],
|
|
5675
5690
|
placeholderChar: [{ type: i0.Input }],
|
|
5676
5691
|
autofocus: [{ type: i0.Input }],
|
|
5677
|
-
readonly: [{ type: i0.Input }],
|
|
5678
|
-
tabindex: [{ type: i0.Input }],
|
|
5679
5692
|
startDate: [{ type: i0.Input }],
|
|
5680
5693
|
clearable: [{ type: i0.Input }],
|
|
5694
|
+
readonly: [{ type: i0.Input }],
|
|
5695
|
+
tabindex: [{ type: i0.Input }],
|
|
5681
5696
|
datePicker: [{ type: i0.ViewChild, args: ['datePicker',] }],
|
|
5682
5697
|
timePicker: [{ type: i0.ViewChild, args: ['timePicker',] }],
|
|
5683
5698
|
matInputs: [{ type: i0.ViewChildren, args: ['matInput',] }]
|
|
@@ -6397,17 +6412,6 @@
|
|
|
6397
6412
|
this.showRadio = this.showRadio || this.floatLabel === 'always';
|
|
6398
6413
|
this.updateTabIndex();
|
|
6399
6414
|
};
|
|
6400
|
-
MatBooleanField.prototype.ngAfterViewInit = function () {
|
|
6401
|
-
var _this = this;
|
|
6402
|
-
// Inject suffix elements, into the first injection point found
|
|
6403
|
-
if (this.suffixDiv) {
|
|
6404
|
-
this.suffixInjections.find(function (item) {
|
|
6405
|
-
item.nativeElement.append(_this.suffixDiv.nativeElement);
|
|
6406
|
-
_this.suffixDiv.nativeElement.classList.remove('cdk-visually-hidden');
|
|
6407
|
-
return true; // take only the first injection point
|
|
6408
|
-
});
|
|
6409
|
-
}
|
|
6410
|
-
};
|
|
6411
6415
|
MatBooleanField.prototype.writeValue = function (value, event) {
|
|
6412
6416
|
var _this = this;
|
|
6413
6417
|
if (this._writing)
|
|
@@ -6526,7 +6530,7 @@
|
|
|
6526
6530
|
MatBooleanField.decorators = [
|
|
6527
6531
|
{ type: i0.Component, args: [{
|
|
6528
6532
|
selector: 'mat-boolean-field',
|
|
6529
|
-
template: "<mat-form-field *ngIf=\"readonly; else writable\"\n [floatLabel]=\"floatLabel\"\n class=\"mat-form-field-disabled {{classList}}\">\n <input matInput hidden type=\"text\" readonly\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\">\n <ion-text>{{(formControl.value == null && 'COMMON.EMPTY_OPTION' || (formControl.value === true && yesLabel) || noLabel) | translate }}</ion-text>\n</mat-form-field>\n\n<ng-template #writable>\n <ng-container [ngSwitch]=\"style\">\n\n <!-- Radio -->\n <mat-form-field *ngSwitchCase=\"'radio'\"\n [floatLabel]=\"showRadio && (!floatLabel || floatLabel === 'auto') ? 'always': floatLabel\"\n class=\"mat-boolean-field mat-boolean-field-radio {{classList}}\">\n <mat-label *ngIf=\"placeholder && floatLabel!=='never'\">\n {{placeholder}}\n <span [hidden]=\"showRadio\">({{yesLabel|translate}}/{{'COMMON.NO'|translate}})</span>\n </mat-label>\n\n <input matInput #fakeInput type=\"text\" readonly=\"true\"\n [formControl]=\"formControl\"\n (focus)=\"_onFocusFakeInput($event)\"\n [required]=\"required\"\n [class.cdk-visually-hidden]=\"showRadio\"\n [tabindex]=\"tabindex\">\n\n <!-- radio button -->\n <mat-radio-group [hidden]=\"!showRadio\"\n [formControl]=\"formControl\"\n (change)=\"onRadioValueChanged($event)\">\n <mat-radio-button #yesButton [value]=\"true\">\n <span>{{yesLabel|translate}}</span>\n </mat-radio-button> \n <mat-radio-button #noButton [value]=\"false\">\n <span>{{noLabel|translate}}</span>\n </mat-radio-button>\n </mat-radio-group>\n\n <
|
|
6533
|
+
template: "<mat-form-field *ngIf=\"readonly; else writable\"\n [floatLabel]=\"floatLabel\"\n class=\"mat-form-field-disabled {{classList}}\">\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n <input matInput hidden type=\"text\" readonly\n [placeholder]=\"placeholder\"\n [formControl]=\"formControl\">\n <ion-text>{{(formControl.value == null && 'COMMON.EMPTY_OPTION' || (formControl.value === true && yesLabel) || noLabel) | translate }}</ion-text>\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n</mat-form-field>\n\n<ng-template #writable>\n <ng-container [ngSwitch]=\"style\">\n\n <!-- Radio -->\n <mat-form-field *ngSwitchCase=\"'radio'\"\n [floatLabel]=\"showRadio && (!floatLabel || floatLabel === 'auto') ? 'always': floatLabel\"\n class=\"mat-boolean-field mat-boolean-field-radio {{classList}}\">\n <mat-label *ngIf=\"placeholder && floatLabel!=='never'\">\n {{placeholder}}\n <span [hidden]=\"showRadio\">({{yesLabel|translate}}/{{'COMMON.NO'|translate}})</span>\n </mat-label>\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n <input matInput #fakeInput type=\"text\" readonly=\"true\"\n [formControl]=\"formControl\"\n (focus)=\"_onFocusFakeInput($event)\"\n [required]=\"required\"\n [class.cdk-visually-hidden]=\"showRadio\"\n [tabindex]=\"tabindex\">\n\n <!-- radio button -->\n <mat-radio-group [hidden]=\"!showRadio\"\n [formControl]=\"formControl\"\n (change)=\"onRadioValueChanged($event)\">\n <mat-radio-button #yesButton [value]=\"true\">\n <span>{{yesLabel|translate}}</span>\n </mat-radio-button> \n <mat-radio-button #noButton [value]=\"false\">\n <span>{{noLabel|translate}}</span>\n </mat-radio-button>\n </mat-radio-group>\n\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n </mat-form-field>\n\n <!-- Checkbox -->\n <mat-form-field *ngSwitchCase=\"'checkbox'\"\n [floatLabel]=\"floatLabel\"\n class=\"mat-boolean-field mat-boolean-field-checkbox {{classList}}\">\n <mat-label *ngIf=\"placeholder && !showRadio\">\n {{placeholder}}\n </mat-label>\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n <input matInput #matInput\n [formControl]=\"formControl\"\n (focus)=\"_onFocusFakeInput($event)\"\n [required]=\"required\"\n [class.cdk-visually-hidden]=\"showRadio\"\n [tabindex]=\"tabindex\">\n\n <ion-label> </ion-label>\n\n <!-- checkbox, when compact -->\n <mat-checkbox #checkboxButton\n [formControl]=\"formControl\"\n (change)=\"onCheckboxValueChanged($event)\"\n [indeterminate]=\"value===undefined\"\n [hidden]=\"!showRadio\"\n [tabindex]=\"tabindex\">\n </mat-checkbox>\n\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n </mat-form-field>\n\n <!-- Buttons -->\n <mat-form-field *ngSwitchCase=\"'button'\"\n [floatLabel]=\"floatLabel === 'never' ? 'never' : 'always'\"\n class=\"mat-boolean-field mat-boolean-field-button {{classList}}\">\n <div matPrefix>\n <ng-container *ngTemplateOutlet=\"matPrefixTemplate\"></ng-container>\n </div>\n <input matInput type=\"text\" hidden\n [formControl]=\"formControl\"\n [placeholder]=\"placeholder\"\n [required]=\"required\">\n <div class=\"mat-form-field-buttons\"\n [style.--buttons-col-count]=\"buttonsColCount\"\n *ngIf=\"!formControl.disabled; else disabledLabel\">\n <!-- yes -->\n <ion-button class=\"mat-form-field-button\"\n [tabindex]=\"_tabindex\"\n (click)=\"writeValue(true, $event)\"\n (keyup.enter)=\"writeValue(true, $event)\"\n [color]=\"_value == null ? 'tertiary' : (_value === true) ? 'accent' : 'light'\">\n <ion-icon *ngIf=\"showButtonIcons && yesIcon; let icon\" slot=\"start\" [name]=\"icon\"></ion-icon>\n {{yesLabel|translate}}\n </ion-button>\n\n <!-- No button -->\n <ion-button class=\"mat-form-field-button\"\n [tabindex]=\"_tabindex !== undefined ? (_tabindex + 1) : undefined\"\n (click)=\"writeValue(false, $event)\"\n (keyup.enter)=\"writeValue(false, $event)\"\n [color]=\"_value == null ? 'tertiary' : (_value === false) ? 'accent' : 'light'\">\n <ion-icon *ngIf=\"showButtonIcons && noIcon; let icon\" slot=\"start\" [name]=\"icon\"></ion-icon>\n {{noLabel|translate}}\n </ion-button>\n </div>\n <ng-template #disabledLabel>\n <ion-label><i translate>COMMON.EMPTY_OPTION</i></ion-label>\n </ng-template>\n\n <mat-error *ngIf=\"formControl.hasError('required')\" translate>ERROR.FIELD_REQUIRED</mat-error>\n <div matSuffix>\n <ng-container *ngTemplateOutlet=\"matSuffixTemplate\"></ng-container>\n </div>\n\n </mat-form-field>\n </ng-container>\n\n <div class=\"cdk-visually-hidden\">\n <div #suffix><ng-content select=\"[matSuffix]\"></ng-content></div>\n </div>\n\n</ng-template>\n\n\n<ng-template #matPrefixTemplate>\n <ng-content select=\"[matPrefix]\"></ng-content>\n</ng-template>\n<ng-template #matSuffixTemplate>\n <ng-content select=\"[matSuffix]\"></ng-content>\n</ng-template>\n",
|
|
6530
6534
|
providers: [
|
|
6531
6535
|
DEFAULT_VALUE_ACCESSOR$1
|
|
6532
6536
|
],
|
|
@@ -6565,8 +6569,7 @@
|
|
|
6565
6569
|
noButton: [{ type: i0.ViewChild, args: ['noButton',] }],
|
|
6566
6570
|
checkboxButton: [{ type: i0.ViewChild, args: ['checkboxButton',] }],
|
|
6567
6571
|
fakeInput: [{ type: i0.ViewChild, args: ['fakeInput',] }],
|
|
6568
|
-
suffixDiv: [{ type: i0.ViewChild, args: ['suffix', { static: false },] }]
|
|
6569
|
-
suffixInjections: [{ type: i0.ViewChildren, args: ['injectMatSuffix',] }]
|
|
6572
|
+
suffixDiv: [{ type: i0.ViewChild, args: ['suffix', { static: false },] }]
|
|
6570
6573
|
};
|
|
6571
6574
|
|
|
6572
6575
|
var SharedMatBooleanModule = /** @class */ (function () {
|
|
@@ -8331,7 +8334,9 @@
|
|
|
8331
8334
|
return [3 /*break*/, 7];
|
|
8332
8335
|
case 4:
|
|
8333
8336
|
if (!this._defaultBackHref) return [3 /*break*/, 6];
|
|
8334
|
-
return [4 /*yield*/, this.router.navigateByUrl(this._defaultBackHref
|
|
8337
|
+
return [4 /*yield*/, this.router.navigateByUrl(this._defaultBackHref, {
|
|
8338
|
+
replaceUrl: true
|
|
8339
|
+
})];
|
|
8335
8340
|
case 5:
|
|
8336
8341
|
_a.sent();
|
|
8337
8342
|
return [3 /*break*/, 7];
|
|
@@ -23170,7 +23175,7 @@
|
|
|
23170
23175
|
};
|
|
23171
23176
|
// Add fetch more capability, if total was fetched
|
|
23172
23177
|
if (withTotal) {
|
|
23173
|
-
nextOffset_1 = offset + entities.length;
|
|
23178
|
+
nextOffset_1 = (offset || 0) + entities.length;
|
|
23174
23179
|
if (nextOffset_1 < res.total) {
|
|
23175
23180
|
res.fetchMore = function () { return _this.loadAll(nextOffset_1, size, sortBy, sortDirection, filter, opts); };
|
|
23176
23181
|
}
|