import { Component, ViewChild } from '@angular/core';
import { CascaderComponent } from 'ng-devui';
import { BaseControl } from '../basecontrol';
import * as i0 from "@angular/core";
import * as i1 from "../../service/common.service";
import * as i2 from "../form-box/form-box.component";
import * as i3 from "ng-devui";
import * as i4 from "@angular/common";
import * as i5 from "@angular/forms";
export class FormTreeComponent extends BaseControl {
    constructor(commonService) {
        super(commonService);
        this.commonService = commonService;
    }
    ngAfterViewInit() {
        if (this.data.postdata.url != "") {
            this.childtree.loadChildrenFn = (value) => {
                return this.commonService.getTheData(this.data, value.value);
            };
        }
    }
    ngOnInit() {
        this.getData();
    }
    getData() {
        this.commonService.getTheData(this.data)?.subscribe(o => {
            this.data.options = o;
        });
    }
}
FormTreeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: FormTreeComponent, deps: [{ token: i1.CommonService }], target: i0.ɵɵFactoryTarget.Component });
FormTreeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.6", type: FormTreeComponent, selector: "form-tree", viewQueries: [{ propertyName: "childtree", first: true, predicate: CascaderComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"data.mode=='op'; else detail\">\r\n    <form-box #box [mainCarry]=\"detail\" [name]=\"data.name\" [controltype]=\"data.controltype\" (controlclick)=\"onClick($event)\"></form-box>\r\n  </ng-container>\r\n  <ng-template #detail>\r\n      <d-form-item>\r\n          <d-form-label [required]=\"data.required\" [hasHelp]=\"data.help\" [helpTips]=\"data.helptip||''\">{{data.label}}</d-form-label>\r\n          <d-form-control>\r\n            <d-cascader\r\n                [disabled]=\"data.disabled\"\r\n                [attr.name]=\"data.controlname\" \r\n                [options]=\"data.options\"\r\n                [placeholder]=\"data.placeholder\"\r\n                [(ngModel)]=\"data.defaultvalue\"\r\n                [trigger]=\"'click'\"\r\n                [showPath]=\"true\"\r\n                [allowClear]=\"true\"\r\n                style=\"width:100%;\"\r\n                ></d-cascader>\r\n          </d-form-control>\r\n        </d-form-item>\r\n  </ng-template>", styles: [":host ::ng-deep d-cascader>div{width:100%!important}\n"], components: [{ type: i2.FormBoxComponent, selector: "form-box", inputs: ["mainCarry", "name", "controltype", "additionalcss"], outputs: ["controlclick"] }, { type: i3.FormItemComponent, selector: "d-form-item", inputs: ["dFeedbackType", "dHasFeedback"] }, { type: i3.FormLabelComponent, selector: "d-form-label", inputs: ["required", "hasHelp", "helpTips"] }, { type: i3.FormControlComponent, selector: "d-form-control", inputs: ["extraInfo", "feedbackStatus", "suffixTemplate"] }, { type: i3.CascaderComponent, selector: "d-cascader", inputs: ["options", "width", "dropdownWidth", "placeholder", "trigger", "disabled", "multiple", "showPath", "allowClear", "allowSearch", "canSelectParent", "checkboxRelation", "dropDownItemTemplate", "dropdownHeaderTemplate", "dropdownPanelClass", "appendToBody", "showAnimation", "loadChildrenFn"], outputs: ["toggleEvent"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: FormTreeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'form-tree', template: "<ng-container *ngIf=\"data.mode=='op'; else detail\">\r\n    <form-box #box [mainCarry]=\"detail\" [name]=\"data.name\" [controltype]=\"data.controltype\" (controlclick)=\"onClick($event)\"></form-box>\r\n  </ng-container>\r\n  <ng-template #detail>\r\n      <d-form-item>\r\n          <d-form-label [required]=\"data.required\" [hasHelp]=\"data.help\" [helpTips]=\"data.helptip||''\">{{data.label}}</d-form-label>\r\n          <d-form-control>\r\n            <d-cascader\r\n                [disabled]=\"data.disabled\"\r\n                [attr.name]=\"data.controlname\" \r\n                [options]=\"data.options\"\r\n                [placeholder]=\"data.placeholder\"\r\n                [(ngModel)]=\"data.defaultvalue\"\r\n                [trigger]=\"'click'\"\r\n                [showPath]=\"true\"\r\n                [allowClear]=\"true\"\r\n                style=\"width:100%;\"\r\n                ></d-cascader>\r\n          </d-form-control>\r\n        </d-form-item>\r\n  </ng-template>", styles: [":host ::ng-deep d-cascader>div{width:100%!important}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.CommonService }]; }, propDecorators: { childtree: [{
                type: ViewChild,
                args: [CascaderComponent, { static: false }]
            }] } });
//# sourceMappingURL=data:application/json;base64, 