@progress/kendo-vue-inputs 3.4.4 → 3.4.5-dev.202207300828
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 +152 -47
- 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 +89 -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 +153 -46
- 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 +90 -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,7 +3,7 @@ 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';
|
|
@@ -13,6 +13,8 @@ import { cacheHsva, removeCachedColor, getCachedHsva, getCachedRgba, getCachedHe
|
|
|
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,7 +54,12 @@ 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);
|
|
@@ -50,9 +70,9 @@ var ColorGradientVue2 = {
|
|
|
50
70
|
return this.$props.value === undefined;
|
|
51
71
|
},
|
|
52
72
|
computedValue: function computedValue() {
|
|
53
|
-
var value = this.value || this.defaultValue || this.currentValue || parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
73
|
+
var value = this.value || this.defaultValue || this.modelValue || this.modelRgbaValue || this.currentValue || parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
54
74
|
|
|
55
|
-
if (!isPresent(parseColor(value, 'hex'))) {
|
|
75
|
+
if (!isPresent(parseColor(value, 'hex', this.opacity))) {
|
|
56
76
|
// Validate/sanitize the input.
|
|
57
77
|
value = DEFAULT_SELECTED_COLOR;
|
|
58
78
|
}
|
|
@@ -66,10 +86,13 @@ var ColorGradientVue2 = {
|
|
|
66
86
|
return this.currentRgba || getCachedRgba(this.guid, this.computedValue) || getRGBA(this.computedValue);
|
|
67
87
|
},
|
|
68
88
|
hex: function hex() {
|
|
69
|
-
return this.currentHex || getCachedHex(this.guid, this.computedValue) || parseColor(this.computedValue, 'hex');
|
|
89
|
+
return this.currentHex || getCachedHex(this.guid, this.computedValue) || parseColor(this.computedValue, 'hex', this.opacity);
|
|
70
90
|
},
|
|
71
91
|
computedBgColor: function computedBgColor() {
|
|
72
92
|
return this.currentBgColor || getColorFromHue(this.hsva.h);
|
|
93
|
+
},
|
|
94
|
+
computedTabIndex: function computedTabIndex() {
|
|
95
|
+
return this.innerTabIndex !== undefined ? this.innerTabIndex : this.focused ? 0 : -1;
|
|
73
96
|
}
|
|
74
97
|
},
|
|
75
98
|
data: function data() {
|
|
@@ -79,7 +102,8 @@ var ColorGradientVue2 = {
|
|
|
79
102
|
isFirstRender: true,
|
|
80
103
|
currentHsva: undefined,
|
|
81
104
|
currentRgba: undefined,
|
|
82
|
-
currentHex: undefined
|
|
105
|
+
currentHex: undefined,
|
|
106
|
+
focused: false
|
|
83
107
|
};
|
|
84
108
|
},
|
|
85
109
|
mounted: function mounted() {
|
|
@@ -100,8 +124,7 @@ var ColorGradientVue2 = {
|
|
|
100
124
|
removeCachedColor(this.guid);
|
|
101
125
|
},
|
|
102
126
|
updated: function updated() {
|
|
103
|
-
|
|
104
|
-
this.setAlphaSliderBackground(this.computedBgColor); // }
|
|
127
|
+
this.setAlphaSliderBackground(this.computedBgColor);
|
|
105
128
|
},
|
|
106
129
|
// @ts-ignore
|
|
107
130
|
setup: !isV3 ? undefined : function () {
|
|
@@ -120,6 +143,8 @@ var ColorGradientVue2 = {
|
|
|
120
143
|
var className = classNames('k-colorgradient', {
|
|
121
144
|
'k-disabled': this.$props.disabled
|
|
122
145
|
});
|
|
146
|
+
var localizationService = provideLocalizationService(this);
|
|
147
|
+
var dragHandle = localizationService.toLanguageString(colorGradientDragHandle, messages[colorGradientDragHandle]);
|
|
123
148
|
|
|
124
149
|
var renderRectangleDragHandle = function renderRectangleDragHandle() {
|
|
125
150
|
var style = {};
|
|
@@ -134,7 +159,24 @@ var ColorGradientVue2 = {
|
|
|
134
159
|
|
|
135
160
|
return h("div", {
|
|
136
161
|
"class": "k-hsv-draghandle k-draghandle",
|
|
137
|
-
|
|
162
|
+
role: "slider",
|
|
163
|
+
attrs: this.v3 ? undefined : {
|
|
164
|
+
role: "slider",
|
|
165
|
+
"aria-label": dragHandle + ("" + (this.value || 'none')),
|
|
166
|
+
"aria-valuenow": Math.round(this.hsva.s * 100),
|
|
167
|
+
"aria-valuetext": "\n saturation: " + Math.round(this.hsva.s * 100) + "%,\n value: " + Math.round(this.hsva.v * 100) + "%",
|
|
168
|
+
tabindex: this.computedTabIndex
|
|
169
|
+
},
|
|
170
|
+
"aria-label": dragHandle + ("" + (this.value || 'none')),
|
|
171
|
+
"aria-valuenow": Math.round(this.hsva.s * 100),
|
|
172
|
+
"aria-valuetext": "\n saturation: " + Math.round(this.hsva.s * 100) + "%,\n value: " + Math.round(this.hsva.v * 100) + "%",
|
|
173
|
+
tabindex: this.computedTabIndex,
|
|
174
|
+
onKeydown: this.dragKeyDown,
|
|
175
|
+
on: this.v3 ? undefined : {
|
|
176
|
+
"keydown": this.dragKeyDown
|
|
177
|
+
},
|
|
178
|
+
style: style,
|
|
179
|
+
ref: setRef(this, 'draghandle')
|
|
138
180
|
});
|
|
139
181
|
};
|
|
140
182
|
|
|
@@ -142,23 +184,25 @@ var ColorGradientVue2 = {
|
|
|
142
184
|
id: this.$props.id,
|
|
143
185
|
attrs: this.v3 ? undefined : {
|
|
144
186
|
id: this.$props.id,
|
|
145
|
-
|
|
187
|
+
role: this.$props.tabIndex !== -1 ? 'textbox' : undefined,
|
|
188
|
+
"aria-disabled": this.$props.disabled,
|
|
146
189
|
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
147
190
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
148
191
|
"aria-describedby": this.$props.ariaDescribedBy
|
|
149
192
|
},
|
|
150
193
|
"class": className,
|
|
151
|
-
|
|
194
|
+
role: this.$props.tabIndex !== -1 ? 'textbox' : undefined,
|
|
195
|
+
"aria-disabled": this.$props.disabled,
|
|
152
196
|
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
153
197
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
154
198
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
155
|
-
|
|
199
|
+
onFocusin: this.onFocus,
|
|
156
200
|
on: this.v3 ? undefined : {
|
|
157
|
-
"
|
|
158
|
-
"
|
|
201
|
+
"focusin": this.onFocus,
|
|
202
|
+
"focusout": this.onBlur,
|
|
159
203
|
"keydown": this.onKeyDownHandler
|
|
160
204
|
},
|
|
161
|
-
|
|
205
|
+
onFocusout: this.onBlur,
|
|
162
206
|
onKeydown: this.onKeyDownHandler
|
|
163
207
|
}, [h("div", {
|
|
164
208
|
"class": "k-colorgradient-canvas k-hstack"
|
|
@@ -182,6 +226,10 @@ var ColorGradientVue2 = {
|
|
|
182
226
|
style: {
|
|
183
227
|
touchAction: 'none'
|
|
184
228
|
},
|
|
229
|
+
tabindex: -1,
|
|
230
|
+
attrs: _this2.v3 ? undefined : {
|
|
231
|
+
tabindex: -1
|
|
232
|
+
},
|
|
185
233
|
onClick: _this2.onGradientWrapperClick,
|
|
186
234
|
on: _this2.v3 ? undefined : {
|
|
187
235
|
"click": _this2.onGradientWrapperClick
|
|
@@ -192,6 +240,10 @@ var ColorGradientVue2 = {
|
|
|
192
240
|
style: {
|
|
193
241
|
touchAction: 'none'
|
|
194
242
|
},
|
|
243
|
+
tabindex: -1,
|
|
244
|
+
attrs: _this2.v3 ? undefined : {
|
|
245
|
+
tabindex: -1
|
|
246
|
+
},
|
|
195
247
|
onClick: _this2.onGradientWrapperClick,
|
|
196
248
|
on: _this2.v3 ? undefined : {
|
|
197
249
|
"click": _this2.onGradientWrapperClick
|
|
@@ -208,8 +260,9 @@ var ColorGradientVue2 = {
|
|
|
208
260
|
})]), h("div", {
|
|
209
261
|
"class": "k-hsv-controls k-hstack"
|
|
210
262
|
}, [h(Slider, {
|
|
211
|
-
|
|
263
|
+
tabIndex: this.computedTabIndex,
|
|
212
264
|
attrs: this.v3 ? undefined : {
|
|
265
|
+
tabIndex: this.computedTabIndex,
|
|
213
266
|
value: this.hsva.h,
|
|
214
267
|
buttons: false,
|
|
215
268
|
vertical: true,
|
|
@@ -218,6 +271,7 @@ var ColorGradientVue2 = {
|
|
|
218
271
|
step: 5,
|
|
219
272
|
disabled: this.$props.disabled
|
|
220
273
|
},
|
|
274
|
+
value: this.hsva.h,
|
|
221
275
|
buttons: false,
|
|
222
276
|
vertical: true,
|
|
223
277
|
min: 0,
|
|
@@ -225,17 +279,14 @@ var ColorGradientVue2 = {
|
|
|
225
279
|
step: 5,
|
|
226
280
|
onChange: this.onHueSliderChange,
|
|
227
281
|
on: this.v3 ? undefined : {
|
|
228
|
-
"change": this.onHueSliderChange
|
|
229
|
-
"focus": this.onFocus,
|
|
230
|
-
"blur": this.onBlur
|
|
282
|
+
"change": this.onHueSliderChange
|
|
231
283
|
},
|
|
232
|
-
onFocus: this.onFocus,
|
|
233
|
-
onBlur: this.onBlur,
|
|
234
284
|
"class": "k-hue-slider k-colorgradient-slider",
|
|
235
285
|
disabled: this.$props.disabled
|
|
236
286
|
}), this.$props.opacity && h(Slider, {
|
|
237
|
-
|
|
287
|
+
tabIndex: this.computedTabIndex,
|
|
238
288
|
attrs: this.v3 ? undefined : {
|
|
289
|
+
tabIndex: this.computedTabIndex,
|
|
239
290
|
value: isPresent(this.hsva.a) ? this.hsva.a * 100 : 100,
|
|
240
291
|
buttons: false,
|
|
241
292
|
vertical: true,
|
|
@@ -244,6 +295,7 @@ var ColorGradientVue2 = {
|
|
|
244
295
|
step: 1,
|
|
245
296
|
disabled: this.$props.disabled
|
|
246
297
|
},
|
|
298
|
+
value: isPresent(this.hsva.a) ? this.hsva.a * 100 : 100,
|
|
247
299
|
buttons: false,
|
|
248
300
|
vertical: true,
|
|
249
301
|
min: 0,
|
|
@@ -251,36 +303,33 @@ var ColorGradientVue2 = {
|
|
|
251
303
|
step: 1,
|
|
252
304
|
onChange: this.onAlphaSliderChange,
|
|
253
305
|
on: this.v3 ? undefined : {
|
|
254
|
-
"change": this.onAlphaSliderChange
|
|
255
|
-
"focus": this.onFocus,
|
|
256
|
-
"blur": this.onBlur
|
|
306
|
+
"change": this.onAlphaSliderChange
|
|
257
307
|
},
|
|
258
|
-
onFocus: this.onFocus,
|
|
259
|
-
onBlur: this.onBlur,
|
|
260
308
|
"class": "k-alpha-slider k-colorgradient-slider",
|
|
261
309
|
disabled: this.$props.disabled,
|
|
262
310
|
ref: this.v3 ? function (el) {
|
|
263
311
|
_this.alphaSliderRef = el;
|
|
264
312
|
} : 'alphaSlider'
|
|
265
313
|
})])]), h(ColorInput, {
|
|
266
|
-
|
|
314
|
+
tabIndex: this.computedTabIndex,
|
|
267
315
|
attrs: this.v3 ? undefined : {
|
|
316
|
+
tabIndex: this.computedTabIndex,
|
|
268
317
|
rgba: this.rgba,
|
|
269
318
|
hex: this.hex,
|
|
270
319
|
opacity: this.$props.opacity,
|
|
271
320
|
disabled: this.$props.disabled
|
|
272
321
|
},
|
|
322
|
+
rgba: this.rgba,
|
|
273
323
|
onRgbachange: this.onRgbaChange,
|
|
274
324
|
on: this.v3 ? undefined : {
|
|
275
325
|
"rgbachange": this.onRgbaChange,
|
|
276
|
-
"blur": this.onBlur,
|
|
277
326
|
"hexchange": this.onHexChange
|
|
278
327
|
},
|
|
279
328
|
hex: this.hex,
|
|
280
|
-
onBlur: this.onBlur,
|
|
281
329
|
onHexchange: this.onHexChange,
|
|
282
330
|
opacity: this.$props.opacity,
|
|
283
|
-
disabled: this.$props.disabled
|
|
331
|
+
disabled: this.$props.disabled,
|
|
332
|
+
ref: 'colorInput'
|
|
284
333
|
}), this.backgroundColor && h(ColorContrastLabels, {
|
|
285
334
|
bgColor: getRGBA(this.backgroundColor),
|
|
286
335
|
attrs: this.v3 ? undefined : {
|
|
@@ -291,35 +340,36 @@ var ColorGradientVue2 = {
|
|
|
291
340
|
})]);
|
|
292
341
|
},
|
|
293
342
|
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
343
|
onKeyDownHandler: function onKeyDownHandler(e) {
|
|
344
|
+
var element = this.$el;
|
|
345
|
+
|
|
346
|
+
if (this.innerTabIndex === undefined) {
|
|
347
|
+
this.focused = focusContainer(e, element);
|
|
348
|
+
}
|
|
349
|
+
|
|
302
350
|
this.$emit('keydown', e);
|
|
303
351
|
},
|
|
304
352
|
onHexChange: function onHexChange(hex, value, event) {
|
|
353
|
+
var rgba = getRGBA(value);
|
|
354
|
+
|
|
305
355
|
if (this.isUncontrolled) {
|
|
306
356
|
var hsva = getHSV(value);
|
|
307
357
|
this.currentHsva = hsva;
|
|
308
358
|
this.currentBgColor = getColorFromHue(hsva.h);
|
|
309
|
-
this.currentRgba =
|
|
359
|
+
this.currentRgba = rgba;
|
|
310
360
|
this.currentHex = hex;
|
|
311
361
|
} else {
|
|
312
362
|
cacheHex(this.guid, value, hex);
|
|
313
363
|
}
|
|
314
364
|
|
|
315
|
-
this.dispatchChangeEvent(value, event,
|
|
365
|
+
this.dispatchChangeEvent(value, event.event, hex, value);
|
|
316
366
|
},
|
|
317
367
|
onRgbaChange: function onRgbaChange(rgba, event) {
|
|
318
368
|
var value = getColorFromRGBA(rgba);
|
|
369
|
+
var hex = parseColor(value, 'hex', this.opacity);
|
|
319
370
|
|
|
320
371
|
if (this.isUncontrolled) {
|
|
321
372
|
var hsva = getHSV(value);
|
|
322
|
-
var hex = parseColor(value, 'hex');
|
|
323
373
|
this.currentHsva = hsva;
|
|
324
374
|
this.currentBgColor = getColorFromHue(hsva.h);
|
|
325
375
|
this.currentRgba = rgba;
|
|
@@ -328,7 +378,7 @@ var ColorGradientVue2 = {
|
|
|
328
378
|
cacheRgba(this.guid, value, rgba);
|
|
329
379
|
}
|
|
330
380
|
|
|
331
|
-
this.dispatchChangeEvent(value, event.event);
|
|
381
|
+
this.dispatchChangeEvent(value, event.event, hex, value);
|
|
332
382
|
},
|
|
333
383
|
onAlphaSliderChange: function onAlphaSliderChange(event) {
|
|
334
384
|
this.handleHsvaChange(Object.assign({}, this.hsva, {
|
|
@@ -348,8 +398,53 @@ var ColorGradientVue2 = {
|
|
|
348
398
|
this.gradientWrapper.classList.remove('k-dragging');
|
|
349
399
|
},
|
|
350
400
|
onGradientWrapperClick: function onGradientWrapperClick(event) {
|
|
401
|
+
this.firstFocusable = getRef(this, 'draghandle');
|
|
402
|
+
this.firstFocusable.focus();
|
|
351
403
|
this.changePosition(event);
|
|
352
404
|
},
|
|
405
|
+
move: function move(e, prop, d) {
|
|
406
|
+
var c = this.hsva;
|
|
407
|
+
c[prop] += d * (e.shiftKey ? 0.01 : 0.05);
|
|
408
|
+
|
|
409
|
+
if (c[prop] < 0) {
|
|
410
|
+
c[prop] = 0;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if (c[prop] > 1) {
|
|
414
|
+
c[prop] = 1;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
e.preventDefault();
|
|
418
|
+
this.handleHsvaChange(c, e);
|
|
419
|
+
},
|
|
420
|
+
dragKeyDown: function dragKeyDown(e) {
|
|
421
|
+
switch (e.keyCode) {
|
|
422
|
+
case Keys.left:
|
|
423
|
+
this.move(e, 's', -1);
|
|
424
|
+
break;
|
|
425
|
+
|
|
426
|
+
case Keys.right:
|
|
427
|
+
this.move(e, 's', 1);
|
|
428
|
+
break;
|
|
429
|
+
|
|
430
|
+
case Keys.up:
|
|
431
|
+
this.move(e, 'v', 1);
|
|
432
|
+
break;
|
|
433
|
+
|
|
434
|
+
case Keys.down:
|
|
435
|
+
this.move(e, 'v', -1);
|
|
436
|
+
break;
|
|
437
|
+
|
|
438
|
+
case Keys.enter:
|
|
439
|
+
break;
|
|
440
|
+
|
|
441
|
+
case Keys.esc:
|
|
442
|
+
break;
|
|
443
|
+
|
|
444
|
+
default:
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
},
|
|
353
448
|
changePosition: function changePosition(event) {
|
|
354
449
|
var gradientRectMetrics = this.getGradientRectMetrics();
|
|
355
450
|
var deltaX = event.clientX - gradientRectMetrics.left;
|
|
@@ -364,9 +459,10 @@ var ColorGradientVue2 = {
|
|
|
364
459
|
},
|
|
365
460
|
handleHsvaChange: function handleHsvaChange(hsva, event) {
|
|
366
461
|
var value = getColorFromHSV(hsva);
|
|
462
|
+
var hex = parseColor(value, 'hex', this.opacity);
|
|
463
|
+
var rgba = parseColor(value, 'rgba');
|
|
367
464
|
|
|
368
465
|
if (this.isUncontrolled) {
|
|
369
|
-
var hex = parseColor(value, 'hex');
|
|
370
466
|
this.currentHsva = hsva;
|
|
371
467
|
this.currentBgColor = getColorFromHue(hsva.h);
|
|
372
468
|
this.currentRgba = getRGBA(value);
|
|
@@ -375,14 +471,18 @@ var ColorGradientVue2 = {
|
|
|
375
471
|
cacheHsva(this.guid, value, hsva);
|
|
376
472
|
}
|
|
377
473
|
|
|
378
|
-
this.dispatchChangeEvent(value, event);
|
|
474
|
+
this.dispatchChangeEvent(value, event, hex, rgba);
|
|
379
475
|
},
|
|
380
|
-
dispatchChangeEvent: function dispatchChangeEvent(value, event) {
|
|
476
|
+
dispatchChangeEvent: function dispatchChangeEvent(value, event, hex, rgbaValue) {
|
|
381
477
|
this.currentValue = value;
|
|
478
|
+
this.$emit('changemodel', hex);
|
|
479
|
+
this.$emit('update:modelRgbaValue', rgbaValue);
|
|
480
|
+
this.$emit('update:modelValue', hex);
|
|
382
481
|
this.$emit('change', {
|
|
383
482
|
event: event,
|
|
384
483
|
target: this,
|
|
385
|
-
value:
|
|
484
|
+
value: hex,
|
|
485
|
+
rgbaValue: rgbaValue
|
|
386
486
|
});
|
|
387
487
|
},
|
|
388
488
|
onFocus: function onFocus(event) {
|
|
@@ -416,7 +516,12 @@ var ColorGradientVue2 = {
|
|
|
416
516
|
};
|
|
417
517
|
},
|
|
418
518
|
focus: function focus() {
|
|
419
|
-
|
|
519
|
+
var _this = this;
|
|
520
|
+
|
|
521
|
+
this.focused = true;
|
|
522
|
+
setTimeout(function () {
|
|
523
|
+
focusFirstFocusableChild(_this.$el);
|
|
524
|
+
}, 1);
|
|
420
525
|
}
|
|
421
526
|
}
|
|
422
527
|
};
|
|
@@ -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
|