winbox-ui-next
Version:
We Design Vue 2.0: A Vue.js 3 UI Library
146 lines (145 loc) • 4.8 kB
JavaScript
"use strict";
var vue = require("vue");
var line = require("./line.js");
var circle = require("./circle.js");
var steps = require("./steps.js");
var globalConfig = require("../_utils/global-config.js");
var context = require("../config-provider/context.js");
var pluginVue_exportHelper = require("../_virtual/plugin-vue_export-helper");
const _sfc_main = vue.defineComponent({
name: "Progress",
components: {
ProgressLine: line,
ProgressCircle: circle,
ProgressSteps: steps
},
props: {
type: {
type: String,
default: "line"
},
size: {
type: String,
default: () => {
var _a, _b;
return (_b = (_a = vue.inject(context.configProviderInjectionKey, void 0)) == null ? void 0 : _a.size) != null ? _b : "default";
}
},
percent: {
type: Number,
default: 0
},
steps: {
type: Number,
default: 0
},
animation: {
type: Boolean,
default: false
},
strokeWidth: {
type: Number
},
width: {
type: [Number, String]
},
strokeColor: {
type: [String, Object]
},
trackColor: String,
bufferColor: {
type: [String, Object]
},
showText: {
type: Boolean,
default: true
},
status: {
type: String
}
},
setup(props) {
const prefixCls = globalConfig.getPrefixCls("progress");
const type = vue.computed(() => props.steps > 0 ? "steps" : props.type);
const computedStatus = vue.computed(() => {
return props.status || (props.percent >= 1 ? "success" : "normal");
});
const cls = vue.computed(() => [
prefixCls,
`${prefixCls}-type-${type.value}`,
`${prefixCls}-size-${props.size}`,
`${prefixCls}-status-${computedStatus.value}`
]);
return {
cls,
computedStatus
};
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_progress_steps = vue.resolveComponent("progress-steps");
const _component_progress_line = vue.resolveComponent("progress-line");
const _component_progress_circle = vue.resolveComponent("progress-circle");
return vue.openBlock(), vue.createElementBlock("div", {
class: vue.normalizeClass(_ctx.cls)
}, [
_ctx.steps > 0 ? (vue.openBlock(), vue.createBlock(_component_progress_steps, {
key: 0,
"stroke-width": _ctx.strokeWidth,
percent: _ctx.percent,
color: _ctx.strokeColor,
"track-color": _ctx.trackColor,
width: _ctx.width,
steps: _ctx.steps,
size: _ctx.size,
"show-text": _ctx.showText
}, vue.createSlots({ _: 2 }, [
_ctx.$slots.text ? {
name: "text",
fn: vue.withCtx((scope) => [
vue.renderSlot(_ctx.$slots, "text", vue.normalizeProps(vue.guardReactiveProps(scope)))
])
} : void 0
]), 1032, ["stroke-width", "percent", "color", "track-color", "width", "steps", "size", "show-text"])) : _ctx.type === "line" && _ctx.size !== "mini" ? (vue.openBlock(), vue.createBlock(_component_progress_line, {
key: 1,
"stroke-width": _ctx.strokeWidth,
animation: _ctx.animation,
percent: _ctx.percent,
color: _ctx.strokeColor,
"track-color": _ctx.trackColor,
size: _ctx.size,
"buffer-color": _ctx.bufferColor,
width: _ctx.width,
"show-text": _ctx.showText,
status: _ctx.computedStatus
}, vue.createSlots({ _: 2 }, [
_ctx.$slots.text ? {
name: "text",
fn: vue.withCtx((scope) => [
vue.renderSlot(_ctx.$slots, "text", vue.normalizeProps(vue.guardReactiveProps(scope)))
])
} : void 0
]), 1032, ["stroke-width", "animation", "percent", "color", "track-color", "size", "buffer-color", "width", "show-text", "status"])) : (vue.openBlock(), vue.createBlock(_component_progress_circle, {
key: 2,
type: _ctx.type,
"stroke-width": _ctx.type === "line" ? _ctx.strokeWidth || 4 : _ctx.strokeWidth,
"path-stroke-width": _ctx.type === "line" ? _ctx.strokeWidth || 4 : _ctx.strokeWidth,
width: _ctx.width,
percent: _ctx.percent,
color: _ctx.strokeColor,
"track-color": _ctx.trackColor,
size: _ctx.size,
"show-text": _ctx.showText,
status: _ctx.computedStatus
}, vue.createSlots({ _: 2 }, [
_ctx.$slots.text ? {
name: "text",
fn: vue.withCtx((scope) => [
vue.renderSlot(_ctx.$slots, "text", vue.normalizeProps(vue.guardReactiveProps(scope)))
])
} : void 0
]), 1032, ["type", "stroke-width", "path-stroke-width", "width", "percent", "color", "track-color", "size", "show-text", "status"]))
], 2);
}
var _Progress = /* @__PURE__ */ pluginVue_exportHelper(_sfc_main, [["render", _sfc_render]]);
module.exports = _Progress;