import { Component, ChangeDetectionStrategy, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';
import { PropertiesControlBase } from '@anglr/dynamic/layout-editor';
import { BUTTONS_PRESETS } from '../tokens';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
const defaultPresets = [
    {
        text: 'primary',
        cssClass: 'btn btn-primary'
    },
    {
        text: 'info',
        cssClass: 'btn btn-info'
    },
    {
        text: 'default',
        cssClass: 'btn btn-default'
    },
    {
        text: 'success',
        cssClass: 'btn btn-success'
    },
    {
        text: 'warning',
        cssClass: 'btn btn-warning'
    },
    {
        text: 'danger',
        cssClass: 'btn btn-danger'
    },
    {
        text: 'error',
        cssClass: 'btn btn-error'
    }
];
/**
 * Component used for displaying button presets
 */
export class ButtonPresetsPropertiesControlSAComponent extends PropertiesControlBase {
    constructor() {
        var _a;
        super(...arguments);
        //######################### private properties #########################
        /**
         * Injected buttons presets
         */
        this.buttonsPresets = (_a = inject(BUTTONS_PRESETS, { optional: true })) !== null && _a !== void 0 ? _a : defaultPresets;
    }
    //######################### protected methods #########################
    /**
     * Sets button preset
     * @param cssClass
     */
    _setPreset(cssClass) {
        var _a, _b;
        (_b = (_a = this.form) === null || _a === void 0 ? void 0 : _a.get('buttonCssClass')) === null || _b === void 0 ? void 0 : _b.setValue(cssClass);
    }
}
ButtonPresetsPropertiesControlSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ButtonPresetsPropertiesControlSAComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
ButtonPresetsPropertiesControlSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.4", type: ButtonPresetsPropertiesControlSAComponent, isStandalone: true, selector: "button-presets", usesInheritance: true, ngImport: i0, template: "<div class=\"properties-form-group\" *ngIf=\"buttonsPresets?.length\">\n    <label class=\"properties-control-label\"></label>\n    <div class=\"button-presets-wrapper\">\n        <button \n            type=\"button\" \n            *ngFor=\"let preset of buttonsPresets\" \n            [ngClass]=\"preset.cssClass\"\n            (click)=\"_setPreset(preset.cssClass)\">{{preset.text}}</button>\n    </div>\n</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ButtonPresetsPropertiesControlSAComponent, decorators: [{
            type: Component,
            args: [{ selector: 'button-presets', standalone: true, imports: [
                        CommonModule,
                        ReactiveFormsModule,
                    ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"properties-form-group\" *ngIf=\"buttonsPresets?.length\">\n    <label class=\"properties-control-label\"></label>\n    <div class=\"button-presets-wrapper\">\n        <button \n            type=\"button\" \n            *ngFor=\"let preset of buttonsPresets\" \n            [ngClass]=\"preset.cssClass\"\n            (click)=\"_setPreset(preset.cssClass)\">{{preset.text}}</button>\n    </div>\n</div>" }]
        }] });
//# sourceMappingURL=buttonPresetsPropertiesControl.component.js.map