@sumaris-net/ngx-components 1.3.8 → 1.4.0
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 +30 -11
- 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 +2 -2
- package/esm2015/src/app/core/services/base-entity-service.class.js +2 -2
- package/esm2015/src/app/core/table/table.class.js +3 -2
- package/esm2015/src/app/shared/functions.js +15 -5
- package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +11 -5
- package/fesm2015/sumaris-net.ngx-components.js +27 -11
- 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/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) {
|
|
@@ -1488,7 +1502,7 @@
|
|
|
1488
1502
|
}
|
|
1489
1503
|
}
|
|
1490
1504
|
})),
|
|
1491
|
-
// Merge some observables, with a common distinctUntilChanged() pipe
|
|
1505
|
+
// Merge some observables, with a common distinctUntilChanged() pipe, and NO debounceTime
|
|
1492
1506
|
rxjs.merge(
|
|
1493
1507
|
// Focus or click => Load all
|
|
1494
1508
|
rxjs.merge(this.onFocus, this.onClick)
|
|
@@ -1497,7 +1511,11 @@
|
|
|
1497
1511
|
this.onDropButtonClick
|
|
1498
1512
|
.pipe(operators.filter(function (event) { return _this.searchable && (!event || !event.defaultPrevented) && _this.formControl.enabled; }), operators.map(function (_) { return _this.showAllOnFocus ? '*' : _this.formControl.value; })), rxjs.merge(this.$inputItems, this._filter$)
|
|
1499
1513
|
.pipe(operators.map(function (_) { return _this.searchable && _this.formControl.value; })))
|
|
1500
|
-
.pipe(
|
|
1514
|
+
.pipe(
|
|
1515
|
+
// If value is a string (and is not = '*'), filter if not enough character
|
|
1516
|
+
operators.filter(function (value) { return value === '*' || !(typeof value === 'string') || value.length >= _this.suggestLengthThreshold; }),
|
|
1517
|
+
// Distinguish changes
|
|
1518
|
+
operators.distinctUntilChanged()))
|
|
1501
1519
|
.pipe(
|
|
1502
1520
|
// DEBUG
|
|
1503
1521
|
//tap(value => console.debug(this.logPrefix + ' Received update event: ', value)),
|
|
@@ -3824,7 +3842,7 @@
|
|
|
3824
3842
|
// Form array
|
|
3825
3843
|
else if (control instanceof i1.FormArray) {
|
|
3826
3844
|
control.controls.forEach(function (child, index) {
|
|
3827
|
-
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
|
|
3828
3846
|
}));
|
|
3829
3847
|
});
|
|
3830
3848
|
}
|
|
@@ -23166,7 +23184,7 @@
|
|
|
23166
23184
|
};
|
|
23167
23185
|
// Add fetch more capability, if total was fetched
|
|
23168
23186
|
if (withTotal) {
|
|
23169
|
-
nextOffset_1 = offset + entities.length;
|
|
23187
|
+
nextOffset_1 = (offset || 0) + entities.length;
|
|
23170
23188
|
if (nextOffset_1 < res.total) {
|
|
23171
23189
|
res.fetchMore = function () { return _this.loadAll(nextOffset_1, size, sortBy, sortDirection, filter, opts); };
|
|
23172
23190
|
}
|
|
@@ -24926,7 +24944,8 @@
|
|
|
24926
24944
|
}
|
|
24927
24945
|
this.markAsLoading();
|
|
24928
24946
|
this.openRow(row.currentData.id, row)
|
|
24929
|
-
.then(function () { return _this.markAsLoaded(); })
|
|
24947
|
+
.then(function () { return _this.markAsLoaded(); })
|
|
24948
|
+
.catch(function () { return _this.markAsLoaded(); });
|
|
24930
24949
|
return true;
|
|
24931
24950
|
}
|
|
24932
24951
|
// Start editing row
|