@syncfusion/ej2-vue-progressbar
Version:
Essential JS 2 ProgressBar Component for Vue
238 lines (233 loc) • 9.55 kB
JavaScript
import { ProgressBar } from '@syncfusion/ej2-progressbar';
export * from '@syncfusion/ej2-progressbar';
import { vueDefineComponent, isExecute, gh, getProps, ComponentBase } from '@syncfusion/ej2-vue-base';
import { isNullOrUndefined } from '@syncfusion/ej2-base';
var ProgressBarAnnotationsDirective = vueDefineComponent({
inject: { custom: { default: null } },
render: function (createElement) {
if (!isExecute) {
var h = !isExecute ? gh : createElement;
var slots = null;
if (!isNullOrUndefined(this.$slots.default)) {
slots = !isExecute ? this.$slots.default() : this.$slots.default;
}
return h('div', { class: 'e-directive' }, slots);
}
return;
},
updated: function () {
if (!isExecute && this.custom) {
this.custom();
}
},
methods: {
getTag: function () {
return 'e-progressbar-annotations';
}
}
});
var ProgressBarAnnotationsPlugin = {
name: 'e-progressbar-annotations',
install: function (Vue) {
Vue.component(ProgressBarAnnotationsPlugin.name, ProgressBarAnnotationsDirective);
}
};
var ProgressBarAnnotationDirective = vueDefineComponent({
render: function () {
return;
},
methods: {
getTag: function () {
return 'e-progressbar-annotation';
}
}
});
var ProgressBarAnnotationPlugin = {
name: 'e-progressbar-annotation',
install: function (Vue) {
Vue.component(ProgressBarAnnotationPlugin.name, ProgressBarAnnotationDirective);
}
};
var RangeColorsDirective = vueDefineComponent({
inject: { custom: { default: null } },
render: function (createElement) {
if (!isExecute) {
var h = !isExecute ? gh : createElement;
var slots = null;
if (!isNullOrUndefined(this.$slots.default)) {
slots = !isExecute ? this.$slots.default() : this.$slots.default;
}
return h('div', { class: 'e-directive' }, slots);
}
return;
},
updated: function () {
if (!isExecute && this.custom) {
this.custom();
}
},
methods: {
getTag: function () {
return 'e-rangecolors';
}
}
});
var RangeColorsPlugin = {
name: 'e-rangecolors',
install: function (Vue) {
Vue.component(RangeColorsPlugin.name, RangeColorsDirective);
}
};
var RangeColorDirective = vueDefineComponent({
render: function () {
return;
},
methods: {
getTag: function () {
return 'e-rangecolor';
}
}
});
var RangeColorPlugin = {
name: 'e-rangecolor',
install: function (Vue) {
Vue.component(RangeColorPlugin.name, RangeColorDirective);
}
};
var properties = ['isLazyUpdate', 'plugins', 'animation', 'annotations', 'cornerRadius', 'enablePersistence', 'enablePieProgress', 'enableProgressSegments', 'enableRtl', 'endAngle', 'gapWidth', 'height', 'innerRadius', 'isActive', 'isGradient', 'isIndeterminate', 'isStriped', 'labelOnTrack', 'labelStyle', 'locale', 'margin', 'maximum', 'minimum', 'progressColor', 'progressThickness', 'radius', 'rangeColors', 'role', 'secondaryProgress', 'secondaryProgressColor', 'secondaryProgressThickness', 'segmentColor', 'segmentCount', 'showProgressValue', 'startAngle', 'theme', 'tooltip', 'trackColor', 'trackThickness', 'type', 'value', 'width', 'animationComplete', 'load', 'loaded', 'mouseClick', 'mouseDown', 'mouseLeave', 'mouseMove', 'mouseUp', 'progressCompleted', 'textRender', 'tooltipRender', 'valueChanged'];
var modelProps = [];
var testProp = getProps({ props: properties });
var props = testProp[0], watch = testProp[1], emitProbs = Object.keys(watch);
emitProbs.push('modelchanged', 'update:modelValue');
for (var _i = 0, modelProps_1 = modelProps; _i < modelProps_1.length; _i++) {
var props_1 = modelProps_1[_i];
emitProbs.push('update:' + props_1);
}
/**
* Represents Vuejs ProgressBar Component
* ```vue
* <ejs-progressbar></ejs-progressbar>
* ```
*/
var ProgressBarComponent = vueDefineComponent({
name: 'ProgressBarComponent',
mixins: [ComponentBase],
props: props,
watch: watch,
emits: emitProbs,
provide: function () { return { custom: this.custom }; },
data: function () {
return {
ej2Instances: new ProgressBar({}),
propKeys: properties,
models: modelProps,
hasChildDirective: true,
hasInjectedModules: true,
tagMapper: { "e-progressbar-annotations": "e-progressbar-annotation", "e-rangecolors": "e-rangecolor" },
tagNameMapper: { "e-progressbar-annotations": "e-annotations", "e-rangecolors": "e-rangeColors" },
isVue3: !isExecute,
templateCollection: {},
};
},
created: function () {
this.bindProperties();
this.ej2Instances._setProperties = this.ej2Instances.setProperties;
this.ej2Instances.setProperties = this.setProperties;
this.ej2Instances.clearTemplate = this.clearTemplate;
this.updated = this.updated;
},
render: function (createElement) {
var h = !isExecute ? gh : createElement;
var slots = null;
if (!isNullOrUndefined(this.$slots.default)) {
slots = !isExecute ? this.$slots.default() : this.$slots.default;
}
return h('div', slots);
},
methods: {
clearTemplate: function (templateNames) {
if (!templateNames) {
templateNames = Object.keys(this.templateCollection || {});
}
if (templateNames.length && this.templateCollection) {
for (var _i = 0, templateNames_1 = templateNames; _i < templateNames_1.length; _i++) {
var tempName = templateNames_1[_i];
var elementCollection = this.templateCollection[tempName];
if (elementCollection && elementCollection.length) {
for (var _a = 0, elementCollection_1 = elementCollection; _a < elementCollection_1.length; _a++) {
var ele = elementCollection_1[_a];
this.destroyPortals(ele);
}
delete this.templateCollection[tempName];
}
}
}
},
setProperties: function (prop, muteOnChange) {
var _this = this;
if (this.isVue3) {
this.models = !this.models ? this.ej2Instances.referModels : this.models;
}
if (this.ej2Instances && this.ej2Instances._setProperties) {
this.ej2Instances._setProperties(prop, muteOnChange);
}
if (prop && this.models && this.models.length) {
Object.keys(prop).map(function (key) {
_this.models.map(function (model) {
if ((key === model) && !(/datasource/i.test(key))) {
if (_this.isVue3) {
_this.ej2Instances.vueInstance.$emit('update:' + key, prop[key]);
}
else {
_this.$emit('update:' + key, prop[key]);
_this.$emit('modelchanged', prop[key]);
}
}
});
});
}
},
custom: function () {
this.updated();
},
calculateProgressRange: function (value, minimum, maximum) {
return this.ej2Instances.calculateProgressRange(value, minimum, maximum);
},
calculateSegmentSize: function (width, thickness) {
return this.ej2Instances.calculateSegmentSize(width, thickness);
},
createClipPath: function (clipPath, range, d, refresh, thickness, isLabel, isMaximum) {
return this.ej2Instances.createClipPath(clipPath, range, d, refresh, thickness, isLabel, isMaximum);
},
destroy: function () {
return this.ej2Instances.destroy();
},
getPathLine: function (x, width, thickness) {
return this.ej2Instances.getPathLine(x, width, thickness);
},
hide: function () {
return this.ej2Instances.hide();
},
removeSvg: function () {
return this.ej2Instances.removeSvg();
},
requiredModules: function () {
return this.ej2Instances.requiredModules();
},
show: function () {
return this.ej2Instances.show();
},
}
});
var ProgressBarPlugin = {
name: 'ejs-progressbar',
install: function (Vue) {
Vue.component(ProgressBarPlugin.name, ProgressBarComponent);
Vue.component(ProgressBarAnnotationPlugin.name, ProgressBarAnnotationDirective);
Vue.component(ProgressBarAnnotationsPlugin.name, ProgressBarAnnotationsDirective);
Vue.component(RangeColorPlugin.name, RangeColorDirective);
Vue.component(RangeColorsPlugin.name, RangeColorsDirective);
}
};
export { ProgressBarAnnotationDirective, ProgressBarAnnotationPlugin, ProgressBarAnnotationsDirective, ProgressBarAnnotationsPlugin, ProgressBarComponent, ProgressBarPlugin, RangeColorDirective, RangeColorPlugin, RangeColorsDirective, RangeColorsPlugin };
//# sourceMappingURL=ej2-vue-progressbar.es5.js.map