@sumaris-net/ngx-components 18.3.20 → 18.3.21
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/doc/changelog.md +3 -0
- package/esm2022/src/app/core/table/table.class.mjs +17 -7
- package/esm2022/src/app/shared/directives/throttled-click.directive.mjs +5 -4
- package/fesm2022/sumaris-net.ngx-components.mjs +19 -8
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/table.class.d.ts +3 -1
- package/src/app/shared/directives/throttled-click.directive.d.ts +1 -0
- package/src/app/shared/inputs.d.ts +1 -1
- package/src/assets/manifest.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/core';
|
|
1
|
+
import { Directive, EventEmitter, HostListener, Input, numberAttribute, Output } from '@angular/core';
|
|
2
2
|
import { Subject } from 'rxjs';
|
|
3
3
|
import { throttleTime } from 'rxjs/operators';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
@@ -24,7 +24,7 @@ export class ThrottledClickDirective {
|
|
|
24
24
|
this.subscription?.unsubscribe();
|
|
25
25
|
}
|
|
26
26
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ThrottledClickDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
27
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
27
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.2.11", type: ThrottledClickDirective, selector: "[appPreventDoubleClick],[throttledClick]", inputs: { throttleTime: ["throttleTime", "throttleTime", numberAttribute] }, outputs: { throttledClick: "throttledClick" }, host: { listeners: { "click": "clickEvent($event)" } }, ngImport: i0 });
|
|
28
28
|
}
|
|
29
29
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ThrottledClickDirective, decorators: [{
|
|
30
30
|
type: Directive,
|
|
@@ -32,11 +32,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
|
|
|
32
32
|
selector: '[appPreventDoubleClick],[throttledClick]',
|
|
33
33
|
}]
|
|
34
34
|
}], ctorParameters: () => [], propDecorators: { throttleTime: [{
|
|
35
|
-
type: Input
|
|
35
|
+
type: Input,
|
|
36
|
+
args: [{ transform: numberAttribute }]
|
|
36
37
|
}], throttledClick: [{
|
|
37
38
|
type: Output
|
|
38
39
|
}], clickEvent: [{
|
|
39
40
|
type: HostListener,
|
|
40
41
|
args: ['click', ['$event']]
|
|
41
42
|
}] } });
|
|
42
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhyb3R0bGVkLWNsaWNrLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9hcHAvc2hhcmVkL2RpcmVjdGl2ZXMvdGhyb3R0bGVkLWNsaWNrLmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLFlBQVksRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLGVBQWUsRUFBcUIsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pILE9BQU8sRUFBRSxPQUFPLEVBQWdCLE1BQU0sTUFBTSxDQUFDO0FBQzdDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQzs7QUFLOUMsTUFBTSxPQUFPLHVCQUF1QjtJQUNLLFlBQVksR0FBRyxHQUFHLENBQUM7SUFFaEQsY0FBYyxHQUFHLElBQUksWUFBWSxFQUFXLENBQUM7SUFFL0MsTUFBTSxHQUFH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LnN1YnNjcmlwdGlvbiA9IHRoaXMuY2xpY2tzLnBpcGUodGhyb3R0bGVUaW1lKHRoaXMudGhyb3R0bGVUaW1lKSkuc3Vic2NyaWJlKChlKSA9PiB0aGlzLmVtaXRUaHJvdHRsZWRDbGljayhlKSk7XG4gIH1cblxuICBlbWl0VGhyb3R0bGVkQ2xpY2soZTogVUlFdmVudCkge1xuICAgIHRoaXMudGhyb3R0bGVkQ2xpY2suZW1pdChlKTtcbiAgfVxuXG4gIG5nT25EZXN0cm95KCkge1xuICAgIHRoaXMuc3Vic2NyaXB0aW9uPy51bnN1YnNjcmliZSgpO1xuICB9XG59XG4iXX0=
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Directive, Pipe, Injectable, EventEmitter, Output, Optional, Inject, inject, NgModule, forwardRef, Component, ChangeDetectionStrategy, Input, ViewChildren, HostBinding, HostListener, ElementRef,
|
|
2
|
+
import { InjectionToken, Directive, Pipe, Injectable, EventEmitter, Output, Optional, Inject, inject, NgModule, forwardRef, Component, ChangeDetectionStrategy, Input, ViewChildren, HostBinding, HostListener, ElementRef, numberAttribute, booleanAttribute, ViewChild, ANIMATION_MODULE_TYPE, RendererStyleFlags2, CUSTOM_ELEMENTS_SCHEMA, ViewEncapsulation, APP_INITIALIZER, ChangeDetectorRef } from '@angular/core';
|
|
3
3
|
import { firstValueFrom, shareReplay, tap, of, timer, Subject, merge, delay, isObservable, from, Subscription, BehaviorSubject, fromEvent, noop as noop$a, Observable, forkJoin, defer, timeout, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, fromEventPattern, interval, combineLatest, EMPTY, switchMap as switchMap$1 } from 'rxjs';
|
|
4
4
|
import { catchError, map, filter, takeUntil, first, switchMap, tap as tap$1, throttleTime, debounceTime, startWith, distinctUntilChanged, mergeMap, skip, finalize, bufferWhen, distinctUntilKeyChanged, take } from 'rxjs/operators';
|
|
5
5
|
import * as i3 from '@angular/common';
|
|
@@ -5975,7 +5975,7 @@ class ThrottledClickDirective {
|
|
|
5975
5975
|
this.subscription?.unsubscribe();
|
|
5976
5976
|
}
|
|
5977
5977
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ThrottledClickDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
5978
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
5978
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.2.11", type: ThrottledClickDirective, selector: "[appPreventDoubleClick],[throttledClick]", inputs: { throttleTime: ["throttleTime", "throttleTime", numberAttribute] }, outputs: { throttledClick: "throttledClick" }, host: { listeners: { "click": "clickEvent($event)" } }, ngImport: i0 });
|
|
5979
5979
|
}
|
|
5980
5980
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: ThrottledClickDirective, decorators: [{
|
|
5981
5981
|
type: Directive,
|
|
@@ -5983,7 +5983,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
|
|
|
5983
5983
|
selector: '[appPreventDoubleClick],[throttledClick]',
|
|
5984
5984
|
}]
|
|
5985
5985
|
}], ctorParameters: () => [], propDecorators: { throttleTime: [{
|
|
5986
|
-
type: Input
|
|
5986
|
+
type: Input,
|
|
5987
|
+
args: [{ transform: numberAttribute }]
|
|
5987
5988
|
}], throttledClick: [{
|
|
5988
5989
|
type: Output
|
|
5989
5990
|
}], clickEvent: [{
|
|
@@ -31497,6 +31498,7 @@ class AppTable {
|
|
|
31497
31498
|
_dataSource;
|
|
31498
31499
|
_filter;
|
|
31499
31500
|
_initialized = false;
|
|
31501
|
+
_openingRow = false;
|
|
31500
31502
|
_subscription = new Subscription();
|
|
31501
31503
|
_dataSourceLoadingSubscription;
|
|
31502
31504
|
_cellValueChangesDefs = {};
|
|
@@ -31563,6 +31565,7 @@ class AppTable {
|
|
|
31563
31565
|
saveBeforeFilter;
|
|
31564
31566
|
propagateRowError = false;
|
|
31565
31567
|
permanentSelectionAllowed = false; // Allow keep selected rows over page change or sort change
|
|
31568
|
+
openRowThrottleTime = 800;
|
|
31566
31569
|
defaultSortBy;
|
|
31567
31570
|
defaultSortDirection;
|
|
31568
31571
|
defaultPageSize = DEFAULT_PAGE_SIZE;
|
|
@@ -32382,8 +32385,6 @@ class AppTable {
|
|
|
32382
32385
|
//event?.preventDefault();
|
|
32383
32386
|
event?.stopPropagation();
|
|
32384
32387
|
this.selection.toggle(row);
|
|
32385
|
-
// FIXME
|
|
32386
|
-
//this.detectChanges(); // Workaround need by for SUMARiS (eg samples tables)
|
|
32387
32388
|
}
|
|
32388
32389
|
clickRow(event, row) {
|
|
32389
32390
|
if (this.loading) {
|
|
@@ -32409,15 +32410,23 @@ class AppTable {
|
|
|
32409
32410
|
}
|
|
32410
32411
|
// Open the detail page (if not inline editing)
|
|
32411
32412
|
if (!this.inlineEdition) {
|
|
32413
|
+
if (this._openingRow)
|
|
32414
|
+
return; // Prevent double click
|
|
32412
32415
|
if (event) {
|
|
32413
32416
|
event.stopPropagation();
|
|
32414
32417
|
event.preventDefault();
|
|
32415
32418
|
}
|
|
32419
|
+
this._openingRow = true; // Prevent double click
|
|
32416
32420
|
this.markAsLoading();
|
|
32417
32421
|
this.selection.clear();
|
|
32418
32422
|
this.openRow(row.currentData.id, row)
|
|
32419
|
-
.
|
|
32420
|
-
.
|
|
32423
|
+
.catch((err) => console.error('Failed to open row', err)) // Continue
|
|
32424
|
+
.then(async () => {
|
|
32425
|
+
this.markAsLoaded();
|
|
32426
|
+
// Add the throttle time, before authorize to click again (prevent double click)
|
|
32427
|
+
await sleep(this.openRowThrottleTime);
|
|
32428
|
+
this._openingRow = false;
|
|
32429
|
+
});
|
|
32421
32430
|
return true;
|
|
32422
32431
|
}
|
|
32423
32432
|
// Start editing row
|
|
@@ -33194,7 +33203,7 @@ class AppTable {
|
|
|
33194
33203
|
}
|
|
33195
33204
|
}
|
|
33196
33205
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: AppTable, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
33197
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.11", type: AppTable, inputs: { settingsId: "settingsId", debug: "debug", i18nColumnPrefix: "i18nColumnPrefix", i18nColumnSuffix: "i18nColumnSuffix", autoLoad: "autoLoad", readOnly: "readOnly", inlineEdition: "inlineEdition", focusFirstColumn: "focusFirstColumn", confirmBeforeDelete: "confirmBeforeDelete", confirmBeforeCancel: "confirmBeforeCancel", undoableDeletion: "undoableDeletion", saveBeforeDelete: "saveBeforeDelete", keepEditedRowOnSave: "keepEditedRowOnSave", saveBeforeSort: "saveBeforeSort", saveBeforeFilter: "saveBeforeFilter", propagateRowError: "propagateRowError", permanentSelectionAllowed: "permanentSelectionAllowed", defaultSortBy: "defaultSortBy", defaultSortDirection: "defaultSortDirection", defaultPageSize: "defaultPageSize", defaultPageSizeOptions: "defaultPageSizeOptions", focusColumn: "focusColumn", dataSource: "dataSource", filter: "filter", disabled: "disabled", paginator: "paginator" }, outputs: { onRefresh: "onRefresh", onOpenRow: "onOpenRow", onNewRow: "onNewRow", onStartEditingRow: "onStartEditingRow", onConfirmEditCreateRow: "onConfirmEditCreateRow", onCancelOrDeleteRow: "onCancelOrDeleteRow", onBeforeDeleteRows: "onBeforeDeleteRows", onBeforeCancelRows: "onBeforeCancelRows", onBeforeSave: "onBeforeSave", onAfterDeletedRows: "onAfterDeletedRows", onSort: "onSort", onDirty: "onDirty", onError: "onError" }, viewQueries: [{ propertyName: "table", first: true, predicate: MatTable, descendants: true }, { propertyName: "childPaginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }], ngImport: i0 });
|
|
33206
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.11", type: AppTable, inputs: { settingsId: "settingsId", debug: "debug", i18nColumnPrefix: "i18nColumnPrefix", i18nColumnSuffix: "i18nColumnSuffix", autoLoad: "autoLoad", readOnly: "readOnly", inlineEdition: "inlineEdition", focusFirstColumn: "focusFirstColumn", confirmBeforeDelete: "confirmBeforeDelete", confirmBeforeCancel: "confirmBeforeCancel", undoableDeletion: "undoableDeletion", saveBeforeDelete: "saveBeforeDelete", keepEditedRowOnSave: "keepEditedRowOnSave", saveBeforeSort: "saveBeforeSort", saveBeforeFilter: "saveBeforeFilter", propagateRowError: "propagateRowError", permanentSelectionAllowed: "permanentSelectionAllowed", openRowThrottleTime: "openRowThrottleTime", defaultSortBy: "defaultSortBy", defaultSortDirection: "defaultSortDirection", defaultPageSize: "defaultPageSize", defaultPageSizeOptions: "defaultPageSizeOptions", focusColumn: "focusColumn", dataSource: "dataSource", filter: "filter", disabled: "disabled", paginator: "paginator" }, outputs: { onRefresh: "onRefresh", onOpenRow: "onOpenRow", onNewRow: "onNewRow", onStartEditingRow: "onStartEditingRow", onConfirmEditCreateRow: "onConfirmEditCreateRow", onCancelOrDeleteRow: "onCancelOrDeleteRow", onBeforeDeleteRows: "onBeforeDeleteRows", onBeforeCancelRows: "onBeforeCancelRows", onBeforeSave: "onBeforeSave", onAfterDeletedRows: "onAfterDeletedRows", onSort: "onSort", onDirty: "onDirty", onError: "onError" }, viewQueries: [{ propertyName: "table", first: true, predicate: MatTable, descendants: true }, { propertyName: "childPaginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }], ngImport: i0 });
|
|
33198
33207
|
}
|
|
33199
33208
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: AppTable, decorators: [{
|
|
33200
33209
|
type: Directive
|
|
@@ -33232,6 +33241,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
|
|
|
33232
33241
|
type: Input
|
|
33233
33242
|
}], permanentSelectionAllowed: [{
|
|
33234
33243
|
type: Input
|
|
33244
|
+
}], openRowThrottleTime: [{
|
|
33245
|
+
type: Input
|
|
33235
33246
|
}], defaultSortBy: [{
|
|
33236
33247
|
type: Input
|
|
33237
33248
|
}], defaultSortDirection: [{
|