fix(alert): remove unneeded warning

This commit is contained in:
Manu Mtz.-Almeida
2018-08-27 19:25:24 +02:00
parent ecf1eb8325
commit 8447f286cc
2 changed files with 4 additions and 3 deletions

View File

@ -143,7 +143,7 @@ export class Alert implements OverlayInterface {
// An alert can be created with several different inputs. Radios,
// checkboxes and inputs are all accepted, but they cannot be mixed.
const inputTypes = new Set(inputs.map(i => i.type));
if (inputTypes.has('checkbox') || inputTypes.has('radio')) {
if (inputTypes.has('checkbox') && inputTypes.has('radio')) {
console.warn(`Alert cannot mix input types: ${(Array.from(inputTypes.values()).join('/'))}. Please see alert docs for more info.`);
}
this.inputType = inputTypes.values().next().value;

View File

@ -367,18 +367,19 @@ export class Select {
const labelText = (label) ? label.textContent : null;
const interfaceOptions = this.interfaceOptions;
const inputType = (this.multiple ? 'checkbox' : 'radio');
const alertOpts: AlertOptions = {
...interfaceOptions,
header: interfaceOptions.header ? interfaceOptions.header : labelText,
inputs: this.childOpts.map(o => {
return {
type: (this.multiple ? 'checkbox' : 'radio'),
type: inputType,
label: o.textContent,
value: o.value,
checked: o.selected,
disabled: o.disabled
} as AlertInput;
};
}),
buttons: [
{