@progress/kendo-vue-progressbars 2.6.4-dev.202111300936
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +11 -0
- package/NOTICE.txt +33 -0
- package/README.md +49 -0
- package/dist/cdn/js/kendo-vue-progressbars.js +1 -0
- package/dist/es/additionalTypes.ts +3 -0
- package/dist/es/common/BaseProps.d.ts +74 -0
- package/dist/es/common/BaseProps.js +0 -0
- package/dist/es/common/constants.d.ts +16 -0
- package/dist/es/common/constants.js +16 -0
- package/dist/es/common/utils.d.ts +16 -0
- package/dist/es/common/utils.js +34 -0
- package/dist/es/main.d.ts +5 -0
- package/dist/es/main.js +5 -0
- package/dist/es/package-metadata.d.ts +5 -0
- package/dist/es/package-metadata.js +11 -0
- package/dist/es/progressbar/ProgressBar.d.ts +49 -0
- package/dist/es/progressbar/ProgressBar.js +240 -0
- package/dist/es/progressbar/hooks/usePrevious.d.ts +2 -0
- package/dist/es/progressbar/hooks/usePrevious.js +4 -0
- package/dist/es/progressbar/interfaces/LabelProps.d.ts +9 -0
- package/dist/es/progressbar/interfaces/LabelProps.js +0 -0
- package/dist/es/progressbar/interfaces/ProgressBarAnimation.d.ts +9 -0
- package/dist/es/progressbar/interfaces/ProgressBarAnimation.js +0 -0
- package/dist/es/progressbar/interfaces/ProgressBarHandle.d.ts +21 -0
- package/dist/es/progressbar/interfaces/ProgressBarHandle.js +3 -0
- package/dist/es/progressbar/interfaces/ProgressBarProps.d.ts +29 -0
- package/dist/es/progressbar/interfaces/ProgressBarProps.js +0 -0
- package/dist/npm/additionalTypes.ts +3 -0
- package/dist/npm/common/BaseProps.d.ts +74 -0
- package/dist/npm/common/BaseProps.js +2 -0
- package/dist/npm/common/constants.d.ts +16 -0
- package/dist/npm/common/constants.js +19 -0
- package/dist/npm/common/utils.d.ts +16 -0
- package/dist/npm/common/utils.js +37 -0
- package/dist/npm/main.d.ts +5 -0
- package/dist/npm/main.js +17 -0
- package/dist/npm/package-metadata.d.ts +5 -0
- package/dist/npm/package-metadata.js +14 -0
- package/dist/npm/progressbar/ProgressBar.d.ts +49 -0
- package/dist/npm/progressbar/ProgressBar.js +255 -0
- package/dist/npm/progressbar/hooks/usePrevious.d.ts +2 -0
- package/dist/npm/progressbar/hooks/usePrevious.js +11 -0
- package/dist/npm/progressbar/interfaces/LabelProps.d.ts +9 -0
- package/dist/npm/progressbar/interfaces/LabelProps.js +2 -0
- package/dist/npm/progressbar/interfaces/ProgressBarAnimation.d.ts +9 -0
- package/dist/npm/progressbar/interfaces/ProgressBarAnimation.js +2 -0
- package/dist/npm/progressbar/interfaces/ProgressBarHandle.d.ts +21 -0
- package/dist/npm/progressbar/interfaces/ProgressBarHandle.js +5 -0
- package/dist/npm/progressbar/interfaces/ProgressBarProps.d.ts +29 -0
- package/dist/npm/progressbar/interfaces/ProgressBarProps.js +2 -0
- package/package.json +60 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
import { animate, cancelAnimation } from '@progress/kendo-vue-animation';
|
|
6
|
+
import { classNames, isRtl, getTabIndex, templateRendering, getListeners, getTemplate } from '@progress/kendo-vue-common';
|
|
7
|
+
import { calculatePercentage, updateProgress, truncateNumber } from '../common/utils';
|
|
8
|
+
import { DEFAULT_ANIMATION_DURATION, NO_ANIMATION } from '../common/constants';
|
|
9
|
+
import { validatePackage } from '@progress/kendo-vue-common';
|
|
10
|
+
import { packageMetadata } from '../package-metadata'; // tslint:enable:max-line-length
|
|
11
|
+
|
|
12
|
+
var ProgressBar = {
|
|
13
|
+
name: 'KendoProgressBar',
|
|
14
|
+
props: {
|
|
15
|
+
animation: {
|
|
16
|
+
type: [Boolean, Object],
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
reverse: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
label: String,
|
|
28
|
+
labelRender: [String, Object, Function],
|
|
29
|
+
labelVisible: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: true
|
|
32
|
+
},
|
|
33
|
+
labelPlacement: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: undefined,
|
|
36
|
+
validator: function validator(value) {
|
|
37
|
+
return ['start', 'center', 'end'].includes(value);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
dir: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: undefined
|
|
43
|
+
},
|
|
44
|
+
max: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 100
|
|
47
|
+
},
|
|
48
|
+
min: {
|
|
49
|
+
type: Number,
|
|
50
|
+
default: 0
|
|
51
|
+
},
|
|
52
|
+
value: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 0
|
|
55
|
+
},
|
|
56
|
+
orientation: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'horizontal',
|
|
59
|
+
validator: function validator(value) {
|
|
60
|
+
return ['horizontal', 'vertical'].includes(value);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
tabIndex: Number,
|
|
64
|
+
emptyStyle: Object,
|
|
65
|
+
emptyClassName: String,
|
|
66
|
+
progressStyle: Object,
|
|
67
|
+
progressClassName: String
|
|
68
|
+
},
|
|
69
|
+
created: function created() {
|
|
70
|
+
validatePackage(packageMetadata);
|
|
71
|
+
},
|
|
72
|
+
mounted: function mounted() {
|
|
73
|
+
this._progressStatus = this.v3 ? this.progressStatusRef : this.$refs.progressStatus;
|
|
74
|
+
this._progressStatusWrap = this.v3 ? this.progressStatusWrapRef : this.$refs.progressStatusWrap;
|
|
75
|
+
this.currentDir = this.$props.dir !== undefined ? this.$props.dir : isRtl(this.$el) ? 'rtl' : 'ltr';
|
|
76
|
+
this.animationFrame = animate({
|
|
77
|
+
duration: this.animationDuration,
|
|
78
|
+
onStart: this.handleStart,
|
|
79
|
+
onUpdate: this.handleUpdate,
|
|
80
|
+
onEnd: this.handleEnd
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
destroyed: !!gh ? undefined : function () {
|
|
84
|
+
cancelAnimation(this.animationFrame);
|
|
85
|
+
},
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
unmounted: function unmounted() {
|
|
88
|
+
cancelAnimation(this.animationFrame);
|
|
89
|
+
},
|
|
90
|
+
data: function data() {
|
|
91
|
+
return {
|
|
92
|
+
currentDir: 'ltr'
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
watch: {
|
|
96
|
+
value: function value(_newValue, oldValue) {
|
|
97
|
+
this.prevValue = oldValue;
|
|
98
|
+
this.animationFrame = animate({
|
|
99
|
+
duration: this.animationDuration,
|
|
100
|
+
onStart: this.handleStart,
|
|
101
|
+
onUpdate: this.handleUpdate,
|
|
102
|
+
onEnd: this.handleEnd
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
computed: {
|
|
107
|
+
wrapperClass: function wrapperClass() {
|
|
108
|
+
var _a = this.$props,
|
|
109
|
+
disabled = _a.disabled,
|
|
110
|
+
reverse = _a.reverse,
|
|
111
|
+
orientation = _a.orientation,
|
|
112
|
+
value = _a.value;
|
|
113
|
+
var isVertical = orientation === 'vertical';
|
|
114
|
+
var indeterminateProp = value === null;
|
|
115
|
+
return {
|
|
116
|
+
'k-widget k-progressbar': true,
|
|
117
|
+
'k-progressbar-horizontal': !isVertical,
|
|
118
|
+
'k-progressbar-vertical': isVertical,
|
|
119
|
+
'k-progressbar-reverse': reverse,
|
|
120
|
+
'k-progressbar-indeterminate': indeterminateProp,
|
|
121
|
+
'k-state-disabled': disabled
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
isVertical: function isVertical() {
|
|
125
|
+
return this.orientation === 'vertical';
|
|
126
|
+
},
|
|
127
|
+
animationDuration: function animationDuration() {
|
|
128
|
+
var animation = this.$props.animation;
|
|
129
|
+
return typeof animation !== 'boolean' && animation !== undefined ? animation.duration : animation ? DEFAULT_ANIMATION_DURATION : NO_ANIMATION;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
setup: !gh ? undefined : function () {
|
|
134
|
+
var v3 = !!gh;
|
|
135
|
+
return {
|
|
136
|
+
v3: v3
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
render: function render(createElement) {
|
|
141
|
+
var _this = this;
|
|
142
|
+
|
|
143
|
+
var h = gh || createElement;
|
|
144
|
+
var _a = this.$props,
|
|
145
|
+
disabled = _a.disabled,
|
|
146
|
+
labelVisible = _a.labelVisible,
|
|
147
|
+
labelPlacement = _a.labelPlacement,
|
|
148
|
+
max = _a.max,
|
|
149
|
+
min = _a.min,
|
|
150
|
+
tabIndex = _a.tabIndex,
|
|
151
|
+
emptyStyle = _a.emptyStyle,
|
|
152
|
+
emptyClassName = _a.emptyClassName,
|
|
153
|
+
progressStyle = _a.progressStyle,
|
|
154
|
+
progressClassName = _a.progressClassName;
|
|
155
|
+
var value = this.$props.value || 0;
|
|
156
|
+
var indeterminateProp = this.$props.value === null;
|
|
157
|
+
var formattedLabel = truncateNumber(value);
|
|
158
|
+
var labelProps = {
|
|
159
|
+
value: value
|
|
160
|
+
};
|
|
161
|
+
var label = this.$props.labelRender ? templateRendering.call(this, this.$props.labelRender, getListeners.call(this)) : undefined;
|
|
162
|
+
var labelDefaultRendering = h('span', {
|
|
163
|
+
'class': 'k-progress-status'
|
|
164
|
+
}, formattedLabel);
|
|
165
|
+
var toggleButtonRendering = getTemplate.call(this, {
|
|
166
|
+
h: h,
|
|
167
|
+
template: label,
|
|
168
|
+
defaultRendering: labelDefaultRendering,
|
|
169
|
+
additionalProps: labelProps
|
|
170
|
+
});
|
|
171
|
+
var renderLabel = labelVisible ? this.$props.label ? h("span", {
|
|
172
|
+
"class": 'k-progress-status'
|
|
173
|
+
}, [this.$props.label]) : toggleButtonRendering : undefined;
|
|
174
|
+
var positionClasses = classNames('k-progress-status-wrap', {
|
|
175
|
+
'k-progress-start': labelPlacement === 'start',
|
|
176
|
+
'k-progress-center': labelPlacement === 'center',
|
|
177
|
+
'k-progress-end': labelPlacement === 'end' || labelPlacement === undefined
|
|
178
|
+
});
|
|
179
|
+
return h("div", {
|
|
180
|
+
"class": this.wrapperClass,
|
|
181
|
+
dir: this.currentDir,
|
|
182
|
+
attrs: this.v3 ? undefined : {
|
|
183
|
+
dir: this.currentDir,
|
|
184
|
+
tabindex: getTabIndex(tabIndex, disabled),
|
|
185
|
+
role: 'progressbar',
|
|
186
|
+
"aria-valuemin": min,
|
|
187
|
+
"aria-valuemax": max,
|
|
188
|
+
"aria-valuenow": indeterminateProp ? undefined : value,
|
|
189
|
+
"aria-disabled": disabled
|
|
190
|
+
},
|
|
191
|
+
tabindex: getTabIndex(tabIndex, disabled),
|
|
192
|
+
role: 'progressbar',
|
|
193
|
+
"aria-valuemin": min,
|
|
194
|
+
"aria-valuemax": max,
|
|
195
|
+
"aria-valuenow": indeterminateProp ? undefined : value,
|
|
196
|
+
"aria-disabled": disabled
|
|
197
|
+
}, [h("span", {
|
|
198
|
+
"class": positionClasses + (emptyClassName ? ' ' + emptyClassName : ''),
|
|
199
|
+
style: emptyStyle
|
|
200
|
+
}, [renderLabel]), h("div", {
|
|
201
|
+
"class": 'k-state-selected',
|
|
202
|
+
style: progressStyle,
|
|
203
|
+
ref: this.v3 ? function (el) {
|
|
204
|
+
_this.progressStatusRef = el;
|
|
205
|
+
} : 'progressStatus'
|
|
206
|
+
}, [h("span", {
|
|
207
|
+
"class": positionClasses + (progressClassName ? ' ' + progressClassName : ''),
|
|
208
|
+
ref: this.v3 ? function (el) {
|
|
209
|
+
_this.progressStatusWrapRef = el;
|
|
210
|
+
} : 'progressStatusWrap'
|
|
211
|
+
}, [renderLabel])])]);
|
|
212
|
+
},
|
|
213
|
+
methods: {
|
|
214
|
+
focus: function focus() {
|
|
215
|
+
if (this.$el) {
|
|
216
|
+
this.$el.focus();
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
progressStatusElement: function progressStatusElement() {
|
|
220
|
+
return this._progressStatus;
|
|
221
|
+
},
|
|
222
|
+
progressStatusWrapElement: function progressStatusWrapElement() {
|
|
223
|
+
return this._progressStatusWrap;
|
|
224
|
+
},
|
|
225
|
+
handleStart: function handleStart() {
|
|
226
|
+
var percentage = calculatePercentage(this.min, this.max, this.prevValue);
|
|
227
|
+
updateProgress(this._progressStatus, this._progressStatusWrap, percentage, this.isVertical);
|
|
228
|
+
},
|
|
229
|
+
handleUpdate: function handleUpdate(progress) {
|
|
230
|
+
var percentage = calculatePercentage(this.min, this.max, this.prevValue + (this.value - this.prevValue) * progress);
|
|
231
|
+
updateProgress(this._progressStatus, this._progressStatusWrap, percentage, this.isVertical);
|
|
232
|
+
},
|
|
233
|
+
handleEnd: function handleEnd() {
|
|
234
|
+
var percentage = calculatePercentage(this.min, this.max, this.value);
|
|
235
|
+
updateProgress(this._progressStatus, this._progressStatusWrap, percentage, this.isVertical);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var ProgressBarVue3 = ProgressBar;
|
|
240
|
+
export { ProgressBar, ProgressBarVue3 };
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ProgressBar ref.
|
|
3
|
+
*/
|
|
4
|
+
export interface ProgressBarHandle {
|
|
5
|
+
/**
|
|
6
|
+
* The ProgressBar element.
|
|
7
|
+
*/
|
|
8
|
+
element: HTMLDivElement | null;
|
|
9
|
+
/**
|
|
10
|
+
* The progress status element.
|
|
11
|
+
*/
|
|
12
|
+
progressStatusElement: HTMLDivElement | null;
|
|
13
|
+
/**
|
|
14
|
+
* The progress status wrap element.
|
|
15
|
+
*/
|
|
16
|
+
progressStatusWrapElement: HTMLSpanElement | null;
|
|
17
|
+
/**
|
|
18
|
+
* Focus the ProgressBar.
|
|
19
|
+
*/
|
|
20
|
+
focus: () => void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseProps } from '../../common/BaseProps';
|
|
2
|
+
import { ProgressBarAnimation } from './ProgressBarAnimation';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the props of the [Kendo UI for Vue ProgressBar component]({% slug overview_progressbar %}).
|
|
5
|
+
*/
|
|
6
|
+
export interface ProgressBarProps extends BaseProps {
|
|
7
|
+
/**
|
|
8
|
+
* Specifies the animation settings of the ProgressBar. Defaults to `false`.
|
|
9
|
+
* If boolean, enables or disables the default animation.
|
|
10
|
+
* Use ProgressBarAnimation to set slide animation with customizable duration option. Accepts a number in milliseconds.
|
|
11
|
+
*/
|
|
12
|
+
animation?: boolean | ProgressBarAnimation;
|
|
13
|
+
/**
|
|
14
|
+
* Overrides the default label ([see example]({% slug progressbar_label %})).
|
|
15
|
+
*/
|
|
16
|
+
label?: any;
|
|
17
|
+
/**
|
|
18
|
+
* Overrides the default label template ([see example]({% slug progressbar_label %})).
|
|
19
|
+
*/
|
|
20
|
+
labelRender?: any;
|
|
21
|
+
/**
|
|
22
|
+
* Sets the visibility of the progress status label. Defaults to `true`.
|
|
23
|
+
*/
|
|
24
|
+
labelVisible?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the position of the progress status label. Defaults to `end` ([see example]({% slug progressbar_label %})).
|
|
27
|
+
*/
|
|
28
|
+
labelPlacement?: 'start' | 'center' | 'end' | any;
|
|
29
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export interface BaseProps {
|
|
5
|
+
/**
|
|
6
|
+
* Sets one of the two visually distinct types of progress bar.
|
|
7
|
+
*
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
type?: 'linear' | 'circular';
|
|
11
|
+
/**
|
|
12
|
+
* Sets the value of the progress bar. Has to be between `min` and `max` values. Defaults to `0`.
|
|
13
|
+
* Set `null` to enable the indeterminate state of the progress bar.
|
|
14
|
+
* See examples ([here]({% slug overview_progressbar %})) and ([here]({% slug overview_chunkprogressbar %})).
|
|
15
|
+
*/
|
|
16
|
+
value?: number | null;
|
|
17
|
+
/**
|
|
18
|
+
* The minimum value of the progress bar. Defaults to `0`.
|
|
19
|
+
*/
|
|
20
|
+
min?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The maximum value of the progress bar. Defaults to `100`.
|
|
23
|
+
*/
|
|
24
|
+
max?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Represents the `dir` HTML attribute. This is used to switch from LTR to RTL.
|
|
27
|
+
*/
|
|
28
|
+
dir?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the disabled state of the progress bar.
|
|
31
|
+
* See examples ([here]({% slug progressbar_disabled %})) and ([here]({% slug chunkprogressbar_disabled %})).
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Defines the orientation of the progress bar.
|
|
36
|
+
* See examples ([here]({% slug progressbar_orientation %})) and ([here]({% slug chunkprogressbar_orientation %})).
|
|
37
|
+
* Defaults to `horizontal`.
|
|
38
|
+
*/
|
|
39
|
+
orientation?: 'horizontal' | 'vertical' | string;
|
|
40
|
+
/**
|
|
41
|
+
* If set to `true`, the progress bar will be reversed.
|
|
42
|
+
* See examples ([here]({% slug progressbar_direction %})) and ([here]({% slug chunkprogressbar_direction %})).
|
|
43
|
+
* Defaults to `false`.
|
|
44
|
+
*/
|
|
45
|
+
reverse?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Specifies a list of CSS classes that will be added to the progress bar element.
|
|
48
|
+
*/
|
|
49
|
+
className?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The styles that are applied to the inner element which represents the empty portion of the progress bar.
|
|
52
|
+
* See examples ([here]({% slug progressbar_appearance %})) and ([here]({% slug chunkprogressbar_appearance %})).
|
|
53
|
+
*/
|
|
54
|
+
emptyStyle?: object;
|
|
55
|
+
/**
|
|
56
|
+
* Sets additional classes to the inner element which represents the empty portion of the progress bar.
|
|
57
|
+
* See examples ([here]({% slug progressbar_appearance %})) and ([here]({% slug chunkprogressbar_appearance %})).
|
|
58
|
+
*/
|
|
59
|
+
emptyClassName?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The styles that are applied to the inner element which represents the full portion of the progress bar.
|
|
62
|
+
* See examples ([here]({% slug progressbar_appearance %})) and ([here]({% slug chunkprogressbar_appearance %})).
|
|
63
|
+
*/
|
|
64
|
+
progressStyle?: object;
|
|
65
|
+
/**
|
|
66
|
+
* Sets additional classes to the inner element which represents the full portion of the progress bar.
|
|
67
|
+
* See examples ([here]({% slug progressbar_appearance %})) and ([here]({% slug chunkprogressbar_appearance %})).
|
|
68
|
+
*/
|
|
69
|
+
progressClassName?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Sets the `tabIndex` property of the progress bar.
|
|
72
|
+
*/
|
|
73
|
+
tabIndex?: number;
|
|
74
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export declare const MIN_RATIO = 0.00001;
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
export declare const LABEL_DECIMALS = 3;
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_ANIMATION_DURATION = 400;
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export declare const NO_ANIMATION = 0;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NO_ANIMATION = exports.DEFAULT_ANIMATION_DURATION = exports.LABEL_DECIMALS = exports.MIN_RATIO = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @hidden
|
|
6
|
+
*/
|
|
7
|
+
exports.MIN_RATIO = 0.00001;
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
exports.LABEL_DECIMALS = 3;
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
exports.DEFAULT_ANIMATION_DURATION = 400;
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
exports.NO_ANIMATION = 0;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export declare const truncateNumber: (value: number) => string;
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
export declare const calculatePercentage: (min: number, max: number, value: number) => number;
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export declare const updateProgress: (progressRef: any, progressWrapRef: any, percentage: number, isVertical: boolean) => void;
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export declare const calculateRatio: (min: number, max: number, value: number) => number;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateRatio = exports.updateProgress = exports.calculatePercentage = exports.truncateNumber = void 0;
|
|
4
|
+
var constants_1 = require("./constants");
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
exports.truncateNumber = function (value) {
|
|
9
|
+
var numberParts = value.toString().split('.');
|
|
10
|
+
return numberParts.length === 1 ? "" + numberParts[0] : numberParts[0] + "." + numberParts[1].substr(0, constants_1.LABEL_DECIMALS);
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
exports.calculatePercentage = function (min, max, value) {
|
|
16
|
+
var onePercent = Math.abs((max - min) / 100);
|
|
17
|
+
return Math.abs((value - min) / onePercent);
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
exports.updateProgress = function (progressRef, progressWrapRef, percentage, isVertical) {
|
|
23
|
+
var progressPercentage = Math.max(percentage, 0.01);
|
|
24
|
+
var progressWrapPercentage = (100 / progressPercentage) * 100;
|
|
25
|
+
if (progressRef && progressWrapRef) {
|
|
26
|
+
progressRef.style.width = !isVertical ? progressPercentage + "%" : '100%';
|
|
27
|
+
progressWrapRef.style.width = !isVertical ? progressWrapPercentage + "%" : '100%';
|
|
28
|
+
progressRef.style.height = isVertical ? progressPercentage + "%" : '100%';
|
|
29
|
+
progressWrapRef.style.height = isVertical ? progressWrapPercentage + "%" : '100%';
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
exports.calculateRatio = function (min, max, value) {
|
|
36
|
+
return Math.max((value - min) / (max - min), constants_1.MIN_RATIO);
|
|
37
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './progressbar/ProgressBar';
|
|
2
|
+
export * from './progressbar/interfaces/ProgressBarHandle';
|
|
3
|
+
export * from './progressbar/interfaces/ProgressBarProps';
|
|
4
|
+
export * from './progressbar/interfaces/ProgressBarAnimation';
|
|
5
|
+
export * from './progressbar/interfaces/LabelProps';
|
package/dist/npm/main.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./progressbar/ProgressBar"), exports);
|
|
14
|
+
__exportStar(require("./progressbar/interfaces/ProgressBarHandle"), exports);
|
|
15
|
+
__exportStar(require("./progressbar/interfaces/ProgressBarProps"), exports);
|
|
16
|
+
__exportStar(require("./progressbar/interfaces/ProgressBarAnimation"), exports);
|
|
17
|
+
__exportStar(require("./progressbar/interfaces/LabelProps"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.packageMetadata = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @hidden
|
|
6
|
+
*/
|
|
7
|
+
exports.packageMetadata = {
|
|
8
|
+
name: '@progress/kendo-vue-progressbars',
|
|
9
|
+
productName: 'Kendo UI for Vue',
|
|
10
|
+
productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
|
|
11
|
+
publishDate: 1638264751,
|
|
12
|
+
version: '',
|
|
13
|
+
licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
|
|
14
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DefineComponent } from '../additionalTypes';
|
|
2
|
+
import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
|
|
3
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
4
|
+
declare type DefaultMethods<V> = {
|
|
5
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
6
|
+
};
|
|
7
|
+
import { ProgressBarProps } from './interfaces/ProgressBarProps';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export interface ProgressBarState {
|
|
12
|
+
_progressStatus?: any;
|
|
13
|
+
_progressStatusWrap?: any;
|
|
14
|
+
animationFrame: any;
|
|
15
|
+
prevValue: number;
|
|
16
|
+
v3: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export interface ProgressBarComputed {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
wrapperClass: object;
|
|
24
|
+
isVertical: boolean;
|
|
25
|
+
animationDuration: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
export interface ProgressBarMethods {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
focus: (e: any) => void;
|
|
33
|
+
toggleIfApplicable: () => void;
|
|
34
|
+
handleClick: (event: any) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
export interface ProgressBarData {
|
|
40
|
+
currentActive: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @hidden
|
|
44
|
+
*/
|
|
45
|
+
export interface ProgressBarAll extends Vue, ProgressBarMethods, ProgressBarData, ProgressBarComputed, ProgressBarState {
|
|
46
|
+
}
|
|
47
|
+
declare let ProgressBar: ComponentOptions<ProgressBarAll, DefaultData<ProgressBarData>, DefaultMethods<ProgressBarAll>, ProgressBarComputed, RecordPropsDefinition<ProgressBarProps>>;
|
|
48
|
+
declare const ProgressBarVue3: DefineComponent<ProgressBarProps, any, ProgressBarData, ProgressBarComputed, ProgressBarMethods, {}, {}, {}, string, ProgressBarProps, ProgressBarProps, {}>;
|
|
49
|
+
export { ProgressBar, ProgressBarVue3 };
|