text: define(["exports","../../../@polymer/polymer/polymer-element.js","../../../@polymer/polymer/lib/utils/render-status.js","../../../@polymer/iron-autogrow-textarea/iron-autogrow-textarea.js","../../../@polymer/iron-a11y-keys/iron-a11y-keys.js","./editable-table-behaviors.js"],function(_exports,_polymerElement,_renderStatus,_ironAutogrowTextarea,_ironA11yKeys,_editableTableBehaviors){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.EditableTableEditorCell=void 0;class EditableTableEditorCell extends((0,_editableTableBehaviors.cellBehaviors)(_polymerElement.PolymerElement)){static get template(){return _polymerElement.html`
        <style is="custom-style">
          :host {
            padding: 0;
            margin: 0;
            width: 100%;
            min-width: unset;
            display: inline-flex;
            justify-content: space-between;
            align-items: center;
            align-content: stretch;
          }
          :host iron-autogrow-textarea {
            width: 100%;
            padding: 0;
            border: none;
            font-weight: unset;
            resize: none;
            -webkit-appearance: none;
            -mozilla-appearance: none;
            flex-grow: 1;
            --iron-autogrow-textarea: {
              padding: 0;
              font-weight: unset;
              border: none;
              resize: none;
              flex-direction: column;
              -webkit-flex-direction: column;
              -webkit-appearance: none;
              -mozilla-appearance: none;
            }
          }
          :host iron-autogrow-textarea > * {
            padding: 0;
            font-weight: unset;
            border: none;
            resize: none;
            flex-direction: column;
            -webkit-flex-direction: column;
            -webkit-appearance: none;
            -mozilla-appearance: none;
          }
        </style>
        <iron-autogrow-textarea
          autofocus=""
          id="cell"
          label\$="[[label]]"
          value\$="{{value}}"
        >
        </iron-autogrow-textarea>
        <div id="icons"><slot></slot></div>
        <iron-a11y-keys
          id="down"
          keys="down"
          target\$="[[cell]]"
          on-keys-pressed="_onCellBelow"
        >
        </iron-a11y-keys>
        <iron-a11y-keys
          id="up"
          keys="up"
          target\$="[[cell]]"
          on-keys-pressed="_onCellAbove"
        >
        </iron-a11y-keys>
        <iron-a11y-keys
          id="left"
          keys="left"
          target\$="[[cell]]"
          on-keys-pressed="_onCellLeft"
        >
        </iron-a11y-keys>
        <iron-a11y-keys
          id="right"
          keys="right"
          target\$="[[cell]]"
          on-keys-pressed="_onCellRight"
        >
        </iron-a11y-keys>
      `}static get tag(){return"editable-table-editor-cell"}static get properties(){return{row:{type:Number,value:null},column:{type:Number,value:null},label:{type:String,computed:"_getCellLabel(column,row)"},value:{type:String,value:!1,reflectToAttribute:!0}}}ready(){super.ready(),(0,_renderStatus.afterNextRender)(this,function(){this.addEventListener("bind-value-changed",this._onValueChanged.bind(this))}),this.cell=this.$.cell}disconnectedCallback(){this.removeEventListener("bind-value-changed",this._onValueChanged.bind(this)),super.disconnectedCallback()}focus(){this.cell.textarea.focus()}_getCellLabel(column,row){return"Cell "+this._getLabel(column,"Column")+this._getLabel(row,"Row")}_onValueChanged(e){this.dispatchEvent(new CustomEvent("cell-value-changed",{bubbles:!0,cancelable:!0,composed:!0,detail:{row:this.row,column:this.column,value:e.detail.value}}))}getCaretPosition(){var caret=0;if(document.selection){this.$.cell.focus();var sel=document.selection.createRange();sel.moveStart("character",-this.$.cell.value.length),caret=sel.text.length}else(this.$.cell.shadowRoot.querySelector("textarea").selectionStart||"0"==this.$.cell.shadowRoot.querySelector("textarea").selectionStart)&&(caret=this.$.cell.shadowRoot.querySelector("textarea").selectionStart);return caret}setCaretPosition(start,end){let textarea=this.$.cell.shadowRoot.querySelector("textarea");if(textarea.focus(),textarea.createTextRange){let range=textarea.createTextRange();range.collapse(!0),range.moveEnd("character",end),range.moveStart("character",start),range.select()}else textarea.setSelectionRange&&(textarea.setSelectionRange(start,end),textarea.selectionStart=start,textarea.selectionEnd=end)}setFocus(start,end){this.$.cell.shadowRoot.querySelector("textarea").focus(),void 0!==start&&void 0!==end?this.setCaretPosition(start,end):void 0!==start?this.setCaretPosition(start,start):this.setCaretPosition(0,0)}_onCellLeft(e){this.dispatchEvent(new CustomEvent("cell-move",{bubbles:!0,cancelable:!0,composed:!0,detail:{cell:this.parentNode,direction:"left"}}))}_onCellRight(e){this.dispatchEvent(new CustomEvent("cell-move",{bubbles:!0,cancelable:!0,composed:!0,detail:{cell:this.parentNode,direction:"right"}}))}_onCellAbove(e){this.dispatchEvent(new CustomEvent("cell-move",{bubbles:!0,cancelable:!0,composed:!0,detail:{cell:this.parentNode,direction:"up"}}))}_onCellBelow(e){this.dispatchEvent(new CustomEvent("cell-move",{bubbles:!0,cancelable:!0,composed:!0,detail:{cell:this.parentNode,direction:"down"}}))}}_exports.EditableTableEditorCell=EditableTableEditorCell,window.customElements.define(EditableTableEditorCell.tag,EditableTableEditorCell)});