@aplus-frontend/ui
Version:
91 lines (90 loc) • 2.7 kB
JavaScript
import { defineComponent as h, shallowRef as B, useSlots as b, createElementBlock as x, createBlock as S, openBlock as r, toDisplayString as _, unref as e, mergeProps as g, createSlots as k, renderList as C, withCtx as P, renderSlot as I, normalizeProps as U, guardReactiveProps as w } from "vue";
import { InputNumber as R } from "@aplus-frontend/antdv";
import { omit as V } from "lodash-unified";
import "../../hooks/index.mjs";
import { useDefaultPlaceholder as z } from "../hooks/use-default-placeholder.mjs";
import { formatSecond as A } from "./helper.mjs";
import { useControllableValue as D } from "../../hooks/useControllableValue.mjs";
const E = { key: 0 }, q = /* @__PURE__ */ h({
name: "ApFieldSecond",
__name: "index",
props: {
mode: {},
class: {},
style: {},
size: {},
bordered: { type: Boolean, default: !0 },
placeholder: {},
name: {},
id: {},
type: {},
addonBefore: {},
addonAfter: {},
prefix: {},
suffix: {},
"onUpdate:value": {},
valueModifiers: {},
status: {},
variant: {},
changeOnWheel: { type: Boolean, default: void 0 },
changeOnBlur: { type: Boolean, default: void 0 },
stringMode: { type: Boolean },
defaultValue: {},
value: {},
prefixCls: {},
min: { default: -1 / 0 },
max: { default: 1 / 0 },
step: { default: 1 },
tabindex: {},
controls: { type: Boolean, default: !0 },
readonly: { type: Boolean },
disabled: { type: Boolean, default: void 0 },
autofocus: { type: Boolean },
keyboard: { type: Boolean, default: !0 },
parser: {},
formatter: {},
precision: {},
decimalSeparator: {},
onInput: {},
onChange: {},
onPressEnter: {},
onStep: {},
onBlur: {},
onFocus: {},
emptyText: { default: "--" }
},
emits: ["update:value"],
setup(u, { expose: d, emit: s }) {
const o = u, p = s, t = B(), { value: a, updateValue: i } = D(
o,
p
), f = b(), c = z("Second", o);
function m() {
t.value?.focus();
}
function y() {
t.value?.blur();
}
return d({ focus: m, blur: y }), (l, F) => l.mode === "read" ? (r(), x("span", E, _(e(A)(Number(e(a)))), 1)) : (r(), S(e(R), g(
{
key: 1,
min: 0,
style: { width: "100%" },
placeholder: e(c),
value: e(a)
},
e(V)(o, ["value", "onUpdate:value", "min", "placeholder", "mode"]),
{ "onUpdate:value": e(i) }
), k({ _: 2 }, [
C(f, (M, n) => ({
name: n,
fn: P((v) => [
I(l.$slots, n, U(w(v || {})))
])
}))
]), 1040, ["placeholder", "value", "onUpdate:value"]));
}
});
export {
q as default
};