import { Component, ChangeDetectionStrategy, forwardRef, Input } from '@angular/core';
import { RelationNodeInputSAComponent } from '@anglr/dynamic/relations-editor';
import { nameof } from '@jscrpt/common';
import * as i0 from "@angular/core";
/**
 * Component used to display relation node input for debugging
 */
export class RelationNodeInputDebugSAComponent extends RelationNodeInputSAComponent {
    constructor() {
        super(...arguments);
        //######################### public properties - inputs #########################
        /**
         * Indication whether highlight relations connected to this input
         */
        this.transferHighlight = false;
    }
    //######################### protected properties #########################
    /**
     * Debug relation instance
     */
    get relationDebug() {
        return this.relation;
    }
    //######################### public properties #########################
    /**
     * Gets native html element for node
     */
    get htmlElement() {
        return this.element.nativeElement;
    }
    //######################### public methods - implementation of OnChanges #########################
    /**
     * Called when input value changes
     */
    ngOnChanges(changes) {
        var _a, _b, _c, _d;
        if (nameof('transferHighlight') in changes) {
            if (this.transferHighlight) {
                (_a = this.relation) === null || _a === void 0 ? void 0 : _a.highlight();
                (_b = this.relationDebug) === null || _b === void 0 ? void 0 : _b.createTransferOverlay();
            }
            else {
                (_c = this.relation) === null || _c === void 0 ? void 0 : _c.cancelHighlight();
                (_d = this.relationDebug) === null || _d === void 0 ? void 0 : _d.destroyTransferOverlay();
            }
        }
    }
    //######################### public methods - overrides #########################
    /**
     * @inheritdoc
     */
    addRelation(relation) {
        var _a, _b, _c, _d;
        const result = super.addRelation(relation);
        if (this.transferHighlight) {
            (_a = this.relation) === null || _a === void 0 ? void 0 : _a.highlight();
            (_b = this.relationDebug) === null || _b === void 0 ? void 0 : _b.createTransferOverlay();
        }
        else {
            (_c = this.relation) === null || _c === void 0 ? void 0 : _c.cancelHighlight();
            (_d = this.relationDebug) === null || _d === void 0 ? void 0 : _d.destroyTransferOverlay();
        }
        return result;
    }
}
RelationNodeInputDebugSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: RelationNodeInputDebugSAComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
RelationNodeInputDebugSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: RelationNodeInputDebugSAComponent, isStandalone: true, selector: "relation-node-input-debug", inputs: { transferHighlight: "transferHighlight" }, providers: [
        {
            provide: RelationNodeInputSAComponent,
            useExisting: forwardRef(() => RelationNodeInputDebugSAComponent),
        },
    ], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: RelationNodeInputDebugSAComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'relation-node-input-debug',
                    template: '',
                    standalone: true,
                    providers: [
                        {
                            provide: RelationNodeInputSAComponent,
                            useExisting: forwardRef(() => RelationNodeInputDebugSAComponent),
                        },
                    ],
                    changeDetection: ChangeDetectionStrategy.OnPush
                }]
        }], propDecorators: { transferHighlight: [{
                type: Input
            }] } });
//# sourceMappingURL=relationsNodeInputDebug.component.js.map