index.js 947 B

12345678910111213141516171819202122232425
  1. Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  2. const require_runtime = require('../../_virtual/_rolldown/runtime.js');
  3. const require_form = require('../../constants/form.js');
  4. let _vueuse_core = require("@vueuse/core");
  5. let vue = require("vue");
  6. //#region ../../packages/hooks/use-calc-input-width/index.ts
  7. function useCalcInputWidth() {
  8. const calculatorRef = (0, vue.shallowRef)();
  9. const calculatorWidth = (0, vue.ref)(0);
  10. const inputStyle = (0, vue.computed)(() => ({ minWidth: `${Math.max(calculatorWidth.value, require_form.MINIMUM_INPUT_WIDTH)}px` }));
  11. const resetCalculatorWidth = () => {
  12. calculatorWidth.value = calculatorRef.value?.getBoundingClientRect().width ?? 0;
  13. };
  14. (0, _vueuse_core.useResizeObserver)(calculatorRef, resetCalculatorWidth);
  15. return {
  16. calculatorRef,
  17. calculatorWidth,
  18. inputStyle
  19. };
  20. }
  21. //#endregion
  22. exports.useCalcInputWidth = useCalcInputWidth;
  23. //# sourceMappingURL=index.js.map