@sumaris-net/ngx-components 1.3.11 → 1.4.3
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 +26 -29
- 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/shared/material/autocomplete/material.autocomplete.js +15 -9
- 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 +26 -28
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- 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
|
@@ -1266,7 +1266,6 @@
|
|
|
1266
1266
|
this.required = false;
|
|
1267
1267
|
this.clearable = false;
|
|
1268
1268
|
this.debounceTime = null;
|
|
1269
|
-
this.highlightAccent = false;
|
|
1270
1269
|
this.i18nPrefix = 'REFERENTIAL.';
|
|
1271
1270
|
this.noResultMessage = 'COMMON.NO_RESULT';
|
|
1272
1271
|
this.matAutocompletePosition = 'auto';
|
|
@@ -1401,9 +1400,10 @@
|
|
|
1401
1400
|
this.mobile = toBoolean(this.mobile, this.config.mobile);
|
|
1402
1401
|
this.suggestLengthThreshold = toNumber(this.suggestLengthThreshold, this.config.suggestLengthThreshold || 0);
|
|
1403
1402
|
this.showAllOnFocus = toBoolean(this.showAllOnFocus, toBoolean(this.config.showAllOnFocus, this.suggestLengthThreshold === 0));
|
|
1404
|
-
this.showPanelOnFocus = toBoolean(this.showPanelOnFocus, toBoolean(this.config.showPanelOnFocus
|
|
1403
|
+
this.showPanelOnFocus = toBoolean(this.showPanelOnFocus, toBoolean(this.config.showPanelOnFocus));
|
|
1405
1404
|
this.classList = this.classList || this.config.class;
|
|
1406
1405
|
this.debounceTime = toNumber(this.debounceTime, this.config.debounceTime);
|
|
1406
|
+
this.highlightAccent = toBoolean(this.highlightAccent, toBoolean(this.config.highlightAccent));
|
|
1407
1407
|
}
|
|
1408
1408
|
// Default values
|
|
1409
1409
|
this.displayAttributes = this.displayAttributes || ((_a = this.filter) === null || _a === void 0 ? void 0 : _a.attributes) || ['label', 'name'];
|
|
@@ -1431,7 +1431,9 @@
|
|
|
1431
1431
|
|| (classList.includes('min-width-large') && '400px')
|
|
1432
1432
|
|| (classList.includes('min-width-xlarge') && '450px')
|
|
1433
1433
|
|| (classList.includes('mat-autocomplete-panel-full-size') && '100vw')));
|
|
1434
|
+
this.showPanelOnFocus = toBoolean(this.showPanelOnFocus, true);
|
|
1434
1435
|
this.debounceTime = toNumber(this.debounceTime, 250);
|
|
1436
|
+
this.highlightAccent = toBoolean(this.highlightAccent, false);
|
|
1435
1437
|
this.suggestLengthThreshold = this.suggestLengthThreshold || 0;
|
|
1436
1438
|
// No suggestFn: filter on the given items
|
|
1437
1439
|
if (!this.suggestFn) {
|
|
@@ -1474,7 +1476,7 @@
|
|
|
1474
1476
|
this._reload$,
|
|
1475
1477
|
// Search text (no distinctUntilChanged() because of the debounceTime() pipe)
|
|
1476
1478
|
this.formControl.valueChanges
|
|
1477
|
-
.pipe(operators.filter(function (value) { return _this.searchable && isNotNilString(value); }),
|
|
1479
|
+
.pipe(operators.filter(function (value) { return _this.enabled && _this.searchable && isNotNilString(value); }),
|
|
1478
1480
|
// Mark as loading (to show loading spinner) - earlier as possible, so before the debounce time
|
|
1479
1481
|
operators.tap(function (value) {
|
|
1480
1482
|
if (_this.showLoadingSpinner) {
|
|
@@ -1484,7 +1486,9 @@
|
|
|
1484
1486
|
// Filter if not enough character
|
|
1485
1487
|
operators.filter(function (value) { return value.length >= _this.suggestLengthThreshold; }),
|
|
1486
1488
|
// Wait a debounce time
|
|
1487
|
-
operators.debounceTime(this.debounceTime)
|
|
1489
|
+
operators.debounceTime(this.debounceTime),
|
|
1490
|
+
// DEBUG
|
|
1491
|
+
operators.tap(function (value) { return console.debug(_this.logPrefix + ' Search text changes:', value); })),
|
|
1488
1492
|
// Object set: use it (no distinctUntilChanged() pipe need)
|
|
1489
1493
|
this.formControl.valueChanges
|
|
1490
1494
|
.pipe(operators.startWith(this.formControl.value), operators.filter(function (value) { return _this.searchable && (typeof value === 'object'); }), operators.tap(function (value) {
|
|
@@ -1499,7 +1503,9 @@
|
|
|
1499
1503
|
_this.matInputText.nativeElement.value = _this.displayValue;
|
|
1500
1504
|
}
|
|
1501
1505
|
}
|
|
1502
|
-
})
|
|
1506
|
+
}),
|
|
1507
|
+
// DEBUG
|
|
1508
|
+
operators.tap(function (value) { return console.debug(_this.logPrefix + ' Received an object value: ', value); })),
|
|
1503
1509
|
// Merge some observables, with a common distinctUntilChanged() pipe, and NO debounceTime
|
|
1504
1510
|
rxjs.merge(
|
|
1505
1511
|
// Focus or click => Load all
|
|
@@ -1513,10 +1519,10 @@
|
|
|
1513
1519
|
// If value is a string (and is not = '*'), filter if not enough character
|
|
1514
1520
|
operators.filter(function (value) { return value === '*' || !(typeof value === 'string') || value.length >= _this.suggestLengthThreshold; }),
|
|
1515
1521
|
// Distinguish changes
|
|
1516
|
-
operators.distinctUntilChanged()
|
|
1517
|
-
.pipe(
|
|
1522
|
+
operators.distinctUntilChanged(),
|
|
1518
1523
|
// DEBUG
|
|
1519
|
-
|
|
1524
|
+
operators.tap(function (value) { return console.debug(_this.logPrefix + ' Received update event: ', value); })))
|
|
1525
|
+
.pipe(
|
|
1520
1526
|
// Suggest values
|
|
1521
1527
|
operators.mergeMap(function (value) { return _this.suggest(value, _this.filter); }),
|
|
1522
1528
|
// DEBUG
|
|
@@ -3792,7 +3798,7 @@
|
|
|
3792
3798
|
Object.keys(control.errors).forEach(function (error) { return console.warn(logPrefix + " -> " + (path || '') + " (" + error + ")"); });
|
|
3793
3799
|
}
|
|
3794
3800
|
if (control.controls) {
|
|
3795
|
-
Object.keys(control.controls).forEach(function (child) { return logFormErrors(control.controls[child], logPrefix, (path ? path + "
|
|
3801
|
+
Object.keys(control.controls).forEach(function (child) { return logFormErrors(control.controls[child], logPrefix, (path ? path + "." + child : child)); } // Recursive call
|
|
3796
3802
|
);
|
|
3797
3803
|
}
|
|
3798
3804
|
}
|
|
@@ -3802,7 +3808,7 @@
|
|
|
3802
3808
|
Object.keys(control.errors).forEach(function (error) { return console.warn(logPrefix + " -> " + (path || '') + " (" + error + ")"); });
|
|
3803
3809
|
}
|
|
3804
3810
|
control.controls.forEach(function (child, index) {
|
|
3805
|
-
logFormErrors(child, logPrefix, (path ? path + "
|
|
3811
|
+
logFormErrors(child, logPrefix, (path ? path + "." + index : "" + index)); // Recursive call
|
|
3806
3812
|
});
|
|
3807
3813
|
}
|
|
3808
3814
|
// Other control's errors
|
|
@@ -3840,7 +3846,7 @@
|
|
|
3840
3846
|
// Form array
|
|
3841
3847
|
else if (control instanceof i1.FormArray) {
|
|
3842
3848
|
control.controls.forEach(function (child, index) {
|
|
3843
|
-
getFormErrors(child, Object.assign(Object.assign({}, opts), { controlName: (opts.controlName || '') + '
|
|
3849
|
+
getFormErrors(child, Object.assign(Object.assign({}, opts), { controlName: (opts.controlName || '') + '.' + index, result: opts.result // Make sure to keep the same result object
|
|
3844
3850
|
}));
|
|
3845
3851
|
});
|
|
3846
3852
|
}
|
|
@@ -5310,6 +5316,7 @@
|
|
|
5310
5316
|
this.compact = false;
|
|
5311
5317
|
this.placeholderChar = DEFAULT_PLACEHOLDER_CHAR;
|
|
5312
5318
|
this.autofocus = false;
|
|
5319
|
+
this.startDate = null;
|
|
5313
5320
|
this.clearable = false;
|
|
5314
5321
|
this.locale = (translate.currentLang || translate.defaultLang).substr(0, 2);
|
|
5315
5322
|
}
|
|
@@ -5677,19 +5684,19 @@
|
|
|
5677
5684
|
{ type: i1.FormGroupDirective, decorators: [{ type: i0.Optional }] }
|
|
5678
5685
|
]; };
|
|
5679
5686
|
MatDateTime.propDecorators = {
|
|
5680
|
-
mobile: [{ type: i0.Input }],
|
|
5681
5687
|
formControl: [{ type: i0.Input }],
|
|
5682
5688
|
formControlName: [{ type: i0.Input }],
|
|
5683
5689
|
placeholder: [{ type: i0.Input }],
|
|
5684
5690
|
floatLabel: [{ type: i0.Input }],
|
|
5685
5691
|
required: [{ type: i0.Input }],
|
|
5692
|
+
mobile: [{ type: i0.Input }],
|
|
5686
5693
|
compact: [{ type: i0.Input }],
|
|
5687
5694
|
placeholderChar: [{ type: i0.Input }],
|
|
5688
5695
|
autofocus: [{ type: i0.Input }],
|
|
5689
|
-
readonly: [{ type: i0.Input }],
|
|
5690
|
-
tabindex: [{ type: i0.Input }],
|
|
5691
5696
|
startDate: [{ type: i0.Input }],
|
|
5692
5697
|
clearable: [{ type: i0.Input }],
|
|
5698
|
+
readonly: [{ type: i0.Input }],
|
|
5699
|
+
tabindex: [{ type: i0.Input }],
|
|
5693
5700
|
datePicker: [{ type: i0.ViewChild, args: ['datePicker',] }],
|
|
5694
5701
|
timePicker: [{ type: i0.ViewChild, args: ['timePicker',] }],
|
|
5695
5702
|
matInputs: [{ type: i0.ViewChildren, args: ['matInput',] }]
|
|
@@ -6409,17 +6416,6 @@
|
|
|
6409
6416
|
this.showRadio = this.showRadio || this.floatLabel === 'always';
|
|
6410
6417
|
this.updateTabIndex();
|
|
6411
6418
|
};
|
|
6412
|
-
MatBooleanField.prototype.ngAfterViewInit = function () {
|
|
6413
|
-
var _this = this;
|
|
6414
|
-
// Inject suffix elements, into the first injection point found
|
|
6415
|
-
if (this.suffixDiv) {
|
|
6416
|
-
this.suffixInjections.find(function (item) {
|
|
6417
|
-
item.nativeElement.append(_this.suffixDiv.nativeElement);
|
|
6418
|
-
_this.suffixDiv.nativeElement.classList.remove('cdk-visually-hidden');
|
|
6419
|
-
return true; // take only the first injection point
|
|
6420
|
-
});
|
|
6421
|
-
}
|
|
6422
|
-
};
|
|
6423
6419
|
MatBooleanField.prototype.writeValue = function (value, event) {
|
|
6424
6420
|
var _this = this;
|
|
6425
6421
|
if (this._writing)
|
|
@@ -6538,7 +6534,7 @@
|
|
|
6538
6534
|
MatBooleanField.decorators = [
|
|
6539
6535
|
{ type: i0.Component, args: [{
|
|
6540
6536
|
selector: 'mat-boolean-field',
|
|
6541
|
-
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 <
|
|
6537
|
+
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",
|
|
6542
6538
|
providers: [
|
|
6543
6539
|
DEFAULT_VALUE_ACCESSOR$1
|
|
6544
6540
|
],
|
|
@@ -6577,8 +6573,7 @@
|
|
|
6577
6573
|
noButton: [{ type: i0.ViewChild, args: ['noButton',] }],
|
|
6578
6574
|
checkboxButton: [{ type: i0.ViewChild, args: ['checkboxButton',] }],
|
|
6579
6575
|
fakeInput: [{ type: i0.ViewChild, args: ['fakeInput',] }],
|
|
6580
|
-
suffixDiv: [{ type: i0.ViewChild, args: ['suffix', { static: false },] }]
|
|
6581
|
-
suffixInjections: [{ type: i0.ViewChildren, args: ['injectMatSuffix',] }]
|
|
6576
|
+
suffixDiv: [{ type: i0.ViewChild, args: ['suffix', { static: false },] }]
|
|
6582
6577
|
};
|
|
6583
6578
|
|
|
6584
6579
|
var SharedMatBooleanModule = /** @class */ (function () {
|
|
@@ -8343,7 +8338,9 @@
|
|
|
8343
8338
|
return [3 /*break*/, 7];
|
|
8344
8339
|
case 4:
|
|
8345
8340
|
if (!this._defaultBackHref) return [3 /*break*/, 6];
|
|
8346
|
-
return [4 /*yield*/, this.router.navigateByUrl(this._defaultBackHref
|
|
8341
|
+
return [4 /*yield*/, this.router.navigateByUrl(this._defaultBackHref, {
|
|
8342
|
+
replaceUrl: true
|
|
8343
|
+
})];
|
|
8347
8344
|
case 5:
|
|
8348
8345
|
_a.sent();
|
|
8349
8346
|
return [3 /*break*/, 7];
|