| 541 | } |
| 542 | |
| 543 | private getValues(): any { |
| 544 | if (this.processedInputs.length === 0) { |
| 545 | // this is an alert without any options/inputs at all |
| 546 | return undefined; |
| 547 | } |
| 548 | |
| 549 | if (this.inputType === 'radio') { |
| 550 | // this is an alert with radio buttons (single value select) |
| 551 | // return the one value which is checked, otherwise undefined |
| 552 | const checkedInput = this.processedInputs.find((i) => !!i.checked); |
| 553 | return checkedInput ? checkedInput.value : undefined; |
| 554 | } |
| 555 | |
| 556 | if (this.inputType === 'checkbox') { |
| 557 | // this is an alert with checkboxes (multiple value select) |
| 558 | // return an array of all the checked values |
| 559 | return this.processedInputs.filter((i) => i.checked).map((i) => i.value); |
| 560 | } |
| 561 | |
| 562 | // this is an alert with text inputs |
| 563 | // return an object of all the values with the input name as the key |
| 564 | const values: { [k: string]: string } = {}; |
| 565 | this.processedInputs.forEach((i) => { |
| 566 | values[i.name!] = i.value || ''; |
| 567 | }); |
| 568 | return values; |
| 569 | } |
| 570 | |
| 571 | private renderAlertInputs() { |
| 572 | switch (this.inputType) { |