export class FormController {
    async create(feature, options) {
        let form = document.createElement('gl-form');
        form.feature = feature;
        for (let optionName in options)
            form[optionName] = options[optionName];
        const modal = await this.modalCtrl.create({
            component: form
        });
        await modal.present();
        return await new Promise((resolve) => {
            form.addEventListener('glFormCancel', () => {
                modal.dismiss();
                resolve();
            });
            form.addEventListener('glFormSubmit', () => {
                modal.dismiss();
                resolve(feature);
            });
        });
    }
    static get is() { return "gl-form-controller"; }
    static get properties() { return {
        "create": {
            "method": true
        },
        "modalCtrl": {
            "connect": "ion-modal-controller"
        }
    }; }
}
