import * as i4 from '@acorex/components/button';
import { AXButtonModule } from '@acorex/components/button';
import * as i2 from '@acorex/components/decorators';
import { AXDecoratorModule } from '@acorex/components/decorators';
import { AXBasePageComponent } from '@acorex/components/page';
import * as i1 from '@acorex/components/time-line';
import { AXTimeLineModule } from '@acorex/components/time-line';
import { AXDateTimeModule } from '@acorex/core/date-time';
import { AXFormatService, AXFormatModule } from '@acorex/core/format';
import * as i6 from '@acorex/core/translation';
import { AXTranslationModule } from '@acorex/core/translation';
import * as i5 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { inject, signal, ChangeDetectionStrategy, Component } from '@angular/core';
import { AXMAppVersionService } from './acorex-modules-platform-management.mjs';
import { DomSanitizer } from '@angular/platform-browser';

class AXMListVersionComponent extends AXBasePageComponent {
    constructor() {
        super(...arguments);
        this.appVersionService = inject(AXMAppVersionService);
        this.formatService = inject(AXFormatService);
        this.sanitize = inject(DomSanitizer);
        this.versions = signal([], ...(ngDevMode ? [{ debugName: "versions" }] : []));
    }
    async ngOnInit() {
        const result = await this.appVersionService.query({
            take: 1000,
            skip: 0,
        });
        const mappedItems = result.items.map((item) => ({
            id: item.id,
            //TODO to translate
            title: `Version ${item.versionNumber} Published  at ${this.formatService.format(item.publishDate, 'datetime', {
                format: 'date',
            })}`,
            content: this.sanitize.bypassSecurityTrustHtml(item.changeLog) ?? '',
        }));
        this.versions.set(mappedItems);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMListVersionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXMListVersionComponent, isStandalone: true, selector: "axm-list-version", usesInheritance: true, ngImport: i0, template: "<div class=\"ax-px-12 ax-min-h-96\">\n  <ax-time-line>\n    @for (version of versions(); track version.id) {\n      <ax-time-line-item [text]=\"version.title\" [isCollapsed]=\"$index == 0 ? false : true\">\n        <ax-icon class=\"fa-solid fa-flag-checkered\"></ax-icon>\n        <ax-content class=\"ax-px-8 ax-py-2 ax-text-base/6\" [innerHtml]=\"version.content\"></ax-content>\n      </ax-time-line-item>\n    }\n  </ax-time-line>\n</div>\n<ax-footer class=\"ax-flex !ax-justify-end\"\n  ><ax-button\n    [text]=\"'@general:actions.ok.title' | translate | async\"\n    color=\"primary\"\n    (onClick)=\"this.close()\"\n  ></ax-button\n></ax-footer>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXTimeLineModule }, { kind: "component", type: i1.AXTimeLineComponent, selector: "ax-time-line", inputs: ["mode"] }, { kind: "component", type: i1.AXTimeLineItemComponent, selector: "ax-time-line-item", inputs: ["text", "isActive", "isCollapsed"], outputs: ["isCollapsedChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXFormatModule }, { kind: "ngmodule", type: AXDateTimeModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i4.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMListVersionComponent, decorators: [{
            type: Component,
            args: [{ selector: 'axm-list-version', imports: [
                        CommonModule,
                        AXTimeLineModule,
                        AXDecoratorModule,
                        AXFormatModule,
                        AXDateTimeModule,
                        AXButtonModule,
                        AXTranslationModule,
                    ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ax-px-12 ax-min-h-96\">\n  <ax-time-line>\n    @for (version of versions(); track version.id) {\n      <ax-time-line-item [text]=\"version.title\" [isCollapsed]=\"$index == 0 ? false : true\">\n        <ax-icon class=\"fa-solid fa-flag-checkered\"></ax-icon>\n        <ax-content class=\"ax-px-8 ax-py-2 ax-text-base/6\" [innerHtml]=\"version.content\"></ax-content>\n      </ax-time-line-item>\n    }\n  </ax-time-line>\n</div>\n<ax-footer class=\"ax-flex !ax-justify-end\"\n  ><ax-button\n    [text]=\"'@general:actions.ok.title' | translate | async\"\n    color=\"primary\"\n    (onClick)=\"this.close()\"\n  ></ax-button\n></ax-footer>\n" }]
        }] });

export { AXMListVersionComponent };
//# sourceMappingURL=acorex-modules-platform-management-list-version.component-DQ5ZNva8.mjs.map
