@progress/kendo-vue-charts
Version:
146 lines (145 loc) • 3.42 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { defineComponent as h, createVNode as m, isVNode as b } from "vue";
import { BaseChart as C } from "./BaseChart.mjs";
import { Sparkline as a } from "@progress/kendo-charts";
import { getDefaultSlots as y, classNames as g, setRef as O, getRef as s } from "@progress/kendo-vue-common";
function S(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !b(e);
}
const B = /* @__PURE__ */ h({
name: "KendoSparkline",
props: {
dataItems: {
type: Array,
default: function() {
}
},
type: String,
dir: String,
renderAs: {
type: String,
default: void 0,
validator: function(e) {
return ["svg", "canvas"].includes(e);
}
},
pannable: {
type: [Boolean, Object],
default: function() {
}
},
zoomable: {
type: [Boolean, Object],
default: function() {
}
},
seriesColors: {
type: Array,
default: function() {
}
},
transitions: {
type: Boolean,
default: !0
},
paneDefaults: {
type: Object,
default: function() {
}
},
panes: {
type: Array,
default: function() {
}
},
seriesDefaults: {
type: Object,
default: function() {
}
},
axisDefaults: {
type: Object,
default: function() {
}
}
},
updated() {
this.baseChart = s(this, "baseChart");
},
mounted() {
this.baseChart = s(this, "baseChart");
},
methods: {
chartInstance() {
return this.baseChart !== null ? this.baseChart.chartInstance : null;
},
surface() {
return this.baseChart !== null ? this.baseChart.surface : null;
},
element() {
return this.baseChart !== null ? this.baseChart.element : null;
},
getTarget() {
return this;
},
deriveOptionsFromParent(e) {
const {
type: t,
dataItems: n
} = this.$props, r = Object.assign({}, e, {
type: t,
data: n
});
return a.normalizeOptions(r);
},
handleBaseChartEvents(e, t) {
this.$emit(e, t);
}
},
render() {
const e = y(this), {
dataItems: t,
dir: n,
renderAs: r,
pannable: i,
zoomable: o,
seriesColors: u,
transitions: l,
paneDefaults: d,
panes: f,
seriesDefaults: p,
axisDefaults: c
} = this.$props;
return m(C, {
dataItems: t,
dir: n,
renderAs: r,
pannable: i,
zoomable: o,
seriesColors: u,
transitions: l,
paneDefaults: d,
panes: f,
seriesDefaults: p,
axisDefaults: c,
ref: O(this, "baseChart"),
chartConstructor: a,
getTarget: this.getTarget,
wrapper: "span",
deriveOptionsFromParent: this.deriveOptionsFromParent,
class: g("k-sparkline k-widget"),
onBasechartevent: this.handleBaseChartEvents
}, S(e) ? e : {
default: () => [e]
});
}
});
export {
B as Sparkline
};