yanzhen-design-vue
Version:
57 lines (56 loc) • 2.14 kB
JavaScript
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, createBlock, createCommentVNode, createSlots, withCtx, createTextVNode, toDisplayString } from "vue";
import { Progress, InputNumber, Tooltip } from "ant-design-vue";
import "../../../hooks/index.mjs";
import { toNumber } from "lodash-es";
import { formulaName, formulaProps, formulaOptions } from "./formula.mjs";
import { useProgress } from "../../../hooks/use-progress/index.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
...{ name: formulaName },
__name: "formula",
props: formulaProps,
setup(__props) {
const { ns } = formulaOptions;
const props = __props;
const { convertSuffix, showProgress } = useProgress(props);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass([unref(ns).b()])
}, [
unref(showProgress) ? (openBlock(), createBlock(unref(Progress), {
key: 0,
percent: unref(toNumber)(_ctx.value),
"show-info": false,
"stroke-color": "#1890ff",
class: normalizeClass([unref(ns).e("progress")])
}, null, 8, ["percent", "class"])) : createCommentVNode("", true),
!_ctx.isDetail ? (openBlock(), createBlock(unref(InputNumber), {
key: 1,
size: _ctx.size,
suffix: unref(convertSuffix),
value: _ctx.value,
disabled: "",
placeholder: ""
}, createSlots({ _: 2 }, [
unref(convertSuffix) ? {
name: "addonAfter",
fn: withCtx(() => [
createTextVNode(toDisplayString(unref(convertSuffix)), 1)
]),
key: "0"
} : void 0
]), 1032, ["size", "suffix", "value"])) : (openBlock(), createBlock(unref(Tooltip), { key: 2 }, {
title: withCtx(() => [
createTextVNode(toDisplayString(_ctx.value), 1)
]),
default: withCtx(() => [
createTextVNode(" " + toDisplayString(_ctx.value), 1)
]),
_: 1
}))
], 2);
};
}
});
export {
_sfc_main as default
};