@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,5 +1,21 @@
|
|
|
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
|
+
|
|
3
19
|
Object.defineProperty(exports, "__esModule", {
|
|
4
20
|
value: true
|
|
5
21
|
});
|
|
@@ -9,6 +25,7 @@ var Vue = require("vue");
|
|
|
9
25
|
|
|
10
26
|
var allVue = Vue;
|
|
11
27
|
var gh = allVue.h;
|
|
28
|
+
var isV3 = allVue.version[0] === '3';
|
|
12
29
|
|
|
13
30
|
var kendo_vue_buttons_1 = require("@progress/kendo-vue-buttons");
|
|
14
31
|
|
|
@@ -19,6 +36,8 @@ var package_metadata_1 = require("../package-metadata");
|
|
|
19
36
|
var Picker_1 = require("./Picker");
|
|
20
37
|
|
|
21
38
|
var ColorPalette_1 = require("./ColorPalette");
|
|
39
|
+
|
|
40
|
+
var ColorGradient_1 = require("./ColorGradient");
|
|
22
41
|
/**
|
|
23
42
|
* @hidden
|
|
24
43
|
*/
|
|
@@ -49,6 +68,15 @@ var isControlled = function isControlled(prop) {
|
|
|
49
68
|
|
|
50
69
|
var ColorPickerVue2 = {
|
|
51
70
|
name: 'KendoColorPicker',
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
emits: {
|
|
73
|
+
'open': null,
|
|
74
|
+
'close': null,
|
|
75
|
+
'activecolorclick': null,
|
|
76
|
+
'focus': null,
|
|
77
|
+
'blur': null,
|
|
78
|
+
'change': null
|
|
79
|
+
},
|
|
52
80
|
props: {
|
|
53
81
|
value: {
|
|
54
82
|
type: String,
|
|
@@ -77,7 +105,18 @@ var ColorPickerVue2 = {
|
|
|
77
105
|
title: String,
|
|
78
106
|
icon: String,
|
|
79
107
|
iconClassName: String,
|
|
80
|
-
popupSettings:
|
|
108
|
+
popupSettings: {
|
|
109
|
+
type: Object,
|
|
110
|
+
default: function _default() {
|
|
111
|
+
return {};
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
gradientSettings: {
|
|
115
|
+
type: Object,
|
|
116
|
+
default: function _default() {
|
|
117
|
+
return {};
|
|
118
|
+
}
|
|
119
|
+
},
|
|
81
120
|
open: {
|
|
82
121
|
type: Boolean,
|
|
83
122
|
default: undefined
|
|
@@ -102,27 +141,34 @@ var ColorPickerVue2 = {
|
|
|
102
141
|
validator: function validator(value) {
|
|
103
142
|
return [null, 'solid', 'flat', 'outline'].includes(value);
|
|
104
143
|
}
|
|
144
|
+
},
|
|
145
|
+
view: {
|
|
146
|
+
type: String,
|
|
147
|
+
default: 'palette',
|
|
148
|
+
validator: function validator(value) {
|
|
149
|
+
return ['gradient', 'palette', 'combo'].includes(value);
|
|
150
|
+
}
|
|
105
151
|
}
|
|
106
152
|
},
|
|
107
153
|
data: function data() {
|
|
108
154
|
return {
|
|
109
155
|
focused: false,
|
|
110
|
-
|
|
111
|
-
|
|
156
|
+
currentValue: this.$props.defaultValue,
|
|
157
|
+
currentOpen: false
|
|
112
158
|
};
|
|
113
159
|
},
|
|
114
160
|
computed: {
|
|
115
161
|
isValueControlled: function isValueControlled() {
|
|
116
|
-
return
|
|
162
|
+
return this.$props.value !== undefined;
|
|
117
163
|
},
|
|
118
164
|
isOpenControlled: function isOpenControlled() {
|
|
119
|
-
return
|
|
165
|
+
return this.$props.open !== undefined;
|
|
120
166
|
},
|
|
121
167
|
computedValue: function computedValue() {
|
|
122
|
-
return this.isValueControlled ? this.$props.value : this.
|
|
168
|
+
return this.isValueControlled ? this.$props.value : this.currentValue;
|
|
123
169
|
},
|
|
124
170
|
computedOpen: function computedOpen() {
|
|
125
|
-
return this.isOpenControlled ? this.$props.open : this.
|
|
171
|
+
return this.isOpenControlled ? this.$props.open : this.currentOpen;
|
|
126
172
|
},
|
|
127
173
|
computedIconClassName: function computedIconClassName() {
|
|
128
174
|
var icon = this.$props.icon;
|
|
@@ -137,7 +183,8 @@ var ColorPickerVue2 = {
|
|
|
137
183
|
rounded = _b.rounded;
|
|
138
184
|
return _a = {
|
|
139
185
|
'k-picker': true,
|
|
140
|
-
'k-colorpicker': true
|
|
186
|
+
'k-colorpicker': true,
|
|
187
|
+
'k-icon-picker': true
|
|
141
188
|
}, _a["k-picker-" + (kendo_vue_common_1.kendoThemeMaps.sizeMap[size] || size)] = size, _a["k-picker-" + fillMode] = fillMode, _a["k-rounded-" + (kendo_vue_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded, _a['k-invalid'] = !this.valid, _a['k-disabled'] = this.disabled, _a['k-focus'] = this.focused, _a;
|
|
142
189
|
}
|
|
143
190
|
},
|
|
@@ -146,17 +193,13 @@ var ColorPickerVue2 = {
|
|
|
146
193
|
this.focusableElementGuid = kendo_vue_common_1.guid();
|
|
147
194
|
},
|
|
148
195
|
mounted: function mounted() {
|
|
149
|
-
this.
|
|
150
|
-
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
151
|
-
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
196
|
+
this.button = kendo_vue_common_1.getRef(this, 'button');
|
|
152
197
|
},
|
|
153
|
-
updated: function updated() {
|
|
154
|
-
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
155
|
-
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
198
|
+
updated: function updated() {// this.button = getRef(this, 'button');
|
|
156
199
|
},
|
|
157
200
|
// @ts-ignore
|
|
158
|
-
setup: !
|
|
159
|
-
var v3 = !!
|
|
201
|
+
setup: !isV3 ? undefined : function () {
|
|
202
|
+
var v3 = !!isV3;
|
|
160
203
|
return {
|
|
161
204
|
v3: v3
|
|
162
205
|
};
|
|
@@ -173,7 +216,49 @@ var ColorPickerVue2 = {
|
|
|
173
216
|
var _b = this.$props,
|
|
174
217
|
disabled = _b.disabled,
|
|
175
218
|
tabIndex = _b.tabIndex,
|
|
176
|
-
dir = _b.dir
|
|
219
|
+
dir = _b.dir,
|
|
220
|
+
view = _b.view;
|
|
221
|
+
|
|
222
|
+
var renderGradiente = function renderGradiente() {
|
|
223
|
+
return h(ColorGradient_1.ColorGradient, __assign({
|
|
224
|
+
tabIndex: 0,
|
|
225
|
+
attrs: this.v3 ? undefined : __assign({
|
|
226
|
+
tabIndex: 0,
|
|
227
|
+
value: this.computedValue || undefined
|
|
228
|
+
}, this.gradientSettings),
|
|
229
|
+
ref: kendo_vue_common_1.setRef(this, 'gradient'),
|
|
230
|
+
value: this.computedValue || undefined,
|
|
231
|
+
onChange: this.onGradientChangeHandler,
|
|
232
|
+
on: this.v3 ? undefined : {
|
|
233
|
+
'change': this.onGradientChangeHandler,
|
|
234
|
+
'focus': this.onFocusHandler,
|
|
235
|
+
'blur': this.onBlurHandler,
|
|
236
|
+
'keydown': this.onKeyDownHandler
|
|
237
|
+
},
|
|
238
|
+
onFocus: this.onFocusHandler,
|
|
239
|
+
onBlur: this.onBlurHandler,
|
|
240
|
+
onKeydown: this.onKeyDownHandler
|
|
241
|
+
}, this.gradientSettings));
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
var renderPalette = function renderPalette() {
|
|
245
|
+
return h(ColorPalette_1.ColorPalette, __assign({
|
|
246
|
+
onKeydown: this.onKeyDownHandler,
|
|
247
|
+
on: this.v3 ? undefined : {
|
|
248
|
+
'keydown': this.onKeyDownHandler,
|
|
249
|
+
'change': this.onPaletteChangeHandler,
|
|
250
|
+
'blur': this.onBlurHandler
|
|
251
|
+
},
|
|
252
|
+
ref: kendo_vue_common_1.setRef(this, 'palette'),
|
|
253
|
+
value: this.computedValue || undefined,
|
|
254
|
+
attrs: this.v3 ? undefined : __assign({
|
|
255
|
+
value: this.computedValue || undefined
|
|
256
|
+
}, this.paletteSettings),
|
|
257
|
+
onChange: this.onPaletteChangeHandler,
|
|
258
|
+
onBlur: this.onBlurHandler
|
|
259
|
+
}, this.paletteSettings));
|
|
260
|
+
}; // const dir = useDir(focusableElementGuid, props.dir);
|
|
261
|
+
|
|
177
262
|
|
|
178
263
|
return h("span", {
|
|
179
264
|
"class": this.wrapperClassName,
|
|
@@ -183,23 +268,21 @@ var ColorPickerVue2 = {
|
|
|
183
268
|
id: this.$props.id,
|
|
184
269
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
185
270
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
186
|
-
|
|
271
|
+
tabindex: kendo_vue_common_1.getTabIndex(tabIndex, disabled),
|
|
187
272
|
title: this.$props.title
|
|
188
273
|
},
|
|
189
274
|
id: this.$props.id,
|
|
190
275
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
191
276
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
192
277
|
ref: this.focusableElementGuid,
|
|
193
|
-
|
|
278
|
+
tabindex: kendo_vue_common_1.getTabIndex(tabIndex, disabled),
|
|
194
279
|
title: this.$props.title,
|
|
195
|
-
onKeydown: this.
|
|
280
|
+
onKeydown: this.onButtonKeyDown,
|
|
196
281
|
on: this.v3 ? undefined : {
|
|
197
|
-
"keydown": this.
|
|
198
|
-
"focusin": this.onFocusHandler
|
|
199
|
-
"focusout": this.onBlurHandler
|
|
282
|
+
"keydown": this.onButtonKeyDown,
|
|
283
|
+
"focusin": this.onFocusHandler
|
|
200
284
|
},
|
|
201
|
-
onFocusin: this.onFocusHandler
|
|
202
|
-
onFocusout: this.onBlurHandler
|
|
285
|
+
onFocusin: this.onFocusHandler
|
|
203
286
|
}, [h("span", {
|
|
204
287
|
onClick: this.onActiveColorClickHandler,
|
|
205
288
|
on: this.v3 ? undefined : {
|
|
@@ -223,9 +306,11 @@ var ColorPickerVue2 = {
|
|
|
223
306
|
type: "button",
|
|
224
307
|
attrs: this.v3 ? undefined : {
|
|
225
308
|
type: "button",
|
|
309
|
+
tabindex: -1,
|
|
226
310
|
rounded: null,
|
|
227
311
|
icon: 'arrow-s'
|
|
228
312
|
},
|
|
313
|
+
tabindex: -1,
|
|
229
314
|
ref: this.v3 ? function (el) {
|
|
230
315
|
_this.buttonRef = el;
|
|
231
316
|
} : 'button',
|
|
@@ -251,94 +336,78 @@ var ColorPickerVue2 = {
|
|
|
251
336
|
},
|
|
252
337
|
popupAnchor: this.focusableElementGuid
|
|
253
338
|
}, this.v3 ? function () {
|
|
254
|
-
return [
|
|
255
|
-
|
|
256
|
-
onKeydown: _this2.onKeyDownHandler // {...paletteSettings}
|
|
257
|
-
,
|
|
258
|
-
on: _this2.v3 ? undefined : {
|
|
259
|
-
"keydown": _this2.onKeyDownHandler,
|
|
260
|
-
"change": _this2.onPaletteChangeHandler,
|
|
261
|
-
"blur": _this2.onBlurHandler
|
|
262
|
-
},
|
|
263
|
-
ref: _this2.v3 ? function (el) {
|
|
264
|
-
_this.paletteRef = el;
|
|
265
|
-
} : 'palette',
|
|
266
|
-
value: _this2.computedValue || undefined,
|
|
267
|
-
attrs: _this2.v3 ? undefined : {
|
|
268
|
-
value: _this2.computedValue || undefined
|
|
269
|
-
},
|
|
270
|
-
onChange: _this2.onPaletteChangeHandler,
|
|
271
|
-
onBlur: _this2.onBlurHandler
|
|
272
|
-
})];
|
|
273
|
-
} : [h(ColorPalette_1.ColorPalette, {
|
|
274
|
-
onKeydown: _this2.onKeyDownHandler,
|
|
275
|
-
on: _this2.v3 ? undefined : {
|
|
276
|
-
"keydown": _this2.onKeyDownHandler,
|
|
277
|
-
"change": _this2.onPaletteChangeHandler,
|
|
278
|
-
"blur": _this2.onBlurHandler
|
|
279
|
-
},
|
|
280
|
-
ref: _this2.v3 ? function (el) {
|
|
281
|
-
_this.paletteRef = el;
|
|
282
|
-
} : 'palette',
|
|
283
|
-
value: _this2.computedValue || undefined,
|
|
284
|
-
attrs: _this2.v3 ? undefined : {
|
|
285
|
-
value: _this2.computedValue || undefined
|
|
286
|
-
},
|
|
287
|
-
onChange: _this2.onPaletteChangeHandler,
|
|
288
|
-
onBlur: _this2.onBlurHandler
|
|
289
|
-
})])]);
|
|
339
|
+
return [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)];
|
|
340
|
+
} : [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)])]);
|
|
290
341
|
},
|
|
291
342
|
methods: {
|
|
292
343
|
focusElement: function focusElement() {
|
|
293
|
-
if (this
|
|
294
|
-
this.
|
|
344
|
+
if (this.$el) {
|
|
345
|
+
this.$el.focus();
|
|
295
346
|
}
|
|
296
347
|
},
|
|
297
348
|
setOpen: function setOpen(nextOpen, isBlur) {
|
|
298
|
-
if (!this
|
|
299
|
-
|
|
300
|
-
this.focusableElement.focus();
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
this.stateOpen = nextOpen;
|
|
349
|
+
if (!nextOpen && !isBlur && this.$el) {
|
|
350
|
+
this.$el.focus();
|
|
304
351
|
}
|
|
352
|
+
|
|
353
|
+
this.currentOpen = nextOpen;
|
|
354
|
+
this.$emit(nextOpen ? 'open' : 'close');
|
|
305
355
|
},
|
|
306
|
-
|
|
356
|
+
onButtonKeyDown: function onButtonKeyDown(event) {
|
|
307
357
|
var altKey = event.altKey,
|
|
308
358
|
keyCode = event.keyCode;
|
|
309
359
|
|
|
310
360
|
if (keyCode === kendo_vue_common_1.Keys.esc) {
|
|
361
|
+
event.preventDefault();
|
|
362
|
+
event.stopPropagation();
|
|
311
363
|
this.setOpen(false);
|
|
312
364
|
return;
|
|
313
365
|
}
|
|
314
366
|
|
|
315
|
-
if (keyCode === kendo_vue_common_1.Keys.enter
|
|
367
|
+
if (keyCode === kendo_vue_common_1.Keys.enter) {
|
|
316
368
|
event.preventDefault();
|
|
317
369
|
event.stopPropagation();
|
|
318
370
|
this.setOpen(!this.computedOpen);
|
|
319
371
|
return;
|
|
320
372
|
}
|
|
321
373
|
|
|
322
|
-
if (altKey &&
|
|
374
|
+
if (altKey && keyCode === kendo_vue_common_1.Keys.down) {
|
|
323
375
|
event.preventDefault();
|
|
324
376
|
event.stopPropagation();
|
|
377
|
+
this.setOpen(true);
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
onKeyDownHandler: function onKeyDownHandler(event) {
|
|
381
|
+
var altKey = event.altKey,
|
|
382
|
+
keyCode = event.keyCode;
|
|
325
383
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
384
|
+
if (keyCode === kendo_vue_common_1.Keys.esc) {
|
|
385
|
+
event.preventDefault();
|
|
386
|
+
event.stopPropagation();
|
|
387
|
+
this.setOpen(false);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
330
390
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
391
|
+
if (keyCode === kendo_vue_common_1.Keys.enter) {
|
|
392
|
+
event.preventDefault();
|
|
393
|
+
event.stopPropagation();
|
|
394
|
+
this.focusElement();
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (altKey && keyCode === kendo_vue_common_1.Keys.up) {
|
|
399
|
+
event.preventDefault();
|
|
400
|
+
event.stopPropagation();
|
|
401
|
+
this.setOpen(false);
|
|
402
|
+
this.focusElement();
|
|
334
403
|
}
|
|
335
404
|
},
|
|
336
405
|
onOpenHandler: function onOpenHandler() {
|
|
337
406
|
// Skip content autofocus when in controlled mode
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
407
|
+
var palette = kendo_vue_common_1.getRef(this, 'palette');
|
|
408
|
+
|
|
409
|
+
if (palette) {
|
|
410
|
+
palette.focus();
|
|
342
411
|
}
|
|
343
412
|
},
|
|
344
413
|
onClickHandler: function onClickHandler() {
|
|
@@ -354,9 +423,10 @@ var ColorPickerVue2 = {
|
|
|
354
423
|
if (this.blurTimeoutRef) {
|
|
355
424
|
clearTimeout(this.blurTimeoutRef);
|
|
356
425
|
this.blurTimeoutRef = undefined; // case where moving back to input from popup
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
426
|
+
|
|
427
|
+
if (event.target === this.$el) {
|
|
428
|
+
this.setOpen(false); // in this case we should focus input on keydown
|
|
429
|
+
}
|
|
360
430
|
} else {
|
|
361
431
|
this.focused = true;
|
|
362
432
|
}
|
|
@@ -366,18 +436,22 @@ var ColorPickerVue2 = {
|
|
|
366
436
|
});
|
|
367
437
|
},
|
|
368
438
|
onBlurTimeout: function onBlurTimeout() {
|
|
369
|
-
var
|
|
439
|
+
var _a, _b;
|
|
370
440
|
|
|
371
|
-
|
|
441
|
+
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'));
|
|
442
|
+
|
|
443
|
+
if (!viewIsFocused) {
|
|
372
444
|
this.setOpen(false, true);
|
|
373
445
|
}
|
|
374
446
|
|
|
375
|
-
this.focused =
|
|
447
|
+
this.focused = viewIsFocused;
|
|
376
448
|
this.blurTimeoutRef = undefined;
|
|
377
449
|
},
|
|
378
450
|
onBlurHandler: function onBlurHandler(event) {
|
|
379
451
|
clearTimeout(this.blurTimeoutRef);
|
|
380
|
-
this.
|
|
452
|
+
this.palette = kendo_vue_common_1.getRef(this, 'palette');
|
|
453
|
+
this.gradient = kendo_vue_common_1.getRef(this, 'gradient');
|
|
454
|
+
this.blurTimeoutRef = setTimeout(this.onBlurTimeout, 200);
|
|
381
455
|
this.$emit('blur', {
|
|
382
456
|
event: event
|
|
383
457
|
});
|
|
@@ -386,7 +460,7 @@ var ColorPickerVue2 = {
|
|
|
386
460
|
var currentValue = isPalette ? event.rgbaValue : event.value;
|
|
387
461
|
|
|
388
462
|
if (!this.isValueControlled) {
|
|
389
|
-
this.
|
|
463
|
+
this.currentValue = currentValue;
|
|
390
464
|
}
|
|
391
465
|
|
|
392
466
|
if (isPalette) {
|
|
@@ -398,6 +472,9 @@ var ColorPickerVue2 = {
|
|
|
398
472
|
event: event
|
|
399
473
|
});
|
|
400
474
|
},
|
|
475
|
+
onGradientChangeHandler: function onGradientChangeHandler(event) {
|
|
476
|
+
this.onChangeHandler(event, false);
|
|
477
|
+
},
|
|
401
478
|
onPaletteChangeHandler: function onPaletteChangeHandler(event) {
|
|
402
479
|
this.onChangeHandler(event, true);
|
|
403
480
|
}
|
|
@@ -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 kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
14
15
|
|
|
@@ -68,21 +69,23 @@ var FlatColorPickerVue2 = {
|
|
|
68
69
|
};
|
|
69
70
|
},
|
|
70
71
|
// @ts-ignore
|
|
71
|
-
setup: !
|
|
72
|
-
var v3 = !!
|
|
72
|
+
setup: !isV3 ? undefined : function () {
|
|
73
|
+
var v3 = !!isV3;
|
|
73
74
|
return {
|
|
74
75
|
v3: v3
|
|
75
76
|
};
|
|
76
77
|
},
|
|
77
78
|
// @ts-ignore
|
|
78
79
|
render: function render(createElement) {
|
|
80
|
+
var _this2 = this;
|
|
81
|
+
|
|
79
82
|
var _this = this;
|
|
80
83
|
|
|
81
84
|
var h = gh || createElement;
|
|
82
85
|
return h("div", {
|
|
83
|
-
|
|
86
|
+
tabindex: kendo_vue_common_1.getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
84
87
|
attrs: this.v3 ? undefined : {
|
|
85
|
-
|
|
88
|
+
tabindex: kendo_vue_common_1.getTabIndex(this.$props.tabIndex, this.$props.disabled)
|
|
86
89
|
},
|
|
87
90
|
"class": kendo_vue_common_1.classNames('k-flatcolorpicker k-coloreditor', {
|
|
88
91
|
'k-disabled': this.$props.disabled
|
|
@@ -100,16 +103,24 @@ var FlatColorPickerVue2 = {
|
|
|
100
103
|
return [// @ts-ignore function children
|
|
101
104
|
h(kendo_vue_buttons_1.Button, {
|
|
102
105
|
type: "button",
|
|
103
|
-
attrs:
|
|
106
|
+
attrs: _this2.v3 ? undefined : {
|
|
104
107
|
type: "button",
|
|
105
108
|
togglable: true,
|
|
106
109
|
fillMode: 'flat',
|
|
107
|
-
selected:
|
|
110
|
+
selected: _this2.isColorGradient
|
|
108
111
|
},
|
|
109
112
|
togglable: true,
|
|
110
113
|
fillMode: 'flat',
|
|
111
|
-
selected:
|
|
112
|
-
|
|
114
|
+
selected: _this2.isColorGradient,
|
|
115
|
+
onClick: function onClick(e) {
|
|
116
|
+
return _this.handleViewChange(e, 'ColorGradient');
|
|
117
|
+
},
|
|
118
|
+
on: _this2.v3 ? undefined : {
|
|
119
|
+
"click": function onClick(e) {
|
|
120
|
+
return _this.handleViewChange(e, 'ColorGradient');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}, _this2.v3 ? function () {
|
|
113
124
|
return [h("span", {
|
|
114
125
|
"class": "k-icon k-i-color-canvas"
|
|
115
126
|
})];
|
|
@@ -118,16 +129,24 @@ var FlatColorPickerVue2 = {
|
|
|
118
129
|
})]), // @ts-ignore function children
|
|
119
130
|
h(kendo_vue_buttons_1.Button, {
|
|
120
131
|
type: "button",
|
|
121
|
-
attrs:
|
|
132
|
+
attrs: _this2.v3 ? undefined : {
|
|
122
133
|
type: "button",
|
|
123
134
|
togglable: true,
|
|
124
135
|
fillMode: 'flat',
|
|
125
|
-
selected: !
|
|
136
|
+
selected: !_this2.isColorGradient
|
|
126
137
|
},
|
|
127
138
|
togglable: true,
|
|
128
139
|
fillMode: 'flat',
|
|
129
|
-
selected: !
|
|
130
|
-
|
|
140
|
+
selected: !_this2.isColorGradient,
|
|
141
|
+
onClick: function onClick(e) {
|
|
142
|
+
return _this.handleViewChange(e, 'ColorPalette');
|
|
143
|
+
},
|
|
144
|
+
on: _this2.v3 ? undefined : {
|
|
145
|
+
"click": function onClick(e) {
|
|
146
|
+
return _this.handleViewChange(e, 'ColorPalette');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, _this2.v3 ? function () {
|
|
131
150
|
return [h("span", {
|
|
132
151
|
"class": "k-icon k-i-palette"
|
|
133
152
|
})];
|
|
@@ -136,16 +155,24 @@ var FlatColorPickerVue2 = {
|
|
|
136
155
|
})])];
|
|
137
156
|
} : [h(kendo_vue_buttons_1.Button, {
|
|
138
157
|
type: "button",
|
|
139
|
-
attrs:
|
|
158
|
+
attrs: _this2.v3 ? undefined : {
|
|
140
159
|
type: "button",
|
|
141
160
|
togglable: true,
|
|
142
161
|
fillMode: 'flat',
|
|
143
|
-
selected:
|
|
162
|
+
selected: _this2.isColorGradient
|
|
144
163
|
},
|
|
145
164
|
togglable: true,
|
|
146
165
|
fillMode: 'flat',
|
|
147
|
-
selected:
|
|
148
|
-
|
|
166
|
+
selected: _this2.isColorGradient,
|
|
167
|
+
onClick: function onClick(e) {
|
|
168
|
+
return _this.handleViewChange(e, 'ColorGradient');
|
|
169
|
+
},
|
|
170
|
+
on: _this2.v3 ? undefined : {
|
|
171
|
+
"click": function onClick(e) {
|
|
172
|
+
return _this.handleViewChange(e, 'ColorGradient');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}, _this2.v3 ? function () {
|
|
149
176
|
return [h("span", {
|
|
150
177
|
"class": "k-icon k-i-color-canvas"
|
|
151
178
|
})];
|
|
@@ -153,16 +180,24 @@ var FlatColorPickerVue2 = {
|
|
|
153
180
|
"class": "k-icon k-i-color-canvas"
|
|
154
181
|
})]), h(kendo_vue_buttons_1.Button, {
|
|
155
182
|
type: "button",
|
|
156
|
-
attrs:
|
|
183
|
+
attrs: _this2.v3 ? undefined : {
|
|
157
184
|
type: "button",
|
|
158
185
|
togglable: true,
|
|
159
186
|
fillMode: 'flat',
|
|
160
|
-
selected: !
|
|
187
|
+
selected: !_this2.isColorGradient
|
|
161
188
|
},
|
|
162
189
|
togglable: true,
|
|
163
190
|
fillMode: 'flat',
|
|
164
|
-
selected: !
|
|
165
|
-
|
|
191
|
+
selected: !_this2.isColorGradient,
|
|
192
|
+
onClick: function onClick(e) {
|
|
193
|
+
return _this.handleViewChange(e, 'ColorPalette');
|
|
194
|
+
},
|
|
195
|
+
on: _this2.v3 ? undefined : {
|
|
196
|
+
"click": function onClick(e) {
|
|
197
|
+
return _this.handleViewChange(e, 'ColorPalette');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}, _this2.v3 ? function () {
|
|
166
201
|
return [h("span", {
|
|
167
202
|
"class": "k-icon k-i-palette"
|
|
168
203
|
})];
|
|
@@ -267,8 +302,12 @@ var FlatColorPickerVue2 = {
|
|
|
267
302
|
this.$el.focus();
|
|
268
303
|
}
|
|
269
304
|
},
|
|
270
|
-
handleViewChange: function handleViewChange(viewType) {
|
|
305
|
+
handleViewChange: function handleViewChange(event, viewType) {
|
|
271
306
|
this.currentView = viewType;
|
|
307
|
+
this.$emit('viewchange', {
|
|
308
|
+
event: event,
|
|
309
|
+
viewType: viewType
|
|
310
|
+
});
|
|
272
311
|
},
|
|
273
312
|
handleResetColor: function handleResetColor() {
|
|
274
313
|
this.colorValue = 'rgba(255, 255, 255, 1)';
|
|
@@ -291,7 +330,7 @@ var FlatColorPickerVue2 = {
|
|
|
291
330
|
}
|
|
292
331
|
},
|
|
293
332
|
handleFlatColorPickerBlur: function handleFlatColorPickerBlur() {
|
|
294
|
-
this.prevColor
|
|
333
|
+
this.prevColor = this.colorValue;
|
|
295
334
|
}
|
|
296
335
|
}
|
|
297
336
|
};
|
|
@@ -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_parser_1 = require("./utils/color-parser");
|
|
14
15
|
|
|
@@ -22,19 +23,30 @@ var Input_1 = require("../input/Input");
|
|
|
22
23
|
|
|
23
24
|
var HexInputVue2 = {
|
|
24
25
|
name: 'KendoHexInput',
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
emits: {
|
|
28
|
+
'hexchange': null,
|
|
29
|
+
'blur': null,
|
|
30
|
+
'focus': null
|
|
31
|
+
},
|
|
25
32
|
props: {
|
|
26
33
|
hex: String,
|
|
27
34
|
disabled: Boolean
|
|
28
35
|
},
|
|
29
36
|
data: function data() {
|
|
30
37
|
return {
|
|
31
|
-
|
|
38
|
+
currentHex: this.$props.hex,
|
|
32
39
|
originalHex: this.$props.hex
|
|
33
40
|
};
|
|
34
41
|
},
|
|
42
|
+
computed: {
|
|
43
|
+
computedHex: function computedHex() {
|
|
44
|
+
return this.hex !== undefined ? this.hex : this.currentHex;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
35
47
|
// @ts-ignore
|
|
36
|
-
setup: !
|
|
37
|
-
var v3 = !!
|
|
48
|
+
setup: !isV3 ? undefined : function () {
|
|
49
|
+
var v3 = !!isV3;
|
|
38
50
|
return {
|
|
39
51
|
v3: v3
|
|
40
52
|
};
|
|
@@ -43,16 +55,18 @@ var HexInputVue2 = {
|
|
|
43
55
|
render: function render(createElement) {
|
|
44
56
|
var h = gh || createElement;
|
|
45
57
|
return h(Input_1.Input, {
|
|
46
|
-
value: this.
|
|
58
|
+
value: this.computedHex,
|
|
47
59
|
attrs: this.v3 ? undefined : {
|
|
48
|
-
value: this.
|
|
60
|
+
value: this.computedHex,
|
|
49
61
|
disabled: this.$props.disabled
|
|
50
62
|
},
|
|
51
63
|
onChange: this.onChange,
|
|
52
64
|
on: this.v3 ? undefined : {
|
|
53
65
|
"change": this.onChange,
|
|
66
|
+
"focus": this.onFocus,
|
|
54
67
|
"blur": this.onBlur
|
|
55
68
|
},
|
|
69
|
+
onFocus: this.onFocus,
|
|
56
70
|
onBlur: this.onBlur,
|
|
57
71
|
disabled: this.$props.disabled
|
|
58
72
|
});
|
|
@@ -61,16 +75,21 @@ var HexInputVue2 = {
|
|
|
61
75
|
onChange: function onChange(event) {
|
|
62
76
|
var hex = event.target.value;
|
|
63
77
|
var value = color_parser_1.parseColor(hex, 'rgba');
|
|
64
|
-
this.
|
|
78
|
+
this.currentHex = hex;
|
|
65
79
|
|
|
66
80
|
if (misc_1.isPresent(value)) {
|
|
67
|
-
this.$
|
|
81
|
+
this.$emit('hexchange', hex, value, event);
|
|
68
82
|
}
|
|
69
83
|
},
|
|
70
|
-
onBlur: function onBlur() {
|
|
84
|
+
onBlur: function onBlur(event) {
|
|
71
85
|
if (!misc_1.isPresent(color_parser_1.parseColor(this.hex, 'rgba'))) {
|
|
72
|
-
this.
|
|
86
|
+
this.currentHex = this.originalHex;
|
|
73
87
|
}
|
|
88
|
+
|
|
89
|
+
this.$emit('blur', event);
|
|
90
|
+
},
|
|
91
|
+
onFocus: function onFocus(event) {
|
|
92
|
+
this.$emit('focus', event);
|
|
74
93
|
}
|
|
75
94
|
}
|
|
76
95
|
};
|