mirror of
https://github.com/dzeiocom/FormManager.git
synced 2025-04-22 10:52:16 +00:00
27 lines
574 B
TypeScript
27 lines
574 B
TypeScript
import InputIdentity from './Interfaces/InputIdentity';
|
|
import DefaultInput from './DefaultInput';
|
|
import { realType } from '../Functions';
|
|
|
|
/**
|
|
*
|
|
* @class FMDateInput
|
|
* @extends {FMInput}
|
|
*/
|
|
export default class SelectInput extends DefaultInput {
|
|
|
|
public formatValue(value: any): any {
|
|
if (typeof value === "undefined") {
|
|
const opt: HTMLOptionElement = this.element.querySelector("option[selected]")
|
|
if (opt) {
|
|
return opt.value
|
|
}
|
|
}
|
|
return realType(value)
|
|
}
|
|
|
|
public static identity: InputIdentity = {
|
|
input: SelectInput,
|
|
tagName: "select"
|
|
}
|
|
}
|