1 line
1.4 KiB
Plaintext
1 line
1.4 KiB
Plaintext
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-calc-input-width/index.ts"],"sourcesContent":["import { computed, ref, shallowRef } from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { MINIMUM_INPUT_WIDTH } from '@element-plus/constants'\n\nexport function useCalcInputWidth() {\n const calculatorRef = shallowRef<HTMLElement>()\n const calculatorWidth = ref(0)\n\n const inputStyle = computed(() => ({\n minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`,\n }))\n\n const resetCalculatorWidth = () => {\n calculatorWidth.value =\n calculatorRef.value?.getBoundingClientRect().width ?? 0\n }\n\n useResizeObserver(calculatorRef, resetCalculatorWidth)\n\n return {\n calculatorRef,\n calculatorWidth,\n inputStyle,\n }\n}\n"],"names":[],"mappings":";;;;AAIO,SAAS,iBAAA,GAAoB;AAClC,EAAA,MAAM,gBAAgB,UAAA,EAAwB;AAC9C,EAAA,MAAM,eAAA,GAAkB,IAAI,CAAC,CAAA;AAE7B,EAAA,MAAM,UAAA,GAAa,SAAS,OAAO;AAAA,IACjC,UAAU,CAAA,EAAG,IAAA,CAAK,IAAI,eAAA,CAAgB,KAAA,EAAO,mBAAmB,CAAC,CAAA,EAAA;AAAA,GACnE,CAAE,CAAA;AAEF,EAAA,MAAM,uBAAuB,MAAM;AAZrC,IAAA,IAAA,EAAA,EAAA,EAAA;AAaI,IAAA,eAAA,CAAgB,SACd,EAAA,GAAA,CAAA,EAAA,GAAA,aAAA,CAAc,KAAA,KAAd,IAAA,GAAA,MAAA,GAAA,EAAA,CAAqB,qBAAA,EAAA,CAAwB,UAA7C,IAAA,GAAA,EAAA,GAAsD,CAAA;AAAA,EAC1D,CAAA;AAEA,EAAA,iBAAA,CAAkB,eAAe,oBAAoB,CAAA;AAErD,EAAA,OAAO;AAAA,IACL,aAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"} |