import { __decorate } from "tslib";
import { Component, Input } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
let SliderComponent = class SliderComponent {
    /**
     * Initialise Services
     * @param formBuilder
     */
    constructor(formBuilder) {
        this.formBuilder = formBuilder;
        /**
         * @description
         * Control Name
         */
        this.min = 0;
        /**
         * @description
         * Control Name
         */
        this.max = 100;
        /**
         * @description
         * Control Name
         */
        this.step = 1;
        /**
         * @description
         * Control Name
         */
        this.unit = '%';
        /**
         * @description
         * Control Name
         */
        this.defaultValue = null;
        /**
         * @description
         * Control Name
         */
        this.controlName = '';
        /**
         * @description
         * Icon type to show on both sides of Silder
         */
        this.iconType = '';
        /**
         * @description
         * Icon type to show on both sides of Silder
         */
        this.withLabel = false;
        /**
         * @description
         * styling classes to add
         */
        this.class = '';
        /**
         * @description
         * Icon type to show on both sides of Silder
         */
        this.formatMultiplier = 100;
    }
    /**
     * NgOnint hook
     */
    ngOnInit() {
        this.initializeProcess();
    }
    /**
     * Initialise Form
     */
    initializeProcess() {
        if (this.controlName == 'opacity') {
            this.formatMultiplier = 100;
        }
        if (this.controlName == 'size') {
            this.formatMultiplier = 1;
        }
        this.createControl();
    }
    /**
     * Create From control for slider input fields.
     */
    createControl() {
        this.parentFrom.addControl(this.controlName, this.formBuilder.control(this.defaultValue));
        //For one & two column dynamic width.
        // if (this.controlName == 'container_width') {
        //   this.parentFrom.get('column_types').valueChanges.subscribe(
        //     value => {
        //       this.min = (value == '2' ? 1000 : 800);
        //       this.defaultValue = (value == '2' ? 1000 : 800);
        //       this.parentFrom.get(this.controlName).setValue(value == '2' ? 1000 : 800);
        //     }
        //   );
        // }
    }
    setValue(v) {
        // if (v <= 10) {
        //   v *= 100;
        // }
        this.parentFrom.get(this.controlName).setValue(v);
    }
};
SliderComponent.ctorParameters = () => [
    { type: FormBuilder }
];
__decorate([
    Input()
], SliderComponent.prototype, "min", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "max", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "step", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "unit", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "defaultValue", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "controlName", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "iconType", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "withLabel", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "class", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "formatMultiplier", void 0);
__decorate([
    Input()
], SliderComponent.prototype, "parentFrom", void 0);
SliderComponent = __decorate([
    Component({
        selector: 'ew-control-slider',
        template: "<div class=\"mat-slider-outer-part common-builder-right\"\r\n [formGroup]=\"parentFrom\"\r\n [ngClass]=\"{'slider-without-label': withLabel == false}\"\r\n [ngClass]=\"class\"\r\n>\r\n\t\r\n\t<span *ngIf=\"iconType != ''\" class=\"size-counting-equalizer decrease-label-ew\">\r\n\t\t<svg *ngIf=\"iconType == 'eyes'\" xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"7.865\" viewBox=\"0 0 14 7.865\">\r\n\t\t\t<defs>\r\n\t\t\t\t<style>\r\n\t\t\t\t\t.a-ew-open {\r\n\t\t\t\t\t\tfill: #2b2b30;\r\n\t\t\t\t\t}\r\n\t\t\t\t</style>\r\n\t\t\t</defs>\r\n\t\t\t<g transform=\"translate(0 -68)\">\r\n\t\t\t\t<g transform=\"translate(0 68)\">\r\n\t\t\t\t\t<g transform=\"translate(0 0)\">\r\n\t\t\t\t\t\t<path class=\"a-ew-open\"\r\n\t\t\t\t\t\t\td=\"M13.942,58.793a7.226,7.226,0,0,1-2.765,2.928l1.48,1.48a.547.547,0,1,1-.773.773l-1.737-1.737a8.186,8.186,0,0,1-2.6.6v2.479a.547.547,0,1,1-1.094,0V62.84a8.186,8.186,0,0,1-2.6-.6L2.117,63.975a.547.547,0,1,1-.773-.773l1.48-1.48A7.226,7.226,0,0,1,.059,58.794a.547.547,0,0,1,.976-.493A6.621,6.621,0,0,0,7,61.764,6.621,6.621,0,0,0,12.965,58.3a.547.547,0,1,1,.976.493Z\"\r\n\t\t\t\t\t\t\ttransform=\"translate(0 -58)\" />\r\n\t\t\t\t\t</g>\r\n\t\t\t\t</g>\r\n\t\t\t</g>\r\n\t\t</svg>\r\n\t\t<mat-icon *ngIf=\"iconType == 'plus_minus'\">remove</mat-icon>\r\n\t</span>\r\n\r\n\t<span class=\"mat-slider-inner\">\r\n\t\t<mat-slider [value]=\"parentFrom.value[controlName]\" (input)=\"setValue($event.value)\" min=\"{{min}}\" max=\"{{max}}\" step=\"{{step}}\"></mat-slider>\r\n\t</span>\r\n\r\n\t<span *ngIf=\"iconType != ''\" class=\"size-counting-equalizer increase-label-ew\">\r\n\t\t<svg *ngIf=\"iconType == 'eyes'\" xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"10.828\" viewBox=\"0 0 14 10.828\">\r\n\t\t\t<defs>\r\n\t\t\t\t<style>\r\n\t\t\t\t\t.a-ew-open {\r\n\t\t\t\t\t\tfill: #2b2b30;\r\n\t\t\t\t\t}\r\n\t\t\t\t</style>\r\n\t\t\t</defs>\r\n\t\t\t<g transform=\"translate(0 -58)\">\r\n\t\t\t\t<g transform=\"translate(0 58)\">\r\n\t\t\t\t\t<g transform=\"translate(0 0)\">\r\n\t\t\t\t\t\t<path class=\"a-ew-open\"\r\n\t\t\t\t\t\t\td=\"M168.464,274a2.461,2.461,0,1,0,2.461,2.461A2.464,2.464,0,0,0,168.464,274Zm0,3.828a1.367,1.367,0,1,1,1.367-1.367A1.369,1.369,0,0,1,168.464,277.828Z\"\r\n\t\t\t\t\t\t\ttransform=\"translate(-161.464 -268.094)\" />\r\n\t\t\t\t\t\t<path class=\"a-ew-open\"\r\n\t\t\t\t\t\t\td=\"M13.942,65.072a7.226,7.226,0,0,0-2.765-2.928l1.48-1.48a.547.547,0,1,0-.773-.773l-1.737,1.737a8.186,8.186,0,0,0-2.6-.6V58.547a.547.547,0,1,0-1.094,0v2.479a8.186,8.186,0,0,0-2.6.6L2.117,59.89a.547.547,0,1,0-.773.773l1.48,1.48A7.226,7.226,0,0,0,.059,65.072a.547.547,0,0,0,.976.493A6.621,6.621,0,0,1,7,62.1a6.621,6.621,0,0,1,5.965,3.463.547.547,0,1,0,.976-.493Z\"\r\n\t\t\t\t\t\t\ttransform=\"translate(0 -58)\" />\r\n\t\t\t\t\t</g>\r\n\t\t\t\t</g>\r\n\t\t\t</g>\r\n\t\t</svg>\r\n\t\t<mat-icon *ngIf=\"iconType == 'plus_minus'\">add</mat-icon>\r\n\t</span>\r\n\r\n\t<span class=\"value-count-slider\">\r\n\t\t{{ (parentFrom.value[controlName] * formatMultiplier).toFixed() }}{{ unit }}\r\n\t</span>\r\n\r\n</div>\r\n",
        styles: [""]
    })
], SliderComponent);
export { SliderComponent };
//# sourceMappingURL=data:application/json;base64, 