You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
821 B

1 month ago
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var core = require('@vueuse/core');
  5. function useCalcInputWidth() {
  6. const calculatorRef = vue.shallowRef();
  7. const calculatorWidth = vue.ref(0);
  8. const MINIMUM_INPUT_WIDTH = 11;
  9. const inputStyle = vue.computed(() => ({
  10. minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`
  11. }));
  12. const resetCalculatorWidth = () => {
  13. var _a, _b;
  14. calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
  15. };
  16. core.useResizeObserver(calculatorRef, resetCalculatorWidth);
  17. return {
  18. calculatorRef,
  19. calculatorWidth,
  20. inputStyle
  21. };
  22. }
  23. exports.useCalcInputWidth = useCalcInputWidth;
  24. //# sourceMappingURL=index.js.map