@progress/kendo-vue-gauges
Version:
95 lines (94 loc) • 2.58 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 n, createVNode as s, isVNode as a } from "vue";
import { BaseGauge as i } from "./BaseGauge.mjs";
import { LinearGauge as u } from "@progress/kendo-charts";
import { Group as o } from "@progress/kendo-drawing";
import { getDefaultSlots as g } from "@progress/kendo-vue-common";
function l(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !a(e);
}
const m = /* @__PURE__ */ n({
name: "KendoLinearGauge",
props: {
dir: String,
renderAs: {
type: String,
default: "svg",
validator: function(e) {
return ["svg", "canvas"].includes(e);
}
},
gaugeConstructor: [Object, Function],
pointer: {
type: [Object, Array],
default: void 0
},
scale: {
type: Object,
default: void 0
},
transitions: {
type: Boolean,
default: void 0
}
},
mounted() {
this._baseGauge = this.baseGaugeRef;
},
updated() {
this._baseGauge = this.baseGaugeRef;
},
render() {
const e = g(this);
return s(i, {
transitions: this.$props.transitions,
scale: this.$props.scale,
pointer: this.$props.pointer,
deriveOptionsFromParent: this.deriveOptionsFromParent,
ref: (t) => {
this.baseGaugeRef = t;
},
gaugeConstructor: u,
getTarget: this.getTarget,
class: "k-gauge"
}, l(e) ? e : {
default: () => [e]
});
},
methods: {
gaugeInstance() {
return this._baseGauge !== null ? this._baseGauge.gaugeInstance : null;
},
surface() {
return this._baseGauge !== null ? this._baseGauge.surface : null;
},
element() {
return this._baseGauge !== null ? this._baseGauge.element : null;
},
exportVisual(e) {
return this.gaugeInstance() !== null ? Promise.resolve(this.gaugeInstance().exportVisual(e)) : Promise.resolve(new o());
},
getTarget() {
return this;
},
deriveOptionsFromParent(e) {
const {
pointer: t,
scale: r
} = this.$props;
return Object.assign({}, e, {
pointer: t,
scale: r
});
}
}
});
export {
m as LinearGauge
};