@sumaris-net/ngx-components 1.3.7 → 1.3.11
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 +31 -15
- 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.class.js +7 -8
- 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 +7 -3
- package/fesm2015/sumaris-net.ngx-components.js +28 -15
- 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;
|
|
@@ -1488,7 +1500,7 @@
|
|
|
1488
1500
|
}
|
|
1489
1501
|
}
|
|
1490
1502
|
})),
|
|
1491
|
-
// Merge some observables, with a common distinctUntilChanged() pipe
|
|
1503
|
+
// Merge some observables, with a common distinctUntilChanged() pipe, and NO debounceTime
|
|
1492
1504
|
rxjs.merge(
|
|
1493
1505
|
// Focus or click => Load all
|
|
1494
1506
|
rxjs.merge(this.onFocus, this.onClick)
|
|
@@ -1497,7 +1509,11 @@
|
|
|
1497
1509
|
this.onDropButtonClick
|
|
1498
1510
|
.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
1511
|
.pipe(operators.map(function (_) { return _this.searchable && _this.formControl.value; })))
|
|
1500
|
-
.pipe(
|
|
1512
|
+
.pipe(
|
|
1513
|
+
// If value is a string (and is not = '*'), filter if not enough character
|
|
1514
|
+
operators.filter(function (value) { return value === '*' || !(typeof value === 'string') || value.length >= _this.suggestLengthThreshold; }),
|
|
1515
|
+
// Distinguish changes
|
|
1516
|
+
operators.distinctUntilChanged()))
|
|
1501
1517
|
.pipe(
|
|
1502
1518
|
// DEBUG
|
|
1503
1519
|
//tap(value => console.debug(this.logPrefix + ' Received update event: ', value)),
|
|
@@ -19484,14 +19500,13 @@
|
|
|
19484
19500
|
console.warn('[form] Trying to set an empty value to form. Skipping');
|
|
19485
19501
|
return;
|
|
19486
19502
|
}
|
|
19487
|
-
|
|
19488
|
-
|
|
19503
|
+
// DEBUG
|
|
19504
|
+
//if (this.debug) console.debug('[form] Updating form (using entity)', data);
|
|
19489
19505
|
// Convert object to json, then apply it to form (e.g. convert 'undefined' into 'null')
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
}*/
|
|
19506
|
+
AppFormUtils.copyEntity2Form(data, this.form, Object.assign({ emitEvent: false, onlySelf: true }, opts));
|
|
19507
|
+
if (!opts || opts.emitEvent !== true) {
|
|
19508
|
+
this.markForCheck();
|
|
19509
|
+
}
|
|
19495
19510
|
};
|
|
19496
19511
|
AppForm.prototype.reset = function (data, opts) {
|
|
19497
19512
|
if (data) {
|
|
@@ -23167,7 +23182,7 @@
|
|
|
23167
23182
|
};
|
|
23168
23183
|
// Add fetch more capability, if total was fetched
|
|
23169
23184
|
if (withTotal) {
|
|
23170
|
-
nextOffset_1 = offset + entities.length;
|
|
23185
|
+
nextOffset_1 = (offset || 0) + entities.length;
|
|
23171
23186
|
if (nextOffset_1 < res.total) {
|
|
23172
23187
|
res.fetchMore = function () { return _this.loadAll(nextOffset_1, size, sortBy, sortDirection, filter, opts); };
|
|
23173
23188
|
}
|
|
@@ -24927,7 +24942,8 @@
|
|
|
24927
24942
|
}
|
|
24928
24943
|
this.markAsLoading();
|
|
24929
24944
|
this.openRow(row.currentData.id, row)
|
|
24930
|
-
.then(function () { return _this.markAsLoaded(); })
|
|
24945
|
+
.then(function () { return _this.markAsLoaded(); })
|
|
24946
|
+
.catch(function () { return _this.markAsLoaded(); });
|
|
24931
24947
|
return true;
|
|
24932
24948
|
}
|
|
24933
24949
|
// Start editing row
|