mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-01 10:48:55 +00:00
a9143b0fba
* ADD - build in-game admin command center * ADD - open admin panel by command * ENH - rebuild admin panel as standalone editor * ENH - compact admin workspace navigation * ENH - expand admin device controls * ENH - refine admin panel navigation style * ADD - add SQL phone configurator * FIX - expose complete phone configuration * FIX - make company jobs freely configurable * FIX - align configurator tables to left * ENH - organize configurator collection controls * ENH - organize nested configurator sections * ENH - add configurator field descriptions * FIX - hide fixed configurator add controls * ENH - refine configurator editing experience * ENH - refine admin configurator controls * FIX - apply configurator settings instantly * FIX - close live activity command registration --------- Co-authored-by: Leon.Schmidt <leonmauricewill15@gmail.com>
27 lines
792 B
TypeScript
27 lines
792 B
TypeScript
import type { Directive } from 'vue'
|
|
|
|
const inputListeners = new WeakMap<HTMLInputElement, () => void>()
|
|
const MINIMUM_INPUT_WIDTH = 42
|
|
|
|
function syncInputWidth(input: HTMLInputElement): void {
|
|
input.style.width = '1px'
|
|
input.style.width = `${Math.max(MINIMUM_INPUT_WIDTH, Math.ceil(input.scrollWidth) + 2)}px`
|
|
}
|
|
|
|
export const vConfigInputWidth: Directive<HTMLInputElement> = {
|
|
mounted(input) {
|
|
const listener = () => syncInputWidth(input)
|
|
inputListeners.set(input, listener)
|
|
input.addEventListener('input', listener)
|
|
syncInputWidth(input)
|
|
},
|
|
updated(input) {
|
|
syncInputWidth(input)
|
|
},
|
|
beforeUnmount(input) {
|
|
const listener = inputListeners.get(input)
|
|
if (listener) input.removeEventListener('input', listener)
|
|
inputListeners.delete(input)
|
|
},
|
|
}
|