@ng-doc/ui-kit
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
49 lines (45 loc) • 2.67 kB
JavaScript
import { DOCUMENT } from '@angular/common';
import * as i0 from '@angular/core';
import { Component, ChangeDetectionStrategy, Inject, Input } from '@angular/core';
import { NgDocFocusableDirective } from '@ng-doc/ui-kit/directives/focusable';
import { NgDocFocusUtils } from '@ng-doc/ui-kit/utils';
class NgDocFocusControlComponent {
constructor(documentRef) {
this.documentRef = documentRef;
this.focusHost = null;
}
focusPrev() {
if (this.focusHost) {
NgDocFocusUtils.focusClosestElement(this.focusHost, this.documentRef.body, false);
}
}
focusNext() {
if (this.focusHost) {
NgDocFocusUtils.focusClosestElement(this.focusHost, this.documentRef.body);
}
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgDocFocusControlComponent, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: NgDocFocusControlComponent, isStandalone: true, selector: "ng-doc-focus-control", inputs: { focusHost: "focusHost" }, ngImport: i0, template: `
<div [ngDocFocusable]="true" data-ng-doc-focus-trap="true" (focus)="focusPrev()"></div>
<ng-content></ng-content>
<div [ngDocFocusable]="true" data-ng-doc-focus-trap="true" (focus)="focusNext()"></div>
`, isInline: true, styles: [":host{width:100%}\n"], dependencies: [{ kind: "directive", type: NgDocFocusableDirective, selector: "[ngDocFocusable]", inputs: ["ngDocFocusable"], exportAs: ["ngDocFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: NgDocFocusControlComponent, decorators: [{
type: Component,
args: [{ selector: 'ng-doc-focus-control', template: `
<div [ngDocFocusable]="true" data-ng-doc-focus-trap="true" (focus)="focusPrev()"></div>
<ng-content></ng-content>
<div [ngDocFocusable]="true" data-ng-doc-focus-trap="true" (focus)="focusNext()"></div>
`, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgDocFocusableDirective], styles: [":host{width:100%}\n"] }]
}], ctorParameters: () => [{ type: Document, decorators: [{
type: Inject,
args: [DOCUMENT]
}] }], propDecorators: { focusHost: [{
type: Input
}] } });
/**
* Generated bundle index. Do not edit.
*/
export { NgDocFocusControlComponent };
//# sourceMappingURL=ng-doc-ui-kit-components-focus-control.mjs.map