@quadrel-enterprise-ui/framework 21.12.15 → 21.12.17
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.
|
@@ -3,7 +3,7 @@ import { Directive, InjectionToken, inject, ElementRef, HostBinding, Input, View
|
|
|
3
3
|
import { Dialog, DialogRef, DIALOG_DATA, DialogModule } from '@angular/cdk/dialog';
|
|
4
4
|
import { quadrelIcons } from '@quadrel-enterprise-ui/icons';
|
|
5
5
|
export { quadrelIconNames } from '@quadrel-enterprise-ui/icons';
|
|
6
|
-
import { BehaviorSubject, pairwise, fromEvent, combineLatest, concat, map as map$1, Subject, throwError, of, ReplaySubject, merge, isObservable, NEVER, Observable, EMPTY, shareReplay, distinctUntilChanged as distinctUntilChanged$1, debounce, timer, switchMap as switchMap$1, asyncScheduler, Subscription, startWith as startWith$1, filter as filter$1, debounceTime as debounceTime$1, firstValueFrom, take as take$1, tap as tap$1, from, delay, defer, throwIfEmpty, EmptyError, queueScheduler, concatMap as concatMap$1, exhaustMap, takeUntil as takeUntil$1,
|
|
6
|
+
import { BehaviorSubject, pairwise, fromEvent, combineLatest, concat, map as map$1, Subject, throwError, of, ReplaySubject, merge, isObservable, NEVER, Observable, EMPTY, shareReplay, distinctUntilChanged as distinctUntilChanged$1, debounce, timer, switchMap as switchMap$1, asyncScheduler, Subscription, startWith as startWith$1, filter as filter$1, debounceTime as debounceTime$1, firstValueFrom, take as take$1, tap as tap$1, from, delay, defer, throwIfEmpty, EmptyError, finalize, queueScheduler, concatMap as concatMap$1, exhaustMap, takeUntil as takeUntil$1, forkJoin, delayWhen, combineLatestWith, withLatestFrom as withLatestFrom$1, async } from 'rxjs';
|
|
7
7
|
import { map, startWith, take, debounceTime, filter, catchError, distinctUntilChanged, switchMap, concatMap, skip, throttleTime, tap, takeUntil, auditTime, withLatestFrom, first, observeOn, pairwise as pairwise$1, mergeMap } from 'rxjs/operators';
|
|
8
8
|
import { v4 } from 'uuid';
|
|
9
9
|
import * as i2 from '@ngx-translate/core';
|
|
@@ -9110,6 +9110,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
9110
9110
|
* view; the guard is released once the focused element blurs, so a newly opened view can
|
|
9111
9111
|
* autofocus again. Using it on more than one active element at a time logs a warning and is
|
|
9112
9112
|
* ignored for the surplus elements.
|
|
9113
|
+
*
|
|
9114
|
+
* An element that is not in the document does not take part, e.g. a field on a page tab that is
|
|
9115
|
+
* not shown. So every tab can have its own autofocus field, and the shown tab gets the focus.
|
|
9116
|
+
* This happens only when the view opens. A tab that the user opens later does not take the focus.
|
|
9117
|
+
*
|
|
9118
|
+
* An element that cannot take the focus, e.g. because it is hidden, frees the guard again.
|
|
9113
9119
|
*/
|
|
9114
9120
|
class QdAutofocusDirective {
|
|
9115
9121
|
autofocusService = inject(QdAutofocusService);
|
|
@@ -9117,34 +9123,52 @@ class QdAutofocusDirective {
|
|
|
9117
9123
|
qdAutofocus = false;
|
|
9118
9124
|
_timeoutId;
|
|
9119
9125
|
_blurHandler;
|
|
9126
|
+
_hasClaimedAutofocus = false;
|
|
9120
9127
|
ngAfterViewInit() {
|
|
9121
9128
|
if (!this.qdAutofocus)
|
|
9122
9129
|
return;
|
|
9123
|
-
if (this.
|
|
9124
|
-
console.warn('Quadrel Framework | QdAutofocus - "hasAutofocus" can be used only once.');
|
|
9130
|
+
if (this.elementRef.nativeElement.isConnected && !this.claimAutofocus())
|
|
9125
9131
|
return;
|
|
9126
|
-
|
|
9127
|
-
this.autofocusService.isAutofocusActivated = true;
|
|
9128
|
-
this._timeoutId = setTimeout(() => {
|
|
9129
|
-
const element = this.elementRef.nativeElement;
|
|
9130
|
-
if (!element.isConnected) {
|
|
9131
|
-
this.autofocusService.isAutofocusActivated = false;
|
|
9132
|
-
return;
|
|
9133
|
-
}
|
|
9134
|
-
element.focus();
|
|
9135
|
-
this._blurHandler = () => {
|
|
9136
|
-
this.autofocusService.isAutofocusActivated = false;
|
|
9137
|
-
};
|
|
9138
|
-
element.addEventListener('blur', this._blurHandler, { once: true });
|
|
9139
|
-
}, 0);
|
|
9132
|
+
this._timeoutId = setTimeout(() => this.focusIfShown(), 0);
|
|
9140
9133
|
}
|
|
9141
9134
|
ngOnDestroy() {
|
|
9142
9135
|
if (this._timeoutId)
|
|
9143
9136
|
clearTimeout(this._timeoutId);
|
|
9144
9137
|
if (this._blurHandler)
|
|
9145
9138
|
this.elementRef.nativeElement.removeEventListener('blur', this._blurHandler);
|
|
9139
|
+
this.releaseAutofocus();
|
|
9140
|
+
}
|
|
9141
|
+
claimAutofocus() {
|
|
9142
|
+
if (this.autofocusService.isAutofocusActivated) {
|
|
9143
|
+
console.warn('Quadrel Framework | QdAutofocus - "hasAutofocus" can be used only once.');
|
|
9144
|
+
return false;
|
|
9145
|
+
}
|
|
9146
|
+
this.autofocusService.isAutofocusActivated = true;
|
|
9147
|
+
this._hasClaimedAutofocus = true;
|
|
9148
|
+
return true;
|
|
9149
|
+
}
|
|
9150
|
+
releaseAutofocus() {
|
|
9151
|
+
if (!this._hasClaimedAutofocus)
|
|
9152
|
+
return;
|
|
9153
|
+
this._hasClaimedAutofocus = false;
|
|
9146
9154
|
this.autofocusService.isAutofocusActivated = false;
|
|
9147
9155
|
}
|
|
9156
|
+
focusIfShown() {
|
|
9157
|
+
const element = this.elementRef.nativeElement;
|
|
9158
|
+
if (!element.isConnected) {
|
|
9159
|
+
this.releaseAutofocus();
|
|
9160
|
+
return;
|
|
9161
|
+
}
|
|
9162
|
+
if (!this._hasClaimedAutofocus && !this.claimAutofocus())
|
|
9163
|
+
return;
|
|
9164
|
+
element.focus();
|
|
9165
|
+
if (element.ownerDocument.activeElement !== element) {
|
|
9166
|
+
this.releaseAutofocus();
|
|
9167
|
+
return;
|
|
9168
|
+
}
|
|
9169
|
+
this._blurHandler = () => this.releaseAutofocus();
|
|
9170
|
+
element.addEventListener('blur', this._blurHandler, { once: true });
|
|
9171
|
+
}
|
|
9148
9172
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdAutofocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
9149
9173
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.17", type: QdAutofocusDirective, isStandalone: false, selector: "[qdAutofocus]", inputs: { qdAutofocus: "qdAutofocus" }, ngImport: i0 });
|
|
9150
9174
|
}
|
|
@@ -30644,7 +30668,9 @@ class QdTreeRowExpanderService {
|
|
|
30644
30668
|
destroyRef = inject(DestroyRef);
|
|
30645
30669
|
init(treeId, rowService) {
|
|
30646
30670
|
this.trees.set(treeId, { treeRows: [], rowService });
|
|
30647
|
-
rowService.treeRow
|
|
30671
|
+
rowService.treeRow$
|
|
30672
|
+
.pipe(finalize(() => this.forgetTree(treeId, rowService)), takeUntilDestroyed(this.destroyRef))
|
|
30673
|
+
.subscribe(tree => {
|
|
30648
30674
|
if (tree)
|
|
30649
30675
|
this.trees.get(treeId).treeRows = tree;
|
|
30650
30676
|
});
|
|
@@ -30689,6 +30715,10 @@ class QdTreeRowExpanderService {
|
|
|
30689
30715
|
});
|
|
30690
30716
|
tree.rowService?.updateRows(JSON.parse(JSON.stringify(tree.treeRows)));
|
|
30691
30717
|
}
|
|
30718
|
+
forgetTree(treeId, rowService) {
|
|
30719
|
+
if (this.trees.get(treeId)?.rowService === rowService)
|
|
30720
|
+
this.trees.delete(treeId);
|
|
30721
|
+
}
|
|
30692
30722
|
expand(row) {
|
|
30693
30723
|
if (!row || !row.nestedRows || !row.nestedRows.length)
|
|
30694
30724
|
return;
|
|
@@ -30738,12 +30768,16 @@ const RESERVED_ROW_PROPERTIES = ['uid', 'nestedRows', 'expanded', 'full'];
|
|
|
30738
30768
|
class QdTreeRowsService {
|
|
30739
30769
|
groupService = inject(QdTreeGroupService);
|
|
30740
30770
|
expanderService = inject(QdTreeRowExpanderService, { optional: true });
|
|
30771
|
+
_destroyRef = inject(DestroyRef);
|
|
30741
30772
|
config;
|
|
30742
30773
|
treeRowSubject = new BehaviorSubject(null);
|
|
30743
30774
|
treeRow$ = this.treeRowSubject.asObservable();
|
|
30744
30775
|
get groupColumn() {
|
|
30745
30776
|
return this.groupService.groupColumn;
|
|
30746
30777
|
}
|
|
30778
|
+
constructor() {
|
|
30779
|
+
this._destroyRef.onDestroy(() => this.treeRowSubject.complete());
|
|
30780
|
+
}
|
|
30747
30781
|
initializeRows(data) {
|
|
30748
30782
|
const rows = structuredClone(data);
|
|
30749
30783
|
let treeRows = this.splitRowsByTree(rows);
|
|
@@ -30879,7 +30913,7 @@ class QdTreeRowsService {
|
|
|
30879
30913
|
}
|
|
30880
30914
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTreeRowsService, decorators: [{
|
|
30881
30915
|
type: Injectable
|
|
30882
|
-
}] });
|
|
30916
|
+
}], ctorParameters: () => [] });
|
|
30883
30917
|
|
|
30884
30918
|
class QdTreeRowActionsSecondaryMenuComponent {
|
|
30885
30919
|
tableStoreService = inject(QdTableStoreService);
|