UNPKG

@aplus-frontend/ui

Version:

67 lines (66 loc) 1.9 kB
import { defineComponent as m, shallowRef as v, useSlots as b, computed as y, createBlock as h, openBlock as B, unref as o, mergeProps as C, createSlots as _, withCtx as x, renderSlot as k } from "vue"; import { Rate as w } from "@aplus-frontend/antdv"; import { omit as R } from "lodash-unified"; import "../../hooks/index.mjs"; import { useControllableValue as g } from "../../hooks/useControllableValue.mjs"; const A = /* @__PURE__ */ m({ name: "ApFieldRate", __name: "index", props: { mode: { default: "edit" }, class: {}, style: {}, prefixCls: {}, count: { default: 5 }, value: {}, allowHalf: { type: Boolean, default: !1 }, allowClear: { type: Boolean, default: !0 }, tooltips: {}, disabled: { type: Boolean, default: void 0 }, character: { default: void 0 }, autofocus: { type: Boolean, default: !1 }, keyboard: { type: Boolean }, tabindex: {}, direction: {}, id: {}, onChange: {}, onHoverChange: {}, "onUpdate:value": {}, onFocus: {}, onBlur: {}, onKeydown: {}, size: {}, defaultValue: {} }, emits: ["update:value"], setup(t, { expose: l, emit: r }) { const e = t, a = v(), u = r, n = b(), { value: d, updateValue: s } = g(e, u), f = y(() => e.mode === "read" ? !0 : e.disabled); function i() { a.value?.focus?.(); } function c() { a.value?.blur?.(); } return l({ focus: i, blur: c }), (p, V) => (B(), h(o(w), C(o(R)(e, ["mode", "defaultValue"]), { ref_key: "rateRef", ref: a, value: o(d), disabled: f.value, "onUpdate:value": o(s) }), _({ _: 2 }, [ n.character ? { name: "character", fn: x(() => [ k(p.$slots, "character") ]), key: "0" } : void 0 ]), 1040, ["value", "disabled", "onUpdate:value"])); } }); export { A as default };