* Constructor * @param {string} name Field name * @param {object} [spec] Field spec * @param {?number} [spec.minLength=null] Minimum amount of characters * @param {?number} [spec.maxLength=null] Maximum amount of characters * @param {?number[]|string|Chain} [spec.whitelistChars=null]
(name, spec = {})
| 23 | * Wether to respect case sensitivity |
| 24 | */ |
| 25 | constructor (name, spec = {}) { |
| 26 | super(name, spec) |
| 27 | this._viewPrototype = TextFieldView |
| 28 | |
| 29 | this._value = Chain.wrap(spec.value || null) |
| 30 | this._minLength = null |
| 31 | this._maxLength = null |
| 32 | this._whitelistChars = null |
| 33 | this._blacklistChars = null |
| 34 | this._uniqueChars = false |
| 35 | this._caseSensitivity = null |
| 36 | |
| 37 | // Apply field options |
| 38 | this.setMinLength(spec.minLength !== undefined ? spec.minLength : null, false) |
| 39 | this.setMaxLength(spec.maxLength !== undefined ? spec.maxLength : null, false) |
| 40 | this.setWhitelistChars(spec.whitelistChars || null, false) |
| 41 | this.setBlacklistChars(spec.blacklistChars || null, false) |
| 42 | this.setUniqueChars(spec.uniqueChars || false, false) |
| 43 | this.setCaseSensitivity(spec.caseSensitivity !== false, false) |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Returns min text length. |
nothing calls this directly
no test coverage detected