import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-b7735e0d.js';

const dvnFieldInputCellSingleChoiceCss = "dvn-field-input-cell-single-choice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:100%}";

let DvnFieldInputCellSingleChoice = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.cellFormCancel = createEvent(this, "cellFormCancel", 7);
    this.cellFormSubmit = createEvent(this, "cellFormSubmit", 7);
  }
  async focus() {
    var _a, _b;
    (_b = (_a = this.el.querySelector('dvn-select')) === null || _a === void 0 ? void 0 : _a.focusOnInput) === null || _b === void 0 ? void 0 : _b.call(_a);
  }
  ;
  render() {
    const { field, value } = this;
    const { options = [] } = field;
    return (h(Host, null, h("dvn-select", { dataAdapter: field.dataAdapter, dataProvider: field.dataProvider, disabled: field.disabled, leaned: true, value: value, width: "100%", scale: "small", onClick: (e) => {
        e.stopImmediatePropagation();
      }, onBlur: (e) => {
        e.stopImmediatePropagation();
        this.cellFormCancel.emit();
      }, onChange: (e) => {
        e.stopImmediatePropagation();
        this.cellFormSubmit.emit({ value: e.detail });
        this.cellFormCancel.emit();
      } }, options.map(option => (h("dvn-select-option", { value: option.value }, option.label))))));
  }
  get el() { return getElement(this); }
};
DvnFieldInputCellSingleChoice.style = dvnFieldInputCellSingleChoiceCss;

export { DvnFieldInputCellSingleChoice as dvn_field_input_cell_single_choice };
