@deepkit/api-console-gui
Version:
API Console GUI
57 lines • 1.67 kB
JavaScript
import { __decorate } from "tslib";
import { Component, EventEmitter, input, model, Output, ViewChild } from '@angular/core';
import { OptionDirective, SelectBoxComponent, unsubscribe } from '@deepkit/desktop-ui';
import { FormsModule } from '@angular/forms';
let EnumInputComponent = class EnumInputComponent {
constructor() {
this.model = model.required();
this.decoration = input();
this.type = input.required();
this.keyValues = [];
this.keyDown = new EventEmitter();
}
ngOnDestroy() {
}
ngOnInit() {
this.load();
}
ngOnChanges() {
this.load();
}
ngAfterViewInit() {
this.select?.open();
}
load() {
this.type().enum;
for (const [label, value] of Object.entries(this.type().enum)) {
this.keyValues.push({ value, label });
}
}
};
__decorate([
Output()
], EnumInputComponent.prototype, "keyDown", void 0);
__decorate([
ViewChild('select')
], EnumInputComponent.prototype, "select", void 0);
__decorate([
unsubscribe()
], EnumInputComponent.prototype, "dropdownSub", void 0);
EnumInputComponent = __decorate([
Component({
template: `
<dui-select #select [(ngModel)]="model().value" textured style="width: 100%">
@for (kv of keyValues; track kv) {
<dui-option [value]="kv.value">{{ kv.label }}</dui-option>
}
</dui-select>
`,
imports: [
SelectBoxComponent,
FormsModule,
OptionDirective,
],
})
], EnumInputComponent);
export { EnumInputComponent };
//# sourceMappingURL=enum-input.component.js.map