@sumaris-net/ngx-components 1.4.1 → 1.4.6
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 -33
- 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/services/local-settings.service.js +6 -4
- package/esm2015/src/app/core/services/storage/entities-storage.service.js +4 -1
- package/esm2015/src/app/core/table/table.class.js +1 -1
- package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +20 -14
- 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/fesm2015/sumaris-net.ngx-components.js +33 -32
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/table.class.d.ts +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
|
@@ -1368,14 +1368,14 @@
|
|
|
1368
1368
|
});
|
|
1369
1369
|
Object.defineProperty(MatAutocompleteField.prototype, "disabled", {
|
|
1370
1370
|
get: function () {
|
|
1371
|
-
return this.
|
|
1371
|
+
return this._readonly || this.formControl.disabled;
|
|
1372
1372
|
},
|
|
1373
1373
|
enumerable: false,
|
|
1374
1374
|
configurable: true
|
|
1375
1375
|
});
|
|
1376
1376
|
Object.defineProperty(MatAutocompleteField.prototype, "enabled", {
|
|
1377
1377
|
get: function () {
|
|
1378
|
-
return !this.
|
|
1378
|
+
return !this._readonly && this.formControl.enabled;
|
|
1379
1379
|
},
|
|
1380
1380
|
enumerable: false,
|
|
1381
1381
|
configurable: true
|
|
@@ -1476,7 +1476,7 @@
|
|
|
1476
1476
|
this._reload$,
|
|
1477
1477
|
// Search text (no distinctUntilChanged() because of the debounceTime() pipe)
|
|
1478
1478
|
this.formControl.valueChanges
|
|
1479
|
-
.pipe(operators.filter(function (value) { return _this.searchable && isNotNilString(value); }),
|
|
1479
|
+
.pipe(operators.filter(function (value) { return _this.enabled && _this.searchable && isNotNilString(value); }),
|
|
1480
1480
|
// Mark as loading (to show loading spinner) - earlier as possible, so before the debounce time
|
|
1481
1481
|
operators.tap(function (value) {
|
|
1482
1482
|
if (_this.showLoadingSpinner) {
|
|
@@ -1486,10 +1486,13 @@
|
|
|
1486
1486
|
// Filter if not enough character
|
|
1487
1487
|
operators.filter(function (value) { return value.length >= _this.suggestLengthThreshold; }),
|
|
1488
1488
|
// Wait a debounce time
|
|
1489
|
-
operators.debounceTime(this.debounceTime)
|
|
1489
|
+
operators.debounceTime(this.debounceTime)
|
|
1490
|
+
// DEBUG
|
|
1491
|
+
//tap((value) => console.debug(this.logPrefix + ' Search text changes:', value)),
|
|
1492
|
+
),
|
|
1490
1493
|
// Object set: use it (no distinctUntilChanged() pipe need)
|
|
1491
1494
|
this.formControl.valueChanges
|
|
1492
|
-
.pipe(operators.startWith(this.formControl.value), operators.filter(function (value) { return _this.searchable && (typeof value === 'object'); }), operators.tap(function (value) {
|
|
1495
|
+
.pipe(operators.startWith(this.formControl.value), operators.filter(function (value) { return (_this.searchable && isNotNil(value) && typeof value === 'object'); }), operators.tap(function (value) {
|
|
1493
1496
|
// DEBUG
|
|
1494
1497
|
//console.debug(this.logPrefix + ' object changes:', value)
|
|
1495
1498
|
// Update the display value (if need)
|
|
@@ -1501,24 +1504,25 @@
|
|
|
1501
1504
|
_this.matInputText.nativeElement.value = _this.displayValue;
|
|
1502
1505
|
}
|
|
1503
1506
|
}
|
|
1504
|
-
})
|
|
1507
|
+
})
|
|
1508
|
+
// DEBUG
|
|
1509
|
+
//tap(value => console.debug(this.logPrefix + ' Received an object value: ', value))
|
|
1510
|
+
),
|
|
1505
1511
|
// Merge some observables, with a common distinctUntilChanged() pipe, and NO debounceTime
|
|
1506
1512
|
rxjs.merge(
|
|
1507
1513
|
// Focus or click => Load all
|
|
1508
1514
|
rxjs.merge(this.onFocus, this.onClick)
|
|
1509
|
-
.pipe(operators.filter(function (_) { return _this.
|
|
1515
|
+
.pipe(operators.filter(function (_) { return _this.enabled && _this.searchable; }), operators.map(function (_) { return _this.showAllOnFocus ? '*' : _this.formControl.value; })),
|
|
1510
1516
|
// On dropdown button click
|
|
1511
1517
|
this.onDropButtonClick
|
|
1512
|
-
.pipe(operators.filter(function (event) { return _this.searchable && (!event || !event.defaultPrevented)
|
|
1513
|
-
.pipe(operators.
|
|
1518
|
+
.pipe(operators.filter(function (event) { return _this.enabled && _this.searchable && (!event || !event.defaultPrevented); }), operators.map(function (_) { return _this.showAllOnFocus ? '*' : _this.formControl.value; })), rxjs.merge(this.$inputItems, this._filter$)
|
|
1519
|
+
.pipe(operators.filter(function (event) { return _this.enabled && _this.searchable; }), operators.map(function (_) { return _this.formControl.value; })))
|
|
1514
1520
|
.pipe(
|
|
1515
1521
|
// If value is a string (and is not = '*'), filter if not enough character
|
|
1516
1522
|
operators.filter(function (value) { return value === '*' || !(typeof value === 'string') || value.length >= _this.suggestLengthThreshold; }),
|
|
1517
1523
|
// Distinguish changes
|
|
1518
1524
|
operators.distinctUntilChanged()))
|
|
1519
1525
|
.pipe(
|
|
1520
|
-
// DEBUG
|
|
1521
|
-
//tap(value => console.debug(this.logPrefix + ' Received update event: ', value)),
|
|
1522
1526
|
// Suggest values
|
|
1523
1527
|
operators.mergeMap(function (value) { return _this.suggest(value, _this.filter); }),
|
|
1524
1528
|
// DEBUG
|
|
@@ -1577,7 +1581,9 @@
|
|
|
1577
1581
|
}));
|
|
1578
1582
|
// Listen form control status change
|
|
1579
1583
|
this._subscription.add(this.formControl.statusChanges
|
|
1580
|
-
.pipe(
|
|
1584
|
+
.pipe(
|
|
1585
|
+
//filter(() => this.enabled),
|
|
1586
|
+
operators.distinctUntilChanged())
|
|
1581
1587
|
// Update component state
|
|
1582
1588
|
.subscribe(function () { return _this.checkIfTouched(); }));
|
|
1583
1589
|
this._subscription.add(this.onKeydownEscape.subscribe(function (event) {
|
|
@@ -1679,7 +1685,7 @@
|
|
|
1679
1685
|
// If combo is empty, or if has content but should force to show panel on focus
|
|
1680
1686
|
if (!hasContent || (this.showPanelOnFocus && this.showAllOnFocus)) {
|
|
1681
1687
|
// DEBUG
|
|
1682
|
-
console.debug(this.logPrefix + ' Emit focus event');
|
|
1688
|
+
//console.debug(this.logPrefix + ' Emit focus event');
|
|
1683
1689
|
this.onFocus.emit(event);
|
|
1684
1690
|
return true;
|
|
1685
1691
|
}
|
|
@@ -5312,6 +5318,7 @@
|
|
|
5312
5318
|
this.compact = false;
|
|
5313
5319
|
this.placeholderChar = DEFAULT_PLACEHOLDER_CHAR;
|
|
5314
5320
|
this.autofocus = false;
|
|
5321
|
+
this.startDate = null;
|
|
5315
5322
|
this.clearable = false;
|
|
5316
5323
|
this.locale = (translate.currentLang || translate.defaultLang).substr(0, 2);
|
|
5317
5324
|
}
|
|
@@ -5679,19 +5686,19 @@
|
|
|
5679
5686
|
{ type: i1.FormGroupDirective, decorators: [{ type: i0.Optional }] }
|
|
5680
5687
|
]; };
|
|
5681
5688
|
MatDateTime.propDecorators = {
|
|
5682
|
-
mobile: [{ type: i0.Input }],
|
|
5683
5689
|
formControl: [{ type: i0.Input }],
|
|
5684
5690
|
formControlName: [{ type: i0.Input }],
|
|
5685
5691
|
placeholder: [{ type: i0.Input }],
|
|
5686
5692
|
floatLabel: [{ type: i0.Input }],
|
|
5687
5693
|
required: [{ type: i0.Input }],
|
|
5694
|
+
mobile: [{ type: i0.Input }],
|
|
5688
5695
|
compact: [{ type: i0.Input }],
|
|
5689
5696
|
placeholderChar: [{ type: i0.Input }],
|
|
5690
5697
|
autofocus: [{ type: i0.Input }],
|
|
5691
|
-
readonly: [{ type: i0.Input }],
|
|
5692
|
-
tabindex: [{ type: i0.Input }],
|
|
5693
5698
|
startDate: [{ type: i0.Input }],
|
|
5694
5699
|
clearable: [{ type: i0.Input }],
|
|
5700
|
+
readonly: [{ type: i0.Input }],
|
|
5701
|
+
tabindex: [{ type: i0.Input }],
|
|
5695
5702
|
datePicker: [{ type: i0.ViewChild, args: ['datePicker',] }],
|
|
5696
5703
|
timePicker: [{ type: i0.ViewChild, args: ['timePicker',] }],
|
|
5697
5704
|
matInputs: [{ type: i0.ViewChildren, args: ['matInput',] }]
|
|
@@ -6411,17 +6418,6 @@
|
|
|
6411
6418
|
this.showRadio = this.showRadio || this.floatLabel === 'always';
|
|
6412
6419
|
this.updateTabIndex();
|
|
6413
6420
|
};
|
|
6414
|
-
MatBooleanField.prototype.ngAfterViewInit = function () {
|
|
6415
|
-
var _this = this;
|
|
6416
|
-
// Inject suffix elements, into the first injection point found
|
|
6417
|
-
if (this.suffixDiv) {
|
|
6418
|
-
this.suffixInjections.find(function (item) {
|
|
6419
|
-
item.nativeElement.append(_this.suffixDiv.nativeElement);
|
|
6420
|
-
_this.suffixDiv.nativeElement.classList.remove('cdk-visually-hidden');
|
|
6421
|
-
return true; // take only the first injection point
|
|
6422
|
-
});
|
|
6423
|
-
}
|
|
6424
|
-
};
|
|
6425
6421
|
MatBooleanField.prototype.writeValue = function (value, event) {
|
|
6426
6422
|
var _this = this;
|
|
6427
6423
|
if (this._writing)
|
|
@@ -6540,7 +6536,7 @@
|
|
|
6540
6536
|
MatBooleanField.decorators = [
|
|
6541
6537
|
{ type: i0.Component, args: [{
|
|
6542
6538
|
selector: 'mat-boolean-field',
|
|
6543
|
-
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 <
|
|
6539
|
+
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",
|
|
6544
6540
|
providers: [
|
|
6545
6541
|
DEFAULT_VALUE_ACCESSOR$1
|
|
6546
6542
|
],
|
|
@@ -6579,8 +6575,7 @@
|
|
|
6579
6575
|
noButton: [{ type: i0.ViewChild, args: ['noButton',] }],
|
|
6580
6576
|
checkboxButton: [{ type: i0.ViewChild, args: ['checkboxButton',] }],
|
|
6581
6577
|
fakeInput: [{ type: i0.ViewChild, args: ['fakeInput',] }],
|
|
6582
|
-
suffixDiv: [{ type: i0.ViewChild, args: ['suffix', { static: false },] }]
|
|
6583
|
-
suffixInjections: [{ type: i0.ViewChildren, args: ['injectMatSuffix',] }]
|
|
6578
|
+
suffixDiv: [{ type: i0.ViewChild, args: ['suffix', { static: false },] }]
|
|
6584
6579
|
};
|
|
6585
6580
|
|
|
6586
6581
|
var SharedMatBooleanModule = /** @class */ (function () {
|
|
@@ -10878,7 +10873,7 @@
|
|
|
10878
10873
|
});
|
|
10879
10874
|
};
|
|
10880
10875
|
LocalSettingsService.prototype.setProperty = function (keyOrDef, value) {
|
|
10881
|
-
if (!this._data)
|
|
10876
|
+
if (!this._data || !keyOrDef)
|
|
10882
10877
|
return;
|
|
10883
10878
|
if (typeof keyOrDef === 'object') {
|
|
10884
10879
|
this.setProperty(keyOrDef.key, value);
|
|
@@ -11001,8 +10996,9 @@
|
|
|
11001
10996
|
var feature = this._data.offlineFeatures.find(function (f) {
|
|
11002
10997
|
if (typeof f === 'string')
|
|
11003
10998
|
return f.toLowerCase().startsWith(featurePrefix);
|
|
11004
|
-
if (typeof f === 'object' && f.name)
|
|
10999
|
+
if (f && typeof f === 'object' && f.name)
|
|
11005
11000
|
return f.name === featureName;
|
|
11001
|
+
return false;
|
|
11006
11002
|
});
|
|
11007
11003
|
if (!feature)
|
|
11008
11004
|
return; // Not found
|
|
@@ -11033,8 +11029,9 @@
|
|
|
11033
11029
|
var existingIndex = this._data.offlineFeatures.findIndex(function (f) {
|
|
11034
11030
|
if (typeof f === 'string')
|
|
11035
11031
|
return f.toLowerCase().startsWith(featurePrefix);
|
|
11036
|
-
if (typeof f === 'object' && f.name)
|
|
11032
|
+
if (f && typeof f === 'object' && f.name)
|
|
11037
11033
|
return f.name === feature.name;
|
|
11034
|
+
return false;
|
|
11038
11035
|
});
|
|
11039
11036
|
if (existingIndex !== -1) {
|
|
11040
11037
|
this._data.offlineFeatures[existingIndex] = feature;
|
|
@@ -13230,6 +13227,9 @@
|
|
|
13230
13227
|
console.warn("[entities-storage] Persisting " + entityName + ": store not found!");
|
|
13231
13228
|
return;
|
|
13232
13229
|
}
|
|
13230
|
+
if (!entityStore.dirty)
|
|
13231
|
+
return;
|
|
13232
|
+
// Persist store
|
|
13233
13233
|
return entityStore.persist()
|
|
13234
13234
|
.then(function (count) {
|
|
13235
13235
|
// If no entity found, remove from the entity names array
|