@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
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var __assign = undefined && undefined.__assign || function () {
|
|
4
|
-
__assign = Object.assign || function (t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
|
|
8
|
-
for (var p in s) {
|
|
9
|
-
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return t;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return __assign.apply(this, arguments);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
3
|
Object.defineProperty(exports, "__esModule", {
|
|
20
4
|
value: true
|
|
21
5
|
});
|
|
@@ -25,6 +9,7 @@ var Vue = require("vue");
|
|
|
25
9
|
|
|
26
10
|
var allVue = Vue;
|
|
27
11
|
var gh = allVue.h;
|
|
12
|
+
var isV3 = allVue.version[0] === '3';
|
|
28
13
|
|
|
29
14
|
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
30
15
|
|
|
@@ -57,7 +42,9 @@ var ColorGradientVue2 = {
|
|
|
57
42
|
// @ts-ignore
|
|
58
43
|
emits: {
|
|
59
44
|
'change': null,
|
|
60
|
-
'focus': null
|
|
45
|
+
'focus': null,
|
|
46
|
+
'blur': null,
|
|
47
|
+
'keydown': null
|
|
61
48
|
},
|
|
62
49
|
props: {
|
|
63
50
|
defaultValue: String,
|
|
@@ -81,9 +68,9 @@ var ColorGradientVue2 = {
|
|
|
81
68
|
return this.$props.value === undefined;
|
|
82
69
|
},
|
|
83
70
|
computedValue: function computedValue() {
|
|
84
|
-
var value = this.value || this.defaultValue || color_parser_1.parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
71
|
+
var value = this.value || this.defaultValue || this.currentValue || color_parser_1.parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
85
72
|
|
|
86
|
-
if (!misc_1.isPresent(color_parser_1.parseColor(
|
|
73
|
+
if (!misc_1.isPresent(color_parser_1.parseColor(value, 'hex'))) {
|
|
87
74
|
// Validate/sanitize the input.
|
|
88
75
|
value = DEFAULT_SELECTED_COLOR;
|
|
89
76
|
}
|
|
@@ -91,13 +78,13 @@ var ColorGradientVue2 = {
|
|
|
91
78
|
return value;
|
|
92
79
|
},
|
|
93
80
|
hsva: function hsva() {
|
|
94
|
-
return color_cache_1.getCachedHsva(this.guid, this.computedValue) || color_parser_1.getHSV(this.computedValue);
|
|
81
|
+
return this.currentHsva || color_cache_1.getCachedHsva(this.guid, this.computedValue) || color_parser_1.getHSV(this.computedValue);
|
|
95
82
|
},
|
|
96
83
|
rgba: function rgba() {
|
|
97
|
-
return color_cache_1.getCachedRgba(this.guid, this.computedValue) || color_parser_1.getRGBA(this.computedValue);
|
|
84
|
+
return this.currentRgba || color_cache_1.getCachedRgba(this.guid, this.computedValue) || color_parser_1.getRGBA(this.computedValue);
|
|
98
85
|
},
|
|
99
86
|
hex: function hex() {
|
|
100
|
-
return color_cache_1.getCachedHex(this.guid, this.computedValue) || color_parser_1.parseColor(this.computedValue, 'hex');
|
|
87
|
+
return this.currentHex || color_cache_1.getCachedHex(this.guid, this.computedValue) || color_parser_1.parseColor(this.computedValue, 'hex');
|
|
101
88
|
},
|
|
102
89
|
computedBgColor: function computedBgColor() {
|
|
103
90
|
return this.backgroundColor !== undefined ? this.backgroundColor : this.currentBgColor || color_parser_1.getColorFromHue(this.hsva.h);
|
|
@@ -105,8 +92,12 @@ var ColorGradientVue2 = {
|
|
|
105
92
|
},
|
|
106
93
|
data: function data() {
|
|
107
94
|
return {
|
|
95
|
+
currentValue: undefined,
|
|
108
96
|
currentBgColor: undefined,
|
|
109
|
-
isFirstRender: true
|
|
97
|
+
isFirstRender: true,
|
|
98
|
+
currentHsva: undefined,
|
|
99
|
+
currentRgba: undefined,
|
|
100
|
+
currentHex: undefined
|
|
110
101
|
};
|
|
111
102
|
},
|
|
112
103
|
mounted: function mounted() {
|
|
@@ -126,14 +117,13 @@ var ColorGradientVue2 = {
|
|
|
126
117
|
destroyed: function destroyed() {
|
|
127
118
|
color_cache_1.removeCachedColor(this.guid);
|
|
128
119
|
},
|
|
129
|
-
updated: function updated() {
|
|
130
|
-
//
|
|
131
|
-
// }
|
|
120
|
+
updated: function updated() {
|
|
121
|
+
// if (prevState.backgroundColor !== this.backgroundColor) {
|
|
122
|
+
this.setAlphaSliderBackground(this.computedBgColor); // }
|
|
132
123
|
},
|
|
133
|
-
// private alphaSlider: any;
|
|
134
124
|
// @ts-ignore
|
|
135
|
-
setup: !
|
|
136
|
-
var v3 = !!
|
|
125
|
+
setup: !isV3 ? undefined : function () {
|
|
126
|
+
var v3 = !!isV3;
|
|
137
127
|
return {
|
|
138
128
|
v3: v3
|
|
139
129
|
};
|
|
@@ -171,19 +161,23 @@ var ColorGradientVue2 = {
|
|
|
171
161
|
attrs: this.v3 ? undefined : {
|
|
172
162
|
id: this.$props.id,
|
|
173
163
|
"aria-disabled": this.$props.disabled ? 'true' : undefined,
|
|
174
|
-
|
|
164
|
+
tabindex: kendo_vue_common_1.getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
175
165
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
176
166
|
"aria-describedby": this.$props.ariaDescribedBy
|
|
177
167
|
},
|
|
178
168
|
"class": className,
|
|
179
169
|
"aria-disabled": this.$props.disabled ? 'true' : undefined,
|
|
180
|
-
|
|
170
|
+
tabindex: kendo_vue_common_1.getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
181
171
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
182
172
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
183
173
|
onFocus: this.onFocus,
|
|
184
174
|
on: this.v3 ? undefined : {
|
|
185
|
-
"focus": this.onFocus
|
|
186
|
-
|
|
175
|
+
"focus": this.onFocus,
|
|
176
|
+
"blur": this.onBlur,
|
|
177
|
+
"keydown": this.onKeyDownHandler
|
|
178
|
+
},
|
|
179
|
+
onBlur: this.onBlur,
|
|
180
|
+
onKeydown: this.onKeyDownHandler
|
|
187
181
|
}, [h("div", {
|
|
188
182
|
"class": "k-colorgradient-canvas k-hstack"
|
|
189
183
|
}, [h("div", {
|
|
@@ -249,8 +243,12 @@ var ColorGradientVue2 = {
|
|
|
249
243
|
step: 5,
|
|
250
244
|
onChange: this.onHueSliderChange,
|
|
251
245
|
on: this.v3 ? undefined : {
|
|
252
|
-
"change": this.onHueSliderChange
|
|
246
|
+
"change": this.onHueSliderChange,
|
|
247
|
+
"focus": this.onFocus,
|
|
248
|
+
"blur": this.onBlur
|
|
253
249
|
},
|
|
250
|
+
onFocus: this.onFocus,
|
|
251
|
+
onBlur: this.onBlur,
|
|
254
252
|
"class": "k-hue-slider k-colorgradient-slider",
|
|
255
253
|
disabled: this.$props.disabled
|
|
256
254
|
}), this.$props.opacity && h(main_1.Slider, {
|
|
@@ -271,8 +269,12 @@ var ColorGradientVue2 = {
|
|
|
271
269
|
step: 1,
|
|
272
270
|
onChange: this.onAlphaSliderChange,
|
|
273
271
|
on: this.v3 ? undefined : {
|
|
274
|
-
"change": this.onAlphaSliderChange
|
|
272
|
+
"change": this.onAlphaSliderChange,
|
|
273
|
+
"focus": this.onFocus,
|
|
274
|
+
"blur": this.onBlur
|
|
275
275
|
},
|
|
276
|
+
onFocus: this.onFocus,
|
|
277
|
+
onBlur: this.onBlur,
|
|
276
278
|
"class": "k-alpha-slider k-colorgradient-slider",
|
|
277
279
|
disabled: this.$props.disabled,
|
|
278
280
|
ref: this.v3 ? function (el) {
|
|
@@ -286,13 +288,17 @@ var ColorGradientVue2 = {
|
|
|
286
288
|
opacity: this.$props.opacity,
|
|
287
289
|
disabled: this.$props.disabled
|
|
288
290
|
},
|
|
289
|
-
|
|
291
|
+
onRgbachange: this.onRgbaChange,
|
|
290
292
|
on: this.v3 ? undefined : {
|
|
291
|
-
"
|
|
292
|
-
"
|
|
293
|
+
"rgbachange": this.onRgbaChange,
|
|
294
|
+
"focus": this.onFocus,
|
|
295
|
+
"blur": this.onBlur,
|
|
296
|
+
"hexchange": this.onHexChange
|
|
293
297
|
},
|
|
294
298
|
hex: this.hex,
|
|
295
|
-
|
|
299
|
+
onFocus: this.onFocus,
|
|
300
|
+
onBlur: this.onBlur,
|
|
301
|
+
onHexchange: this.onHexChange,
|
|
296
302
|
opacity: this.$props.opacity,
|
|
297
303
|
disabled: this.$props.disabled
|
|
298
304
|
}), this.computedBgColor && h(ColorContrastLabels_1.ColorContrastLabels, {
|
|
@@ -312,13 +318,16 @@ var ColorGradientVue2 = {
|
|
|
312
318
|
// }
|
|
313
319
|
// return null;
|
|
314
320
|
// },
|
|
321
|
+
onKeyDownHandler: function onKeyDownHandler(e) {
|
|
322
|
+
this.$emit('keydown', e);
|
|
323
|
+
},
|
|
315
324
|
onHexChange: function onHexChange(hex, value, event) {
|
|
316
325
|
if (this.isUncontrolled) {
|
|
317
326
|
var hsva = color_parser_1.getHSV(value);
|
|
318
|
-
this.
|
|
319
|
-
this.
|
|
320
|
-
this.
|
|
321
|
-
this.
|
|
327
|
+
this.currentHsva = hsva;
|
|
328
|
+
this.currentBgColor = color_parser_1.getColorFromHue(hsva.h);
|
|
329
|
+
this.currentRgba = color_parser_1.getRGBA(value);
|
|
330
|
+
this.currentHex = hex;
|
|
322
331
|
} else {
|
|
323
332
|
color_cache_1.cacheHex(this.guid, value, hex);
|
|
324
333
|
}
|
|
@@ -331,10 +340,10 @@ var ColorGradientVue2 = {
|
|
|
331
340
|
if (this.isUncontrolled) {
|
|
332
341
|
var hsva = color_parser_1.getHSV(value);
|
|
333
342
|
var hex = color_parser_1.parseColor(value, 'hex');
|
|
334
|
-
this.
|
|
343
|
+
this.currentHsva = hsva;
|
|
335
344
|
this.currentBgColor = color_parser_1.getColorFromHue(hsva.h);
|
|
336
|
-
this.
|
|
337
|
-
this.
|
|
345
|
+
this.currentRgba = rgba;
|
|
346
|
+
this.currentHex = hex;
|
|
338
347
|
} else {
|
|
339
348
|
color_cache_1.cacheRgba(this.guid, value, rgba);
|
|
340
349
|
}
|
|
@@ -378,10 +387,10 @@ var ColorGradientVue2 = {
|
|
|
378
387
|
|
|
379
388
|
if (this.isUncontrolled) {
|
|
380
389
|
var hex = color_parser_1.parseColor(value, 'hex');
|
|
381
|
-
this.
|
|
390
|
+
this.currentHsva = hsva;
|
|
382
391
|
this.currentBgColor = color_parser_1.getColorFromHue(hsva.h);
|
|
383
|
-
this.
|
|
384
|
-
this.
|
|
392
|
+
this.currentRgba = color_parser_1.getRGBA(value);
|
|
393
|
+
this.currentHex = hex;
|
|
385
394
|
} else {
|
|
386
395
|
color_cache_1.cacheHsva(this.guid, value, hsva);
|
|
387
396
|
}
|
|
@@ -389,19 +398,24 @@ var ColorGradientVue2 = {
|
|
|
389
398
|
this.dispatchChangeEvent(value, event);
|
|
390
399
|
},
|
|
391
400
|
dispatchChangeEvent: function dispatchChangeEvent(value, event) {
|
|
401
|
+
this.currentValue = value;
|
|
392
402
|
this.$emit('change', {
|
|
393
403
|
event: event,
|
|
394
404
|
target: this,
|
|
395
405
|
value: value
|
|
396
406
|
});
|
|
397
407
|
},
|
|
398
|
-
onFocus: function onFocus(
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
408
|
+
onFocus: function onFocus(event) {
|
|
409
|
+
this.$emit('focus', {
|
|
410
|
+
event: event,
|
|
411
|
+
target: this
|
|
412
|
+
});
|
|
413
|
+
},
|
|
414
|
+
onBlur: function onBlur(event) {
|
|
415
|
+
this.$emit('blur', {
|
|
416
|
+
event: event,
|
|
417
|
+
target: this
|
|
418
|
+
});
|
|
405
419
|
},
|
|
406
420
|
setAlphaSliderBackground: function setAlphaSliderBackground(backgroundColor) {
|
|
407
421
|
if (this.$props.opacity && this.alphaSlider && this.alphaSlider.sliderTrack) {
|
|
@@ -409,8 +423,17 @@ var ColorGradientVue2 = {
|
|
|
409
423
|
}
|
|
410
424
|
},
|
|
411
425
|
getGradientRectMetrics: function getGradientRectMetrics() {
|
|
412
|
-
var
|
|
413
|
-
return
|
|
426
|
+
var rect = this.gradientWrapper.getBoundingClientRect();
|
|
427
|
+
return {
|
|
428
|
+
top: rect.top,
|
|
429
|
+
right: rect.right,
|
|
430
|
+
bottom: rect.bottom,
|
|
431
|
+
left: rect.left,
|
|
432
|
+
width: rect.width,
|
|
433
|
+
height: rect.height,
|
|
434
|
+
x: rect.x,
|
|
435
|
+
y: rect.y
|
|
436
|
+
};
|
|
414
437
|
},
|
|
415
438
|
focus: function focus() {
|
|
416
439
|
kendo_vue_common_1.focusFirstFocusableChild(this.$el);
|
|
@@ -25,6 +25,7 @@ var Vue = require("vue");
|
|
|
25
25
|
|
|
26
26
|
var allVue = Vue;
|
|
27
27
|
var gh = allVue.h;
|
|
28
|
+
var isV3 = allVue.version[0] === '3';
|
|
28
29
|
|
|
29
30
|
var main_1 = require("../main");
|
|
30
31
|
|
|
@@ -49,20 +50,32 @@ var modes = ['rgba', 'rgb', 'hex'];
|
|
|
49
50
|
|
|
50
51
|
var ColorInputVue2 = {
|
|
51
52
|
name: 'KendoColorInput',
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
emits: {
|
|
55
|
+
'focus': null,
|
|
56
|
+
'blur': null,
|
|
57
|
+
'hexchange': null,
|
|
58
|
+
'rgbachange': null
|
|
59
|
+
},
|
|
52
60
|
props: {
|
|
53
61
|
rgba: Object,
|
|
54
62
|
hex: String,
|
|
55
63
|
opacity: Boolean,
|
|
56
64
|
disabled: Boolean
|
|
57
65
|
},
|
|
66
|
+
inject: {
|
|
67
|
+
kendoLocalizationService: {
|
|
68
|
+
default: null
|
|
69
|
+
}
|
|
70
|
+
},
|
|
58
71
|
data: function data() {
|
|
59
72
|
return {
|
|
60
73
|
inputMode: modes[1]
|
|
61
74
|
};
|
|
62
75
|
},
|
|
63
76
|
// @ts-ignore
|
|
64
|
-
setup: !
|
|
65
|
-
var v3 = !!
|
|
77
|
+
setup: !isV3 ? undefined : function () {
|
|
78
|
+
var v3 = !!isV3;
|
|
66
79
|
return {
|
|
67
80
|
v3: v3
|
|
68
81
|
};
|
|
@@ -87,11 +100,15 @@ var ColorInputVue2 = {
|
|
|
87
100
|
icon: 'arrows-kpi'
|
|
88
101
|
},
|
|
89
102
|
icon: 'arrows-kpi',
|
|
90
|
-
|
|
91
|
-
onClick: this.onToggleModeChange.bind(this),
|
|
103
|
+
onFocus: this.onFocus,
|
|
92
104
|
on: this.v3 ? undefined : {
|
|
93
|
-
"
|
|
94
|
-
|
|
105
|
+
"focus": this.onFocus,
|
|
106
|
+
"blur": this.onBlur,
|
|
107
|
+
"click": this.onToggleModeChange
|
|
108
|
+
},
|
|
109
|
+
onBlur: this.onBlur,
|
|
110
|
+
"class": "k-colorgradient-toggle-mode k-icon-button",
|
|
111
|
+
onClick: this.onToggleModeChange
|
|
95
112
|
})]), this.inputMode === 'hex' && h("div", {
|
|
96
113
|
"class": "k-vstack k-flex-1"
|
|
97
114
|
}, [h("span", {
|
|
@@ -102,10 +119,14 @@ var ColorInputVue2 = {
|
|
|
102
119
|
hex: this.$props.hex,
|
|
103
120
|
disabled: this.$props.disabled
|
|
104
121
|
},
|
|
105
|
-
|
|
122
|
+
onFocus: this.onFocus,
|
|
106
123
|
on: this.v3 ? undefined : {
|
|
107
|
-
"
|
|
124
|
+
"focus": this.onFocus,
|
|
125
|
+
"blur": this.onBlur,
|
|
126
|
+
"hexchange": this.onHexChange
|
|
108
127
|
},
|
|
128
|
+
onBlur: this.onBlur,
|
|
129
|
+
onHexchange: this.onHexChange,
|
|
109
130
|
disabled: this.$props.disabled
|
|
110
131
|
})]), // @ts-ignore function children
|
|
111
132
|
h(kendo_vue_labels_1.Label, {
|
|
@@ -128,10 +149,14 @@ var ColorInputVue2 = {
|
|
|
128
149
|
max: 255,
|
|
129
150
|
spinners: false,
|
|
130
151
|
format: "n",
|
|
131
|
-
|
|
152
|
+
onFocus: this.onFocus,
|
|
132
153
|
on: this.v3 ? undefined : {
|
|
154
|
+
"focus": this.onFocus,
|
|
155
|
+
"blur": this.onBlur,
|
|
133
156
|
"change": this.onRgbaRChange
|
|
134
157
|
},
|
|
158
|
+
onBlur: this.onBlur,
|
|
159
|
+
onChange: this.onRgbaRChange,
|
|
135
160
|
disabled: this.$props.disabled
|
|
136
161
|
}), // @ts-ignore function children
|
|
137
162
|
h(kendo_vue_labels_1.Label, {
|
|
@@ -154,10 +179,14 @@ var ColorInputVue2 = {
|
|
|
154
179
|
max: 255,
|
|
155
180
|
spinners: false,
|
|
156
181
|
format: "n",
|
|
157
|
-
|
|
182
|
+
onFocus: this.onFocus,
|
|
158
183
|
on: this.v3 ? undefined : {
|
|
184
|
+
"focus": this.onFocus,
|
|
185
|
+
"blur": this.onBlur,
|
|
159
186
|
"change": this.onRgbaGChange
|
|
160
187
|
},
|
|
188
|
+
onBlur: this.onBlur,
|
|
189
|
+
onChange: this.onRgbaGChange,
|
|
161
190
|
disabled: this.$props.disabled
|
|
162
191
|
}), // @ts-ignore function children
|
|
163
192
|
h(kendo_vue_labels_1.Label, {
|
|
@@ -180,10 +209,14 @@ var ColorInputVue2 = {
|
|
|
180
209
|
max: 255,
|
|
181
210
|
spinners: false,
|
|
182
211
|
format: "n",
|
|
183
|
-
|
|
212
|
+
onFocus: this.onFocus,
|
|
184
213
|
on: this.v3 ? undefined : {
|
|
214
|
+
"focus": this.onFocus,
|
|
215
|
+
"blur": this.onBlur,
|
|
185
216
|
"change": this.onRgbaBChange
|
|
186
217
|
},
|
|
218
|
+
onBlur: this.onBlur,
|
|
219
|
+
onChange: this.onRgbaBChange,
|
|
187
220
|
disabled: this.$props.disabled
|
|
188
221
|
}), // @ts-ignore function children
|
|
189
222
|
h(kendo_vue_labels_1.Label, {
|
|
@@ -208,19 +241,32 @@ var ColorInputVue2 = {
|
|
|
208
241
|
step: 0.01,
|
|
209
242
|
spinners: false,
|
|
210
243
|
format: "n2",
|
|
211
|
-
|
|
244
|
+
onFocus: this.onFocus,
|
|
212
245
|
on: this.v3 ? undefined : {
|
|
246
|
+
"focus": this.onFocus,
|
|
247
|
+
"blur": this.onBlur,
|
|
213
248
|
"change": this.onRgbaAChange
|
|
214
249
|
},
|
|
250
|
+
onBlur: this.onBlur,
|
|
251
|
+
onChange: this.onRgbaAChange,
|
|
215
252
|
disabled: this.$props.disabled
|
|
216
|
-
}),
|
|
253
|
+
}), this.$props.opacity && // @ts-ignore function children
|
|
217
254
|
h(kendo_vue_labels_1.Label, {
|
|
218
255
|
"class": "k-colorgradient-input-label"
|
|
219
256
|
}, this.v3 ? function () {
|
|
220
257
|
return [aMessage];
|
|
221
|
-
} : [aMessage])
|
|
258
|
+
} : [aMessage])])]);
|
|
222
259
|
},
|
|
223
260
|
methods: {
|
|
261
|
+
onFocus: function onFocus(event) {
|
|
262
|
+
this.$emit('focus', event);
|
|
263
|
+
},
|
|
264
|
+
onBlur: function onBlur(event) {
|
|
265
|
+
this.$emit('blur', event);
|
|
266
|
+
},
|
|
267
|
+
onHexChange: function onHexChange(event) {
|
|
268
|
+
this.$emit('hexchange', event);
|
|
269
|
+
},
|
|
224
270
|
onRgbaRChange: function onRgbaRChange(event) {
|
|
225
271
|
this.dispatchRgbaChange({
|
|
226
272
|
r: event.value
|
|
@@ -260,7 +306,7 @@ var ColorInputVue2 = {
|
|
|
260
306
|
rgba.a = newValue.a;
|
|
261
307
|
}
|
|
262
308
|
|
|
263
|
-
this.$
|
|
309
|
+
this.$emit('rgbachange', rgba, event);
|
|
264
310
|
},
|
|
265
311
|
onToggleModeChange: function onToggleModeChange() {
|
|
266
312
|
var index = modes.length - 1 === modes.indexOf(this.inputMode) ? 0 : modes.indexOf(this.inputMode) + 1;
|
|
@@ -9,6 +9,7 @@ var Vue = require("vue");
|
|
|
9
9
|
|
|
10
10
|
var allVue = Vue;
|
|
11
11
|
var gh = allVue.h;
|
|
12
|
+
var isV3 = allVue.version[0] === '3';
|
|
12
13
|
|
|
13
14
|
var color_palette_service_1 = require("./utils/color-palette.service");
|
|
14
15
|
|
|
@@ -73,10 +74,10 @@ var ColorPaletteVue2 = {
|
|
|
73
74
|
this.guid = kendo_vue_common_1.guid();
|
|
74
75
|
},
|
|
75
76
|
mounted: function mounted() {
|
|
76
|
-
this.wrapper =
|
|
77
|
+
this.wrapper = kendo_vue_common_1.getRef(this, 'wrapper');
|
|
77
78
|
},
|
|
78
79
|
updated: function updated() {
|
|
79
|
-
this.wrapper =
|
|
80
|
+
this.wrapper = kendo_vue_common_1.getRef(this, 'wrapper');
|
|
80
81
|
},
|
|
81
82
|
computed: {
|
|
82
83
|
focusedColorCooridanates: function focusedColorCooridanates() {
|
|
@@ -91,22 +92,19 @@ var ColorPaletteVue2 = {
|
|
|
91
92
|
},
|
|
92
93
|
data: function data() {
|
|
93
94
|
return {
|
|
94
|
-
focusedColor:
|
|
95
|
-
currentValue: undefined
|
|
96
|
-
isFirstRender: true
|
|
95
|
+
focusedColor: this.$props.value,
|
|
96
|
+
currentValue: undefined
|
|
97
97
|
};
|
|
98
98
|
},
|
|
99
99
|
// @ts-ignore
|
|
100
|
-
setup: !
|
|
101
|
-
var v3 = !!
|
|
100
|
+
setup: !isV3 ? undefined : function () {
|
|
101
|
+
var v3 = !!isV3;
|
|
102
102
|
return {
|
|
103
103
|
v3: v3
|
|
104
104
|
};
|
|
105
105
|
},
|
|
106
106
|
// @ts-ignore
|
|
107
107
|
render: function render(createElement) {
|
|
108
|
-
var _this = this;
|
|
109
|
-
|
|
110
108
|
var h = gh || createElement;
|
|
111
109
|
var paletteInfo = this.getPaletteInfo();
|
|
112
110
|
var svc = this.paletteService = new color_palette_service_1.ColorPaletteService();
|
|
@@ -114,7 +112,7 @@ var ColorPaletteVue2 = {
|
|
|
114
112
|
var selectedCellCoords = svc.getCellCoordsFor(this.selectedColor);
|
|
115
113
|
var focusedCellCoords = svc.getCellCoordsFor(this.focusedColor);
|
|
116
114
|
var className = kendo_vue_common_1.classNames('k-colorpalette', {
|
|
117
|
-
'k-
|
|
115
|
+
'k-disabled': this.$props.disabled
|
|
118
116
|
});
|
|
119
117
|
|
|
120
118
|
var renderColumns = function renderColumns(columns, rowIndex, cSelectedCellCoords, cFocusedCellCoords) {
|
|
@@ -133,8 +131,8 @@ var ColorPaletteVue2 = {
|
|
|
133
131
|
|
|
134
132
|
var isSelected = rowIsSelected && selectedColumn === i;
|
|
135
133
|
var tdClassName = kendo_vue_common_1.classNames('k-colorpalette-tile', {
|
|
136
|
-
'k-
|
|
137
|
-
'k-
|
|
134
|
+
'k-selected': isSelected,
|
|
135
|
+
'k-focus': rowIsFocused && focusedColumn === i
|
|
138
136
|
});
|
|
139
137
|
return h("td", {
|
|
140
138
|
"class": tdClassName,
|
|
@@ -192,7 +190,7 @@ var ColorPaletteVue2 = {
|
|
|
192
190
|
"aria-activedescendant": selectedCellCoords && this.createCellId(selectedCellCoords),
|
|
193
191
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
194
192
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
195
|
-
|
|
193
|
+
tabindex: kendo_vue_common_1.getTabIndex(this.$props.tabIndex, this.$props.disabled)
|
|
196
194
|
},
|
|
197
195
|
"class": className,
|
|
198
196
|
onFocusin: this.onFocus,
|
|
@@ -207,10 +205,8 @@ var ColorPaletteVue2 = {
|
|
|
207
205
|
"aria-activedescendant": selectedCellCoords && this.createCellId(selectedCellCoords),
|
|
208
206
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
209
207
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
210
|
-
|
|
211
|
-
ref: this
|
|
212
|
-
_this.wrapperRef = el;
|
|
213
|
-
} : 'wrapper'
|
|
208
|
+
tabindex: kendo_vue_common_1.getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
209
|
+
ref: kendo_vue_common_1.setRef(this, 'wrapper')
|
|
214
210
|
}, [h("div", {
|
|
215
211
|
"class": "k-colorpalette-table-wrap",
|
|
216
212
|
role: "grid",
|
|
@@ -236,27 +232,6 @@ var ColorPaletteVue2 = {
|
|
|
236
232
|
this.wrapper.focus();
|
|
237
233
|
}
|
|
238
234
|
},
|
|
239
|
-
getDerivedStateFromProps: function getDerivedStateFromProps(props, state) {
|
|
240
|
-
if (!state.isFirstRender && props.value !== undefined) {
|
|
241
|
-
// The component is in controlled mode.
|
|
242
|
-
if (props.value === '' && state.selectedColor !== undefined) {
|
|
243
|
-
// The selection has to be removed.
|
|
244
|
-
return {
|
|
245
|
-
selectedColor: undefined
|
|
246
|
-
};
|
|
247
|
-
} else if (props.value !== '' && props.value !== state.selectedColor) {
|
|
248
|
-
return {
|
|
249
|
-
selectedColor: props.value
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
} else if (state.isFirstRender) {
|
|
253
|
-
return {
|
|
254
|
-
isFirstRender: false
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return null;
|
|
259
|
-
},
|
|
260
235
|
onKeyDown: function onKeyDown(event) {
|
|
261
236
|
switch (event.keyCode) {
|
|
262
237
|
case kendo_vue_common_1.Keys.down:
|
|
@@ -284,7 +259,6 @@ var ColorPaletteVue2 = {
|
|
|
284
259
|
return;
|
|
285
260
|
}
|
|
286
261
|
|
|
287
|
-
event.preventDefault();
|
|
288
262
|
this.$emit('keydown', event);
|
|
289
263
|
},
|
|
290
264
|
onColorClick: function onColorClick(color, event) {
|