@aplus-frontend/ui
Version:
88 lines (87 loc) • 2.51 kB
JavaScript
import { defineComponent as B, useSlots as x, ref as g, computed as k, unref as t, createElementBlock as C, createBlock as S, openBlock as n, Fragment as _, createTextVNode as P, toDisplayString as T, mergeProps as V, createSlots as b, renderList as h, withCtx as F, renderSlot as R, normalizeProps as U, guardReactiveProps as A } from "vue";
import { Slider as $ } from "@aplus-frontend/antdv";
import "../../hooks/index.mjs";
import { isNil as N, isArray as w, omit as z } from "lodash-unified";
import { useControllableValue as D } from "../../hooks/useControllableValue.mjs";
const I = /* @__PURE__ */ B({
name: "ApFieldSlider",
__name: "index",
props: {
mode: {},
class: {},
style: {},
id: {},
prefixCls: {},
tooltipPrefixCls: {},
range: {},
reverse: { type: Boolean },
min: { default: 0 },
max: { default: 100 },
step: { default: 1 },
marks: {},
dots: { type: Boolean },
value: {},
defaultValue: {},
included: { type: Boolean, default: !0 },
disabled: { type: Boolean, default: void 0 },
vertical: { type: Boolean },
tipFormatter: {},
tooltipOpen: { type: Boolean, default: void 0 },
tooltipVisible: { type: Boolean, default: void 0 },
tooltipPlacement: {},
getTooltipPopupContainer: {},
autofocus: { type: Boolean },
handleStyle: {},
trackStyle: {},
onChange: {},
onAfterChange: {},
onFocus: {},
onBlur: {},
"onUpdate:value": {},
emptyText: { default: "--" }
},
emits: ["update:value"],
setup(u, { expose: i, emit: p }) {
const s = x(), o = g(), l = u, d = p, { value: a, updateValue: f } = D(l, d), m = k(() => {
const e = t(a);
return N(e) ? l.emptyText : w(e) ? `${e[0]}-${e[1]}` : e;
});
function c() {
o.value?.focus?.();
}
function v() {
o.value?.blur?.();
}
return i({
focus: c,
blur: v
}), (e, E) => e.mode === "read" ? (n(), C(_, { key: 0 }, [
P(T(m.value), 1)
], 64)) : (n(), S(t($), V(
{ key: 1 },
t(z)(l, [
"value",
"onUpdate:value",
"mode",
"emptyText",
"defaultValue"
]),
{
ref_key: "sliderRef",
ref: o,
value: t(a),
"onUpdate:value": t(f)
}
), b({ _: 2 }, [
h(s, (L, r) => ({
name: r,
fn: F((y) => [
R(e.$slots, r, U(A(y || {})))
])
}))
]), 1040, ["value", "onUpdate:value"]));
}
});
export {
I as default
};