@progress/kendo-vue-inputs 3.4.1 → 3.4.3-dev.202207111225
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/dist/cdn/js/kendo-vue-inputs.js +1 -1
- package/dist/es/checkbox/Checkbox.js +9 -12
- package/dist/es/colors/ColorContrastLabels.js +3 -2
- package/dist/es/colors/ColorContrastSvg.d.ts +1 -1
- package/dist/es/colors/ColorContrastSvg.js +3 -2
- package/dist/es/colors/ColorGradient.d.ts +1 -0
- package/dist/es/colors/ColorGradient.js +82 -59
- package/dist/es/colors/ColorInput.js +61 -15
- package/dist/es/colors/ColorPalette.d.ts +0 -1
- package/dist/es/colors/ColorPalette.js +14 -40
- package/dist/es/colors/ColorPicker.d.ts +0 -1
- package/dist/es/colors/ColorPicker.js +169 -93
- package/dist/es/colors/FlatColorPicker.js +61 -22
- package/dist/es/colors/HexInput.js +28 -9
- package/dist/es/colors/Picker.js +3 -2
- package/dist/es/colors/interfaces/ColorPickerProps.d.ts +6 -1
- package/dist/es/colors/utils/color-palette.service.d.ts +1 -0
- package/dist/es/colors/utils/color-palette.service.js +7 -16
- package/dist/es/input/Input.js +3 -2
- package/dist/es/input-separator/InputSeparator.js +3 -2
- package/dist/es/main.d.ts +1 -0
- package/dist/es/main.js +1 -0
- package/dist/es/maskedtextbox/MaskedTextBox.js +21 -24
- package/dist/es/numerictextbox/NumericTextBox.js +16 -19
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/RadioButton.js +8 -11
- package/dist/es/radiobutton/RadioGroup.js +3 -2
- package/dist/es/range-slider/RangeSlider.js +11 -10
- package/dist/es/slider/Slider.js +17 -6
- package/dist/es/slider/SliderLabel.js +3 -2
- package/dist/es/switch/Switch.js +14 -19
- package/dist/es/textarea/TextArea.js +3 -2
- package/dist/npm/checkbox/Checkbox.js +8 -11
- package/dist/npm/colors/ColorContrastLabels.js +3 -2
- package/dist/npm/colors/ColorContrastSvg.d.ts +1 -1
- package/dist/npm/colors/ColorContrastSvg.js +3 -2
- package/dist/npm/colors/ColorGradient.d.ts +1 -0
- package/dist/npm/colors/ColorGradient.js +81 -58
- package/dist/npm/colors/ColorInput.js +61 -15
- package/dist/npm/colors/ColorPalette.d.ts +0 -1
- package/dist/npm/colors/ColorPalette.js +13 -39
- package/dist/npm/colors/ColorPicker.d.ts +0 -1
- package/dist/npm/colors/ColorPicker.js +168 -91
- package/dist/npm/colors/FlatColorPicker.js +61 -22
- package/dist/npm/colors/HexInput.js +28 -9
- package/dist/npm/colors/Picker.js +3 -2
- package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +6 -1
- package/dist/npm/colors/utils/color-palette.service.d.ts +1 -0
- package/dist/npm/colors/utils/color-palette.service.js +7 -16
- package/dist/npm/input/Input.js +3 -2
- package/dist/npm/input-separator/InputSeparator.js +3 -2
- package/dist/npm/main.d.ts +1 -0
- package/dist/npm/main.js +2 -0
- package/dist/npm/maskedtextbox/MaskedTextBox.js +20 -23
- package/dist/npm/numerictextbox/NumericTextBox.js +15 -18
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/RadioButton.js +7 -10
- package/dist/npm/radiobutton/RadioGroup.js +3 -2
- package/dist/npm/range-slider/RangeSlider.js +11 -10
- package/dist/npm/slider/Slider.js +17 -6
- package/dist/npm/slider/SliderLabel.js +3 -2
- package/dist/npm/switch/Switch.js +13 -18
- package/dist/npm/textarea/TextArea.js +3 -2
- package/package.json +14 -14
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import * as Vue from 'vue';
|
|
3
3
|
var allVue = Vue;
|
|
4
4
|
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version[0] === '3';
|
|
5
6
|
var ref = allVue.ref;
|
|
6
7
|
var inject = allVue.inject;
|
|
7
|
-
import { Keys, classNames, guid, getTabIndex, getDefaultSlots, validatePackage, templateRendering, getTemplate, getListeners, kendoThemeMaps } from '@progress/kendo-vue-common';
|
|
8
|
+
import { Keys, classNames, guid, getTabIndex, getDefaultSlots, validatePackage, templateRendering, getTemplate, getListeners, kendoThemeMaps, setRef, getRef } from '@progress/kendo-vue-common';
|
|
8
9
|
import { packageMetadata } from '../package-metadata';
|
|
9
10
|
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
10
11
|
import { messages, checkboxValidation, checkboxOptionalText } from './../messages';
|
|
@@ -145,7 +146,7 @@ var CheckboxVue2 = {
|
|
|
145
146
|
}
|
|
146
147
|
},
|
|
147
148
|
mounted: function mounted() {
|
|
148
|
-
this.input = this
|
|
149
|
+
this.input = getRef(this, 'input');
|
|
149
150
|
|
|
150
151
|
if (!this.currentDir && window && this.$el) {
|
|
151
152
|
// Note: getComputedStyle forces reflow
|
|
@@ -160,14 +161,14 @@ var CheckboxVue2 = {
|
|
|
160
161
|
},
|
|
161
162
|
updated: function updated() {
|
|
162
163
|
if (!this.input) {
|
|
163
|
-
this.input = this
|
|
164
|
+
this.input = getRef(this, 'input');
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
this.setValidity();
|
|
167
168
|
},
|
|
168
169
|
// @ts-ignore
|
|
169
|
-
setup: !
|
|
170
|
-
var v3 = !!
|
|
170
|
+
setup: !isV3 ? undefined : function () {
|
|
171
|
+
var v3 = !!isV3;
|
|
171
172
|
var inputRef = ref(null);
|
|
172
173
|
var kendoLocalizationService = inject('kendoLocalizationService', {});
|
|
173
174
|
return {
|
|
@@ -208,8 +209,6 @@ var CheckboxVue2 = {
|
|
|
208
209
|
}, _a["k-checkbox-" + kendoThemeMaps.sizeMap[size]] = size, _a["k-rounded-" + kendoThemeMaps.roundedMap[rounded]] = rounded, _a['k-state-indeterminate'] = this.indeterminateProp, _a['k-state-invalid k-invalid'] = !(this.isValid || validityStyles !== undefined || validityStyles === true), _a));
|
|
209
210
|
|
|
210
211
|
var checkboxInput = function checkboxInput() {
|
|
211
|
-
var _this = this;
|
|
212
|
-
|
|
213
212
|
return h("input", {
|
|
214
213
|
type: 'checkbox',
|
|
215
214
|
attrs: this.v3 ? undefined : {
|
|
@@ -219,7 +218,7 @@ var CheckboxVue2 = {
|
|
|
219
218
|
"aria-labelledby": ariaLabelledBy,
|
|
220
219
|
"aria-describedby": ariaDescribedBy,
|
|
221
220
|
disabled: disabled,
|
|
222
|
-
|
|
221
|
+
tabindex: getTabIndex(tabIndex, disabled),
|
|
223
222
|
role: 'checkbox',
|
|
224
223
|
required: required !== undefined ? required : false,
|
|
225
224
|
"aria-checked": this.computedChecked || this.checkedProp ? true : this.indeterminateProp ? 'mixed' : false,
|
|
@@ -228,9 +227,7 @@ var CheckboxVue2 = {
|
|
|
228
227
|
"class": inputClasses,
|
|
229
228
|
name: name,
|
|
230
229
|
id: id || this.calculatedId,
|
|
231
|
-
ref: this
|
|
232
|
-
_this.inputRef = el;
|
|
233
|
-
} : 'input',
|
|
230
|
+
ref: setRef(this, 'input'),
|
|
234
231
|
"aria-labelledby": ariaLabelledBy,
|
|
235
232
|
"aria-describedby": ariaDescribedBy,
|
|
236
233
|
checked: this.v3 ? Boolean(this.checkedProp) : null,
|
|
@@ -238,7 +235,7 @@ var CheckboxVue2 = {
|
|
|
238
235
|
"checked": Boolean(this.checkedProp)
|
|
239
236
|
},
|
|
240
237
|
disabled: disabled,
|
|
241
|
-
|
|
238
|
+
tabindex: getTabIndex(tabIndex, disabled),
|
|
242
239
|
role: 'checkbox',
|
|
243
240
|
required: required !== undefined ? required : false,
|
|
244
241
|
"aria-checked": this.computedChecked || this.checkedProp ? true : this.indeterminateProp ? 'mixed' : false,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as Vue from 'vue';
|
|
3
3
|
var allVue = Vue;
|
|
4
4
|
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version[0] === '3';
|
|
5
6
|
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
6
7
|
import { messages, colorGradientContrastRatio, colorGradientAALevel, colorGradientAAALevel, colorGradientPass, colorGradientFail } from '../messages';
|
|
7
8
|
import { getContrastFromTwoRGBAs } from './utils/color-parser';
|
|
@@ -21,8 +22,8 @@ var ColorContrastLabelsVue2 = {
|
|
|
21
22
|
}
|
|
22
23
|
},
|
|
23
24
|
// @ts-ignore
|
|
24
|
-
setup: !
|
|
25
|
-
var v3 = !!
|
|
25
|
+
setup: !isV3 ? undefined : function () {
|
|
26
|
+
var v3 = !!isV3;
|
|
26
27
|
return {
|
|
27
28
|
v3: v3
|
|
28
29
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as Vue from 'vue';
|
|
3
3
|
var allVue = Vue;
|
|
4
4
|
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version[0] === '3';
|
|
5
6
|
import { bezierCommand, controlPoint, line, svgPath } from './utils/svg-calc';
|
|
6
7
|
import { getColorFromHSV, getRGBA, getContrastFromTwoRGBAs } from './utils/color-parser';
|
|
7
8
|
var AA_CONTRAST = 4.5;
|
|
@@ -19,8 +20,8 @@ var ColorContrastSvgVue2 = {
|
|
|
19
20
|
hsva: Object
|
|
20
21
|
},
|
|
21
22
|
// @ts-ignore
|
|
22
|
-
setup: !
|
|
23
|
-
var v3 = !!
|
|
23
|
+
setup: !isV3 ? undefined : function () {
|
|
24
|
+
var v3 = !!isV3;
|
|
24
25
|
return {
|
|
25
26
|
v3: v3
|
|
26
27
|
};
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
|
|
6
|
-
for (var p in s) {
|
|
7
|
-
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
return __assign.apply(this, arguments);
|
|
15
|
-
}; // @ts-ignore
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
// @ts-ignore
|
|
18
2
|
import * as Vue from 'vue';
|
|
19
3
|
var allVue = Vue;
|
|
20
4
|
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version[0] === '3';
|
|
21
6
|
import { Draggable, guid, classNames, focusFirstFocusableChild, getTabIndex } from '@progress/kendo-vue-common';
|
|
22
7
|
import { validatePackage } from '@progress/kendo-vue-common';
|
|
23
8
|
import { packageMetadata } from '../package-metadata';
|
|
@@ -39,7 +24,9 @@ var ColorGradientVue2 = {
|
|
|
39
24
|
// @ts-ignore
|
|
40
25
|
emits: {
|
|
41
26
|
'change': null,
|
|
42
|
-
'focus': null
|
|
27
|
+
'focus': null,
|
|
28
|
+
'blur': null,
|
|
29
|
+
'keydown': null
|
|
43
30
|
},
|
|
44
31
|
props: {
|
|
45
32
|
defaultValue: String,
|
|
@@ -63,9 +50,9 @@ var ColorGradientVue2 = {
|
|
|
63
50
|
return this.$props.value === undefined;
|
|
64
51
|
},
|
|
65
52
|
computedValue: function computedValue() {
|
|
66
|
-
var value = this.value || this.defaultValue || parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
53
|
+
var value = this.value || this.defaultValue || this.currentValue || parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
67
54
|
|
|
68
|
-
if (!isPresent(parseColor(
|
|
55
|
+
if (!isPresent(parseColor(value, 'hex'))) {
|
|
69
56
|
// Validate/sanitize the input.
|
|
70
57
|
value = DEFAULT_SELECTED_COLOR;
|
|
71
58
|
}
|
|
@@ -73,13 +60,13 @@ var ColorGradientVue2 = {
|
|
|
73
60
|
return value;
|
|
74
61
|
},
|
|
75
62
|
hsva: function hsva() {
|
|
76
|
-
return getCachedHsva(this.guid, this.computedValue) || getHSV(this.computedValue);
|
|
63
|
+
return this.currentHsva || getCachedHsva(this.guid, this.computedValue) || getHSV(this.computedValue);
|
|
77
64
|
},
|
|
78
65
|
rgba: function rgba() {
|
|
79
|
-
return getCachedRgba(this.guid, this.computedValue) || getRGBA(this.computedValue);
|
|
66
|
+
return this.currentRgba || getCachedRgba(this.guid, this.computedValue) || getRGBA(this.computedValue);
|
|
80
67
|
},
|
|
81
68
|
hex: function hex() {
|
|
82
|
-
return getCachedHex(this.guid, this.computedValue) || parseColor(this.computedValue, 'hex');
|
|
69
|
+
return this.currentHex || getCachedHex(this.guid, this.computedValue) || parseColor(this.computedValue, 'hex');
|
|
83
70
|
},
|
|
84
71
|
computedBgColor: function computedBgColor() {
|
|
85
72
|
return this.backgroundColor !== undefined ? this.backgroundColor : this.currentBgColor || getColorFromHue(this.hsva.h);
|
|
@@ -87,8 +74,12 @@ var ColorGradientVue2 = {
|
|
|
87
74
|
},
|
|
88
75
|
data: function data() {
|
|
89
76
|
return {
|
|
77
|
+
currentValue: undefined,
|
|
90
78
|
currentBgColor: undefined,
|
|
91
|
-
isFirstRender: true
|
|
79
|
+
isFirstRender: true,
|
|
80
|
+
currentHsva: undefined,
|
|
81
|
+
currentRgba: undefined,
|
|
82
|
+
currentHex: undefined
|
|
92
83
|
};
|
|
93
84
|
},
|
|
94
85
|
mounted: function mounted() {
|
|
@@ -108,14 +99,13 @@ var ColorGradientVue2 = {
|
|
|
108
99
|
destroyed: function destroyed() {
|
|
109
100
|
removeCachedColor(this.guid);
|
|
110
101
|
},
|
|
111
|
-
updated: function updated() {
|
|
112
|
-
//
|
|
113
|
-
// }
|
|
102
|
+
updated: function updated() {
|
|
103
|
+
// if (prevState.backgroundColor !== this.backgroundColor) {
|
|
104
|
+
this.setAlphaSliderBackground(this.computedBgColor); // }
|
|
114
105
|
},
|
|
115
|
-
// private alphaSlider: any;
|
|
116
106
|
// @ts-ignore
|
|
117
|
-
setup: !
|
|
118
|
-
var v3 = !!
|
|
107
|
+
setup: !isV3 ? undefined : function () {
|
|
108
|
+
var v3 = !!isV3;
|
|
119
109
|
return {
|
|
120
110
|
v3: v3
|
|
121
111
|
};
|
|
@@ -153,19 +143,23 @@ var ColorGradientVue2 = {
|
|
|
153
143
|
attrs: this.v3 ? undefined : {
|
|
154
144
|
id: this.$props.id,
|
|
155
145
|
"aria-disabled": this.$props.disabled ? 'true' : undefined,
|
|
156
|
-
|
|
146
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
157
147
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
158
148
|
"aria-describedby": this.$props.ariaDescribedBy
|
|
159
149
|
},
|
|
160
150
|
"class": className,
|
|
161
151
|
"aria-disabled": this.$props.disabled ? 'true' : undefined,
|
|
162
|
-
|
|
152
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
163
153
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
164
154
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
165
155
|
onFocus: this.onFocus,
|
|
166
156
|
on: this.v3 ? undefined : {
|
|
167
|
-
"focus": this.onFocus
|
|
168
|
-
|
|
157
|
+
"focus": this.onFocus,
|
|
158
|
+
"blur": this.onBlur,
|
|
159
|
+
"keydown": this.onKeyDownHandler
|
|
160
|
+
},
|
|
161
|
+
onBlur: this.onBlur,
|
|
162
|
+
onKeydown: this.onKeyDownHandler
|
|
169
163
|
}, [h("div", {
|
|
170
164
|
"class": "k-colorgradient-canvas k-hstack"
|
|
171
165
|
}, [h("div", {
|
|
@@ -231,8 +225,12 @@ var ColorGradientVue2 = {
|
|
|
231
225
|
step: 5,
|
|
232
226
|
onChange: this.onHueSliderChange,
|
|
233
227
|
on: this.v3 ? undefined : {
|
|
234
|
-
"change": this.onHueSliderChange
|
|
228
|
+
"change": this.onHueSliderChange,
|
|
229
|
+
"focus": this.onFocus,
|
|
230
|
+
"blur": this.onBlur
|
|
235
231
|
},
|
|
232
|
+
onFocus: this.onFocus,
|
|
233
|
+
onBlur: this.onBlur,
|
|
236
234
|
"class": "k-hue-slider k-colorgradient-slider",
|
|
237
235
|
disabled: this.$props.disabled
|
|
238
236
|
}), this.$props.opacity && h(Slider, {
|
|
@@ -253,8 +251,12 @@ var ColorGradientVue2 = {
|
|
|
253
251
|
step: 1,
|
|
254
252
|
onChange: this.onAlphaSliderChange,
|
|
255
253
|
on: this.v3 ? undefined : {
|
|
256
|
-
"change": this.onAlphaSliderChange
|
|
254
|
+
"change": this.onAlphaSliderChange,
|
|
255
|
+
"focus": this.onFocus,
|
|
256
|
+
"blur": this.onBlur
|
|
257
257
|
},
|
|
258
|
+
onFocus: this.onFocus,
|
|
259
|
+
onBlur: this.onBlur,
|
|
258
260
|
"class": "k-alpha-slider k-colorgradient-slider",
|
|
259
261
|
disabled: this.$props.disabled,
|
|
260
262
|
ref: this.v3 ? function (el) {
|
|
@@ -268,13 +270,17 @@ var ColorGradientVue2 = {
|
|
|
268
270
|
opacity: this.$props.opacity,
|
|
269
271
|
disabled: this.$props.disabled
|
|
270
272
|
},
|
|
271
|
-
|
|
273
|
+
onRgbachange: this.onRgbaChange,
|
|
272
274
|
on: this.v3 ? undefined : {
|
|
273
|
-
"
|
|
274
|
-
"
|
|
275
|
+
"rgbachange": this.onRgbaChange,
|
|
276
|
+
"focus": this.onFocus,
|
|
277
|
+
"blur": this.onBlur,
|
|
278
|
+
"hexchange": this.onHexChange
|
|
275
279
|
},
|
|
276
280
|
hex: this.hex,
|
|
277
|
-
|
|
281
|
+
onFocus: this.onFocus,
|
|
282
|
+
onBlur: this.onBlur,
|
|
283
|
+
onHexchange: this.onHexChange,
|
|
278
284
|
opacity: this.$props.opacity,
|
|
279
285
|
disabled: this.$props.disabled
|
|
280
286
|
}), this.computedBgColor && h(ColorContrastLabels, {
|
|
@@ -294,13 +300,16 @@ var ColorGradientVue2 = {
|
|
|
294
300
|
// }
|
|
295
301
|
// return null;
|
|
296
302
|
// },
|
|
303
|
+
onKeyDownHandler: function onKeyDownHandler(e) {
|
|
304
|
+
this.$emit('keydown', e);
|
|
305
|
+
},
|
|
297
306
|
onHexChange: function onHexChange(hex, value, event) {
|
|
298
307
|
if (this.isUncontrolled) {
|
|
299
308
|
var hsva = getHSV(value);
|
|
300
|
-
this.
|
|
301
|
-
this.
|
|
302
|
-
this.
|
|
303
|
-
this.
|
|
309
|
+
this.currentHsva = hsva;
|
|
310
|
+
this.currentBgColor = getColorFromHue(hsva.h);
|
|
311
|
+
this.currentRgba = getRGBA(value);
|
|
312
|
+
this.currentHex = hex;
|
|
304
313
|
} else {
|
|
305
314
|
cacheHex(this.guid, value, hex);
|
|
306
315
|
}
|
|
@@ -313,10 +322,10 @@ var ColorGradientVue2 = {
|
|
|
313
322
|
if (this.isUncontrolled) {
|
|
314
323
|
var hsva = getHSV(value);
|
|
315
324
|
var hex = parseColor(value, 'hex');
|
|
316
|
-
this.
|
|
325
|
+
this.currentHsva = hsva;
|
|
317
326
|
this.currentBgColor = getColorFromHue(hsva.h);
|
|
318
|
-
this.
|
|
319
|
-
this.
|
|
327
|
+
this.currentRgba = rgba;
|
|
328
|
+
this.currentHex = hex;
|
|
320
329
|
} else {
|
|
321
330
|
cacheRgba(this.guid, value, rgba);
|
|
322
331
|
}
|
|
@@ -360,10 +369,10 @@ var ColorGradientVue2 = {
|
|
|
360
369
|
|
|
361
370
|
if (this.isUncontrolled) {
|
|
362
371
|
var hex = parseColor(value, 'hex');
|
|
363
|
-
this.
|
|
372
|
+
this.currentHsva = hsva;
|
|
364
373
|
this.currentBgColor = getColorFromHue(hsva.h);
|
|
365
|
-
this.
|
|
366
|
-
this.
|
|
374
|
+
this.currentRgba = getRGBA(value);
|
|
375
|
+
this.currentHex = hex;
|
|
367
376
|
} else {
|
|
368
377
|
cacheHsva(this.guid, value, hsva);
|
|
369
378
|
}
|
|
@@ -371,19 +380,24 @@ var ColorGradientVue2 = {
|
|
|
371
380
|
this.dispatchChangeEvent(value, event);
|
|
372
381
|
},
|
|
373
382
|
dispatchChangeEvent: function dispatchChangeEvent(value, event) {
|
|
383
|
+
this.currentValue = value;
|
|
374
384
|
this.$emit('change', {
|
|
375
385
|
event: event,
|
|
376
386
|
target: this,
|
|
377
387
|
value: value
|
|
378
388
|
});
|
|
379
389
|
},
|
|
380
|
-
onFocus: function onFocus(
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
390
|
+
onFocus: function onFocus(event) {
|
|
391
|
+
this.$emit('focus', {
|
|
392
|
+
event: event,
|
|
393
|
+
target: this
|
|
394
|
+
});
|
|
395
|
+
},
|
|
396
|
+
onBlur: function onBlur(event) {
|
|
397
|
+
this.$emit('blur', {
|
|
398
|
+
event: event,
|
|
399
|
+
target: this
|
|
400
|
+
});
|
|
387
401
|
},
|
|
388
402
|
setAlphaSliderBackground: function setAlphaSliderBackground(backgroundColor) {
|
|
389
403
|
if (this.$props.opacity && this.alphaSlider && this.alphaSlider.sliderTrack) {
|
|
@@ -391,8 +405,17 @@ var ColorGradientVue2 = {
|
|
|
391
405
|
}
|
|
392
406
|
},
|
|
393
407
|
getGradientRectMetrics: function getGradientRectMetrics() {
|
|
394
|
-
var
|
|
395
|
-
return
|
|
408
|
+
var rect = this.gradientWrapper.getBoundingClientRect();
|
|
409
|
+
return {
|
|
410
|
+
top: rect.top,
|
|
411
|
+
right: rect.right,
|
|
412
|
+
bottom: rect.bottom,
|
|
413
|
+
left: rect.left,
|
|
414
|
+
width: rect.width,
|
|
415
|
+
height: rect.height,
|
|
416
|
+
x: rect.x,
|
|
417
|
+
y: rect.y
|
|
418
|
+
};
|
|
396
419
|
},
|
|
397
420
|
focus: function focus() {
|
|
398
421
|
focusFirstFocusableChild(this.$el);
|
|
@@ -18,6 +18,7 @@ var __assign = this && this.__assign || function () {
|
|
|
18
18
|
import * as Vue from 'vue';
|
|
19
19
|
var allVue = Vue;
|
|
20
20
|
var gh = allVue.h;
|
|
21
|
+
var isV3 = allVue.version[0] === '3';
|
|
21
22
|
import { NumericTextBox } from '../main';
|
|
22
23
|
import { HexInput } from './HexInput';
|
|
23
24
|
import { Button } from '@progress/kendo-vue-buttons';
|
|
@@ -35,20 +36,32 @@ var modes = ['rgba', 'rgb', 'hex'];
|
|
|
35
36
|
|
|
36
37
|
var ColorInputVue2 = {
|
|
37
38
|
name: 'KendoColorInput',
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
emits: {
|
|
41
|
+
'focus': null,
|
|
42
|
+
'blur': null,
|
|
43
|
+
'hexchange': null,
|
|
44
|
+
'rgbachange': null
|
|
45
|
+
},
|
|
38
46
|
props: {
|
|
39
47
|
rgba: Object,
|
|
40
48
|
hex: String,
|
|
41
49
|
opacity: Boolean,
|
|
42
50
|
disabled: Boolean
|
|
43
51
|
},
|
|
52
|
+
inject: {
|
|
53
|
+
kendoLocalizationService: {
|
|
54
|
+
default: null
|
|
55
|
+
}
|
|
56
|
+
},
|
|
44
57
|
data: function data() {
|
|
45
58
|
return {
|
|
46
59
|
inputMode: modes[1]
|
|
47
60
|
};
|
|
48
61
|
},
|
|
49
62
|
// @ts-ignore
|
|
50
|
-
setup: !
|
|
51
|
-
var v3 = !!
|
|
63
|
+
setup: !isV3 ? undefined : function () {
|
|
64
|
+
var v3 = !!isV3;
|
|
52
65
|
return {
|
|
53
66
|
v3: v3
|
|
54
67
|
};
|
|
@@ -73,11 +86,15 @@ var ColorInputVue2 = {
|
|
|
73
86
|
icon: 'arrows-kpi'
|
|
74
87
|
},
|
|
75
88
|
icon: 'arrows-kpi',
|
|
76
|
-
|
|
77
|
-
onClick: this.onToggleModeChange.bind(this),
|
|
89
|
+
onFocus: this.onFocus,
|
|
78
90
|
on: this.v3 ? undefined : {
|
|
79
|
-
"
|
|
80
|
-
|
|
91
|
+
"focus": this.onFocus,
|
|
92
|
+
"blur": this.onBlur,
|
|
93
|
+
"click": this.onToggleModeChange
|
|
94
|
+
},
|
|
95
|
+
onBlur: this.onBlur,
|
|
96
|
+
"class": "k-colorgradient-toggle-mode k-icon-button",
|
|
97
|
+
onClick: this.onToggleModeChange
|
|
81
98
|
})]), this.inputMode === 'hex' && h("div", {
|
|
82
99
|
"class": "k-vstack k-flex-1"
|
|
83
100
|
}, [h("span", {
|
|
@@ -88,10 +105,14 @@ var ColorInputVue2 = {
|
|
|
88
105
|
hex: this.$props.hex,
|
|
89
106
|
disabled: this.$props.disabled
|
|
90
107
|
},
|
|
91
|
-
|
|
108
|
+
onFocus: this.onFocus,
|
|
92
109
|
on: this.v3 ? undefined : {
|
|
93
|
-
"
|
|
110
|
+
"focus": this.onFocus,
|
|
111
|
+
"blur": this.onBlur,
|
|
112
|
+
"hexchange": this.onHexChange
|
|
94
113
|
},
|
|
114
|
+
onBlur: this.onBlur,
|
|
115
|
+
onHexchange: this.onHexChange,
|
|
95
116
|
disabled: this.$props.disabled
|
|
96
117
|
})]), // @ts-ignore function children
|
|
97
118
|
h(Label, {
|
|
@@ -114,10 +135,14 @@ var ColorInputVue2 = {
|
|
|
114
135
|
max: 255,
|
|
115
136
|
spinners: false,
|
|
116
137
|
format: "n",
|
|
117
|
-
|
|
138
|
+
onFocus: this.onFocus,
|
|
118
139
|
on: this.v3 ? undefined : {
|
|
140
|
+
"focus": this.onFocus,
|
|
141
|
+
"blur": this.onBlur,
|
|
119
142
|
"change": this.onRgbaRChange
|
|
120
143
|
},
|
|
144
|
+
onBlur: this.onBlur,
|
|
145
|
+
onChange: this.onRgbaRChange,
|
|
121
146
|
disabled: this.$props.disabled
|
|
122
147
|
}), // @ts-ignore function children
|
|
123
148
|
h(Label, {
|
|
@@ -140,10 +165,14 @@ var ColorInputVue2 = {
|
|
|
140
165
|
max: 255,
|
|
141
166
|
spinners: false,
|
|
142
167
|
format: "n",
|
|
143
|
-
|
|
168
|
+
onFocus: this.onFocus,
|
|
144
169
|
on: this.v3 ? undefined : {
|
|
170
|
+
"focus": this.onFocus,
|
|
171
|
+
"blur": this.onBlur,
|
|
145
172
|
"change": this.onRgbaGChange
|
|
146
173
|
},
|
|
174
|
+
onBlur: this.onBlur,
|
|
175
|
+
onChange: this.onRgbaGChange,
|
|
147
176
|
disabled: this.$props.disabled
|
|
148
177
|
}), // @ts-ignore function children
|
|
149
178
|
h(Label, {
|
|
@@ -166,10 +195,14 @@ var ColorInputVue2 = {
|
|
|
166
195
|
max: 255,
|
|
167
196
|
spinners: false,
|
|
168
197
|
format: "n",
|
|
169
|
-
|
|
198
|
+
onFocus: this.onFocus,
|
|
170
199
|
on: this.v3 ? undefined : {
|
|
200
|
+
"focus": this.onFocus,
|
|
201
|
+
"blur": this.onBlur,
|
|
171
202
|
"change": this.onRgbaBChange
|
|
172
203
|
},
|
|
204
|
+
onBlur: this.onBlur,
|
|
205
|
+
onChange: this.onRgbaBChange,
|
|
173
206
|
disabled: this.$props.disabled
|
|
174
207
|
}), // @ts-ignore function children
|
|
175
208
|
h(Label, {
|
|
@@ -194,19 +227,32 @@ var ColorInputVue2 = {
|
|
|
194
227
|
step: 0.01,
|
|
195
228
|
spinners: false,
|
|
196
229
|
format: "n2",
|
|
197
|
-
|
|
230
|
+
onFocus: this.onFocus,
|
|
198
231
|
on: this.v3 ? undefined : {
|
|
232
|
+
"focus": this.onFocus,
|
|
233
|
+
"blur": this.onBlur,
|
|
199
234
|
"change": this.onRgbaAChange
|
|
200
235
|
},
|
|
236
|
+
onBlur: this.onBlur,
|
|
237
|
+
onChange: this.onRgbaAChange,
|
|
201
238
|
disabled: this.$props.disabled
|
|
202
|
-
}),
|
|
239
|
+
}), this.$props.opacity && // @ts-ignore function children
|
|
203
240
|
h(Label, {
|
|
204
241
|
"class": "k-colorgradient-input-label"
|
|
205
242
|
}, this.v3 ? function () {
|
|
206
243
|
return [aMessage];
|
|
207
|
-
} : [aMessage])
|
|
244
|
+
} : [aMessage])])]);
|
|
208
245
|
},
|
|
209
246
|
methods: {
|
|
247
|
+
onFocus: function onFocus(event) {
|
|
248
|
+
this.$emit('focus', event);
|
|
249
|
+
},
|
|
250
|
+
onBlur: function onBlur(event) {
|
|
251
|
+
this.$emit('blur', event);
|
|
252
|
+
},
|
|
253
|
+
onHexChange: function onHexChange(event) {
|
|
254
|
+
this.$emit('hexchange', event);
|
|
255
|
+
},
|
|
210
256
|
onRgbaRChange: function onRgbaRChange(event) {
|
|
211
257
|
this.dispatchRgbaChange({
|
|
212
258
|
r: event.value
|
|
@@ -246,7 +292,7 @@ var ColorInputVue2 = {
|
|
|
246
292
|
rgba.a = newValue.a;
|
|
247
293
|
}
|
|
248
294
|
|
|
249
|
-
this.$
|
|
295
|
+
this.$emit('rgbachange', rgba, event);
|
|
250
296
|
},
|
|
251
297
|
onToggleModeChange: function onToggleModeChange() {
|
|
252
298
|
var index = modes.length - 1 === modes.indexOf(this.inputMode) ? 0 : modes.indexOf(this.inputMode) + 1;
|