1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __getOwnPropNames = Object.getOwnPropertyNames;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __export = (target, all) => {
- for (var name2 in all)
- __defProp(target, name2, { get: all[name2], enumerable: true });
- };
- var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
- };
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
- var stdin_exports = {};
- __export(stdin_exports, {
- default: () => stdin_default
- });
- module.exports = __toCommonJS(stdin_exports);
- var import_vue = require("vue");
- var import_vue2 = require("vue");
- var import_utils = require("../utils");
- const [name, bem] = (0, import_utils.createNamespace)("progress");
- const progressProps = {
- color: String,
- inactive: Boolean,
- pivotText: String,
- textColor: String,
- showPivot: import_utils.truthProp,
- pivotColor: String,
- trackColor: String,
- strokeWidth: import_utils.numericProp,
- percentage: {
- type: import_utils.numericProp,
- default: 0,
- validator: (value) => value >= 0 && value <= 100
- }
- };
- var stdin_default = (0, import_vue2.defineComponent)({
- name,
- props: progressProps,
- setup(props) {
- const background = (0, import_vue2.computed)(() => props.inactive ? void 0 : props.color);
- const renderPivot = () => {
- const {
- textColor,
- pivotText,
- pivotColor,
- percentage
- } = props;
- const text = pivotText != null ? pivotText : `${percentage}%`;
- if (props.showPivot && text) {
- const style = {
- color: textColor,
- left: `${+percentage}%`,
- transform: `translate(-${+percentage}%,-50%)`,
- background: pivotColor || background.value
- };
- return (0, import_vue.createVNode)("span", {
- "style": style,
- "class": bem("pivot", {
- inactive: props.inactive
- })
- }, [text]);
- }
- };
- return () => {
- const {
- trackColor,
- percentage,
- strokeWidth
- } = props;
- const rootStyle = {
- background: trackColor,
- height: (0, import_utils.addUnit)(strokeWidth)
- };
- const portionStyle = {
- width: `${percentage}%`,
- background: background.value
- };
- return (0, import_vue.createVNode)("div", {
- "class": bem(),
- "style": rootStyle
- }, [(0, import_vue.createVNode)("span", {
- "class": bem("portion", {
- inactive: props.inactive
- }),
- "style": portionStyle
- }, null), renderPivot()]);
- };
- }
- });
|