| 1 |
import IMask from '../core/holder.js'; |
| 2 |
|
| 3 |
/** Generic element API to use with mask */ |
| 4 |
class MaskElement { |
| 5 |
/** */ |
| 6 |
|
| 7 |
/** */ |
| 8 |
|
| 9 |
/** */ |
| 10 |
|
| 11 |
/** Safely returns selection start */ |
| 12 |
get selectionStart() { |
| 13 |
let start; |
| 14 |
try { |
| 15 |
start = this._unsafeSelectionStart; |
| 16 |
} catch {} |
| 17 |
return start != null ? start : this.value.length; |
| 18 |
} |
| 19 |
|
| 20 |
/** Safely returns selection end */ |
| 21 |
get selectionEnd() { |
| 22 |
let end; |
| 23 |
try { |
| 24 |
end = this._unsafeSelectionEnd; |
| 25 |
} catch {} |
| 26 |
return end != null ? end : this.value.length; |
| 27 |
} |
| 28 |
|
| 29 |
/** Safely sets element selection */ |
| 30 |
select(start, end) { |
| 31 |
if (start == null || end == null || start === this.selectionStart && end === this.selectionEnd) return; |
| 32 |
try { |
| 33 |
this._unsafeSelect(start, end); |
| 34 |
} catch {} |
| 35 |
} |
| 36 |
|
| 37 |
/** */ |
| 38 |
get isActive() { |
| 39 |
return false; |
| 40 |
} |
| 41 |
/** */ |
| 42 |
|
| 43 |
/** */ |
| 44 |
|
| 45 |
/** */ |
| 46 |
} |
| 47 |
IMask.MaskElement = MaskElement; |
| 48 |
|
| 49 |
export { MaskElement as default }; |
| 50 |
|