@sumaris-net/ngx-components 18.3.20 → 18.3.22
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 +6 -0
- package/esm2022/src/app/core/table/async-table.class.mjs +31 -5
- package/esm2022/src/app/core/table/table.class.mjs +23 -12
- package/esm2022/src/app/shared/directives/throttled-click.directive.mjs +5 -4
- package/fesm2022/sumaris-net.ngx-components.mjs +56 -18
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/async-table.class.d.ts +4 -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhyb3R0bGVkLWNsaWNrLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9hcHAvc2hhcmVkL2RpcmVjdGl2ZXMvdGhyb3R0bGVkLWNsaWNrLmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLFlBQVksRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLGVBQWUsRUFBcUIsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pILE9BQU8sRUFBRSxPQUFPLEVBQWdCLE1BQU0sTUFBTSxDQUFDO0FBQzdDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQzs7QUFLOUMsTUFBTSxPQUFPLHVCQUF1QjtJQUNLLFlBQVksR0FBRyxHQUFHLENBQUM7SUFFaEQ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lja3MubmV4dChldmVudCk7XG4gIH1cblxuICBuZ09uSW5pdCgpIHtcbiAgICB0aGlzLnN1YnNjcmlwdGlvbiA9IHRoaXMuY2xpY2tzLnBpcGUodGhyb3R0bGVUaW1lKHRoaXMudGhyb3R0bGVUaW1lKSkuc3Vic2NyaWJlKChlKSA9PiB0aGlzLmVtaXRUaHJvdHRsZWRDbGljayhlKSk7XG4gIH1cblxuICBlbWl0VGhyb3R0bGVkQ2xpY2soZTogVUlFdmVudCkge1xuICAgIHRoaXMudGhyb3R0bGVkQ2xpY2suZW1pdChlKTtcbiAgfVxuXG4gIG5nT25EZXN0cm95KCkge1xuICAgIHRoaXMuc3Vic2NyaXB0aW9uPy51bnN1YnNjcmliZSgpO1xuICB9XG59XG4iXX0=
|
|
@@ -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; // Prevent double click - see issue sumaris-app#864
|
|
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,29 @@ 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(() => {
|
|
32425
|
+
this.markAsLoaded();
|
|
32426
|
+
// Prevent double click (use an open throttle time)
|
|
32427
|
+
if (this.openRowThrottleTime > 0) {
|
|
32428
|
+
setTimeout(() => {
|
|
32429
|
+
this._openingRow = false;
|
|
32430
|
+
}, this.openRowThrottleTime);
|
|
32431
|
+
}
|
|
32432
|
+
else {
|
|
32433
|
+
this._openingRow = false;
|
|
32434
|
+
}
|
|
32435
|
+
});
|
|
32421
32436
|
return true;
|
|
32422
32437
|
}
|
|
32423
32438
|
// Start editing row
|
|
@@ -32542,8 +32557,6 @@ class AppTable {
|
|
|
32542
32557
|
}
|
|
32543
32558
|
this.editedRow = row;
|
|
32544
32559
|
this.onStartEditingRow.emit(row);
|
|
32545
|
-
// FIXME
|
|
32546
|
-
//this.detectChanges(); // Workaround need by SUMARiS (e.g. for samples tables) otherwise the row will not be editable
|
|
32547
32560
|
return true;
|
|
32548
32561
|
}
|
|
32549
32562
|
/**
|
|
@@ -32822,11 +32835,8 @@ class AppTable {
|
|
|
32822
32835
|
this.visibleRowCount++;
|
|
32823
32836
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
32824
32837
|
// Emit event
|
|
32825
|
-
if (!opts || opts.emitEvent !== false)
|
|
32838
|
+
if (!opts || opts.emitEvent !== false)
|
|
32826
32839
|
this.markForCheck();
|
|
32827
|
-
// FIXME
|
|
32828
|
-
//this.detectChanges(); // Workaround need by SUMARiS (e.g. samples tables) otherwise new row is not visible
|
|
32829
|
-
}
|
|
32830
32840
|
return row;
|
|
32831
32841
|
}
|
|
32832
32842
|
registerCellValueChanges(name, formPath, emitInitialValue) {
|
|
@@ -33194,7 +33204,7 @@ class AppTable {
|
|
|
33194
33204
|
}
|
|
33195
33205
|
}
|
|
33196
33206
|
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 });
|
|
33207
|
+
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
33208
|
}
|
|
33199
33209
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: AppTable, decorators: [{
|
|
33200
33210
|
type: Directive
|
|
@@ -33232,6 +33242,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
|
|
|
33232
33242
|
type: Input
|
|
33233
33243
|
}], permanentSelectionAllowed: [{
|
|
33234
33244
|
type: Input
|
|
33245
|
+
}], openRowThrottleTime: [{
|
|
33246
|
+
type: Input
|
|
33235
33247
|
}], defaultSortBy: [{
|
|
33236
33248
|
type: Input
|
|
33237
33249
|
}], defaultSortDirection: [{
|
|
@@ -34239,6 +34251,7 @@ class AppAsyncTable {
|
|
|
34239
34251
|
_dataSource;
|
|
34240
34252
|
_filter;
|
|
34241
34253
|
_initialized = false;
|
|
34254
|
+
_openingRow = false;
|
|
34242
34255
|
_subscription = new Subscription();
|
|
34243
34256
|
_dataSourceLoadingSubscription;
|
|
34244
34257
|
_cellValueChangesDefs = {};
|
|
@@ -34298,6 +34311,7 @@ class AppAsyncTable {
|
|
|
34298
34311
|
saveBeforeFilter;
|
|
34299
34312
|
propagateRowError = false;
|
|
34300
34313
|
permanentSelectionAllowed = false; // Allow keep selected rows over page change or sort change
|
|
34314
|
+
openRowThrottleTime = 800; // Prevent double click - see issue sumaris-app#864
|
|
34301
34315
|
defaultSortBy;
|
|
34302
34316
|
defaultSortDirection;
|
|
34303
34317
|
defaultPageSize = DEFAULT_PAGE_SIZE;
|
|
@@ -34513,6 +34527,14 @@ class AppAsyncTable {
|
|
|
34513
34527
|
get sortDirection() {
|
|
34514
34528
|
return (this.sort && this.sort.direction && (this.sort.direction === 'desc' ? 'desc' : 'asc')) || undefined;
|
|
34515
34529
|
}
|
|
34530
|
+
set sortDirection(value) {
|
|
34531
|
+
if (this.sort) {
|
|
34532
|
+
this.sort.direction = value;
|
|
34533
|
+
}
|
|
34534
|
+
else {
|
|
34535
|
+
this.defaultSortDirection = value;
|
|
34536
|
+
}
|
|
34537
|
+
}
|
|
34516
34538
|
_paginator = null;
|
|
34517
34539
|
set paginator(value) {
|
|
34518
34540
|
this._paginator = value;
|
|
@@ -35092,15 +35114,29 @@ class AppAsyncTable {
|
|
|
35092
35114
|
}
|
|
35093
35115
|
// Open the detail page (if not inline editing)
|
|
35094
35116
|
if (!this.inlineEdition) {
|
|
35117
|
+
if (this._openingRow)
|
|
35118
|
+
return; // Prevent double click
|
|
35095
35119
|
if (event) {
|
|
35096
35120
|
event.stopPropagation();
|
|
35097
35121
|
event.preventDefault();
|
|
35098
35122
|
}
|
|
35123
|
+
this._openingRow = true; // Prevent double click
|
|
35099
35124
|
this.markAsLoading();
|
|
35100
35125
|
this.selection.clear();
|
|
35101
35126
|
this.openRow(row.currentData.id, row)
|
|
35102
|
-
.
|
|
35103
|
-
.
|
|
35127
|
+
.catch((err) => console.error('Failed to open row', err)) // Continue
|
|
35128
|
+
.then(() => {
|
|
35129
|
+
this.markAsLoaded();
|
|
35130
|
+
// Prevent double click (use an open throttle time)
|
|
35131
|
+
if (this.openRowThrottleTime > 0) {
|
|
35132
|
+
setTimeout(() => {
|
|
35133
|
+
this._openingRow = false;
|
|
35134
|
+
}, this.openRowThrottleTime);
|
|
35135
|
+
}
|
|
35136
|
+
else {
|
|
35137
|
+
this._openingRow = false;
|
|
35138
|
+
}
|
|
35139
|
+
});
|
|
35104
35140
|
return true;
|
|
35105
35141
|
}
|
|
35106
35142
|
// Start editing row
|
|
@@ -35716,7 +35752,7 @@ class AppAsyncTable {
|
|
|
35716
35752
|
}
|
|
35717
35753
|
}
|
|
35718
35754
|
setLoading(value, opts) {
|
|
35719
|
-
if (this.loadingSubject.value !== value) {
|
|
35755
|
+
if (!this.loadingSubject.closed && this.loadingSubject.value !== value) {
|
|
35720
35756
|
this.loadingSubject.next(value);
|
|
35721
35757
|
if (!opts || opts.emitEvent !== false) {
|
|
35722
35758
|
this.markForCheck();
|
|
@@ -35864,7 +35900,7 @@ class AppAsyncTable {
|
|
|
35864
35900
|
}
|
|
35865
35901
|
}
|
|
35866
35902
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: AppAsyncTable, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
35867
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.11", type: AppAsyncTable, 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 });
|
|
35903
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.11", type: AppAsyncTable, 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 });
|
|
35868
35904
|
}
|
|
35869
35905
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImport: i0, type: AppAsyncTable, decorators: [{
|
|
35870
35906
|
type: Directive
|
|
@@ -35902,6 +35938,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
|
|
|
35902
35938
|
type: Input
|
|
35903
35939
|
}], permanentSelectionAllowed: [{
|
|
35904
35940
|
type: Input
|
|
35941
|
+
}], openRowThrottleTime: [{
|
|
35942
|
+
type: Input
|
|
35905
35943
|
}], defaultSortBy: [{
|
|
35906
35944
|
type: Input
|
|
35907
35945
|
}], defaultSortDirection: [{
|