@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,8 +2,9 @@
|
|
|
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 { ColorPaletteService } from './utils/color-palette.service';
|
|
6
|
-
import { classNames, Keys, guid, getTabIndex, validatePackage } from '@progress/kendo-vue-common';
|
|
7
|
+
import { classNames, Keys, guid, getTabIndex, validatePackage, setRef, getRef } from '@progress/kendo-vue-common';
|
|
7
8
|
import { packageMetadata } from '../package-metadata';
|
|
8
9
|
import { PALETTEPRESETS } from './models/palette-presets';
|
|
9
10
|
import { isPresent } from './utils/misc';
|
|
@@ -59,10 +60,10 @@ var ColorPaletteVue2 = {
|
|
|
59
60
|
this.guid = guid();
|
|
60
61
|
},
|
|
61
62
|
mounted: function mounted() {
|
|
62
|
-
this.wrapper = this
|
|
63
|
+
this.wrapper = getRef(this, 'wrapper');
|
|
63
64
|
},
|
|
64
65
|
updated: function updated() {
|
|
65
|
-
this.wrapper = this
|
|
66
|
+
this.wrapper = getRef(this, 'wrapper');
|
|
66
67
|
},
|
|
67
68
|
computed: {
|
|
68
69
|
focusedColorCooridanates: function focusedColorCooridanates() {
|
|
@@ -77,22 +78,19 @@ var ColorPaletteVue2 = {
|
|
|
77
78
|
},
|
|
78
79
|
data: function data() {
|
|
79
80
|
return {
|
|
80
|
-
focusedColor:
|
|
81
|
-
currentValue: undefined
|
|
82
|
-
isFirstRender: true
|
|
81
|
+
focusedColor: this.$props.value,
|
|
82
|
+
currentValue: undefined
|
|
83
83
|
};
|
|
84
84
|
},
|
|
85
85
|
// @ts-ignore
|
|
86
|
-
setup: !
|
|
87
|
-
var v3 = !!
|
|
86
|
+
setup: !isV3 ? undefined : function () {
|
|
87
|
+
var v3 = !!isV3;
|
|
88
88
|
return {
|
|
89
89
|
v3: v3
|
|
90
90
|
};
|
|
91
91
|
},
|
|
92
92
|
// @ts-ignore
|
|
93
93
|
render: function render(createElement) {
|
|
94
|
-
var _this = this;
|
|
95
|
-
|
|
96
94
|
var h = gh || createElement;
|
|
97
95
|
var paletteInfo = this.getPaletteInfo();
|
|
98
96
|
var svc = this.paletteService = new ColorPaletteService();
|
|
@@ -100,7 +98,7 @@ var ColorPaletteVue2 = {
|
|
|
100
98
|
var selectedCellCoords = svc.getCellCoordsFor(this.selectedColor);
|
|
101
99
|
var focusedCellCoords = svc.getCellCoordsFor(this.focusedColor);
|
|
102
100
|
var className = classNames('k-colorpalette', {
|
|
103
|
-
'k-
|
|
101
|
+
'k-disabled': this.$props.disabled
|
|
104
102
|
});
|
|
105
103
|
|
|
106
104
|
var renderColumns = function renderColumns(columns, rowIndex, cSelectedCellCoords, cFocusedCellCoords) {
|
|
@@ -119,8 +117,8 @@ var ColorPaletteVue2 = {
|
|
|
119
117
|
|
|
120
118
|
var isSelected = rowIsSelected && selectedColumn === i;
|
|
121
119
|
var tdClassName = classNames('k-colorpalette-tile', {
|
|
122
|
-
'k-
|
|
123
|
-
'k-
|
|
120
|
+
'k-selected': isSelected,
|
|
121
|
+
'k-focus': rowIsFocused && focusedColumn === i
|
|
124
122
|
});
|
|
125
123
|
return h("td", {
|
|
126
124
|
"class": tdClassName,
|
|
@@ -178,7 +176,7 @@ var ColorPaletteVue2 = {
|
|
|
178
176
|
"aria-activedescendant": selectedCellCoords && this.createCellId(selectedCellCoords),
|
|
179
177
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
180
178
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
181
|
-
|
|
179
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled)
|
|
182
180
|
},
|
|
183
181
|
"class": className,
|
|
184
182
|
onFocusin: this.onFocus,
|
|
@@ -193,10 +191,8 @@ var ColorPaletteVue2 = {
|
|
|
193
191
|
"aria-activedescendant": selectedCellCoords && this.createCellId(selectedCellCoords),
|
|
194
192
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
195
193
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
196
|
-
|
|
197
|
-
ref: this
|
|
198
|
-
_this.wrapperRef = el;
|
|
199
|
-
} : 'wrapper'
|
|
194
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
195
|
+
ref: setRef(this, 'wrapper')
|
|
200
196
|
}, [h("div", {
|
|
201
197
|
"class": "k-colorpalette-table-wrap",
|
|
202
198
|
role: "grid",
|
|
@@ -222,27 +218,6 @@ var ColorPaletteVue2 = {
|
|
|
222
218
|
this.wrapper.focus();
|
|
223
219
|
}
|
|
224
220
|
},
|
|
225
|
-
getDerivedStateFromProps: function getDerivedStateFromProps(props, state) {
|
|
226
|
-
if (!state.isFirstRender && props.value !== undefined) {
|
|
227
|
-
// The component is in controlled mode.
|
|
228
|
-
if (props.value === '' && state.selectedColor !== undefined) {
|
|
229
|
-
// The selection has to be removed.
|
|
230
|
-
return {
|
|
231
|
-
selectedColor: undefined
|
|
232
|
-
};
|
|
233
|
-
} else if (props.value !== '' && props.value !== state.selectedColor) {
|
|
234
|
-
return {
|
|
235
|
-
selectedColor: props.value
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
} else if (state.isFirstRender) {
|
|
239
|
-
return {
|
|
240
|
-
isFirstRender: false
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
return null;
|
|
245
|
-
},
|
|
246
221
|
onKeyDown: function onKeyDown(event) {
|
|
247
222
|
switch (event.keyCode) {
|
|
248
223
|
case Keys.down:
|
|
@@ -270,7 +245,6 @@ var ColorPaletteVue2 = {
|
|
|
270
245
|
return;
|
|
271
246
|
}
|
|
272
247
|
|
|
273
|
-
event.preventDefault();
|
|
274
248
|
this.$emit('keydown', event);
|
|
275
249
|
},
|
|
276
250
|
onColorClick: function onColorClick(color, event) {
|
|
@@ -1,13 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
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
|
+
|
|
2
18
|
import * as Vue from 'vue';
|
|
3
19
|
var allVue = Vue;
|
|
4
20
|
var gh = allVue.h;
|
|
21
|
+
var isV3 = allVue.version[0] === '3';
|
|
5
22
|
import { Button } from '@progress/kendo-vue-buttons';
|
|
6
23
|
import { classNames, Keys, // useDir,
|
|
7
|
-
getTabIndex, guid, kendoThemeMaps, validatePackage } from '@progress/kendo-vue-common';
|
|
24
|
+
getTabIndex, guid, kendoThemeMaps, validatePackage, setRef, getRef } from '@progress/kendo-vue-common';
|
|
8
25
|
import { packageMetadata } from '../package-metadata';
|
|
9
26
|
import { Picker } from './Picker';
|
|
10
27
|
import { ColorPalette, DEFAULT_PRESET, DEFAULT_TILE_SIZE } from './ColorPalette';
|
|
28
|
+
import { ColorGradient } from './ColorGradient';
|
|
11
29
|
/**
|
|
12
30
|
* @hidden
|
|
13
31
|
*/
|
|
@@ -37,6 +55,15 @@ var isControlled = function isControlled(prop) {
|
|
|
37
55
|
|
|
38
56
|
var ColorPickerVue2 = {
|
|
39
57
|
name: 'KendoColorPicker',
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
emits: {
|
|
60
|
+
'open': null,
|
|
61
|
+
'close': null,
|
|
62
|
+
'activecolorclick': null,
|
|
63
|
+
'focus': null,
|
|
64
|
+
'blur': null,
|
|
65
|
+
'change': null
|
|
66
|
+
},
|
|
40
67
|
props: {
|
|
41
68
|
value: {
|
|
42
69
|
type: String,
|
|
@@ -65,7 +92,18 @@ var ColorPickerVue2 = {
|
|
|
65
92
|
title: String,
|
|
66
93
|
icon: String,
|
|
67
94
|
iconClassName: String,
|
|
68
|
-
popupSettings:
|
|
95
|
+
popupSettings: {
|
|
96
|
+
type: Object,
|
|
97
|
+
default: function _default() {
|
|
98
|
+
return {};
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
gradientSettings: {
|
|
102
|
+
type: Object,
|
|
103
|
+
default: function _default() {
|
|
104
|
+
return {};
|
|
105
|
+
}
|
|
106
|
+
},
|
|
69
107
|
open: {
|
|
70
108
|
type: Boolean,
|
|
71
109
|
default: undefined
|
|
@@ -90,27 +128,34 @@ var ColorPickerVue2 = {
|
|
|
90
128
|
validator: function validator(value) {
|
|
91
129
|
return [null, 'solid', 'flat', 'outline'].includes(value);
|
|
92
130
|
}
|
|
131
|
+
},
|
|
132
|
+
view: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: 'palette',
|
|
135
|
+
validator: function validator(value) {
|
|
136
|
+
return ['gradient', 'palette', 'combo'].includes(value);
|
|
137
|
+
}
|
|
93
138
|
}
|
|
94
139
|
},
|
|
95
140
|
data: function data() {
|
|
96
141
|
return {
|
|
97
142
|
focused: false,
|
|
98
|
-
|
|
99
|
-
|
|
143
|
+
currentValue: this.$props.defaultValue,
|
|
144
|
+
currentOpen: false
|
|
100
145
|
};
|
|
101
146
|
},
|
|
102
147
|
computed: {
|
|
103
148
|
isValueControlled: function isValueControlled() {
|
|
104
|
-
return
|
|
149
|
+
return this.$props.value !== undefined;
|
|
105
150
|
},
|
|
106
151
|
isOpenControlled: function isOpenControlled() {
|
|
107
|
-
return
|
|
152
|
+
return this.$props.open !== undefined;
|
|
108
153
|
},
|
|
109
154
|
computedValue: function computedValue() {
|
|
110
|
-
return this.isValueControlled ? this.$props.value : this.
|
|
155
|
+
return this.isValueControlled ? this.$props.value : this.currentValue;
|
|
111
156
|
},
|
|
112
157
|
computedOpen: function computedOpen() {
|
|
113
|
-
return this.isOpenControlled ? this.$props.open : this.
|
|
158
|
+
return this.isOpenControlled ? this.$props.open : this.currentOpen;
|
|
114
159
|
},
|
|
115
160
|
computedIconClassName: function computedIconClassName() {
|
|
116
161
|
var icon = this.$props.icon;
|
|
@@ -125,7 +170,8 @@ var ColorPickerVue2 = {
|
|
|
125
170
|
rounded = _b.rounded;
|
|
126
171
|
return _a = {
|
|
127
172
|
'k-picker': true,
|
|
128
|
-
'k-colorpicker': true
|
|
173
|
+
'k-colorpicker': true,
|
|
174
|
+
'k-icon-picker': true
|
|
129
175
|
}, _a["k-picker-" + (kendoThemeMaps.sizeMap[size] || size)] = size, _a["k-picker-" + fillMode] = fillMode, _a["k-rounded-" + (kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded, _a['k-invalid'] = !this.valid, _a['k-disabled'] = this.disabled, _a['k-focus'] = this.focused, _a;
|
|
130
176
|
}
|
|
131
177
|
},
|
|
@@ -134,17 +180,13 @@ var ColorPickerVue2 = {
|
|
|
134
180
|
this.focusableElementGuid = guid();
|
|
135
181
|
},
|
|
136
182
|
mounted: function mounted() {
|
|
137
|
-
this.
|
|
138
|
-
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
139
|
-
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
183
|
+
this.button = getRef(this, 'button');
|
|
140
184
|
},
|
|
141
|
-
updated: function updated() {
|
|
142
|
-
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
143
|
-
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
185
|
+
updated: function updated() {// this.button = getRef(this, 'button');
|
|
144
186
|
},
|
|
145
187
|
// @ts-ignore
|
|
146
|
-
setup: !
|
|
147
|
-
var v3 = !!
|
|
188
|
+
setup: !isV3 ? undefined : function () {
|
|
189
|
+
var v3 = !!isV3;
|
|
148
190
|
return {
|
|
149
191
|
v3: v3
|
|
150
192
|
};
|
|
@@ -161,7 +203,49 @@ var ColorPickerVue2 = {
|
|
|
161
203
|
var _b = this.$props,
|
|
162
204
|
disabled = _b.disabled,
|
|
163
205
|
tabIndex = _b.tabIndex,
|
|
164
|
-
dir = _b.dir
|
|
206
|
+
dir = _b.dir,
|
|
207
|
+
view = _b.view;
|
|
208
|
+
|
|
209
|
+
var renderGradiente = function renderGradiente() {
|
|
210
|
+
return h(ColorGradient, __assign({
|
|
211
|
+
tabIndex: 0,
|
|
212
|
+
attrs: this.v3 ? undefined : __assign({
|
|
213
|
+
tabIndex: 0,
|
|
214
|
+
value: this.computedValue || undefined
|
|
215
|
+
}, this.gradientSettings),
|
|
216
|
+
ref: setRef(this, 'gradient'),
|
|
217
|
+
value: this.computedValue || undefined,
|
|
218
|
+
onChange: this.onGradientChangeHandler,
|
|
219
|
+
on: this.v3 ? undefined : {
|
|
220
|
+
'change': this.onGradientChangeHandler,
|
|
221
|
+
'focus': this.onFocusHandler,
|
|
222
|
+
'blur': this.onBlurHandler,
|
|
223
|
+
'keydown': this.onKeyDownHandler
|
|
224
|
+
},
|
|
225
|
+
onFocus: this.onFocusHandler,
|
|
226
|
+
onBlur: this.onBlurHandler,
|
|
227
|
+
onKeydown: this.onKeyDownHandler
|
|
228
|
+
}, this.gradientSettings));
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
var renderPalette = function renderPalette() {
|
|
232
|
+
return h(ColorPalette, __assign({
|
|
233
|
+
onKeydown: this.onKeyDownHandler,
|
|
234
|
+
on: this.v3 ? undefined : {
|
|
235
|
+
'keydown': this.onKeyDownHandler,
|
|
236
|
+
'change': this.onPaletteChangeHandler,
|
|
237
|
+
'blur': this.onBlurHandler
|
|
238
|
+
},
|
|
239
|
+
ref: setRef(this, 'palette'),
|
|
240
|
+
value: this.computedValue || undefined,
|
|
241
|
+
attrs: this.v3 ? undefined : __assign({
|
|
242
|
+
value: this.computedValue || undefined
|
|
243
|
+
}, this.paletteSettings),
|
|
244
|
+
onChange: this.onPaletteChangeHandler,
|
|
245
|
+
onBlur: this.onBlurHandler
|
|
246
|
+
}, this.paletteSettings));
|
|
247
|
+
}; // const dir = useDir(focusableElementGuid, props.dir);
|
|
248
|
+
|
|
165
249
|
|
|
166
250
|
return h("span", {
|
|
167
251
|
"class": this.wrapperClassName,
|
|
@@ -171,23 +255,21 @@ var ColorPickerVue2 = {
|
|
|
171
255
|
id: this.$props.id,
|
|
172
256
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
173
257
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
174
|
-
|
|
258
|
+
tabindex: getTabIndex(tabIndex, disabled),
|
|
175
259
|
title: this.$props.title
|
|
176
260
|
},
|
|
177
261
|
id: this.$props.id,
|
|
178
262
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
179
263
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
180
264
|
ref: this.focusableElementGuid,
|
|
181
|
-
|
|
265
|
+
tabindex: getTabIndex(tabIndex, disabled),
|
|
182
266
|
title: this.$props.title,
|
|
183
|
-
onKeydown: this.
|
|
267
|
+
onKeydown: this.onButtonKeyDown,
|
|
184
268
|
on: this.v3 ? undefined : {
|
|
185
|
-
"keydown": this.
|
|
186
|
-
"focusin": this.onFocusHandler
|
|
187
|
-
"focusout": this.onBlurHandler
|
|
269
|
+
"keydown": this.onButtonKeyDown,
|
|
270
|
+
"focusin": this.onFocusHandler
|
|
188
271
|
},
|
|
189
|
-
onFocusin: this.onFocusHandler
|
|
190
|
-
onFocusout: this.onBlurHandler
|
|
272
|
+
onFocusin: this.onFocusHandler
|
|
191
273
|
}, [h("span", {
|
|
192
274
|
onClick: this.onActiveColorClickHandler,
|
|
193
275
|
on: this.v3 ? undefined : {
|
|
@@ -211,9 +293,11 @@ var ColorPickerVue2 = {
|
|
|
211
293
|
type: "button",
|
|
212
294
|
attrs: this.v3 ? undefined : {
|
|
213
295
|
type: "button",
|
|
296
|
+
tabindex: -1,
|
|
214
297
|
rounded: null,
|
|
215
298
|
icon: 'arrow-s'
|
|
216
299
|
},
|
|
300
|
+
tabindex: -1,
|
|
217
301
|
ref: this.v3 ? function (el) {
|
|
218
302
|
_this.buttonRef = el;
|
|
219
303
|
} : 'button',
|
|
@@ -239,94 +323,78 @@ var ColorPickerVue2 = {
|
|
|
239
323
|
},
|
|
240
324
|
popupAnchor: this.focusableElementGuid
|
|
241
325
|
}, this.v3 ? function () {
|
|
242
|
-
return [
|
|
243
|
-
|
|
244
|
-
onKeydown: _this2.onKeyDownHandler // {...paletteSettings}
|
|
245
|
-
,
|
|
246
|
-
on: _this2.v3 ? undefined : {
|
|
247
|
-
"keydown": _this2.onKeyDownHandler,
|
|
248
|
-
"change": _this2.onPaletteChangeHandler,
|
|
249
|
-
"blur": _this2.onBlurHandler
|
|
250
|
-
},
|
|
251
|
-
ref: _this2.v3 ? function (el) {
|
|
252
|
-
_this.paletteRef = el;
|
|
253
|
-
} : 'palette',
|
|
254
|
-
value: _this2.computedValue || undefined,
|
|
255
|
-
attrs: _this2.v3 ? undefined : {
|
|
256
|
-
value: _this2.computedValue || undefined
|
|
257
|
-
},
|
|
258
|
-
onChange: _this2.onPaletteChangeHandler,
|
|
259
|
-
onBlur: _this2.onBlurHandler
|
|
260
|
-
})];
|
|
261
|
-
} : [h(ColorPalette, {
|
|
262
|
-
onKeydown: _this2.onKeyDownHandler,
|
|
263
|
-
on: _this2.v3 ? undefined : {
|
|
264
|
-
"keydown": _this2.onKeyDownHandler,
|
|
265
|
-
"change": _this2.onPaletteChangeHandler,
|
|
266
|
-
"blur": _this2.onBlurHandler
|
|
267
|
-
},
|
|
268
|
-
ref: _this2.v3 ? function (el) {
|
|
269
|
-
_this.paletteRef = el;
|
|
270
|
-
} : 'palette',
|
|
271
|
-
value: _this2.computedValue || undefined,
|
|
272
|
-
attrs: _this2.v3 ? undefined : {
|
|
273
|
-
value: _this2.computedValue || undefined
|
|
274
|
-
},
|
|
275
|
-
onChange: _this2.onPaletteChangeHandler,
|
|
276
|
-
onBlur: _this2.onBlurHandler
|
|
277
|
-
})])]);
|
|
326
|
+
return [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)];
|
|
327
|
+
} : [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)])]);
|
|
278
328
|
},
|
|
279
329
|
methods: {
|
|
280
330
|
focusElement: function focusElement() {
|
|
281
|
-
if (this
|
|
282
|
-
this.
|
|
331
|
+
if (this.$el) {
|
|
332
|
+
this.$el.focus();
|
|
283
333
|
}
|
|
284
334
|
},
|
|
285
335
|
setOpen: function setOpen(nextOpen, isBlur) {
|
|
286
|
-
if (!this
|
|
287
|
-
|
|
288
|
-
this.focusableElement.focus();
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
this.stateOpen = nextOpen;
|
|
336
|
+
if (!nextOpen && !isBlur && this.$el) {
|
|
337
|
+
this.$el.focus();
|
|
292
338
|
}
|
|
339
|
+
|
|
340
|
+
this.currentOpen = nextOpen;
|
|
341
|
+
this.$emit(nextOpen ? 'open' : 'close');
|
|
293
342
|
},
|
|
294
|
-
|
|
343
|
+
onButtonKeyDown: function onButtonKeyDown(event) {
|
|
295
344
|
var altKey = event.altKey,
|
|
296
345
|
keyCode = event.keyCode;
|
|
297
346
|
|
|
298
347
|
if (keyCode === Keys.esc) {
|
|
348
|
+
event.preventDefault();
|
|
349
|
+
event.stopPropagation();
|
|
299
350
|
this.setOpen(false);
|
|
300
351
|
return;
|
|
301
352
|
}
|
|
302
353
|
|
|
303
|
-
if (keyCode === Keys.enter
|
|
354
|
+
if (keyCode === Keys.enter) {
|
|
304
355
|
event.preventDefault();
|
|
305
356
|
event.stopPropagation();
|
|
306
357
|
this.setOpen(!this.computedOpen);
|
|
307
358
|
return;
|
|
308
359
|
}
|
|
309
360
|
|
|
310
|
-
if (altKey &&
|
|
361
|
+
if (altKey && keyCode === Keys.down) {
|
|
311
362
|
event.preventDefault();
|
|
312
363
|
event.stopPropagation();
|
|
364
|
+
this.setOpen(true);
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
onKeyDownHandler: function onKeyDownHandler(event) {
|
|
368
|
+
var altKey = event.altKey,
|
|
369
|
+
keyCode = event.keyCode;
|
|
313
370
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
371
|
+
if (keyCode === Keys.esc) {
|
|
372
|
+
event.preventDefault();
|
|
373
|
+
event.stopPropagation();
|
|
374
|
+
this.setOpen(false);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
318
377
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
378
|
+
if (keyCode === Keys.enter) {
|
|
379
|
+
event.preventDefault();
|
|
380
|
+
event.stopPropagation();
|
|
381
|
+
this.focusElement();
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (altKey && keyCode === Keys.up) {
|
|
386
|
+
event.preventDefault();
|
|
387
|
+
event.stopPropagation();
|
|
388
|
+
this.setOpen(false);
|
|
389
|
+
this.focusElement();
|
|
322
390
|
}
|
|
323
391
|
},
|
|
324
392
|
onOpenHandler: function onOpenHandler() {
|
|
325
393
|
// Skip content autofocus when in controlled mode
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
394
|
+
var palette = getRef(this, 'palette');
|
|
395
|
+
|
|
396
|
+
if (palette) {
|
|
397
|
+
palette.focus();
|
|
330
398
|
}
|
|
331
399
|
},
|
|
332
400
|
onClickHandler: function onClickHandler() {
|
|
@@ -342,9 +410,10 @@ var ColorPickerVue2 = {
|
|
|
342
410
|
if (this.blurTimeoutRef) {
|
|
343
411
|
clearTimeout(this.blurTimeoutRef);
|
|
344
412
|
this.blurTimeoutRef = undefined; // case where moving back to input from popup
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
413
|
+
|
|
414
|
+
if (event.target === this.$el) {
|
|
415
|
+
this.setOpen(false); // in this case we should focus input on keydown
|
|
416
|
+
}
|
|
348
417
|
} else {
|
|
349
418
|
this.focused = true;
|
|
350
419
|
}
|
|
@@ -354,18 +423,22 @@ var ColorPickerVue2 = {
|
|
|
354
423
|
});
|
|
355
424
|
},
|
|
356
425
|
onBlurTimeout: function onBlurTimeout() {
|
|
357
|
-
var
|
|
426
|
+
var _a, _b;
|
|
358
427
|
|
|
359
|
-
|
|
428
|
+
var viewIsFocused = !!((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('.k-palette')) || !!((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.closest('.k-colorgradient'));
|
|
429
|
+
|
|
430
|
+
if (!viewIsFocused) {
|
|
360
431
|
this.setOpen(false, true);
|
|
361
432
|
}
|
|
362
433
|
|
|
363
|
-
this.focused =
|
|
434
|
+
this.focused = viewIsFocused;
|
|
364
435
|
this.blurTimeoutRef = undefined;
|
|
365
436
|
},
|
|
366
437
|
onBlurHandler: function onBlurHandler(event) {
|
|
367
438
|
clearTimeout(this.blurTimeoutRef);
|
|
368
|
-
this.
|
|
439
|
+
this.palette = getRef(this, 'palette');
|
|
440
|
+
this.gradient = getRef(this, 'gradient');
|
|
441
|
+
this.blurTimeoutRef = setTimeout(this.onBlurTimeout, 200);
|
|
369
442
|
this.$emit('blur', {
|
|
370
443
|
event: event
|
|
371
444
|
});
|
|
@@ -374,7 +447,7 @@ var ColorPickerVue2 = {
|
|
|
374
447
|
var currentValue = isPalette ? event.rgbaValue : event.value;
|
|
375
448
|
|
|
376
449
|
if (!this.isValueControlled) {
|
|
377
|
-
this.
|
|
450
|
+
this.currentValue = currentValue;
|
|
378
451
|
}
|
|
379
452
|
|
|
380
453
|
if (isPalette) {
|
|
@@ -386,6 +459,9 @@ var ColorPickerVue2 = {
|
|
|
386
459
|
event: event
|
|
387
460
|
});
|
|
388
461
|
},
|
|
462
|
+
onGradientChangeHandler: function onGradientChangeHandler(event) {
|
|
463
|
+
this.onChangeHandler(event, false);
|
|
464
|
+
},
|
|
389
465
|
onPaletteChangeHandler: function onPaletteChangeHandler(event) {
|
|
390
466
|
this.onChangeHandler(event, true);
|
|
391
467
|
}
|