@aplus-frontend/ui
Version:
75 lines (74 loc) • 2.43 kB
JavaScript
import { defineComponent as g, onMounted as h, createElementBlock as R, openBlock as V, normalizeClass as b, unref as t, createVNode as u, mergeProps as I } from "vue";
import { Form as B, InputNumber as k, RadioGroup as x } from "@aplus-frontend/antdv";
import { omit as y } from "lodash-unified";
import "../../config-provider/index.mjs";
import _ from "./style/index.mjs";
import { useLocale as F } from "../../config-provider/hooks/use-locale.mjs";
import { useNamespace as N } from "../../config-provider/hooks/use-namespace.mjs";
const z = /* @__PURE__ */ g({
name: "ApInputRadio",
__name: "ApInputRadio",
props: {
disabled: { type: Boolean },
stringMode: { type: Boolean, default: !0 },
precision: {},
max: {},
min: {},
step: {},
bordered: { type: Boolean, default: !0 },
autofocus: { type: Boolean },
decimalSeparator: {},
controls: { type: Boolean, default: !0 },
formatter: {},
onInput: {},
onChange: {},
onPressEnter: {},
onStep: {},
onBlur: {},
onFocus: {},
value: {},
options: {},
onInputRadioChange: {},
setRadioValCallback: {}
},
emits: ["update:value", "InputRadioChange"],
setup(r, { emit: i }) {
const p = B.useInjectFormItemContext(), e = r, { t: s } = F(), { b: d, e: m } = N("ap-input-radio"), c = _("ap-input-radio"), l = i, n = (o) => {
let a = { ...e.value, ...o };
l("update:value", a), l("InputRadioChange", a), p.onFieldChange();
}, C = (o) => {
n({ inputVal: o });
}, f = (o) => {
const a = o.target.value;
if (e.setRadioValCallback) {
let v = e.setRadioValCallback(a);
n({ inputVal: v, radioVal: a });
} else
n({ radioVal: a });
};
return h(() => {
if (e.setRadioValCallback) {
let o = e.setRadioValCallback(e.value.radioVal);
n({ inputVal: o });
}
}), (o, a) => (V(), R("div", {
class: b([t(d)(), t(c)])
}, [
u(t(k), I({
class: t(m)("input-number")
}, t(y)(e, ["value", "options"]), {
value: e.value ? e.value?.inputVal : "",
placeholder: t(s)("ap.common.inputText"),
onChange: C
}), null, 16, ["class", "value", "placeholder"]),
u(t(x), {
value: e.value ? e.value?.radioVal : "",
options: e.options,
onChange: f
}, null, 8, ["value", "options"])
], 2));
}
});
export {
z as default
};