var __awaiter=this&&this.__awaiter||function(e,t,n,l){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{u(l.next(e))}catch(e){r(e)}}function o(e){try{u(l["throw"](e))}catch(e){r(e)}}function u(e){e.done?n(e.value):i(e.value).then(a,o)}u((l=l.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},l,i,r,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(e){return function(t){return u([e,t])}}function u(a){if(l)throw new TypeError("Generator is already executing.");while(n)try{if(l=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{l=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-ecdfb761.js";var dvnFieldInputCellTextCss="dvn-field-input-cell-text{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:100%}";var DvnFieldInputCellText=function(){function e(e){registerInstance(this,e);this.cellFormCancel=createEvent(this,"cellFormCancel",7);this.cellFormSubmit=createEvent(this,"cellFormSubmit",7)}e.prototype.focus=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(n){(t=(e=this.el.querySelector("dvn-input"))===null||e===void 0?void 0:e.focus)===null||t===void 0?void 0:t.call(e);return[2]}))}))};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.cellFormCancel.emit();this.internalValue=this.value}else if(e.key==="Enter"){if(this.internalValue!==this.value){this.cellFormSubmit.emit({value:this.internalValue})}this.cellFormCancel.emit()}};e.prototype.componentWillLoad=function(){this.internalValue=this.value};e.prototype.render=function(){var e=this;var t=this,n=t.disabled,l=t.errors,i=t.field,r=t.value;var a=l&&l.length>0;return h(Host,null,h("dvn-input",{id:i.id,type:i.inputType||"text",disabled:n||i.disabled,placeholder:i.placeholder,onChange:function(t){t.stopImmediatePropagation();e.internalValue=t.detail},onBlur:function(t){t.stopImmediatePropagation();if(e.internalValue!==e.value){e.cellFormSubmit.emit({value:e.internalValue})}e.cellFormCancel.emit()},value:r,feedback:a?"error":undefined,leaned:true,autoComplete:i.autoComplete,overrideStyle:{width:"100%","min-width":"0"},scale:"small"}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();DvnFieldInputCellText.style=dvnFieldInputCellTextCss;export{DvnFieldInputCellText as dvn_field_input_cell_text};