@progress/kendo-vue-inputs 3.4.4-dev.202207220925 → 3.4.5-dev.202208010452
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 +2 -2
- package/dist/es/colors/ColorGradient.d.ts +2 -0
- package/dist/es/colors/ColorGradient.js +161 -77
- package/dist/es/colors/ColorInput.d.ts +3 -0
- package/dist/es/colors/ColorInput.js +80 -56
- package/dist/es/colors/ColorPalette.js +30 -16
- package/dist/es/colors/ColorPicker.d.ts +1 -0
- package/dist/es/colors/ColorPicker.js +91 -69
- package/dist/es/colors/FlatColorPicker.d.ts +41 -5
- package/dist/es/colors/FlatColorPicker.js +306 -109
- package/dist/es/colors/HexInput.d.ts +1 -0
- package/dist/es/colors/HexInput.js +16 -2
- package/dist/es/colors/Picker.js +19 -11
- package/dist/es/colors/interfaces/ColorGradientChangeEvent.d.ts +4 -0
- package/dist/es/colors/interfaces/ColorGradientProps.d.ts +12 -0
- package/dist/es/colors/interfaces/ColorPaletteChangeEvent.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPaletteProps.d.ts +8 -3
- package/dist/es/colors/interfaces/ColorPickerActiveColorClick.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerBlurEvent.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerChangeEvent.d.ts +4 -3
- package/dist/es/colors/interfaces/ColorPickerFocusEvent.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerPaletteSettings.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerPopupSettings.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerProps.d.ts +30 -4
- package/dist/es/colors/interfaces/ColorPickerView.d.ts +0 -3
- package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
- package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.js +0 -0
- package/dist/es/colors/interfaces/PickerProps.d.ts +4 -0
- package/dist/es/colors/utils/color-cache.d.ts +13 -0
- package/dist/es/colors/utils/color-cache.js +14 -0
- package/dist/es/colors/utils/color-parser.d.ts +7 -1
- package/dist/es/colors/utils/color-parser.js +11 -2
- package/dist/es/input/Input.d.ts +4 -0
- package/dist/es/input/Input.js +8 -3
- package/dist/es/messages/index.d.ts +45 -0
- package/dist/es/messages/index.js +46 -0
- package/dist/es/numerictextbox/NumericTextBox.js +3 -0
- package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.d.ts +4 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/RadioButton.js +1 -1
- package/dist/es/radiobutton/RadioGroup.js +1 -1
- package/dist/es/range-slider/RangeSlider.js +1 -1
- package/dist/es/slider/Slider.js +2 -2
- package/dist/npm/checkbox/Checkbox.js +2 -2
- package/dist/npm/colors/ColorGradient.d.ts +2 -0
- package/dist/npm/colors/ColorGradient.js +161 -75
- package/dist/npm/colors/ColorInput.d.ts +3 -0
- package/dist/npm/colors/ColorInput.js +80 -55
- package/dist/npm/colors/ColorPalette.js +30 -16
- package/dist/npm/colors/ColorPicker.d.ts +1 -0
- package/dist/npm/colors/ColorPicker.js +92 -70
- package/dist/npm/colors/FlatColorPicker.d.ts +41 -5
- package/dist/npm/colors/FlatColorPicker.js +306 -106
- package/dist/npm/colors/HexInput.d.ts +1 -0
- package/dist/npm/colors/HexInput.js +16 -2
- package/dist/npm/colors/Picker.js +18 -10
- package/dist/npm/colors/interfaces/ColorGradientChangeEvent.d.ts +4 -0
- package/dist/npm/colors/interfaces/ColorGradientProps.d.ts +12 -0
- package/dist/npm/colors/interfaces/ColorPaletteChangeEvent.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPaletteProps.d.ts +8 -3
- package/dist/npm/colors/interfaces/ColorPickerActiveColorClick.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerBlurEvent.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerChangeEvent.d.ts +4 -3
- package/dist/npm/colors/interfaces/ColorPickerFocusEvent.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerPaletteSettings.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerPopupSettings.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +30 -4
- package/dist/npm/colors/interfaces/ColorPickerView.d.ts +0 -3
- package/dist/npm/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
- package/dist/npm/colors/interfaces/FlatColorPickerViewChangeEvent.js +2 -0
- package/dist/npm/colors/interfaces/PickerProps.d.ts +4 -0
- package/dist/npm/colors/utils/color-cache.d.ts +13 -0
- package/dist/npm/colors/utils/color-cache.js +15 -1
- package/dist/npm/colors/utils/color-parser.d.ts +7 -1
- package/dist/npm/colors/utils/color-parser.js +12 -3
- package/dist/npm/input/Input.d.ts +4 -0
- package/dist/npm/input/Input.js +8 -3
- package/dist/npm/messages/index.d.ts +45 -0
- package/dist/npm/messages/index.js +47 -1
- package/dist/npm/numerictextbox/NumericTextBox.js +3 -0
- package/dist/npm/numerictextbox/interfaces/NumericTextBoxProps.d.ts +4 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/RadioButton.js +1 -1
- package/dist/npm/radiobutton/RadioGroup.js +1 -1
- package/dist/npm/range-slider/RangeSlider.js +1 -1
- package/dist/npm/slider/Slider.js +2 -2
- package/package.json +11 -11
|
@@ -202,11 +202,11 @@ var CheckboxVue2 = {
|
|
|
202
202
|
this.defaultValidationMessage = this.localizeMessage(checkboxValidation);
|
|
203
203
|
this.optionalMessage = this.localizeMessage(checkboxOptionalText);
|
|
204
204
|
var checkboxClasses = classNames({
|
|
205
|
-
'k-
|
|
205
|
+
'k-disabled': disabled
|
|
206
206
|
});
|
|
207
207
|
var inputClasses = classNames((_a = {
|
|
208
208
|
'k-checkbox': true
|
|
209
|
-
}, _a["k-checkbox-" + kendoThemeMaps.sizeMap[size]] = size, _a["k-rounded-" + kendoThemeMaps.roundedMap[rounded]] = rounded, _a['k-
|
|
209
|
+
}, _a["k-checkbox-" + kendoThemeMaps.sizeMap[size]] = size, _a["k-rounded-" + kendoThemeMaps.roundedMap[rounded]] = rounded, _a['k-indeterminate'] = this.indeterminateProp, _a['k-invalid k-invalid'] = !(this.isValid || validityStyles !== undefined || validityStyles === true), _a));
|
|
210
210
|
|
|
211
211
|
var checkboxInput = function checkboxInput() {
|
|
212
212
|
return h("input", {
|
|
@@ -3,16 +3,18 @@ import * as Vue from 'vue';
|
|
|
3
3
|
var allVue = Vue;
|
|
4
4
|
var gh = allVue.h;
|
|
5
5
|
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
|
-
import { Draggable, guid, classNames, focusFirstFocusableChild, getTabIndex } from '@progress/kendo-vue-common';
|
|
6
|
+
import { Draggable, guid, classNames, focusFirstFocusableChild, getTabIndex, Keys, setRef, getRef, focusContainer } from '@progress/kendo-vue-common';
|
|
7
7
|
import { validatePackage } from '@progress/kendo-vue-common';
|
|
8
8
|
import { packageMetadata } from '../package-metadata';
|
|
9
9
|
import { Slider } from './../main';
|
|
10
10
|
import { fitIntoBounds, isPresent } from './utils/misc';
|
|
11
11
|
import { getColorFromHue, parseColor, getHSV, getColorFromHSV, getRGBA, getColorFromRGBA } from './utils/color-parser';
|
|
12
|
-
import {
|
|
12
|
+
import { removeCachedColor, getCachedHsva, getCachedRgba, getCachedHex } from './utils/color-cache';
|
|
13
13
|
import { ColorInput } from './ColorInput';
|
|
14
14
|
import { ColorContrastLabels } from './ColorContrastLabels';
|
|
15
15
|
import { ColorContrastSvg } from './ColorContrastSvg';
|
|
16
|
+
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
17
|
+
import { colorGradientDragHandle, messages } from '../messages';
|
|
16
18
|
var FORMAT = 'rgba';
|
|
17
19
|
var DEFAULT_SELECTED_COLOR = 'rgba(255, 255, 255, 1)';
|
|
18
20
|
/**
|
|
@@ -21,14 +23,27 @@ var DEFAULT_SELECTED_COLOR = 'rgba(255, 255, 255, 1)';
|
|
|
21
23
|
|
|
22
24
|
var ColorGradientVue2 = {
|
|
23
25
|
name: 'KendoColorGradient',
|
|
26
|
+
model: {
|
|
27
|
+
event: 'changemodel'
|
|
28
|
+
},
|
|
24
29
|
// @ts-ignore
|
|
25
30
|
emits: {
|
|
26
31
|
'change': null,
|
|
27
32
|
'focus': null,
|
|
28
33
|
'blur': null,
|
|
34
|
+
'changemodel': null,
|
|
35
|
+
'update:modelValue': null,
|
|
36
|
+
'update:modelRgbaValue': null,
|
|
29
37
|
'keydown': null
|
|
30
38
|
},
|
|
39
|
+
inject: {
|
|
40
|
+
kendoLocalizationService: {
|
|
41
|
+
default: null
|
|
42
|
+
}
|
|
43
|
+
},
|
|
31
44
|
props: {
|
|
45
|
+
modelValue: String,
|
|
46
|
+
modelRgbaValue: String,
|
|
32
47
|
defaultValue: String,
|
|
33
48
|
value: String,
|
|
34
49
|
opacity: {
|
|
@@ -39,20 +54,22 @@ var ColorGradientVue2 = {
|
|
|
39
54
|
disabled: Boolean,
|
|
40
55
|
id: String,
|
|
41
56
|
ariaLabelledBy: String,
|
|
42
|
-
ariaDescribedBy: String
|
|
57
|
+
ariaDescribedBy: String,
|
|
58
|
+
tabIndex: Number,
|
|
59
|
+
innerTabIndex: {
|
|
60
|
+
type: Number,
|
|
61
|
+
default: undefined
|
|
62
|
+
}
|
|
43
63
|
},
|
|
44
64
|
created: function created() {
|
|
45
65
|
validatePackage(packageMetadata);
|
|
46
66
|
this.guid = guid();
|
|
47
67
|
},
|
|
48
68
|
computed: {
|
|
49
|
-
isUncontrolled: function isUncontrolled() {
|
|
50
|
-
return this.$props.value === undefined;
|
|
51
|
-
},
|
|
52
69
|
computedValue: function computedValue() {
|
|
53
|
-
var value = this.value || this.defaultValue || this.currentValue || parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
70
|
+
var value = this.value || this.defaultValue || this.modelValue || this.modelRgbaValue || this.currentValue || parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
54
71
|
|
|
55
|
-
if (!isPresent(parseColor(value, 'hex'))) {
|
|
72
|
+
if (!isPresent(parseColor(value, 'hex', this.opacity))) {
|
|
56
73
|
// Validate/sanitize the input.
|
|
57
74
|
value = DEFAULT_SELECTED_COLOR;
|
|
58
75
|
}
|
|
@@ -66,10 +83,13 @@ var ColorGradientVue2 = {
|
|
|
66
83
|
return this.currentRgba || getCachedRgba(this.guid, this.computedValue) || getRGBA(this.computedValue);
|
|
67
84
|
},
|
|
68
85
|
hex: function hex() {
|
|
69
|
-
return this.currentHex || getCachedHex(this.guid, this.computedValue) || parseColor(this.computedValue, 'hex');
|
|
86
|
+
return this.currentHex || getCachedHex(this.guid, this.computedValue) || parseColor(this.computedValue, 'hex', this.opacity);
|
|
70
87
|
},
|
|
71
88
|
computedBgColor: function computedBgColor() {
|
|
72
89
|
return this.currentBgColor || getColorFromHue(this.hsva.h);
|
|
90
|
+
},
|
|
91
|
+
computedTabIndex: function computedTabIndex() {
|
|
92
|
+
return this.innerTabIndex !== undefined ? this.innerTabIndex : this.focused ? 0 : -1;
|
|
73
93
|
}
|
|
74
94
|
},
|
|
75
95
|
data: function data() {
|
|
@@ -79,7 +99,8 @@ var ColorGradientVue2 = {
|
|
|
79
99
|
isFirstRender: true,
|
|
80
100
|
currentHsva: undefined,
|
|
81
101
|
currentRgba: undefined,
|
|
82
|
-
currentHex: undefined
|
|
102
|
+
currentHex: undefined,
|
|
103
|
+
focused: false
|
|
83
104
|
};
|
|
84
105
|
},
|
|
85
106
|
mounted: function mounted() {
|
|
@@ -100,8 +121,7 @@ var ColorGradientVue2 = {
|
|
|
100
121
|
removeCachedColor(this.guid);
|
|
101
122
|
},
|
|
102
123
|
updated: function updated() {
|
|
103
|
-
|
|
104
|
-
this.setAlphaSliderBackground(this.computedBgColor); // }
|
|
124
|
+
this.setAlphaSliderBackground(this.computedBgColor);
|
|
105
125
|
},
|
|
106
126
|
// @ts-ignore
|
|
107
127
|
setup: !isV3 ? undefined : function () {
|
|
@@ -120,6 +140,8 @@ var ColorGradientVue2 = {
|
|
|
120
140
|
var className = classNames('k-colorgradient', {
|
|
121
141
|
'k-disabled': this.$props.disabled
|
|
122
142
|
});
|
|
143
|
+
var localizationService = provideLocalizationService(this);
|
|
144
|
+
var dragHandle = localizationService.toLanguageString(colorGradientDragHandle, messages[colorGradientDragHandle]);
|
|
123
145
|
|
|
124
146
|
var renderRectangleDragHandle = function renderRectangleDragHandle() {
|
|
125
147
|
var style = {};
|
|
@@ -134,7 +156,24 @@ var ColorGradientVue2 = {
|
|
|
134
156
|
|
|
135
157
|
return h("div", {
|
|
136
158
|
"class": "k-hsv-draghandle k-draghandle",
|
|
137
|
-
|
|
159
|
+
role: "slider",
|
|
160
|
+
attrs: this.v3 ? undefined : {
|
|
161
|
+
role: "slider",
|
|
162
|
+
"aria-label": dragHandle + ("" + (this.value || 'none')),
|
|
163
|
+
"aria-valuenow": Math.round(this.hsva.s * 100),
|
|
164
|
+
"aria-valuetext": "\n saturation: " + Math.round(this.hsva.s * 100) + "%,\n value: " + Math.round(this.hsva.v * 100) + "%",
|
|
165
|
+
tabindex: this.computedTabIndex
|
|
166
|
+
},
|
|
167
|
+
"aria-label": dragHandle + ("" + (this.value || 'none')),
|
|
168
|
+
"aria-valuenow": Math.round(this.hsva.s * 100),
|
|
169
|
+
"aria-valuetext": "\n saturation: " + Math.round(this.hsva.s * 100) + "%,\n value: " + Math.round(this.hsva.v * 100) + "%",
|
|
170
|
+
tabindex: this.computedTabIndex,
|
|
171
|
+
onKeydown: this.dragKeyDown,
|
|
172
|
+
on: this.v3 ? undefined : {
|
|
173
|
+
"keydown": this.dragKeyDown
|
|
174
|
+
},
|
|
175
|
+
style: style,
|
|
176
|
+
ref: setRef(this, 'draghandle')
|
|
138
177
|
});
|
|
139
178
|
};
|
|
140
179
|
|
|
@@ -142,13 +181,15 @@ var ColorGradientVue2 = {
|
|
|
142
181
|
id: this.$props.id,
|
|
143
182
|
attrs: this.v3 ? undefined : {
|
|
144
183
|
id: this.$props.id,
|
|
145
|
-
|
|
184
|
+
role: this.$props.tabIndex !== -1 ? 'textbox' : undefined,
|
|
185
|
+
"aria-disabled": this.$props.disabled,
|
|
146
186
|
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
147
187
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
148
188
|
"aria-describedby": this.$props.ariaDescribedBy
|
|
149
189
|
},
|
|
150
190
|
"class": className,
|
|
151
|
-
|
|
191
|
+
role: this.$props.tabIndex !== -1 ? 'textbox' : undefined,
|
|
192
|
+
"aria-disabled": this.$props.disabled,
|
|
152
193
|
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
153
194
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
154
195
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
@@ -182,6 +223,10 @@ var ColorGradientVue2 = {
|
|
|
182
223
|
style: {
|
|
183
224
|
touchAction: 'none'
|
|
184
225
|
},
|
|
226
|
+
tabindex: -1,
|
|
227
|
+
attrs: _this2.v3 ? undefined : {
|
|
228
|
+
tabindex: -1
|
|
229
|
+
},
|
|
185
230
|
onClick: _this2.onGradientWrapperClick,
|
|
186
231
|
on: _this2.v3 ? undefined : {
|
|
187
232
|
"click": _this2.onGradientWrapperClick
|
|
@@ -192,6 +237,10 @@ var ColorGradientVue2 = {
|
|
|
192
237
|
style: {
|
|
193
238
|
touchAction: 'none'
|
|
194
239
|
},
|
|
240
|
+
tabindex: -1,
|
|
241
|
+
attrs: _this2.v3 ? undefined : {
|
|
242
|
+
tabindex: -1
|
|
243
|
+
},
|
|
195
244
|
onClick: _this2.onGradientWrapperClick,
|
|
196
245
|
on: _this2.v3 ? undefined : {
|
|
197
246
|
"click": _this2.onGradientWrapperClick
|
|
@@ -208,8 +257,9 @@ var ColorGradientVue2 = {
|
|
|
208
257
|
})]), h("div", {
|
|
209
258
|
"class": "k-hsv-controls k-hstack"
|
|
210
259
|
}, [h(Slider, {
|
|
211
|
-
|
|
260
|
+
tabIndex: this.computedTabIndex,
|
|
212
261
|
attrs: this.v3 ? undefined : {
|
|
262
|
+
tabIndex: this.computedTabIndex,
|
|
213
263
|
value: this.hsva.h,
|
|
214
264
|
buttons: false,
|
|
215
265
|
vertical: true,
|
|
@@ -218,6 +268,7 @@ var ColorGradientVue2 = {
|
|
|
218
268
|
step: 5,
|
|
219
269
|
disabled: this.$props.disabled
|
|
220
270
|
},
|
|
271
|
+
value: this.hsva.h,
|
|
221
272
|
buttons: false,
|
|
222
273
|
vertical: true,
|
|
223
274
|
min: 0,
|
|
@@ -225,17 +276,14 @@ var ColorGradientVue2 = {
|
|
|
225
276
|
step: 5,
|
|
226
277
|
onChange: this.onHueSliderChange,
|
|
227
278
|
on: this.v3 ? undefined : {
|
|
228
|
-
"change": this.onHueSliderChange
|
|
229
|
-
"focus": this.onFocus,
|
|
230
|
-
"blur": this.onBlur
|
|
279
|
+
"change": this.onHueSliderChange
|
|
231
280
|
},
|
|
232
|
-
onFocus: this.onFocus,
|
|
233
|
-
onBlur: this.onBlur,
|
|
234
281
|
"class": "k-hue-slider k-colorgradient-slider",
|
|
235
282
|
disabled: this.$props.disabled
|
|
236
283
|
}), this.$props.opacity && h(Slider, {
|
|
237
|
-
|
|
284
|
+
tabIndex: this.computedTabIndex,
|
|
238
285
|
attrs: this.v3 ? undefined : {
|
|
286
|
+
tabIndex: this.computedTabIndex,
|
|
239
287
|
value: isPresent(this.hsva.a) ? this.hsva.a * 100 : 100,
|
|
240
288
|
buttons: false,
|
|
241
289
|
vertical: true,
|
|
@@ -244,6 +292,7 @@ var ColorGradientVue2 = {
|
|
|
244
292
|
step: 1,
|
|
245
293
|
disabled: this.$props.disabled
|
|
246
294
|
},
|
|
295
|
+
value: isPresent(this.hsva.a) ? this.hsva.a * 100 : 100,
|
|
247
296
|
buttons: false,
|
|
248
297
|
vertical: true,
|
|
249
298
|
min: 0,
|
|
@@ -251,36 +300,33 @@ var ColorGradientVue2 = {
|
|
|
251
300
|
step: 1,
|
|
252
301
|
onChange: this.onAlphaSliderChange,
|
|
253
302
|
on: this.v3 ? undefined : {
|
|
254
|
-
"change": this.onAlphaSliderChange
|
|
255
|
-
"focus": this.onFocus,
|
|
256
|
-
"blur": this.onBlur
|
|
303
|
+
"change": this.onAlphaSliderChange
|
|
257
304
|
},
|
|
258
|
-
onFocus: this.onFocus,
|
|
259
|
-
onBlur: this.onBlur,
|
|
260
305
|
"class": "k-alpha-slider k-colorgradient-slider",
|
|
261
306
|
disabled: this.$props.disabled,
|
|
262
307
|
ref: this.v3 ? function (el) {
|
|
263
308
|
_this.alphaSliderRef = el;
|
|
264
309
|
} : 'alphaSlider'
|
|
265
310
|
})])]), h(ColorInput, {
|
|
266
|
-
|
|
311
|
+
tabIndex: this.computedTabIndex,
|
|
267
312
|
attrs: this.v3 ? undefined : {
|
|
313
|
+
tabIndex: this.computedTabIndex,
|
|
268
314
|
rgba: this.rgba,
|
|
269
315
|
hex: this.hex,
|
|
270
316
|
opacity: this.$props.opacity,
|
|
271
317
|
disabled: this.$props.disabled
|
|
272
318
|
},
|
|
319
|
+
rgba: this.rgba,
|
|
273
320
|
onRgbachange: this.onRgbaChange,
|
|
274
321
|
on: this.v3 ? undefined : {
|
|
275
322
|
"rgbachange": this.onRgbaChange,
|
|
276
|
-
"blur": this.onBlur,
|
|
277
323
|
"hexchange": this.onHexChange
|
|
278
324
|
},
|
|
279
325
|
hex: this.hex,
|
|
280
|
-
onBlur: this.onBlur,
|
|
281
326
|
onHexchange: this.onHexChange,
|
|
282
327
|
opacity: this.$props.opacity,
|
|
283
|
-
disabled: this.$props.disabled
|
|
328
|
+
disabled: this.$props.disabled,
|
|
329
|
+
ref: 'colorInput'
|
|
284
330
|
}), this.backgroundColor && h(ColorContrastLabels, {
|
|
285
331
|
bgColor: getRGBA(this.backgroundColor),
|
|
286
332
|
attrs: this.v3 ? undefined : {
|
|
@@ -291,44 +337,33 @@ var ColorGradientVue2 = {
|
|
|
291
337
|
})]);
|
|
292
338
|
},
|
|
293
339
|
methods: {
|
|
294
|
-
// getDerivedStateFromProps(props: ColorGradientProps, state: ColorGradientState) {
|
|
295
|
-
// if (props.value && !state.isFirstRender) {
|
|
296
|
-
// // The component is in controlled mode.
|
|
297
|
-
// return ColorGradientWithoutContext.getStateFromValue(props.value, state.guid);
|
|
298
|
-
// }
|
|
299
|
-
// return null;
|
|
300
|
-
// },
|
|
301
340
|
onKeyDownHandler: function onKeyDownHandler(e) {
|
|
341
|
+
var element = this.$el;
|
|
342
|
+
|
|
343
|
+
if (this.innerTabIndex === undefined) {
|
|
344
|
+
this.focused = focusContainer(e, element);
|
|
345
|
+
}
|
|
346
|
+
|
|
302
347
|
this.$emit('keydown', e);
|
|
303
348
|
},
|
|
304
349
|
onHexChange: function onHexChange(hex, value, event) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
cacheHex(this.guid, value, hex);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
this.dispatchChangeEvent(value, event, event.event);
|
|
350
|
+
var rgba = getRGBA(value);
|
|
351
|
+
var hsva = getHSV(value);
|
|
352
|
+
this.currentHsva = hsva;
|
|
353
|
+
this.currentBgColor = getColorFromHue(hsva.h);
|
|
354
|
+
this.currentRgba = rgba;
|
|
355
|
+
this.currentHex = hex;
|
|
356
|
+
this.dispatchChangeEvent(value, event.event, hex, value);
|
|
316
357
|
},
|
|
317
358
|
onRgbaChange: function onRgbaChange(rgba, event) {
|
|
318
359
|
var value = getColorFromRGBA(rgba);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
this.currentHex = hex;
|
|
327
|
-
} else {
|
|
328
|
-
cacheRgba(this.guid, value, rgba);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
this.dispatchChangeEvent(value, event.event);
|
|
360
|
+
var hex = parseColor(value, 'hex', this.opacity);
|
|
361
|
+
var hsva = getHSV(value);
|
|
362
|
+
this.currentHsva = hsva;
|
|
363
|
+
this.currentBgColor = getColorFromHue(hsva.h);
|
|
364
|
+
this.currentRgba = rgba;
|
|
365
|
+
this.currentHex = hex;
|
|
366
|
+
this.dispatchChangeEvent(value, event.event, hex, value);
|
|
332
367
|
},
|
|
333
368
|
onAlphaSliderChange: function onAlphaSliderChange(event) {
|
|
334
369
|
this.handleHsvaChange(Object.assign({}, this.hsva, {
|
|
@@ -348,8 +383,53 @@ var ColorGradientVue2 = {
|
|
|
348
383
|
this.gradientWrapper.classList.remove('k-dragging');
|
|
349
384
|
},
|
|
350
385
|
onGradientWrapperClick: function onGradientWrapperClick(event) {
|
|
386
|
+
this.firstFocusable = getRef(this, 'draghandle');
|
|
387
|
+
this.firstFocusable.focus();
|
|
351
388
|
this.changePosition(event);
|
|
352
389
|
},
|
|
390
|
+
move: function move(e, prop, d) {
|
|
391
|
+
var c = this.hsva;
|
|
392
|
+
c[prop] += d * (e.shiftKey ? 0.01 : 0.05);
|
|
393
|
+
|
|
394
|
+
if (c[prop] < 0) {
|
|
395
|
+
c[prop] = 0;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (c[prop] > 1) {
|
|
399
|
+
c[prop] = 1;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
e.preventDefault();
|
|
403
|
+
this.handleHsvaChange(c, e);
|
|
404
|
+
},
|
|
405
|
+
dragKeyDown: function dragKeyDown(e) {
|
|
406
|
+
switch (e.keyCode) {
|
|
407
|
+
case Keys.left:
|
|
408
|
+
this.move(e, 's', -1);
|
|
409
|
+
break;
|
|
410
|
+
|
|
411
|
+
case Keys.right:
|
|
412
|
+
this.move(e, 's', 1);
|
|
413
|
+
break;
|
|
414
|
+
|
|
415
|
+
case Keys.up:
|
|
416
|
+
this.move(e, 'v', 1);
|
|
417
|
+
break;
|
|
418
|
+
|
|
419
|
+
case Keys.down:
|
|
420
|
+
this.move(e, 'v', -1);
|
|
421
|
+
break;
|
|
422
|
+
|
|
423
|
+
case Keys.enter:
|
|
424
|
+
break;
|
|
425
|
+
|
|
426
|
+
case Keys.esc:
|
|
427
|
+
break;
|
|
428
|
+
|
|
429
|
+
default:
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
},
|
|
353
433
|
changePosition: function changePosition(event) {
|
|
354
434
|
var gradientRectMetrics = this.getGradientRectMetrics();
|
|
355
435
|
var deltaX = event.clientX - gradientRectMetrics.left;
|
|
@@ -364,25 +444,24 @@ var ColorGradientVue2 = {
|
|
|
364
444
|
},
|
|
365
445
|
handleHsvaChange: function handleHsvaChange(hsva, event) {
|
|
366
446
|
var value = getColorFromHSV(hsva);
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
} else {
|
|
375
|
-
cacheHsva(this.guid, value, hsva);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
this.dispatchChangeEvent(value, event);
|
|
447
|
+
var hex = parseColor(value, 'hex', this.opacity);
|
|
448
|
+
var rgba = parseColor(value, 'rgba');
|
|
449
|
+
this.currentHsva = hsva;
|
|
450
|
+
this.currentBgColor = getColorFromHue(hsva.h);
|
|
451
|
+
this.currentRgba = getRGBA(value);
|
|
452
|
+
this.currentHex = hex;
|
|
453
|
+
this.dispatchChangeEvent(value, event, hex, rgba);
|
|
379
454
|
},
|
|
380
|
-
dispatchChangeEvent: function dispatchChangeEvent(value, event) {
|
|
455
|
+
dispatchChangeEvent: function dispatchChangeEvent(value, event, hex, rgbaValue) {
|
|
381
456
|
this.currentValue = value;
|
|
457
|
+
this.$emit('changemodel', hex);
|
|
458
|
+
this.$emit('update:modelRgbaValue', rgbaValue);
|
|
459
|
+
this.$emit('update:modelValue', hex);
|
|
382
460
|
this.$emit('change', {
|
|
383
461
|
event: event,
|
|
384
462
|
target: this,
|
|
385
|
-
value:
|
|
463
|
+
value: hex,
|
|
464
|
+
rgbaValue: rgbaValue
|
|
386
465
|
});
|
|
387
466
|
},
|
|
388
467
|
onFocus: function onFocus(event) {
|
|
@@ -416,7 +495,12 @@ var ColorGradientVue2 = {
|
|
|
416
495
|
};
|
|
417
496
|
},
|
|
418
497
|
focus: function focus() {
|
|
419
|
-
|
|
498
|
+
var _this = this;
|
|
499
|
+
|
|
500
|
+
this.focused = true;
|
|
501
|
+
setTimeout(function () {
|
|
502
|
+
focusFirstFocusableChild(_this.$el);
|
|
503
|
+
}, 1);
|
|
420
504
|
}
|
|
421
505
|
}
|
|
422
506
|
};
|
|
@@ -9,6 +9,7 @@ import { RGBA } from './models/rgba';
|
|
|
9
9
|
* @hidden
|
|
10
10
|
*/
|
|
11
11
|
export interface ColorInputProps {
|
|
12
|
+
tabIndex?: number;
|
|
12
13
|
rgba: RGBA;
|
|
13
14
|
onRgbaChange?: (rgba: RGBA, event: NumericTextBoxChangeEvent) => void;
|
|
14
15
|
hex: string;
|
|
@@ -20,6 +21,8 @@ export interface ColorInputProps {
|
|
|
20
21
|
* @hidden
|
|
21
22
|
*/
|
|
22
23
|
export interface ColorInputState {
|
|
24
|
+
lastFocusable: any;
|
|
25
|
+
hexInputId: string;
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* @hidden
|