UNPKG

@aplus-frontend/ui

Version:

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