UNPKG

@neocomplexx/ngx-neo-directives

Version:

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.5.

1,880 lines 58.4 kB
import { Directive, ElementRef, Input, HostListener, InjectionToken, Renderer2, NgModule } from '@angular/core';
import { __awaiter } from 'tslib';
import { BehaviorSubject, Subject, combineLatest, timer } from 'rxjs';
import { tap, map, filter, switchMap } from 'rxjs/operators';
import { NgModel } from '@angular/forms';
import { NgbTabset } from '@ng-bootstrap/ng-bootstrap';

/**
 * @fileoverview added by tsickle
 * Generated from: lib/onReturn.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
class OnReturnDirective {
    /**
     * @param {?} _el
     */
    constructor(_el) {
        this._el = _el;
        this.setEnabled = true;
        this.el = this._el;
    }
    /**
     * @param {?} e
     * @return {?}
     */
    onKeyDown(e) {
        if ((e.which === 13 || e.keyCode === 13)) {
            e.preventDefault();
            OnReturnDirective.setNextFocus(this.onReturn, this.setEnabled);
            return;
        }
    }
    // tslint:disable-next-line:member-ordering
    /**
     * @param {?} onReturn
     * @param {?=} setEnabled
     * @return {?}
     */
    static setNextFocus(onReturn, setEnabled = true) {
        if (onReturn instanceof Array) {
            /** @type {?} */
            let termine = false;
            /** @type {?} */
            let i = 0;
            while (!termine && i < onReturn.length) {
                /** @type {?} */
                let element = onReturn[i];
                if (element) {
                    if (element instanceof HTMLInputElement ||
                        element instanceof HTMLButtonElement ||
                        element instanceof HTMLSelectElement ||
                        element instanceof HTMLSelectElement) {
                        if (!element.disabled) {
                            element.focus();
                            termine = true;
                        }
                    }
                    else {
                        if (element && element.nativeElement instanceof HTMLInputElement ||
                            element.nativeElement instanceof HTMLButtonElement ||
                            element.nativeElement instanceof HTMLSelectElement) {
                            if (!element.nativeElement.disabled) {
                                element.nativeElement.focus();
                                termine = true;
                            }
                        }
                        else {
                            /** @type {?} */
                            let input = element['ctrInput'];
                            if (input) {
                                input = input['nativeElement'];
                                if (input && input instanceof HTMLInputElement) {
                                    if (!input.disabled) {
                                        input.focus();
                                        termine = true;
                                    }
                                }
                            }
                            else {
                                element = document.getElementById(element);
                                if (element) {
                                    if (element.disabled && setEnabled) {
                                        element.disabled = false;
                                    }
                                    if (!element.disabled) {
                                        element.focus();
                                        termine = true;
                                    }
                                }
                            }
                        }
                    }
                }
                i++;
            }
        }
        else if (onReturn) {
            /** @type {?} */
            let element = onReturn;
            if (element instanceof HTMLInputElement || element instanceof HTMLButtonElement || element instanceof HTMLSelectElement) {
                if (element.disabled) {
                    element.disabled = false;
                }
                element.focus();
            }
            else {
                /** @type {?} */
                let input = element['ctrInput'];
                if (input) {
                    input = input['nativeElement'];
                    if (input && input instanceof HTMLInputElement) {
                        if (input.disabled) {
                            input.disabled = false;
                        }
                        input.focus();
                    }
                }
                else {
                    element = document.getElementById(onReturn);
                    if (element) {
                        if (element.disabled && setEnabled) {
                            element.disabled = false;
                        }
                        element.focus();
                    }
                }
            }
        }
    }
}
OnReturnDirective.decorators = [
    { type: Directive, args: [{
                // tslint:disable-next-line:directive-selector
                selector: '[onReturn]'
            },] }
];
/** @nocollapse */
OnReturnDirective.ctorParameters = () => [
    { type: ElementRef }
];
OnReturnDirective.propDecorators = {
    onReturn: [{ type: Input }],
    setEnabled: [{ type: Input }],
    onKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]
};
if (false) {
    /**
     * @type {?}
     * @private
     */
    OnReturnDirective.prototype.el;
    /** @type {?} */
    OnReturnDirective.prototype.onReturn;
    /** @type {?} */
    OnReturnDirective.prototype.setEnabled;
    /**
     * @type {?}
     * @private
     */
    OnReturnDirective.prototype._el;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/ngx-command/command.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/** @type {?} */
const COMMAND_CONFIG = new InjectionToken('COMMAND_CONFIG');
/** @type {?} */
const COMMAND_DEFAULT_CONFIG = {
    executingCssClass: 'executing',
};
/*
export function provideConfig(config: CommandOptions): any {
    return Object.assign({}, COMMAND_DEFAULT_CONFIG, config);
} */
/**
 *
 * ### Example with options
 * ```html
 * <button [command]='saveCmd' [commandOptions]='{executingCssClass: 'in-progress'}'>Save</button>
 * ```
 */
class CommandDirective {
    /**
     * @param {?} renderer
     * @param {?} element
     */
    constructor(renderer, element) {
        this.renderer = renderer;
        this.element = element;
        this.stopPropagation = false;
        // @HostBinding('disabled') isDisabled: boolean;
        this.setEnabled = true;
        this.config = COMMAND_DEFAULT_CONFIG;
        this.ownDisabledState = false;
        this.commandDisabledChanged = false;
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        // console.log('[commandDirective::init]');
        this.commandOptions = Object.assign({}, this.config, this.commandOptions);
        if (!this.command) {
            throw new Error('[commandDirective] command should be defined!');
        }
        else {
            this.command.verifyCommandExecutionPipe();
            this.command.setNextFocus(this.commandNextFocus);
            this.command.setEnabledValue(this.setEnabled);
        }
        // if (this.element.nativeElement.localName === 'button') {
        // 	let thisAux = this;	// Set up a new observer
        // 	var observer = new MutationObserver(function(mutations) {
        // 		mutations.forEach(function(mutation) {
        // 			// Check the modified attributeName is "disabled"
        // 			if(!thisAux.commandDisabledChanged) {
        // 				if (mutation.attributeName === "disabled") {
        // 					thisAux.ownDisabledState = thisAux.element.nativeElement.disabled;
        // 				}
        // 			} else {
        // 				thisAux.commandDisabledChanged = false;
        // 			}
        // 		});
        // 	});
        // 	// Configure to only listen to attribute changes
        // 	var config = { attributes: true };
        // 	// Start observing myElem
        // 	observer.observe(this.element.nativeElement, config);
        // }
        this.canExecute$$ = this.command.canExecute$.pipe(tap((/**
         * @param {?} x
         * @return {?}
         */
        x => {
            if (this.element.nativeElement.localName === 'button') {
                this.commandDisabledChanged = true;
                if (this.commandValue == this.command.executingParam) {
                    this.element.nativeElement.disabled = !x;
                    // } else {
                    // 	this.element.nativeElement.disabled = !(!this.ownDisabledState && x);
                }
            }
        }))).subscribe();
        this.isExecuting$$ = this.command.isExecuting$.pipe(tap((/**
         * @param {?} x
         * @return {?}
         */
        x => {
            // console.log('[commandDirective::isExecuting$]', x);
            x ? this.renderer.addClass(this.element.nativeElement, this.commandOptions.executingCssClass) : this.renderer.removeClass(this.element.nativeElement, this.commandOptions.executingCssClass);
        }))).subscribe();
        if (this.isMobileOperatingSystem()) {
            this.element.nativeElement.addEventListener('touchstart', (/**
             * @param {?} event
             * @return {?}
             */
            (event) => __awaiter(this, void 0, void 0, function* () {
                event.preventDefault();
                event.stopPropagation();
                if (this.element.nativeElement.localName === 'input') {
                    return;
                }
                this.executeCommand();
            })));
            this.element.nativeElement.addEventListener('focusin', (/**
             * @param {?} event
             * @return {?}
             */
            (event) => __awaiter(this, void 0, void 0, function* () {
                event.preventDefault();
                event.stopPropagation();
                this.executeCommand();
            })));
        }
        else {
            this.element.nativeElement.addEventListener('keydown', (/**
             * @param {?} event
             * @return {?}
             */
            (event) => __awaiter(this, void 0, void 0, function* () {
                if ((event.which === 13 || event.keyCode === 13)) {
                    event.preventDefault();
                    event.stopPropagation();
                    this.executeCommand();
                }
            })));
            this.element.nativeElement.addEventListener('click', (/**
             * @param {?} event
             * @return {?}
             */
            (event) => __awaiter(this, void 0, void 0, function* () {
                if (this.element.nativeElement.localName === 'input') {
                    return;
                }
                event.preventDefault();
                if (this.stopPropagation) {
                    event.stopPropagation();
                }
                this.executeCommand();
            })));
        }
    }
    /**
     * @return {?}
     */
    executeCommand() {
        if (!this.element.nativeElement.disabled)
            this.command.canExecute = true;
        this.command.verifyCommandExecutionPipe();
        this.command.execute(this.commandValue);
    }
    /**
     * @return {?}
     */
    ngOnDestroy() {
        if (this.command) {
            this.command.destroy();
        }
        if (this.canExecute$$) {
            this.canExecute$$.unsubscribe();
        }
        if (this.isExecuting$$) {
            this.isExecuting$$.unsubscribe();
        }
    }
    /**
     * @private
     * @return {?}
     */
    isMobileOperatingSystem() {
        /** @type {?} */
        let isMobile = false;
        /** @type {?} */
        const userAgent = navigator.userAgent || navigator.vendor;
        // Windows Phone must come first because its UA also contains "Android"
        if (/windows phone/i.test(userAgent)) {
            isMobile = true; // "Windows Phone";
        }
        else if (/android/i.test(userAgent)) {
            isMobile = true; // "Android";
        }
        else if (/iPad|iPhone|iPod/.test(userAgent)) {
            // iOS detection from: http://stackoverflow.com/a/9039885/177710
            isMobile = true; // "iOS";
        }
        isMobile = false;
        return isMobile; // "unknown";
    }
}
CommandDirective.decorators = [
    { type: Directive, args: [{
                // tslint:disable-next-line:directive-selector
                selector: '[command]'
            },] }
];
/** @nocollapse */
CommandDirective.ctorParameters = () => [
    { type: Renderer2 },
    { type: ElementRef }
];
CommandDirective.propDecorators = {
    command: [{ type: Input }],
    commandOptions: [{ type: Input }],
    commandCanExecute: [{ type: Input }],
    commandValue: [{ type: Input }],
    stopPropagation: [{ type: Input }],
    commandNextFocus: [{ type: Input }],
    setEnabled: [{ type: Input }]
};
if (false) {
    /** @type {?} */
    CommandDirective.prototype.command;
    /** @type {?} */
    CommandDirective.prototype.commandOptions;
    /** @type {?} */
    CommandDirective.prototype.commandCanExecute;
    /** @type {?} */
    CommandDirective.prototype.commandValue;
    /** @type {?} */
    CommandDirective.prototype.stopPropagation;
    /** @type {?} */
    CommandDirective.prototype.commandNextFocus;
    /** @type {?} */
    CommandDirective.prototype.setEnabled;
    /**
     * @type {?}
     * @private
     */
    CommandDirective.prototype.canExecute$$;
    /**
     * @type {?}
     * @private
     */
    CommandDirective.prototype.isExecuting$$;
    /**
     * @type {?}
     * @private
     */
    CommandDirective.prototype.config;
    /**
     * @type {?}
     * @private
     */
    CommandDirective.prototype.ownDisabledState;
    /**
     * @type {?}
     * @private
     */
    CommandDirective.prototype.commandDisabledChanged;
    /**
     * @type {?}
     * @private
     */
    CommandDirective.prototype.renderer;
    /**
     * @type {?}
     * @private
     */
    CommandDirective.prototype.element;
}
/**
 * @record
 */
function CommandOptions() { }
if (false) {
    /**
     * Css Class which gets added/removed on the Command element's host while Command isExecuting$.
     *
     * @type {?}
     */
    CommandOptions.prototype.executingCssClass;
}
/**
 * @record
 */
function ICommand() { }
if (false) {
    /** @type {?} */
    ICommand.prototype.executingParam;
    /**
     * Determines whether the command is currently executing.
     * @type {?}
     */
    ICommand.prototype.isExecuting;
    /** @type {?|undefined} */
    ICommand.prototype.isExecuting$;
    /**
     * Determines whether the command can execute or not.
     * @type {?}
     */
    ICommand.prototype.canExecute;
    /** @type {?|undefined} */
    ICommand.prototype.canExecute$;
    /**
     * Execute function to invoke.
     * @param {?=} value
     * @return {?}
     */
    ICommand.prototype.execute = function (value) { };
    /**
     * Execute function to invoke and return a result in Promise.
     * @param {?=} value
     * @return {?}
     */
    ICommand.prototype.executeWithResult = function (value) { };
    /**
     * Disposes all resources held by subscriptions.
     * @return {?}
     */
    ICommand.prototype.destroy = function () { };
    /**
     * @return {?}
     */
    ICommand.prototype.verifyCommandExecutionPipe = function () { };
    /**
     * @param {?} element
     * @return {?}
     */
    ICommand.prototype.setNextFocus = function (element) { };
    /**
     * @param {?} enable
     * @return {?}
     */
    ICommand.prototype.setEnabledValue = function (enable) { };
}
/**
 * Command object used to encapsulate information which is needed to perform an action.
 */
class Command {
    /**
     * Creates an instance of Command.
     * @param {?} executeParam
     * @param {?=} canExecute$
     * @param {?=} isAsync
     * @param {?=} delay
     */
    constructor(executeParam, canExecute$, isAsync, delay) {
        this.executeParam = executeParam;
        this.isAsync = isAsync;
        this.delay = delay;
        this.isExecuting = false;
        this.isExecuting$ = new BehaviorSubject(false);
        this.canExecute = true;
        this.executionPipe$ = new Subject();
        this.setEnabled = true;
        if (canExecute$) {
            this.canExecute$ = combineLatest(this.isExecuting$, canExecute$, (/**
             * @param {?} isExecuting
             * @param {?} canExecuteResult
             * @return {?}
             */
            (isExecuting, canExecuteResult) => {
                // console.log('[command::combineLatest$] update!', { isExecuting, canExecuteResult });
                this.isExecuting = isExecuting;
                this.canExecute = !isExecuting && canExecuteResult;
                return this.canExecute;
            }));
            this.canExecute$$ = this.canExecute$.subscribe();
        }
        else {
            this.canExecute$ = this.isExecuting$.pipe(map((/**
             * @param {?} x
             * @return {?}
             */
            x => {
                /** @type {?} */
                const canExecute = !x;
                this.canExecute = canExecute;
                return canExecute;
            })));
            this.isExecuting$$ = this.isExecuting$.pipe(tap((/**
             * @param {?} x
             * @return {?}
             */
            x => this.isExecuting = x)))
                .subscribe();
        }
        this.buildExecutionPipe(executeParam, isAsync, delay);
    }
    /**
     * @return {?}
     */
    verifyCommandExecutionPipe() {
        if (this.executionPipe$.observers.length === 0) {
            this.buildExecutionPipe(this.executeParam, this.isAsync, this.delay);
        }
    }
    /**
     * @param {?=} value
     * @return {?}
     */
    execute(value) {
        this.executingParam = value;
        this.executionPipe$.next(value);
    }
    /**
     * @param {?=} value
     * @return {?}
     */
    executeWithResult(value) {
        return __awaiter(this, void 0, void 0, function* () {
            this.executingParam = value;
            this.executionPipe$.next(value);
            return yield this.result;
        });
    }
    /**
     * @return {?}
     */
    destroy() {
        if (this.executionPipe$$) {
            this.executionPipe$$.unsubscribe();
        }
        if (this.canExecute$$) {
            this.canExecute$$.unsubscribe();
        }
        if (this.isExecuting$$) {
            this.isExecuting$$.unsubscribe();
        }
        if (this.isExecuting$) {
            this.isExecuting$.complete();
        }
        if (this.asyncAction != null) {
            this.asyncAction = null;
            this.resultAsyncAction = null;
        }
    }
    /**
     * @private
     * @param {?} executeParm
     * @param {?=} isAsync
     * @param {?=} delay
     * @return {?}
     */
    buildExecutionPipe(executeParm, isAsync, delay) {
        /** @type {?} */
        let pipe$ = this.executionPipe$.pipe(filter((/**
         * @return {?}
         */
        () => this.canExecute)), tap((/**
         * @return {?}
         */
        () => {
            this.isExecuting$.next(true);
            if (isAsync && this.asyncAction != null) {
                this.resultAsyncAction = this.asyncAction(undefined);
            }
        })));
        pipe$ = isAsync
            ? pipe$.pipe(switchMap((/**
             * @param {?} value
             * @return {?}
             */
            (value) => {
                if (delay && delay > 0) {
                    if (this.delaySubscribe) {
                        this.delaySubscribe.unsubscribe();
                    }
                    /** @type {?} */
                    const delayTimer = timer(delay);
                    this.delaySubscribe = delayTimer.subscribe((/**
                     * @param {?} t
                     * @return {?}
                     */
                    t => { executeParm(value); }));
                    return Promise.resolve(null);
                }
                else {
                    /** @type {?} */
                    const result = executeParm(value);
                    return Promise.resolve(result);
                }
            })))
            : pipe$.pipe(tap((/**
             * @param {?} value
             * @return {?}
             */
            (value) => { executeParm(value); })));
        pipe$ = pipe$.pipe(tap((/**
         * @return {?}
         */
        () => {
            // console.log('[command::excutionPipe$] do#2 - set idle');
            this.isExecuting$.next(false);
            this.executingParam = undefined;
            if (isAsync && this.asyncAction != null) {
                this.resultAsyncAction = this.asyncAction(this.resultAsyncAction);
            }
            OnReturnDirective.setNextFocus(this.elementNextFocus, this.setEnabled);
        }), (/**
         * @param {?} e
         * @return {?}
         */
        (e) => {
            console.log('[command::excutionPipe$] do#2 error - set idle' + e.toString());
            this.isExecuting$.next(false);
            this.executingParam = undefined;
            if (isAsync && this.asyncAction != null) {
                this.resultAsyncAction = this.asyncAction(this.resultAsyncAction);
            }
            this.buildExecutionPipe(executeParm, isAsync, delay);
        })));
        this.executionPipe$$ = pipe$.subscribe();
    }
    /**
     * @param {?} element
     * @return {?}
     */
    setNextFocus(element) {
        this.elementNextFocus = element;
    }
    /**
     * @param {?} enabled
     * @return {?}
     */
    setEnabledValue(enabled) {
        this.setEnabled = enabled;
    }
}
if (false) {
    /** @type {?} */
    Command.prototype.isExecuting;
    /** @type {?} */
    Command.prototype.isExecuting$;
    /** @type {?} */
    Command.prototype.canExecute;
    /** @type {?} */
    Command.prototype.canExecute$;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.executionPipe$;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.isExecuting$$;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.canExecute$$;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.executionPipe$$;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.elementNextFocus;
    /** @type {?} */
    Command.prototype.result;
    /** @type {?} */
    Command.prototype.asyncAction;
    /** @type {?} */
    Command.prototype.resultAsyncAction;
    /** @type {?} */
    Command.prototype.executingParam;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.delaySubscribe;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.setEnabled;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.executeParam;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.isAsync;
    /**
     * @type {?}
     * @private
     */
    Command.prototype.delay;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/strings.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
class StringsDirective {
    /**
     * @param {?} _el
     */
    constructor(_el) {
        this._el = _el;
        this.el = this._el;
    }
    /**
     * @param {?} e
     * @return {?}
     */
    onKeyDown(e) {
        if (e.key === 'Delete' || e.key === 'Tab' || e.key === 'Backspace' || e.key === 'ArrowLeft' ||
            e.altKey || e.ctrlKey || e.key === 'Home' || e.key === 'End' || e.key === 'PageDown' || e.key === 'PageUp' ||
            e.key === 'ArrowRight' || e.key === 'Control' || e.key === 'Alt' || e.key === 'Shift') {
            return;
        }
        /** @type {?} */
        const element = this._el.nativeElement.value;
        if (element && element.length >= this.maxLength) {
            e.preventDefault();
        }
    }
}
StringsDirective.decorators = [
    { type: Directive, args: [{
                // tslint:disable-next-line:directive-selector
                selector: '[maxLength]'
            },] }
];
/** @nocollapse */
StringsDirective.ctorParameters = () => [
    { type: ElementRef }
];
StringsDirective.propDecorators = {
    maxLength: [{ type: Input }],
    onKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]
};
if (false) {
    /**
     * @type {?}
     * @private
     */
    StringsDirective.prototype.el;
    /** @type {?} */
    StringsDirective.prototype.maxLength;
    /**
     * @type {?}
     * @private
     */
    StringsDirective.prototype._el;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/neo-numbers.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
class NeoNumbersDirective {
    /**
     * @param {?} el
     * @param {?} renderer
     * @param {?} model
     */
    constructor(el, renderer, model) {
        this.el = el;
        this.renderer = renderer;
        this.model = model;
        this.allowNullValue = false;
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        if ((/** @type {?} */ (this.allowNullValue)) === "")
            this.allowNullValue = true;
        this.regex = new RegExp('^\\d+$');
        this.el.nativeElement.type = "number";
    }
    /**
     * @param {?} e
     * @return {?}
     */
    blockPaste(e) {
        /** @type {?} */
        const clipboardData = e.clipboardData || window['clipboardData'];
        /** @type {?} */
        let pastedData = clipboardData.getData('text/plain').split(",").join(".");
        /** @type {?} */
        let posPoint = pastedData.lastIndexOf('.');
        if (posPoint > -1) {
            pastedData = pastedData.substring(0, posPoint).split(".").join("");
        }
        /** @type {?} */
        const onlyNumbers = Array.from(pastedData).map((/**
         * @param {?} x
         * @return {?}
         */
        x => this.isOnlyNumber(x))).reduce((/**
         * @param {?} prev
         * @param {?} el
         * @return {?}
         */
        (prev, el) => prev && el), true);
        /** @type {?} */
        const isCorrect = this.regex.test(pastedData);
        if (isCorrect && this.el.nativeElement.max && pastedData.length > this.el.nativeElement.max.length)
            pastedData = pastedData.substr(0, this.el.nativeElement.max.length);
        setTimeout((/**
         * @return {?}
         */
        () => {
            if (onlyNumbers && isCorrect) {
                this.el.nativeElement.value = pastedData;
            }
            else {
                this.el.nativeElement.value = '0';
            }
        }), 10);
    }
    /**
     * @return {?}
     */
    onfocus() {
        if (this.el.nativeElement.value == "0") {
            this.el.nativeElement.value = null;
        }
    }
    /**
     * @return {?}
     */
    onBlur() {
        /** @type {?} */
        let current = this.el.nativeElement.value;
        if (current == "") {
            if (this.allowNullValue) {
                this.el.nativeElement.value = null;
                this.model.control.setValue(null);
            }
            else {
                this.el.nativeElement.value = "0";
                this.model.control.setValue(0);
            }
        }
        else {
            this.el.nativeElement.type = "text";
            this.el.nativeElement.type = "number";
            if (this.el.nativeElement.max && this.el.nativeElement.valueAsNumber > +this.el.nativeElement.max) {
                this.el.nativeElement.value = this.el.nativeElement.max;
                this.model.control.setValue(this.el.nativeElement.valueAsNumber);
            }
        }
    }
    /**
     * @param {?} event
     * @return {?}
     */
    onKeyUp(event) {
        console.log(event);
        /** @type {?} */
        let current = this.el.nativeElement.value;
        current = current.split("-").join("");
        /** @type {?} */
        let posPoint = current.indexOf('.');
        if (posPoint > -1) {
            current = current.substring(0, posPoint);
            this.el.nativeElement.value = current;
        }
        if (this.isSpecial(event) || current == "") {
            if (event.keyCode == 8 || current != "") {
                this.prev = current;
            }
            return;
        }
        if (!this.isOnlyNumber(event)) {
            event.preventDefault();
            event.stopPropagation();
            return false;
        }
        if (this.el.nativeElement.max && this.el.nativeElement.valueAsNumber > +this.el.nativeElement.max) {
            this.el.nativeElement.value = current.substring(0, current.length - 1);
        }
    }
    /**
     * @param {?} event
     * @return {?}
     */
    onKeyDown(event) {
        if (this.isSpecial(event)) {
            return;
        }
        if (!this.isOnlyNumber(event)) {
            event.preventDefault();
            event.stopPropagation();
            return false;
        }
        /** @type {?} */
        let current = this.el.nativeElement.value;
        this.prev = current;
    }
    /**
     * @private
     * @param {?} e
     * @return {?}
     */
    isSpecial(e) {
        return e.key === 'Delete' || (e.key === 'Tab' || e.keyCode == 9) || (e.key === 'Backspace' || e.keyCode == 8) || e.key === 'ArrowLeft' ||
            e.altKey || e.ctrlKey || e.key === 'Home' || e.key === 'End' || e.key === 'PageDown' || e.key === 'PageUp' ||
            e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'ArrowRight' || e.key === 'Control' || e.key === 'Alt' || e.key === 'Shift' ||
            (((/** @type {?} */ (e))).keyIdentifier == 'Down' || ((/** @type {?} */ (e))).keyIdentifier == 'Up' || ((/** @type {?} */ (e))).keyIdentifier == 'Left' || ((/** @type {?} */ (e))).keyIdentifier == 'Right');
    }
    /**
     * @private
     * @param {?} e
     * @return {?}
     */
    isOnlyNumber(e) {
        if (e instanceof KeyboardEvent) {
            return ((e.key >= '0' && e.key <= '9') || (e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105));
        }
        else {
            return (e >= '0' && e <= '9');
        }
    }
}
NeoNumbersDirective.decorators = [
    { type: Directive, args: [{
                selector: '[isNumber]'
            },] }
];
/** @nocollapse */
NeoNumbersDirective.ctorParameters = () => [
    { type: ElementRef },
    { type: Renderer2 },
    { type: NgModel }
];
NeoNumbersDirective.propDecorators = {
    isNumber: [{ type: Input }],
    allowNullValue: [{ type: Input, args: ['allowNullValue',] }],
    blockPaste: [{ type: HostListener, args: ['paste', ['$event'],] }],
    onfocus: [{ type: HostListener, args: ['focus',] }],
    onBlur: [{ type: HostListener, args: ['blur',] }],
    onKeyUp: [{ type: HostListener, args: ['keyup', ['$event'],] }],
    onKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]
};
if (false) {
    /** @type {?} */
    NeoNumbersDirective.prototype.isNumber;
    /** @type {?} */
    NeoNumbersDirective.prototype.allowNullValue;
    /**
     * @type {?}
     * @private
     */
    NeoNumbersDirective.prototype.prev;
    /**
     * @type {?}
     * @private
     */
    NeoNumbersDirective.prototype.regex;
    /**
     * @type {?}
     * @private
     */
    NeoNumbersDirective.prototype.el;
    /**
     * @type {?}
     * @private
     */
    NeoNumbersDirective.prototype.renderer;
    /**
     * @type {?}
     * @private
     */
    NeoNumbersDirective.prototype.model;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/ngb-tabset.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/**
 * @author jcangelosi
 */
class NgbTabSetDirective {
    /**
     * @param {?} _el
     */
    constructor(_el) {
        this._el = _el;
        this.el = this._el;
        this.onTabChanging = false;
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        if (this.tabSelectedId) {
            this.tabSelectedIdSubscribe = this.tabSelectedId.subscribe((/**
             * @param {?} tabSelectedId
             * @return {?}
             */
            (tabSelectedId) => {
                if (tabSelectedId.length > 0) {
                    /** @type {?} */
                    const tabs = (/** @type {?} */ (this.el));
                    // const previousValue = this.tabSelectedId.value;
                    if (tabs.activeId !== tabSelectedId) {
                        tabs.select(tabSelectedId);
                    }
                }
            }));
        }
    }
    /**
     * @return {?}
     */
    ngOnDestroy() {
        if (this.tabSelectedIdSubscribe) {
            this.tabSelectedIdSubscribe.unsubscribe();
        }
    }
    /**
     * @param {?} $event
     * @return {?}
     */
    onTabChange($event) {
        return __awaiter(this, void 0, void 0, function* () {
            if (this.onTabChanging) {
                return;
            }
            this.onTabChanging = true;
            if (this.tabChangeController) {
                $event.preventDefault();
                if (yield this.tabChangeController.canChangeTab()) {
                    this.cambiarTab($event, true);
                }
            }
            else {
                this.cambiarTab($event);
            }
            this.onTabChanging = false;
        });
    }
    /**
     * @private
     * @param {?} $event
     * @param {?=} force
     * @return {?}
     */
    cambiarTab($event, force = false) {
        /** @type {?} */
        const tabSelecting = $event.nextId;
        if (force || this.tabSelectedId.value !== tabSelecting) {
            this.tabSelectedId.next(tabSelecting);
        }
    }
}
NgbTabSetDirective.decorators = [
    { type: Directive, args: [{
                // tslint:disable-next-line:directive-selector
                selector: '[tabSelectedId], [tabChangeController]',
            },] }
];
/** @nocollapse */
NgbTabSetDirective.ctorParameters = () => [
    { type: NgbTabset }
];
NgbTabSetDirective.propDecorators = {
    tabSelectedId: [{ type: Input }],
    tabChangeController: [{ type: Input }],
    onTabChange: [{ type: HostListener, args: ['tabChange', ['$event'],] }]
};
if (false) {
    /**
     * @type {?}
     * @protected
     */
    NgbTabSetDirective.prototype.el;
    /**
     * @type {?}
     * @protected
     */
    NgbTabSetDirective.prototype.tabSelectedIdSubscribe;
    /** @type {?} */
    NgbTabSetDirective.prototype.tabSelectedId;
    /** @type {?} */
    NgbTabSetDirective.prototype.tabChangeController;
    /**
     * @type {?}
     * @protected
     */
    NgbTabSetDirective.prototype.onTabChanging;
    /**
     * @type {?}
     * @protected
     */
    NgbTabSetDirective.prototype._el;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/neo-autofocus.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
class NeoAutofocusDirective {
    /**
     * @param {?} el
     */
    constructor(el) {
        this.el = el;
    }
    /**
     * @return {?}
     */
    ngOnInit() {
    }
    /**
     * @return {?}
     */
    ngAfterViewInit() {
        this.subscription = timer(100).subscribe((/**
         * @return {?}
         */
        () => {
            if (this.neoAutofocus) {
                this.setFocus();
            }
            this.subscription.unsubscribe();
        }));
    }
    /**
     * @private
     * @return {?}
     */
    setFocus() {
        if (this.el) {
            if (this.el instanceof HTMLInputElement ||
                this.el instanceof HTMLButtonElement ||
                this.el instanceof HTMLSelectElement ||
                this.el instanceof HTMLSelectElement) {
                if (!this.el.disabled) {
                    this.el.focus();
                }
            }
            else {
                if (this.el && this.el.nativeElement instanceof HTMLInputElement ||
                    this.el.nativeElement instanceof HTMLButtonElement ||
                    this.el.nativeElement instanceof HTMLSelectElement) {
                    if (!this.el.nativeElement.disabled) {
                        this.el.nativeElement.focus();
                    }
                }
                else {
                    /** @type {?} */
                    let input = this.el['ctrInput'];
                    if (input) {
                        input = input['nativeElement'];
                        if (input && input instanceof HTMLInputElement) {
                            if (!input.disabled) {
                                input.focus();
                            }
                        }
                    }
                }
            }
        }
    }
}
NeoAutofocusDirective.decorators = [
    { type: Directive, args: [{
                selector: '[neoAutofocus]'
            },] }
];
/** @nocollapse */
NeoAutofocusDirective.ctorParameters = () => [
    { type: ElementRef }
];
NeoAutofocusDirective.propDecorators = {
    neoAutofocus: [{ type: Input, args: ['neoAutofocus',] }]
};
if (false) {
    /** @type {?} */
    NeoAutofocusDirective.prototype.neoAutofocus;
    /**
     * @type {?}
     * @private
     */
    NeoAutofocusDirective.prototype.subscription;
    /**
     * @type {?}
     * @private
     */
    NeoAutofocusDirective.prototype.el;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/neo-changecommand.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
class NeoChangeCommandDirective {
    /**
     * @param {?} element
     */
    constructor(element) {
        this.element = element;
    }
    /**
     * @param {?} event
     * @return {?}
     */
    onInputChange(event) {
        /** @type {?} */
        const value = this.element.nativeElement.value;
        if (!this._lastValue || this._lastValue !== value) {
            this._lastValue = value;
            this.changeCommand.execute(value);
        }
    }
}
NeoChangeCommandDirective.decorators = [
    { type: Directive, args: [{
                // tslint:disable-next-line:directive-selector
                selector: '[changeCommand]'
            },] }
];
/** @nocollapse */
NeoChangeCommandDirective.ctorParameters = () => [
    { type: ElementRef }
];
NeoChangeCommandDirective.propDecorators = {
    changeCommand: [{ type: Input }],
    onInputChange: [{ type: HostListener, args: ['keyup', ['$event'],] }]
};
if (false) {
    /** @type {?} */
    NeoChangeCommandDirective.prototype.changeCommand;
    /**
     * @type {?}
     * @private
     */
    NeoChangeCommandDirective.prototype._lastValue;
    /**
     * @type {?}
     * @private
     */
    NeoChangeCommandDirective.prototype.element;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/neo-decimalNumbers.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
class NeoDecimalNumbersDirective {
    /**
     * @param {?} el
     * @param {?} renderer
     * @param {?} model
     */
    constructor(el, renderer, model) {
        this.el = el;
        this.renderer = renderer;
        this.model = model;
        this.decimals = 2;
        this.allowNullValue = false;
        this.haveDecimalPoint = false;
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        if ((/** @type {?} */ (this.decimals)) == "")
            this.decimals = 2;
        if ((/** @type {?} */ (this.allowNullValue)) === "")
            this.allowNullValue = true;
        this.el.nativeElement.type = "number";
        this.regex = new RegExp('^[0-9]+(\\.[0-9]{0,' + this.decimals + '})?$');
    }
    /**
     * @param {?} e
     * @return {?}
     */
    blockPaste(e) {
        /** @type {?} */
        const clipboardData = e.clipboardData || window['clipboardData'];
        /** @type {?} */
        let pastedData = clipboardData.getData('text/plain').split(",").join(".");
        /** @type {?} */
        let posPoint = pastedData.lastIndexOf('.');
        if (posPoint > -1) {
            pastedData = pastedData.substring(0, posPoint).split(".").join("") + pastedData.substring(posPoint);
            posPoint = pastedData.lastIndexOf('.');
            if (posPoint + this.decimals < pastedData.length) {
                pastedData = pastedData.substring(0, posPoint + this.decimals + 1);
            }
        }
        /** @type {?} */
        const onlyNumbers = Array.from(pastedData).map((/**
         * @param {?} x
         * @return {?}
         */
        x => this.isNumber(x))).reduce((/**
         * @param {?} prev
         * @param {?} el
         * @return {?}
         */
        (prev, el) => prev && el), true);
        /** @type {?} */
        const a = this.regex.test(pastedData);
        setTimeout((/**
         * @return {?}
         */
        () => {
            if (onlyNumbers && a) {
                this.el.nativeElement.value = pastedData;
            }
            else {
                this.el.nativeElement.value = '0';
            }
        }), 10);
    }
    /**
     * @return {?}
     */
    onfocus() {
        if (this.el.nativeElement.value == "0") {
            this.el.nativeElement.value = null;
        }
    }
    /**
     * @return {?}
     */
    onBlur() {
        /** @type {?} */
        let current = this.el.nativeElement.value;
        if (current == "") {
            if (this.allowNullValue) {
                this.el.nativeElement.value = null;
                this.model.control.setValue(null);
            }
            else {
                this.el.nativeElement.value = "0";
                this.model.control.setValue(0);
            }
        }
        else {
            this.el.nativeElement.type = "text";
            this.el.nativeElement.type = "number";
            if (this.el.nativeElement.max && this.el.nativeElement.valueAsNumber > +this.el.nativeElement.max) {
                this.el.nativeElement.value = this.el.nativeElement.max;
                this.model.control.setValue(this.el.nativeElement.valueAsNumber);
            }
        }
    }
    /**
     * @param {?} event
     * @return {?}
     */
    onKeyUp(event) {
        /** @type {?} */
        let current = this.el.nativeElement.value;
        current = current.split("-").join("");
        /** @type {?} */
        let posPoint = current.indexOf('.');
        if (posPoint > -1) {
            this.el.nativeElement.value = current.substring(0, posPoint + 1) + current.substring(posPoint).split(".").join("");
        }
        if (this.haveDecimalPoint && current == "" && this.prev > "") {
            this.haveDecimalPoint = false;
            this.el.nativeElement.value = this.prev + (this.prev.endsWith(".0") ? "" : ".0");
            this.el.nativeElement.type = "text";
            this.el.nativeElement.selectionStart = this.el.nativeElement.value.length - 1;
            this.el.nativeElement.selectionEnd = this.el.nativeElement.value.length;
            this.el.nativeElement.type = "number";
            return;
        }
        if (this.isSpecial(event) || current == "") {
            if (event.keyCode == 8 || current != "") {
                this.prev = current;
                /** @type {?} */
                const dotIndex = current.toString().indexOf('.');
                if (dotIndex >= 0)
                    this.haveDecimalPoint = false;
            }
            return;
        }
        if (!this.isNumber(event)) {
            event.preventDefault();
            event.stopPropagation();
            return false;
        }
        if (current) {
            current = current.toString();
            /** @type {?} */
            const dotIndex = current.indexOf('.');
            if ((dotIndex >= 0) && ((current.length - 1) - dotIndex > this.decimals)) {
                this.renderer.setProperty(this.el.nativeElement, 'value', current.slice(0, dotIndex + this.decimals + 1));
            }
        }
        else {
            this.renderer.setProperty(this.el.nativeElement, 'value', this.prev);
        }
    }
    /**
     * @param {?} event
     * @return {?}
     */
    onKeyDown(event) {
        if (this.isSpecial(event)) {
            return;
        }
        if (!this.isNumber(event)) {
            event.preventDefault();
            event.stopPropagation();
            return false;
        }
        /** @type {?} */
        let current = this.el.nativeElement.value;
        if (this.isDecimalPoint(event)) {
            this.haveDecimalPoint = true;
            if (!current.endsWith(".0")) {
                this.el.nativeElement.value = current + ".0";
                this.el.nativeElement.type = "text";
                this.el.nativeElement.selectionStart = this.el.nativeElement.value.length - 1;
                this.el.nativeElement.selectionEnd = this.el.nativeElement.value.length;
                this.el.nativeElement.type = "number";
            }
        }
        this.prev = current;
    }
    /**
     * @private
     * @param {?} e
     * @return {?}
     */
    isSpecial(e) {
        return e.key === 'Delete' || (e.key === 'Tab' || e.keyCode == 9) || (e.key === 'Backspace' || e.keyCode == 8) || e.key === 'ArrowLeft' ||
            e.altKey || e.ctrlKey || e.key === 'Home' || e.key === 'End' || e.key === 'PageDown' || e.key === 'PageUp' ||
            e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'ArrowRight' || e.key === 'Control' || e.key === 'Alt' || e.key === 'Shift' ||
            (((/** @type {?} */ (e))).keyIdentifier == 'Down' || ((/** @type {?} */ (e))).keyIdentifier == 'Up');
    }
    /**
     * @private
     * @param {?} e
     * @return {?}
     */
    isNumber(e) {
        if (e instanceof KeyboardEvent) {
            return ((e.key >= '0' && e.key <= '9') || ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) ||
                (e.key === '.' || e.key === ',') || (e.keyCode === 188 || e.keyCode === 190 || e.keyCode === 229));
        }
        else {
            return ((e >= '0' && e <= '9') || (e === '.' || e === ','));
        }
    }
    /**
     * @private
     * @param {?} e
     * @return {?}
     */
    isDecimalPoint(e) {
        return (e.key === '.' || e.key === ',') || (e.keyCode === 188 || e.keyCode === 190 || e.keyCode === 229);
    }
}
NeoDecimalNumbersDirective.decorators = [
    { type: Directive, args: [{
                selector: '[isDecimal]',
            },] }
];
/** @nocollapse */
NeoDecimalNumbersDirective.ctorParameters = () => [
    { type: ElementRef },
    { type: Renderer2 },
    { type: NgModel }
];
NeoDecimalNumbersDirective.propDecorators = {
    decimals: [{ type: Input, args: ['isDecimal',] }],
    allowNullValue: [{ type: Input, args: ['allowNullValue',] }],
    blockPaste: [{ type: HostListener, args: ['paste', ['$event'],] }],
    onfocus: [{ type: HostListener, args: ['focus',] }],
    onBlur: [{ type: HostListener, args: ['blur',] }],
    onKeyUp: [{ type: HostListener, args: ['keyup', ['$event'],] }],
    onKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]
};
if (false) {
    /** @type {?} */
    NeoDecimalNumbersDirective.prototype.decimals;
    /** @type {?} */
    NeoDecimalNumbersDirective.prototype.allowNullValue;
    /**
     * @type {?}
     * @private
     */
    NeoDecimalNumbersDirective.prototype.prev;
    /**
     * @type {?}
     * @private
     */
    NeoDecimalNumbersDirective.prototype.regex;
    /**
     * @type {?}
     * @private
     */
    NeoDecimalNumbersDirective.prototype.haveDecimalPoint;
    /**
     * @type {?}
     * @private
     */
    NeoDecimalNumbersDirective.prototype.el;
    /**
     * @type {?}
     * @private
     */
    NeoDecimalNumbersDirective.prototype.renderer;
    /**
     * @type {?}
     * @private
     */
    NeoDecimalNumbersDirective.prototype.model;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/composite-input/commandKey.function.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/**
 * Boolean function that check if the keyboard event is not a normal key but a command like key
 * Will return boolean if the key is Alt, Shift , Control, Delete, Tab, Backspace, Arrows, Home, End, PageUp and PageDown.
 *
 * @export
 * @param {?} e
 * @return {?}
 */
function isCommandKey(e) {
    return e.key === 'Delete' || e.key === 'Tab' || e.key === 'Backspace' || e.key === 'ArrowLeft' || e.key === 'Left' ||
        e.altKey || e.ctrlKey || e.key === 'Home' || e.key === 'End' || e.key === 'PageDown' || e.key === 'PageUp' ||
        e.key === 'ArrowRight' || e.key === 'Right' || e.key === 'Control' || e.key === 'Alt' || e.key === 'Shift';
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/composite-input/composite-input.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
class NeoCompositeInputDirective {
    /**
     * @param {?} el
     */
    constructor(el) {
        this.el = el;
        // Next input to move from the current input
        this.previousInput = null;
        // Previous input to move from the current input
        this.nextInput = null;
    }
    /**
     * @param {?} e
     * @return {?}
     */
    onKeyDown(e) {
        // If the element is selected and the user presses backspace we must clear the input
        if (e.key === 'Backspace' && this.elementIsSelected()) {
            return true;
        }
        // We must move to the previous input if the user presses backspace and he is in the first position of the input
        // or if he presses the left key
        if (((e.key === 'Backspace') && (this.el.nativeElement.selectionStart === 0) || ((e.key === 'ArrowLeft') || (e.key === 'Left')))) {
            if ((this.previousInput) && (this.previousInput instanceof HTMLInputElement) && (!this.previousInput.disabled)) {
                this.previousInput.focus();
                return false;
            }
        }
        // If he presses the right arrow it must move to the next input
        if (e.key === 'ArrowRight' || e.key === 'Right') {
            if ((this.nextInput) && (this.nextInput instanceof HTMLInputElement) && (!this.nextInput.disabled)) {
                this.nextInput.focus();
                return false;
            }
        }
    }
    /**
     *
     * Method called on keyup to check if the pressed key is allow, if it is not it stops the event.
     * If the element reached its maximum length on key pressed it must jump to the next input
     * @param {?} e
     * @return {?}
     */
    onKeyUp(e) {
        if (isCommandKey(e)) {
            return;
        }
        /** @type {?} */
        const value = this.el.nativeElement.value;
        if (this.nextInput && (value.length >= this.el.nativeElement.maxLength)) {
            this.nextInput.focus();
        }
    }
    /**
     * On focus we select the entire value of the input
     * @return {?}
     */
    onFocus() {
        this.el.nativeElement.select();
    }
    /**
     * Method to check if the element is selected
     *
     * @private
     * @return {?}
     */
    elementIsSelected() {
        return this.el.nativeElement.selectionStart === 0 && this.el.nativeElement.selectionEnd !== 0;
    }
}
NeoCompositeInputDirective.decorators = [
    { type: Directive, args: [{
                selector: '[compositeInput]'
            },] }
];
/** @nocollapse */
NeoCompositeInputDirective.ctorParameters = () => [
    { type: ElementRef }
];
NeoCompositeInputDirective.propDecorators = {
    previousInput: [{ type: Input }],
    nextInput: [{ type: Input }],
    onKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }],
    onKeyUp: [{ type: HostListener, args: ['keyup', ['$event'],] }],
    onFocus: [{ type: HostListener, args: ['focus', [],] }]
};
if (false) {
    /** @type {?} */
    NeoCompositeInputDirective.prototype.previousInput;
    /** @type {?} */
    NeoCompositeInputDirective.prototype.nextInput;
    /**
     * @type {?}
     * @private
     */
    NeoCompositeInputDirective.prototype.el;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/neo-matchheight.directive.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
class NeoMatchHeightDirective {
    /**
     * @param {?} el
     */
    constructor(el) {
        this.el = el;
    }
    /**
     * @return {?}
     */
    onResize() {
        this.matchHeight(this.el.nativeElement, this.matchHeightClassName);
    }
    /**
     * @return {?}
     */
    ngAfterViewChecked() {
        this.matchHeight(this.el.nativeElement, this.matchHeightClassName);
    }
    /**
     * @param {?} parent
     * @param {?} className
     * @return {?}
     */
    matchHeight(parent, className) {
        if (!parent) {
            return;
        }
        // step 1: find all the child elements with the selected class name
        /** @type {?} */
        const children = parent.getElementsByClassName(className);
        if (!children) {
            return;
        }
        // step 1b: reset all children height
        Array.from(children).forEach((/**
         * @param {?} x
         * @return {?}
         */
        (x) => {
            x.style.height = 'initial';
        }));
        // step 2a: get all the child elements heights
        /** @type {?} */
        const itemHeights = Array.from(children)
            .map((/**
         * @param {?} x
         * @return {?}
         */
        x => x.getBoundingClientRect().height));
        // step 2b: find out the tallest
        /** @type {?} */
        const maxHeight = itemHeights.reduce((/**
         * @param {?} prev
         * @param {?} curr
         * @return {?}
         */
        (prev, curr) => {
            return curr > prev ? curr : prev;
        }), 0);
        // step 3: update all the child elements to the tallest height
        Array.from(children)
            .forEach((/**
         * @param {?} x
         * @return {?}
         */
        (x) => x.style.height = `${maxHeight}px`));
    }
}
NeoMatchHeightDirective.decorators = [
    { type: Directive, args: [{
                selector: '[neoMatchHeight]'
            },] }
];
/** @nocollapse */
NeoMatchHeightDirective.ctorParameters = () => [
    { type: ElementRef }
];
NeoMatchHeightDirective.propDecorators = {
    matchHeightClassName: [{ type: Input, args: ['neoMatchHeight',] }],
    onResize: [{ type: HostListener, args: ['window:resize',] }]
};
if (false) {
    /** @type {?} */
    NeoMatchHeightDirective.prototype.matchHeightClassName;
    /**
     * @type {?}
     * @private
     */
    NeoMatchHeightDirective.prototype.el;
}

/**
 * @fileoverview added by tsickle
 * Generated from: lib/ngx-neo-directives.module.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
class NgxNeoDirectivesModule {
    /**
     * @param {?=} options
     * @return {?}
     */
    static forRoot(options = { executingCssClass: 'executing' }) {
        return {
            ngModule: NgxNeoDirectivesModule,
            providers: [
                { provide: COMMAND_CONFIG, useValue: options },
            ]
        };
    }
}
NgxNeoDirectivesModule.decorators = [
    { type: NgModule, args: [{
                imports: [],
                declarations: [
                    CommandDirective,
                    OnReturnDirective,
                    StringsDirective,
                    NeoNumbersDirective,
                    NgbTabSetDirective,
                    NeoAutofocusDirective,
                    NeoChangeCommandDirective,
                    NeoDecimalNumbersDirective,
                    NeoCompositeInputDirective,
                    NeoMatchHeightDirective,
                ],
                exports: [
                    CommandDirective,
                    OnReturnDirective,
                    StringsDirective,
                    NeoNumbersDirective,
                    NgbTabSetDirective,
                    NeoAutofocusDirective,
                    NeoChangeCommandDirective,
                    NeoDecimalNumbersDirective,
                    NeoCompositeInputDirective,
                    NeoMatchHeightDirective
                ]
            },] }
];

/**
 * @fileoverview added by tsickle
 * Generated from: lib/models.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
/**
 * @record
 */
function ITabChangeController() { }
if (false) {
    /**
     * @return {?}
     */
    ITabChangeController.prototype.canChangeTab = function () { };
}

/**
 * @fileoverview added by tsickle
 * Generated from: public_api.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */

/**
 * @fileoverview added by tsickle
 * Generated from: neocomplexx-ngx-neo-directives.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */

export { COMMAND_CONFIG, COMMAND_DEFAULT_CONFIG, Command, CommandDirective, NeoAutofocusDirective, NeoChangeCommandDirective, NeoCompositeInputDirective, NeoDecimalNumbersDirective, NeoMatchHeightDirective, NeoNumbersDirective, NgbTabSetDirective, NgxNeoDirectivesModule, OnReturnDirective, StringsDirective, isCommandKey };
//# sourceMappingURL=neocomplexx-ngx-neo-directives.js.map