import { computed as e, createElementBlock as t, defineComponent as n, normalizeClass as r, openBlock as i, reactive as a, ref as o, toDisplayString as s, unref as c } from "vue";
import { call as l } from "@milaboratories/helpers";
var u = ["value"], d = { key: 1 }, f = /* @__PURE__ */ n({
	__name: "BaseCellComponent",
	props: {
		modelValue: {},
		valueType: {},
		editable: { type: Boolean }
	},
	emits: ["update:modelValue"],
	setup(n, { emit: f }) {
		let p = f, m = n, h = a({ edit: !1 }), g = e(() => m.valueType), _ = (e) => {
			let t = e.target?.value, n = c(g);
			p("update:modelValue", l(() => n === "integer" ? parseInt(t, 10) : n === "float" ? Number(t) : t)), h.edit = !1;
		}, v = o(), y = (e) => {
			!e.metaKey && m.editable && (h.edit = !0, requestAnimationFrame(() => {
				v.value?.querySelector("input")?.focus();
			}));
		};
		return (e, a) => (i(), t("div", {
			ref_key: "baseRef",
			ref: v,
			class: r(["base-cell", { "base-cell__edit": h.edit }]),
			onClick: y
		}, [h.edit ? (i(), t("input", {
			key: 0,
			value: n.modelValue,
			onFocusout: a[0] ||= (e) => h.edit = !1,
			onChange: _
		}, null, 40, u)) : (i(), t("div", d, s(n.modelValue), 1))], 2));
	}
});
export { f as default };

//# sourceMappingURL=BaseCellComponent.vue2.js.map