import { AXTranslationModule } from '@acorex/core/translation';
import * as i1 from '@acorex/platform/layout/widget-core';
import { AXPValueWidgetComponent, AXPWidgetCoreModule } from '@acorex/platform/layout/widget-core';
import * as i0 from '@angular/core';
import { inject, computed, signal, effect, ChangeDetectionStrategy, Component } from '@angular/core';
import { c as AXPTemplateWidgetProviderService } from './acorex-modules-form-template-management-acorex-modules-form-template-management-DCKQMU5_.mjs';

class AXPTemplateWidgetEditComponent extends AXPValueWidgetComponent {
    // protected allowRemove = computed<boolean>(() => this.options()['allowRemove'] as boolean ?? false);
    // protected showRemove = computed(() => {
    //   return this.allowRemove() && this.parent?.config.name != 'template';
    // });
    constructor() {
        super();
        this.metaKey = '__meta__';
        this.templateProvider = inject(AXPTemplateWidgetProviderService);
        this.templateId = computed(() => this.options()['templateId'], ...(ngDevMode ? [{ debugName: "templateId" }] : []));
        this.nodes = signal([], ...(ngDevMode ? [{ debugName: "nodes" }] : []));
        //
        effect(async () => {
            this.nodes.set([]);
            const templateId = this.templateId();
            if (templateId) {
                const item = await this.templateProvider.get(templateId);
                if (item) {
                    this.nodes.set(item.nodes);
                }
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPTemplateWidgetEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXPTemplateWidgetEditComponent, isStandalone: true, selector: "axp-template-widget-edit", usesInheritance: true, ngImport: i0, template: `
   @for (node of nodes(); track $index) {
      <ng-container axp-widget-renderer
        [node]="node"
        [parentNode]="this"
        [mode]="this.mode">
      </ng-container>
    }
    <!-- @if(nodes().length>0) {
    <ng-container>
       
    </ng-container> -->
    <!-- @if(showRemove())
    {
      <div
        class="ax-text-danger-500 hover:ax-text-danger-800  ax-mt-2 ax-text-xs ax-cursor-pointer"
        (click)="handleRemoveClick()"
      >
        {{ 'remove-template' | translate : { scope: 'form-template-management' } | async }}
      </div>
    }
    } 
    @else {
    <span
      class="ax-underline ax-decoration-dotted  ax-underline-offset-8 hover:ax-text-primary-500 ax-cursor-pointer"
      (click)="handleSelectClick()"
    >
      {{ 'choose-template' | translate : { scope: 'form-template-management' } | async }}
    </span>
    } -->
  `, isInline: true, dependencies: [{ kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "directive", type: i1.AXPWidgetRendererDirective, selector: "[axp-widget-renderer]", inputs: ["parentNode", "index", "mode", "node"], outputs: ["onOptionsChanged", "onValueChanged"], exportAs: ["widgetRenderer"] }, { kind: "ngmodule", type: AXTranslationModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPTemplateWidgetEditComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'axp-template-widget-edit',
                    template: `
   @for (node of nodes(); track $index) {
      <ng-container axp-widget-renderer
        [node]="node"
        [parentNode]="this"
        [mode]="this.mode">
      </ng-container>
    }
    <!-- @if(nodes().length>0) {
    <ng-container>
       
    </ng-container> -->
    <!-- @if(showRemove())
    {
      <div
        class="ax-text-danger-500 hover:ax-text-danger-800  ax-mt-2 ax-text-xs ax-cursor-pointer"
        (click)="handleRemoveClick()"
      >
        {{ 'remove-template' | translate : { scope: 'form-template-management' } | async }}
      </div>
    }
    } 
    @else {
    <span
      class="ax-underline ax-decoration-dotted  ax-underline-offset-8 hover:ax-text-primary-500 ax-cursor-pointer"
      (click)="handleSelectClick()"
    >
      {{ 'choose-template' | translate : { scope: 'form-template-management' } | async }}
    </span>
    } -->
  `,
                    changeDetection: ChangeDetectionStrategy.OnPush,
                    imports: [AXPWidgetCoreModule, AXTranslationModule]
                }]
        }], ctorParameters: () => [] });

export { AXPTemplateWidgetEditComponent };
//# sourceMappingURL=acorex-modules-form-template-management-template-widget-edit.component-CvEqpmfa.mjs.map
