@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.
Files changed (51) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +33 -0
  3. package/README.md +49 -0
  4. package/dist/cdn/js/kendo-vue-progressbars.js +1 -0
  5. package/dist/es/additionalTypes.ts +3 -0
  6. package/dist/es/common/BaseProps.d.ts +74 -0
  7. package/dist/es/common/BaseProps.js +0 -0
  8. package/dist/es/common/constants.d.ts +16 -0
  9. package/dist/es/common/constants.js +16 -0
  10. package/dist/es/common/utils.d.ts +16 -0
  11. package/dist/es/common/utils.js +34 -0
  12. package/dist/es/main.d.ts +5 -0
  13. package/dist/es/main.js +5 -0
  14. package/dist/es/package-metadata.d.ts +5 -0
  15. package/dist/es/package-metadata.js +11 -0
  16. package/dist/es/progressbar/ProgressBar.d.ts +49 -0
  17. package/dist/es/progressbar/ProgressBar.js +240 -0
  18. package/dist/es/progressbar/hooks/usePrevious.d.ts +2 -0
  19. package/dist/es/progressbar/hooks/usePrevious.js +4 -0
  20. package/dist/es/progressbar/interfaces/LabelProps.d.ts +9 -0
  21. package/dist/es/progressbar/interfaces/LabelProps.js +0 -0
  22. package/dist/es/progressbar/interfaces/ProgressBarAnimation.d.ts +9 -0
  23. package/dist/es/progressbar/interfaces/ProgressBarAnimation.js +0 -0
  24. package/dist/es/progressbar/interfaces/ProgressBarHandle.d.ts +21 -0
  25. package/dist/es/progressbar/interfaces/ProgressBarHandle.js +3 -0
  26. package/dist/es/progressbar/interfaces/ProgressBarProps.d.ts +29 -0
  27. package/dist/es/progressbar/interfaces/ProgressBarProps.js +0 -0
  28. package/dist/npm/additionalTypes.ts +3 -0
  29. package/dist/npm/common/BaseProps.d.ts +74 -0
  30. package/dist/npm/common/BaseProps.js +2 -0
  31. package/dist/npm/common/constants.d.ts +16 -0
  32. package/dist/npm/common/constants.js +19 -0
  33. package/dist/npm/common/utils.d.ts +16 -0
  34. package/dist/npm/common/utils.js +37 -0
  35. package/dist/npm/main.d.ts +5 -0
  36. package/dist/npm/main.js +17 -0
  37. package/dist/npm/package-metadata.d.ts +5 -0
  38. package/dist/npm/package-metadata.js +14 -0
  39. package/dist/npm/progressbar/ProgressBar.d.ts +49 -0
  40. package/dist/npm/progressbar/ProgressBar.js +255 -0
  41. package/dist/npm/progressbar/hooks/usePrevious.d.ts +2 -0
  42. package/dist/npm/progressbar/hooks/usePrevious.js +11 -0
  43. package/dist/npm/progressbar/interfaces/LabelProps.d.ts +9 -0
  44. package/dist/npm/progressbar/interfaces/LabelProps.js +2 -0
  45. package/dist/npm/progressbar/interfaces/ProgressBarAnimation.d.ts +9 -0
  46. package/dist/npm/progressbar/interfaces/ProgressBarAnimation.js +2 -0
  47. package/dist/npm/progressbar/interfaces/ProgressBarHandle.d.ts +21 -0
  48. package/dist/npm/progressbar/interfaces/ProgressBarHandle.js +5 -0
  49. package/dist/npm/progressbar/interfaces/ProgressBarProps.d.ts +29 -0
  50. package/dist/npm/progressbar/interfaces/ProgressBarProps.js +2 -0
  51. package/package.json +60 -0
@@ -0,0 +1,255 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ProgressBarVue3 = exports.ProgressBar = void 0; // @ts-ignore
7
+
8
+ var Vue = require("vue");
9
+
10
+ var allVue = Vue;
11
+ var gh = allVue.h;
12
+
13
+ var kendo_vue_animation_1 = require("@progress/kendo-vue-animation");
14
+
15
+ var kendo_vue_common_1 = require("@progress/kendo-vue-common");
16
+
17
+ var utils_1 = require("../common/utils");
18
+
19
+ var constants_1 = require("../common/constants");
20
+
21
+ var kendo_vue_common_2 = require("@progress/kendo-vue-common");
22
+
23
+ var package_metadata_1 = require("../package-metadata"); // tslint:enable:max-line-length
24
+
25
+
26
+ var ProgressBar = {
27
+ name: 'KendoProgressBar',
28
+ props: {
29
+ animation: {
30
+ type: [Boolean, Object],
31
+ default: false
32
+ },
33
+ disabled: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ reverse: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ label: String,
42
+ labelRender: [String, Object, Function],
43
+ labelVisible: {
44
+ type: Boolean,
45
+ default: true
46
+ },
47
+ labelPlacement: {
48
+ type: String,
49
+ default: undefined,
50
+ validator: function validator(value) {
51
+ return ['start', 'center', 'end'].includes(value);
52
+ }
53
+ },
54
+ dir: {
55
+ type: String,
56
+ default: undefined
57
+ },
58
+ max: {
59
+ type: Number,
60
+ default: 100
61
+ },
62
+ min: {
63
+ type: Number,
64
+ default: 0
65
+ },
66
+ value: {
67
+ type: Number,
68
+ default: 0
69
+ },
70
+ orientation: {
71
+ type: String,
72
+ default: 'horizontal',
73
+ validator: function validator(value) {
74
+ return ['horizontal', 'vertical'].includes(value);
75
+ }
76
+ },
77
+ tabIndex: Number,
78
+ emptyStyle: Object,
79
+ emptyClassName: String,
80
+ progressStyle: Object,
81
+ progressClassName: String
82
+ },
83
+ created: function created() {
84
+ kendo_vue_common_2.validatePackage(package_metadata_1.packageMetadata);
85
+ },
86
+ mounted: function mounted() {
87
+ this._progressStatus = this.v3 ? this.progressStatusRef : this.$refs.progressStatus;
88
+ this._progressStatusWrap = this.v3 ? this.progressStatusWrapRef : this.$refs.progressStatusWrap;
89
+ this.currentDir = this.$props.dir !== undefined ? this.$props.dir : kendo_vue_common_1.isRtl(this.$el) ? 'rtl' : 'ltr';
90
+ this.animationFrame = kendo_vue_animation_1.animate({
91
+ duration: this.animationDuration,
92
+ onStart: this.handleStart,
93
+ onUpdate: this.handleUpdate,
94
+ onEnd: this.handleEnd
95
+ });
96
+ },
97
+ destroyed: !!gh ? undefined : function () {
98
+ kendo_vue_animation_1.cancelAnimation(this.animationFrame);
99
+ },
100
+ // @ts-ignore
101
+ unmounted: function unmounted() {
102
+ kendo_vue_animation_1.cancelAnimation(this.animationFrame);
103
+ },
104
+ data: function data() {
105
+ return {
106
+ currentDir: 'ltr'
107
+ };
108
+ },
109
+ watch: {
110
+ value: function value(_newValue, oldValue) {
111
+ this.prevValue = oldValue;
112
+ this.animationFrame = kendo_vue_animation_1.animate({
113
+ duration: this.animationDuration,
114
+ onStart: this.handleStart,
115
+ onUpdate: this.handleUpdate,
116
+ onEnd: this.handleEnd
117
+ });
118
+ }
119
+ },
120
+ computed: {
121
+ wrapperClass: function wrapperClass() {
122
+ var _a = this.$props,
123
+ disabled = _a.disabled,
124
+ reverse = _a.reverse,
125
+ orientation = _a.orientation,
126
+ value = _a.value;
127
+ var isVertical = orientation === 'vertical';
128
+ var indeterminateProp = value === null;
129
+ return {
130
+ 'k-widget k-progressbar': true,
131
+ 'k-progressbar-horizontal': !isVertical,
132
+ 'k-progressbar-vertical': isVertical,
133
+ 'k-progressbar-reverse': reverse,
134
+ 'k-progressbar-indeterminate': indeterminateProp,
135
+ 'k-state-disabled': disabled
136
+ };
137
+ },
138
+ isVertical: function isVertical() {
139
+ return this.orientation === 'vertical';
140
+ },
141
+ animationDuration: function animationDuration() {
142
+ var animation = this.$props.animation;
143
+ return typeof animation !== 'boolean' && animation !== undefined ? animation.duration : animation ? constants_1.DEFAULT_ANIMATION_DURATION : constants_1.NO_ANIMATION;
144
+ }
145
+ },
146
+ // @ts-ignore
147
+ setup: !gh ? undefined : function () {
148
+ var v3 = !!gh;
149
+ return {
150
+ v3: v3
151
+ };
152
+ },
153
+ // @ts-ignore
154
+ render: function render(createElement) {
155
+ var _this = this;
156
+
157
+ var h = gh || createElement;
158
+ var _a = this.$props,
159
+ disabled = _a.disabled,
160
+ labelVisible = _a.labelVisible,
161
+ labelPlacement = _a.labelPlacement,
162
+ max = _a.max,
163
+ min = _a.min,
164
+ tabIndex = _a.tabIndex,
165
+ emptyStyle = _a.emptyStyle,
166
+ emptyClassName = _a.emptyClassName,
167
+ progressStyle = _a.progressStyle,
168
+ progressClassName = _a.progressClassName;
169
+ var value = this.$props.value || 0;
170
+ var indeterminateProp = this.$props.value === null;
171
+ var formattedLabel = utils_1.truncateNumber(value);
172
+ var labelProps = {
173
+ value: value
174
+ };
175
+ var label = this.$props.labelRender ? kendo_vue_common_1.templateRendering.call(this, this.$props.labelRender, kendo_vue_common_1.getListeners.call(this)) : undefined;
176
+ var labelDefaultRendering = h('span', {
177
+ 'class': 'k-progress-status'
178
+ }, formattedLabel);
179
+ var toggleButtonRendering = kendo_vue_common_1.getTemplate.call(this, {
180
+ h: h,
181
+ template: label,
182
+ defaultRendering: labelDefaultRendering,
183
+ additionalProps: labelProps
184
+ });
185
+ var renderLabel = labelVisible ? this.$props.label ? h("span", {
186
+ "class": 'k-progress-status'
187
+ }, [this.$props.label]) : toggleButtonRendering : undefined;
188
+ var positionClasses = kendo_vue_common_1.classNames('k-progress-status-wrap', {
189
+ 'k-progress-start': labelPlacement === 'start',
190
+ 'k-progress-center': labelPlacement === 'center',
191
+ 'k-progress-end': labelPlacement === 'end' || labelPlacement === undefined
192
+ });
193
+ return h("div", {
194
+ "class": this.wrapperClass,
195
+ dir: this.currentDir,
196
+ attrs: this.v3 ? undefined : {
197
+ dir: this.currentDir,
198
+ tabindex: kendo_vue_common_1.getTabIndex(tabIndex, disabled),
199
+ role: 'progressbar',
200
+ "aria-valuemin": min,
201
+ "aria-valuemax": max,
202
+ "aria-valuenow": indeterminateProp ? undefined : value,
203
+ "aria-disabled": disabled
204
+ },
205
+ tabindex: kendo_vue_common_1.getTabIndex(tabIndex, disabled),
206
+ role: 'progressbar',
207
+ "aria-valuemin": min,
208
+ "aria-valuemax": max,
209
+ "aria-valuenow": indeterminateProp ? undefined : value,
210
+ "aria-disabled": disabled
211
+ }, [h("span", {
212
+ "class": positionClasses + (emptyClassName ? ' ' + emptyClassName : ''),
213
+ style: emptyStyle
214
+ }, [renderLabel]), h("div", {
215
+ "class": 'k-state-selected',
216
+ style: progressStyle,
217
+ ref: this.v3 ? function (el) {
218
+ _this.progressStatusRef = el;
219
+ } : 'progressStatus'
220
+ }, [h("span", {
221
+ "class": positionClasses + (progressClassName ? ' ' + progressClassName : ''),
222
+ ref: this.v3 ? function (el) {
223
+ _this.progressStatusWrapRef = el;
224
+ } : 'progressStatusWrap'
225
+ }, [renderLabel])])]);
226
+ },
227
+ methods: {
228
+ focus: function focus() {
229
+ if (this.$el) {
230
+ this.$el.focus();
231
+ }
232
+ },
233
+ progressStatusElement: function progressStatusElement() {
234
+ return this._progressStatus;
235
+ },
236
+ progressStatusWrapElement: function progressStatusWrapElement() {
237
+ return this._progressStatusWrap;
238
+ },
239
+ handleStart: function handleStart() {
240
+ var percentage = utils_1.calculatePercentage(this.min, this.max, this.prevValue);
241
+ utils_1.updateProgress(this._progressStatus, this._progressStatusWrap, percentage, this.isVertical);
242
+ },
243
+ handleUpdate: function handleUpdate(progress) {
244
+ var percentage = utils_1.calculatePercentage(this.min, this.max, this.prevValue + (this.value - this.prevValue) * progress);
245
+ utils_1.updateProgress(this._progressStatus, this._progressStatusWrap, percentage, this.isVertical);
246
+ },
247
+ handleEnd: function handleEnd() {
248
+ var percentage = utils_1.calculatePercentage(this.min, this.max, this.value);
249
+ utils_1.updateProgress(this._progressStatus, this._progressStatusWrap, percentage, this.isVertical);
250
+ }
251
+ }
252
+ };
253
+ exports.ProgressBar = ProgressBar;
254
+ var ProgressBarVue3 = ProgressBar;
255
+ exports.ProgressBarVue3 = ProgressBarVue3;
@@ -0,0 +1,2 @@
1
+ /** @hidden */
2
+ export declare const usePrevious: (value: any) => any;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePrevious = void 0;
7
+ /** @hidden */
8
+
9
+ exports.usePrevious = function (value) {
10
+ return value;
11
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * An interface for the ProgressBar label.
3
+ */
4
+ export interface LabelProps {
5
+ /**
6
+ * Represents the current value of the ProgressBar.
7
+ */
8
+ value?: number | null;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Specifies the animation settings of the ProgressBar.
3
+ */
4
+ export interface ProgressBarAnimation {
5
+ /**
6
+ * Specifies the duration of the ProgressBar animation. Defaults to `400`.
7
+ */
8
+ duration: number;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,5 @@
1
+ "use strict";
2
+ /**
3
+ * The ProgressBar ref.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@progress/kendo-vue-progressbars",
3
+ "description": "Kendo UI for Vue ProgressBars package",
4
+ "version": "2.6.4-dev.202111300936",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/telerik/kendo-vue.git"
8
+ },
9
+ "main": "dist/npm/main.js",
10
+ "types": "dist/npm/main.d.ts",
11
+ "module": "dist/es/main.js",
12
+ "jsnext:main": "dist/es/main.js",
13
+ "scripts": {
14
+ "test": "cd ../../ && npm run test -- --testPathPattern=/packages/progressbars/.*",
15
+ "start": "gulp start",
16
+ "build-package": "gulp build-package"
17
+ },
18
+ "homepage": "https://www.telerik.com/kendo-vue-ui/",
19
+ "keywords": [
20
+ "Kendo UI",
21
+ "Vue",
22
+ "Progress",
23
+ "ProgressBars",
24
+ "ProgressBar",
25
+ "ChunkProgressBar",
26
+ "Kendo UI for Vue",
27
+ "vuejs",
28
+ "UI",
29
+ "components",
30
+ "Vue component",
31
+ "Telerik"
32
+ ],
33
+ "peerDependencies": {
34
+ "@progress/kendo-licensing": "^1.0.1",
35
+ "@progress/kendo-vue-animation": "^2.6.3",
36
+ "vue": "^2.6.12 || ^3.0.2"
37
+ },
38
+ "devDependencies": {
39
+ "@progress/kendo-drawing": "^1.8.0",
40
+ "@progress/kendo-licensing": "^1.0.1",
41
+ "@progress/kendo-vue-animation": "2.6.4-dev.202111300936",
42
+ "@progress/kendo-vue-buttons": "2.6.4-dev.202111300936",
43
+ "@progress/kendo-vue-dropdowns": "2.6.4-dev.202111300936",
44
+ "@progress/kendo-vue-form": "2.6.4-dev.202111300936",
45
+ "@progress/kendo-vue-inputs": "2.6.4-dev.202111300936",
46
+ "@progress/kendo-vue-intl": "2.6.4-dev.202111300936"
47
+ },
48
+ "dependencies": {
49
+ "@progress/kendo-vue-common": "2.6.4-dev.202111300936"
50
+ },
51
+ "@progress": {
52
+ "friendlyName": "ProgressBars",
53
+ "framework": "Kendo UI for Vue"
54
+ },
55
+ "author": "Progress",
56
+ "license": "SEE LICENSE IN LICENSE.md",
57
+ "publishConfig": {
58
+ "access": "public"
59
+ }
60
+ }