first commit
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
import * as vue from "vue";
|
||||
|
||||
//#region ../../packages/hooks/use-calc-input-width/index.d.ts
|
||||
declare function useCalcInputWidth(): {
|
||||
calculatorRef: vue.ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
||||
calculatorWidth: vue.Ref<number, number>;
|
||||
inputStyle: vue.ComputedRef<{
|
||||
minWidth: string;
|
||||
}>;
|
||||
};
|
||||
//#endregion
|
||||
export { useCalcInputWidth };
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
||||
const require_form = require('../../constants/form.js');
|
||||
let _vueuse_core = require("@vueuse/core");
|
||||
let vue = require("vue");
|
||||
|
||||
//#region ../../packages/hooks/use-calc-input-width/index.ts
|
||||
function useCalcInputWidth() {
|
||||
const calculatorRef = (0, vue.shallowRef)();
|
||||
const calculatorWidth = (0, vue.ref)(0);
|
||||
const inputStyle = (0, vue.computed)(() => ({ minWidth: `${Math.max(calculatorWidth.value, require_form.MINIMUM_INPUT_WIDTH)}px` }));
|
||||
const resetCalculatorWidth = () => {
|
||||
calculatorWidth.value = calculatorRef.value?.getBoundingClientRect().width ?? 0;
|
||||
};
|
||||
(0, _vueuse_core.useResizeObserver)(calculatorRef, resetCalculatorWidth);
|
||||
return {
|
||||
calculatorRef,
|
||||
calculatorWidth,
|
||||
inputStyle
|
||||
};
|
||||
}
|
||||
|
||||
//#endregion
|
||||
exports.useCalcInputWidth = useCalcInputWidth;
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","names":["MINIMUM_INPUT_WIDTH"],"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"],"mappings":";;;;;;;AAIA,SAAgB,oBAAoB;CAClC,MAAM,qCAAyC;CAC/C,MAAM,+BAAsB,EAAE;CAE9B,MAAM,sCAA6B,EACjC,UAAU,GAAG,KAAK,IAAI,gBAAgB,OAAOA,iCAAoB,CAAC,KACnE,EAAE;CAEH,MAAM,6BAA6B;AACjC,kBAAgB,QACd,cAAc,OAAO,uBAAuB,CAAC,SAAS;;AAG1D,qCAAkB,eAAe,qBAAqB;AAEtD,QAAO;EACL;EACA;EACA;EACD"}
|
||||
Reference in New Issue
Block a user