@open-data-v/ui
Version:
OpenDataV UI基础包
50 lines (49 loc) • 1.33 kB
JavaScript
import { defineComponent as s, openBlock as f, createElementBlock as p } from "vue";
const m = ["value"], g = /* @__PURE__ */ s({
__name: "ColorInput",
props: {
label: {},
labelText: {},
desc: {},
value: {},
max: {},
min: {},
arrowOffset: { default: 1 }
},
emits: ["change", "update:value"],
setup(u, { emit: d }) {
const o = u, a = d;
function c(e) {
r(e.target.value);
}
function r(e) {
const t = {};
t[o.label] = e, (t.hex === void 0 && t["#"] === void 0 || e.toString().length > 5) && a("change", t);
}
function i(e) {
const t = Number(o.value);
if (t) {
const l = o.arrowOffset || 1;
if (e.keyCode === 38) {
const n = t + l;
a("update:value", n), r(n), e.preventDefault();
}
if (e.keyCode === 40) {
const n = t - l;
a("update:value", n), r(n), e.preventDefault();
}
}
}
return (e, t) => (f(), p("input", {
ref: "input",
value: e.value,
class: "outline-0 p-0 w-full rounded-sm dark:bg-zinc-800 bg-white text-gray-800 dark:text-gray-50 dark:border-gray-500 border border-gray-300",
onKeydown: i,
onInput: c
}, null, 40, m));
}
});
export {
g as default
};
//# sourceMappingURL=ColorInput.vue.esm.js.map