';\n\n document.getElementById(tagId).innerHTML = html;\n this._tagId = tagId;\n if (this.enabled) {\n for (let i = 0; i < this._columns.length; i++) {\n if (this._columns[i].type === 'select' && this._columns[i].onChange != null) {\n this.onInputChange(i);\n }\n }\n }\n }\n\n onInputChange(i) {\n this._columns[i].onChange(document.getElementById(`${this._columns[i].name}_input`));\n }\n\n refresh() {\n this.render(this._tagId);\n }\n\n getColumns() {\n return this._columns;\n }\n\n getColumnsCount() {\n return this._columns.length;\n }\n\n setAllData(data, canDelete) {\n this._data = data;\n this._canDelete = canDelete;\n }\n\n getData(id, row) {\n return this._data[id][row];\n }\n\n setData(id, row, val) {\n this._data[id][row] = val;\n }\n\n getAllData() {\n return this._data;\n }\n\n getCanDelete(id) {\n return this._canDelete[id];\n }\n\n getAllCanDelete() {\n return this._canDelete;\n }\n\n getSize() {\n return this._data.length;\n }\n\n setAllAdditionalData(data) {\n this._additionalData = data;\n }\n\n getAllAdditionalData() {\n return this._additionalData;\n }\n\n setAdditionalData(id, data) {\n this._additionalData[id] = data;\n }\n\n getAdditionalData(id) {\n if (id < 0) {\n return false;\n }\n return this._additionalData[id];\n }\n\n setPointer(theRow, theRowNum, theAction) {\n if (theAction === 'click') {\n this.setSelection(theRowNum);\n } else if (theAction === 'over' && theRowNum != this._selectedId) {\n theRow.className = this._overClass;\n } else if (theAction === 'out') {\n theRow.className = theRowNum == this._selectedId ? this._selectedClass : (theRowNum % 2 === 0 ? this._oddClass : this._evenClass);\n }\n }\n\n setSelection(id) {\n if (id < 0 || id >= this.getSize()) {\n id = -1;\n }\n let selectedRow;\n if (this._selectedId !== -1) {\n selectedRow = this.getRow(this._selectedId);\n selectedRow.className = (this._selectedId % 2 === 0 ? this._oddClass : this._evenClass);\n }\n const oldid = this._selectedId;\n this._selectedId = id;\n if (this._selectedId !== -1) {\n selectedRow = this.getRow(this._selectedId);\n selectedRow.className = this._selectedClass;\n if (typeof this.onSelect === 'function') {\n this.onSelect(this, this._selectedId, oldid);\n }\n }\n }\n\n getSelection() {\n return this._selectedId;\n }\n\n getRow(theRowNum) {\n const rows = document.getElementById(this._tagId).getElementsByTagName('tr');\n if (theRowNum < 0 || theRowNum > rows.length) {\n return null;\n }\n return rows[theRowNum + (this.enabled ? 2 : 1)];\n }\n\n Add() {\n let i;\n let j;\n const ndata = [];\n const errors = [];\n let res;\n\n for (i = 0; i < this._columns.length; i++) {\n if (this._columns[i].type === 'const') {\n ndata[i] = this._columns[i].value;\n } else {\n ndata[i] = document.getElementById(`${this._columns[i].name}_input`).value;\n if (ndata[i] == '' && this._columns[i].required) {\n errors.push(`${this._columns[i].text}: ${this._locale.lmsg('emptyParameter')}`);\n } else if (this._columns[i].check != null && (res = this._columns[i].check(ndata[i])) != true) {\n errors.push(`${this._columns[i].text}: ${res}`);\n }\n }\n }\n if (errors.length > 0) {\n let msg = `${this._locale.lmsg('wrongParameters')}:\\n`;\n msg += errors.map(error => ` ${error}\\n`).join('');\n // eslint-disable-next-line no-alert\n alert(msg);\n return false;\n }\n\n for (j = 0; j < this._data.length; j++) {\n // error\n let uniqerr = 0;\n for (i = 0; i < this._columns.length; i++) {\n if (this._columns[i].primary) {\n uniqerr++;\n if (this._data[j][i] != ndata[i]) {\n uniqerr--;\n }\n }\n }\n if (uniqerr > 0) {\n // eslint-disable-next-line no-alert\n alert('Error: dublicate record.');\n return false;\n }\n }\n\n this._data.push(ndata);\n this._canDelete.push(true);\n this._additionalData.push('');\n if (typeof this.onNewElement === 'function') {\n this.onNewElement(this, this._data.length - 1);\n }\n this.refresh();\n if (this._canSelect) {\n this.setSelection(this._data.length - 1);\n }\n return true;\n }\n\n Del(id) {\n let i;\n const data = [];\n const canDelete = [];\n const additionalData = [];\n for (i = 0; i < this._data.length; i++) {\n if (i != id) {\n data.push(this._data[i]);\n canDelete.push(this._canDelete[i]);\n additionalData.push(this._additionalData[i]);\n }\n }\n this._data = data;\n this._canDelete = canDelete;\n this._additionalData = additionalData;\n if (this._canSelect) {\n if (id < this._selectedId) {\n this._selectedId--;\n } else if (id == this._selectedId) {\n if (this._selectedId >= this._data.length) {\n this._selectedId = this._data.length - 1;\n }\n }\n }\n\n if (typeof this.onDeleteElement === 'function') {\n this.onDeleteElement(this);\n }\n this.refresh();\n }\n}\n\nexport default EditList;\n","module.exports = Jsw.skinUrl + \"/icons/16/plesk/add-disabled.png?1a20f1ce41ba7962179707bb93fb0160\";","module.exports = Jsw.skinUrl + \"/icons/16/plesk/add.png?adc28eb740975477578cb3393b40c7f8\";","module.exports = Jsw.skinUrl + \"/icons/16/plesk/delete-disabled.png?0401c699042a592ecdb931912edd304d\";","module.exports = Jsw.skinUrl + \"/icons/16/plesk/delete.png?27d654be29d57ad05641c2ff392035fa\";"],"names":["window","psaEditLists","constructor","name","enabled","columns","data","additionalData","canDelete","selectable","selection","onSelect","onNewElement","onDeleteElement","this","_id","length","objectName","_columns","_data","_additionalData","_canDelete","_canSelect","_selectedId","_inputClass","_selectedClass","_overClass","_oddClass","_evenClass","_locale","Locale","getSection","render","tagId","html","i","size","text","inputDisabled","type","value","values","j","found","primary","k","push","require","editable","escapeAttribute","str","escapeHtml","document","getElementById","innerHTML","_tagId","onChange","onInputChange","refresh","getColumns","getColumnsCount","setAllData","getData","id","row","setData","val","getAllData","getCanDelete","getAllCanDelete","getSize","setAllAdditionalData","getAllAdditionalData","setAdditionalData","getAdditionalData","setPointer","theRow","theRowNum","theAction","setSelection","className","selectedRow","getRow","oldid","getSelection","rows","getElementsByTagName","Add","ndata","errors","res","required","lmsg","check","msg","map","error","join","alert","uniqerr","Del","module","exports","Jsw","skinUrl"],"sourceRoot":""}