import { AXPColumnWidgetComponent } from '@acorex/platform/layout/widget-core';
import * as i0 from '@angular/core';
import { computed, ChangeDetectionStrategy, Component } from '@angular/core';

class AXPIconChooserWidgetColumnComponent extends AXPColumnWidgetComponent {
    constructor() {
        super(...arguments);
        this.parseValue = (value) => {
            if (!value) {
                return undefined;
            }
            if (typeof value === 'string') {
                const parts = value.split(' ');
                if (parts.length === 1) {
                    return { styleClass: 'fa-solid', iconClass: parts[0] };
                }
                if (parts.length === 2) {
                    return { styleClass: parts[0], iconClass: parts[1] };
                }
                return undefined;
            }
            return value;
        };
        this.title = computed(() => {
            const parsed = this.parseValue(this.rawValue);
            return parsed?.label ?? '';
        }, ...(ngDevMode ? [{ debugName: "title" }] : []));
        this.icon = computed(() => {
            const parsed = this.parseValue(this.rawValue);
            return parsed ? `${parsed.styleClass} ${parsed.iconClass}` : '';
        }, ...(ngDevMode ? [{ debugName: "icon" }] : []));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPIconChooserWidgetColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: AXPIconChooserWidgetColumnComponent, isStandalone: true, selector: "ax-icon-chooser-column", inputs: { rawValue: "rawValue" }, usesInheritance: true, ngImport: i0, template: `
    <div class="ax-flex ax-items-center ax-justify-center ax-h-full">
      <i [class]="icon()"></i>
    </div>
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPIconChooserWidgetColumnComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'ax-icon-chooser-column',
                    template: `
    <div class="ax-flex ax-items-center ax-justify-center ax-h-full">
      <i [class]="icon()"></i>
    </div>
  `,
                    inputs: ['rawValue'],
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

export { AXPIconChooserWidgetColumnComponent };
//# sourceMappingURL=acorex-platform-themes-shared-icon-chooser-column.component-Cmju9l91.mjs.map
