front_ponto_eletronico/node_modules/vuetify/lib/components/VSparkline/VSparkline.mjs

49 lines
1.7 KiB
JavaScript

import { createVNode as _createVNode, mergeProps as _mergeProps, resolveDirective as _resolveDirective } from "vue";
// Components
import { makeVBarlineProps, VBarline } from "./VBarline.mjs";
import { makeVTrendlineProps, VTrendline } from "./VTrendline.mjs"; // Composables
import { useTextColor } from "../../composables/color.mjs"; // Utilities
import { computed, toRef } from 'vue';
import { genericComponent, propsFactory, useRender } from "../../util/index.mjs"; // Types
// Types
export const makeVSparklineProps = propsFactory({
type: {
type: String,
default: 'trend'
},
...makeVBarlineProps(),
...makeVTrendlineProps()
}, 'VSparkline');
export const VSparkline = genericComponent()({
name: 'VSparkline',
props: makeVSparklineProps(),
setup(props, _ref) {
let {
slots
} = _ref;
const {
textColorClasses,
textColorStyles
} = useTextColor(toRef(props, 'color'));
const hasLabels = computed(() => {
return Boolean(props.showLabels || props.labels.length > 0 || !!slots?.label);
});
const totalHeight = computed(() => {
let height = parseInt(props.height, 10);
if (hasLabels.value) height += parseInt(props.labelSize, 10) * 1.5;
return height;
});
useRender(() => {
const Tag = props.type === 'trend' ? VTrendline : VBarline;
const lineProps = props.type === 'trend' ? VTrendline.filterProps(props) : VBarline.filterProps(props);
return _createVNode(Tag, _mergeProps({
"key": props.type,
"class": textColorClasses.value,
"style": textColorStyles.value,
"viewBox": `0 0 ${props.width} ${parseInt(totalHeight.value, 10)}`
}, lineProps), slots);
});
}
});
//# sourceMappingURL=VSparkline.mjs.map