(e, pname, ptype)
| 1725 | } |
| 1726 | |
| 1727 | onAddRemoveFileInput(e, pname, ptype) { |
| 1728 | if (e.target.tagName.toLowerCase() !== 'button') { |
| 1729 | return; |
| 1730 | } |
| 1731 | |
| 1732 | if (e.target.classList.contains('file-input-remove-btn')) { |
| 1733 | // Remove File Input Set |
| 1734 | const el = e.target.closest('.input-set'); |
| 1735 | el.remove(); |
| 1736 | return; |
| 1737 | } |
| 1738 | const el = e.target.closest('.file-input-container'); |
| 1739 | |
| 1740 | // Add File Input Set |
| 1741 | |
| 1742 | // Container |
| 1743 | const newInputContainerEl = document.createElement('div'); |
| 1744 | newInputContainerEl.setAttribute('class', 'input-set row'); |
| 1745 | |
| 1746 | // File Input |
| 1747 | const newInputEl = document.createElement('input'); |
| 1748 | newInputEl.type = 'file'; |
| 1749 | newInputEl.style = 'width:200px; margin-top:2px;'; |
| 1750 | newInputEl.setAttribute('data-pname', pname); |
| 1751 | newInputEl.setAttribute('data-ptype', ptype.includes('form-urlencode') ? 'form-urlencode' : 'form-data'); |
| 1752 | newInputEl.setAttribute('data-array', 'false'); |
| 1753 | newInputEl.setAttribute('data-file-array', 'true'); |
| 1754 | |
| 1755 | // Remover Button |
| 1756 | const newRemoveBtnEl = document.createElement('button'); |
| 1757 | newRemoveBtnEl.setAttribute('class', 'file-input-remove-btn'); |
| 1758 | newRemoveBtnEl.innerHTML = '✕'; |
| 1759 | |
| 1760 | newInputContainerEl.appendChild(newInputEl); |
| 1761 | newInputContainerEl.appendChild(newRemoveBtnEl); |
| 1762 | el.insertBefore(newInputContainerEl, e.target); |
| 1763 | // el.appendChild(newInputContainerEl); |
| 1764 | } |
| 1765 | |
| 1766 | clearResponseData() { |
| 1767 | this.responseUrl = ''; |
no test coverage detected