@quadrel-enterprise-ui/framework 21.12.14 → 21.12.16
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.
|
@@ -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
|
}
|
|
@@ -36737,7 +36761,7 @@ class QdShellNotificationComponent {
|
|
|
36737
36761
|
this.notificationService.remove('shell', this.notification.uuid);
|
|
36738
36762
|
}
|
|
36739
36763
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdShellNotificationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
36740
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdShellNotificationComponent, isStandalone: false, selector: "qd-shell-notification", inputs: { notification: "notification" }, host: { properties: { "
|
|
36764
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdShellNotificationComponent, isStandalone: false, selector: "qd-shell-notification", inputs: { notification: "notification" }, host: { properties: { "class": "this.typeClassName" }, classAttribute: "qd-shell-notification" }, usesOnChanges: true, ngImport: i0, template: "@if (closeable) {\n<qd-icon [icon]=\"'timesLarge'\" class=\"closer\" (click)=\"remove()\"></qd-icon>\n}\n<qd-icon [icon]=\"this.getIcon()\" class=\"icon\"></qd-icon>\n\n@if (notification?.title) {\n<h3 class=\"title\">{{ notification.title.i18n | translate }}</h3>\n}\n<span class=\"message\">{{ notification?.i18n | translate }}</span>\n\n@if (displayedDate) {\n<span class=\"date\">{{ displayedDate }}</span>\n}\n", styles: [":host{position:relative;display:grid;width:100%;padding:.5rem 1.5rem .5rem .75rem;border:rgb(213,213,213) solid .0625rem;margin-bottom:.75rem;background:#fff;font-size:.875rem;gap:.125rem .625rem;grid-template-columns:23px 1fr;line-height:1rem}:host .icon{font-size:1.5rem;grid-row:1/span 3;line-height:1.5rem}:host .title{margin:0!important;color:#171717;font-size:.875rem}:host .message{margin-top:.1875rem;color:#333;font-size:.875rem;white-space:pre-wrap}:host .title+.message{margin-top:0}:host .date{margin-top:.875rem;color:#333;font-size:.875rem}:host.qd-notification-info{border-left:.25rem solid rgb(0,102,153)}:host.qd-notification-info .icon{color:#069}:host.qd-notification-warning{border-left:.25rem solid rgb(255,155,0)}:host.qd-notification-warning .icon{color:#ff9b00}:host.qd-notification-urgent{border-left:.25rem solid rgb(199,0,35)}:host.qd-notification-urgent .icon{color:#c70023}:host.qd-notification-critical{border-left:.25rem solid rgb(199,0,35)}:host.qd-notification-critical .icon{color:#c70023}:host.qd-notification-positive{border-left:.25rem solid rgb(0,129,58)}:host.qd-notification-positive .icon{color:#00813a}:host .closer{position:absolute;top:.5rem;right:.75rem;color:#333;cursor:pointer;font-size:.75rem}\n"], dependencies: [{ kind: "component", type: QdIconComponent, selector: "qd-icon", inputs: ["icon", "status"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] });
|
|
36741
36765
|
}
|
|
36742
36766
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdShellNotificationComponent, decorators: [{
|
|
36743
36767
|
type: Component,
|
|
@@ -36746,7 +36770,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
36746
36770
|
type: Input
|
|
36747
36771
|
}], typeClassName: [{
|
|
36748
36772
|
type: HostBinding,
|
|
36749
|
-
args: ['
|
|
36773
|
+
args: ['class']
|
|
36750
36774
|
}] } });
|
|
36751
36775
|
|
|
36752
36776
|
// @ts-strict-ignore
|