UNPKG

@aplus-frontend/ui

Version:

74 lines (73 loc) 2.36 kB
import { defineComponent as v, onMounted as g, createElementBlock as R, openBlock as V, normalizeClass as h, unref as t, createVNode as u, mergeProps as b } from "vue"; import "../../config-provider/index.mjs"; import { Form as I, InputNumber as B, RadioGroup as k } from "@aplus-frontend/antdv"; import { omit as x } from "lodash-unified"; import { useLocale as _ } from "../../config-provider/hooks/use-locale.mjs"; import { useNamespace as y } from "../../config-provider/hooks/use-namespace.mjs"; const P = /* @__PURE__ */ v({ 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 = I.useInjectFormItemContext(), e = r, { t: s } = _(), { b: c, e: d } = y("ap-input-radio"), l = i, n = (o) => { let a = { ...e.value, ...o }; l("update:value", a), l("InputRadioChange", a), p.onFieldChange(); }, m = (o) => { n({ inputVal: o }); }, C = (o) => { const a = o.target.value; if (e.setRadioValCallback) { let f = e.setRadioValCallback(a); n({ inputVal: f, radioVal: a }); } else n({ radioVal: a }); }; return g(() => { if (e.setRadioValCallback) { let o = e.setRadioValCallback(e.value.radioVal); n({ inputVal: o }); } }), (o, a) => (V(), R("div", { class: h([t(c)()]) }, [ u(t(B), b({ class: t(d)("input-number") }, t(x)(e, ["value", "options"]), { value: e.value ? e.value?.inputVal : "", placeholder: t(s)("ap.common.inputText"), onChange: m }), null, 16, ["class", "value", "placeholder"]), u(t(k), { value: e.value ? e.value?.radioVal : "", options: e.options, onChange: C }, null, 8, ["value", "options"]) ], 2)); } }); export { P as default };