@progress/kendo-vue-inputs 3.4.2 → 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.
Files changed (36) hide show
  1. package/dist/cdn/js/kendo-vue-inputs.js +1 -1
  2. package/dist/es/colors/ColorContrastSvg.d.ts +1 -1
  3. package/dist/es/colors/ColorGradient.d.ts +1 -0
  4. package/dist/es/colors/ColorGradient.js +77 -55
  5. package/dist/es/colors/ColorInput.js +58 -13
  6. package/dist/es/colors/ColorPalette.d.ts +0 -1
  7. package/dist/es/colors/ColorPalette.js +5 -28
  8. package/dist/es/colors/ColorPicker.d.ts +0 -1
  9. package/dist/es/colors/ColorPicker.js +164 -89
  10. package/dist/es/colors/FlatColorPicker.js +56 -18
  11. package/dist/es/colors/HexInput.js +25 -7
  12. package/dist/es/colors/interfaces/ColorPickerProps.d.ts +6 -1
  13. package/dist/es/colors/utils/color-palette.service.d.ts +1 -0
  14. package/dist/es/colors/utils/color-palette.service.js +7 -16
  15. package/dist/es/main.d.ts +1 -0
  16. package/dist/es/main.js +1 -0
  17. package/dist/es/package-metadata.js +1 -1
  18. package/dist/es/slider/Slider.js +12 -2
  19. package/dist/npm/colors/ColorContrastSvg.d.ts +1 -1
  20. package/dist/npm/colors/ColorGradient.d.ts +1 -0
  21. package/dist/npm/colors/ColorGradient.js +76 -54
  22. package/dist/npm/colors/ColorInput.js +58 -13
  23. package/dist/npm/colors/ColorPalette.d.ts +0 -1
  24. package/dist/npm/colors/ColorPalette.js +5 -28
  25. package/dist/npm/colors/ColorPicker.d.ts +0 -1
  26. package/dist/npm/colors/ColorPicker.js +163 -87
  27. package/dist/npm/colors/FlatColorPicker.js +56 -18
  28. package/dist/npm/colors/HexInput.js +25 -7
  29. package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +6 -1
  30. package/dist/npm/colors/utils/color-palette.service.d.ts +1 -0
  31. package/dist/npm/colors/utils/color-palette.service.js +7 -16
  32. package/dist/npm/main.d.ts +1 -0
  33. package/dist/npm/main.js +2 -0
  34. package/dist/npm/package-metadata.js +1 -1
  35. package/dist/npm/slider/Slider.js +12 -2
  36. package/package.json +14 -14
@@ -1,14 +1,31 @@
1
- // @ts-ignore
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;
5
21
  var isV3 = allVue.version[0] === '3';
6
22
  import { Button } from '@progress/kendo-vue-buttons';
7
23
  import { classNames, Keys, // useDir,
8
- getTabIndex, guid, kendoThemeMaps, validatePackage } from '@progress/kendo-vue-common';
24
+ getTabIndex, guid, kendoThemeMaps, validatePackage, setRef, getRef } from '@progress/kendo-vue-common';
9
25
  import { packageMetadata } from '../package-metadata';
10
26
  import { Picker } from './Picker';
11
27
  import { ColorPalette, DEFAULT_PRESET, DEFAULT_TILE_SIZE } from './ColorPalette';
28
+ import { ColorGradient } from './ColorGradient';
12
29
  /**
13
30
  * @hidden
14
31
  */
@@ -38,6 +55,15 @@ var isControlled = function isControlled(prop) {
38
55
 
39
56
  var ColorPickerVue2 = {
40
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
+ },
41
67
  props: {
42
68
  value: {
43
69
  type: String,
@@ -66,7 +92,18 @@ var ColorPickerVue2 = {
66
92
  title: String,
67
93
  icon: String,
68
94
  iconClassName: String,
69
- popupSettings: Object,
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
+ },
70
107
  open: {
71
108
  type: Boolean,
72
109
  default: undefined
@@ -91,27 +128,34 @@ var ColorPickerVue2 = {
91
128
  validator: function validator(value) {
92
129
  return [null, 'solid', 'flat', 'outline'].includes(value);
93
130
  }
131
+ },
132
+ view: {
133
+ type: String,
134
+ default: 'palette',
135
+ validator: function validator(value) {
136
+ return ['gradient', 'palette', 'combo'].includes(value);
137
+ }
94
138
  }
95
139
  },
96
140
  data: function data() {
97
141
  return {
98
142
  focused: false,
99
- stateValue: '',
100
- stateOpen: false
143
+ currentValue: this.$props.defaultValue,
144
+ currentOpen: false
101
145
  };
102
146
  },
103
147
  computed: {
104
148
  isValueControlled: function isValueControlled() {
105
- return isControlled(this.$props.value);
149
+ return this.$props.value !== undefined;
106
150
  },
107
151
  isOpenControlled: function isOpenControlled() {
108
- return isControlled(this.$props.open);
152
+ return this.$props.open !== undefined;
109
153
  },
110
154
  computedValue: function computedValue() {
111
- return this.isValueControlled ? this.$props.value : this.stateValue;
155
+ return this.isValueControlled ? this.$props.value : this.currentValue;
112
156
  },
113
157
  computedOpen: function computedOpen() {
114
- return this.isOpenControlled ? this.$props.open : this.stateOpen;
158
+ return this.isOpenControlled ? this.$props.open : this.currentOpen;
115
159
  },
116
160
  computedIconClassName: function computedIconClassName() {
117
161
  var icon = this.$props.icon;
@@ -126,7 +170,8 @@ var ColorPickerVue2 = {
126
170
  rounded = _b.rounded;
127
171
  return _a = {
128
172
  'k-picker': true,
129
- 'k-colorpicker': true
173
+ 'k-colorpicker': true,
174
+ 'k-icon-picker': true
130
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;
131
176
  }
132
177
  },
@@ -135,13 +180,9 @@ var ColorPickerVue2 = {
135
180
  this.focusableElementGuid = guid();
136
181
  },
137
182
  mounted: function mounted() {
138
- this.focusableElement = this.$refs[this.focusableElementGuid];
139
- this.button = this.v3 ? this.buttonRef : this.$refs.button;
140
- this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
183
+ this.button = getRef(this, 'button');
141
184
  },
142
- updated: function updated() {
143
- this.button = this.v3 ? this.buttonRef : this.$refs.button;
144
- this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
185
+ updated: function updated() {// this.button = getRef(this, 'button');
145
186
  },
146
187
  // @ts-ignore
147
188
  setup: !isV3 ? undefined : function () {
@@ -162,7 +203,49 @@ var ColorPickerVue2 = {
162
203
  var _b = this.$props,
163
204
  disabled = _b.disabled,
164
205
  tabIndex = _b.tabIndex,
165
- dir = _b.dir; // const dir = useDir(focusableElementGuid, props.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
+
166
249
 
167
250
  return h("span", {
168
251
  "class": this.wrapperClassName,
@@ -181,14 +264,12 @@ var ColorPickerVue2 = {
181
264
  ref: this.focusableElementGuid,
182
265
  tabindex: getTabIndex(tabIndex, disabled),
183
266
  title: this.$props.title,
184
- onKeydown: this.onKeyDownHandler,
267
+ onKeydown: this.onButtonKeyDown,
185
268
  on: this.v3 ? undefined : {
186
- "keydown": this.onKeyDownHandler,
187
- "focusin": this.onFocusHandler,
188
- "focusout": this.onBlurHandler
269
+ "keydown": this.onButtonKeyDown,
270
+ "focusin": this.onFocusHandler
189
271
  },
190
- onFocusin: this.onFocusHandler,
191
- onFocusout: this.onBlurHandler
272
+ onFocusin: this.onFocusHandler
192
273
  }, [h("span", {
193
274
  onClick: this.onActiveColorClickHandler,
194
275
  on: this.v3 ? undefined : {
@@ -212,9 +293,11 @@ var ColorPickerVue2 = {
212
293
  type: "button",
213
294
  attrs: this.v3 ? undefined : {
214
295
  type: "button",
296
+ tabindex: -1,
215
297
  rounded: null,
216
298
  icon: 'arrow-s'
217
299
  },
300
+ tabindex: -1,
218
301
  ref: this.v3 ? function (el) {
219
302
  _this.buttonRef = el;
220
303
  } : 'button',
@@ -240,94 +323,78 @@ var ColorPickerVue2 = {
240
323
  },
241
324
  popupAnchor: this.focusableElementGuid
242
325
  }, this.v3 ? function () {
243
- return [// @ts-ignore function children
244
- h(ColorPalette, {
245
- onKeydown: _this2.onKeyDownHandler // {...paletteSettings}
246
- ,
247
- on: _this2.v3 ? undefined : {
248
- "keydown": _this2.onKeyDownHandler,
249
- "change": _this2.onPaletteChangeHandler,
250
- "blur": _this2.onBlurHandler
251
- },
252
- ref: _this2.v3 ? function (el) {
253
- _this.paletteRef = el;
254
- } : 'palette',
255
- value: _this2.computedValue || undefined,
256
- attrs: _this2.v3 ? undefined : {
257
- value: _this2.computedValue || undefined
258
- },
259
- onChange: _this2.onPaletteChangeHandler,
260
- onBlur: _this2.onBlurHandler
261
- })];
262
- } : [h(ColorPalette, {
263
- onKeydown: _this2.onKeyDownHandler,
264
- on: _this2.v3 ? undefined : {
265
- "keydown": _this2.onKeyDownHandler,
266
- "change": _this2.onPaletteChangeHandler,
267
- "blur": _this2.onBlurHandler
268
- },
269
- ref: _this2.v3 ? function (el) {
270
- _this.paletteRef = el;
271
- } : 'palette',
272
- value: _this2.computedValue || undefined,
273
- attrs: _this2.v3 ? undefined : {
274
- value: _this2.computedValue || undefined
275
- },
276
- onChange: _this2.onPaletteChangeHandler,
277
- onBlur: _this2.onBlurHandler
278
- })])]);
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)])]);
279
328
  },
280
329
  methods: {
281
330
  focusElement: function focusElement() {
282
- if (this.focusableElement) {
283
- this.focusableElement.focus();
331
+ if (this.$el) {
332
+ this.$el.focus();
284
333
  }
285
334
  },
286
335
  setOpen: function setOpen(nextOpen, isBlur) {
287
- if (!this.isOpenControlled) {
288
- if (!nextOpen && !isBlur && this.focusableElement) {
289
- this.focusableElement.focus();
290
- }
291
-
292
- this.stateOpen = nextOpen;
336
+ if (!nextOpen && !isBlur && this.$el) {
337
+ this.$el.focus();
293
338
  }
339
+
340
+ this.currentOpen = nextOpen;
341
+ this.$emit(nextOpen ? 'open' : 'close');
294
342
  },
295
- onKeyDownHandler: function onKeyDownHandler(event) {
343
+ onButtonKeyDown: function onButtonKeyDown(event) {
296
344
  var altKey = event.altKey,
297
345
  keyCode = event.keyCode;
298
346
 
299
347
  if (keyCode === Keys.esc) {
348
+ event.preventDefault();
349
+ event.stopPropagation();
300
350
  this.setOpen(false);
301
351
  return;
302
352
  }
303
353
 
304
- if (keyCode === Keys.enter && !this.isOpenControlled) {
354
+ if (keyCode === Keys.enter) {
305
355
  event.preventDefault();
306
356
  event.stopPropagation();
307
357
  this.setOpen(!this.computedOpen);
308
358
  return;
309
359
  }
310
360
 
311
- if (altKey && (keyCode === Keys.up || keyCode === Keys.down)) {
361
+ if (altKey && keyCode === Keys.down) {
312
362
  event.preventDefault();
313
363
  event.stopPropagation();
364
+ this.setOpen(true);
365
+ }
366
+ },
367
+ onKeyDownHandler: function onKeyDownHandler(event) {
368
+ var altKey = event.altKey,
369
+ keyCode = event.keyCode;
314
370
 
315
- if (keyCode === Keys.up && this.focusableElement) {
316
- this.focusableElement.focus();
317
- this.setOpen(false);
318
- }
371
+ if (keyCode === Keys.esc) {
372
+ event.preventDefault();
373
+ event.stopPropagation();
374
+ this.setOpen(false);
375
+ return;
376
+ }
319
377
 
320
- if (keyCode === Keys.down) {
321
- this.setOpen(true);
322
- }
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();
323
390
  }
324
391
  },
325
392
  onOpenHandler: function onOpenHandler() {
326
393
  // Skip content autofocus when in controlled mode
327
- if (!this.isOpenControlled) {
328
- if (this.palette) {
329
- this.palette.focus();
330
- }
394
+ var palette = getRef(this, 'palette');
395
+
396
+ if (palette) {
397
+ palette.focus();
331
398
  }
332
399
  },
333
400
  onClickHandler: function onClickHandler() {
@@ -343,9 +410,10 @@ var ColorPickerVue2 = {
343
410
  if (this.blurTimeoutRef) {
344
411
  clearTimeout(this.blurTimeoutRef);
345
412
  this.blurTimeoutRef = undefined; // case where moving back to input from popup
346
- // if (event.target === this.focusableElement) {
347
- // this.setOpen(false); // in this case we should focus input on keydown
348
- // }
413
+
414
+ if (event.target === this.$el) {
415
+ this.setOpen(false); // in this case we should focus input on keydown
416
+ }
349
417
  } else {
350
418
  this.focused = true;
351
419
  }
@@ -355,18 +423,22 @@ var ColorPickerVue2 = {
355
423
  });
356
424
  },
357
425
  onBlurTimeout: function onBlurTimeout() {
358
- var paleteIsFocused = this.palette && document.activeElement === this.palette.$el;
426
+ var _a, _b;
359
427
 
360
- if (!paleteIsFocused) {
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) {
361
431
  this.setOpen(false, true);
362
432
  }
363
433
 
364
- this.focused = paleteIsFocused;
434
+ this.focused = viewIsFocused;
365
435
  this.blurTimeoutRef = undefined;
366
436
  },
367
437
  onBlurHandler: function onBlurHandler(event) {
368
438
  clearTimeout(this.blurTimeoutRef);
369
- this.blurTimeoutRef = window.setTimeout(this.onBlurTimeout, 200);
439
+ this.palette = getRef(this, 'palette');
440
+ this.gradient = getRef(this, 'gradient');
441
+ this.blurTimeoutRef = setTimeout(this.onBlurTimeout, 200);
370
442
  this.$emit('blur', {
371
443
  event: event
372
444
  });
@@ -375,7 +447,7 @@ var ColorPickerVue2 = {
375
447
  var currentValue = isPalette ? event.rgbaValue : event.value;
376
448
 
377
449
  if (!this.isValueControlled) {
378
- this.stateValue = currentValue;
450
+ this.currentValue = currentValue;
379
451
  }
380
452
 
381
453
  if (isPalette) {
@@ -387,6 +459,9 @@ var ColorPickerVue2 = {
387
459
  event: event
388
460
  });
389
461
  },
462
+ onGradientChangeHandler: function onGradientChangeHandler(event) {
463
+ this.onChangeHandler(event, false);
464
+ },
390
465
  onPaletteChangeHandler: function onPaletteChangeHandler(event) {
391
466
  this.onChangeHandler(event, true);
392
467
  }
@@ -63,6 +63,8 @@ var FlatColorPickerVue2 = {
63
63
  },
64
64
  // @ts-ignore
65
65
  render: function render(createElement) {
66
+ var _this2 = this;
67
+
66
68
  var _this = this;
67
69
 
68
70
  var h = gh || createElement;
@@ -87,16 +89,24 @@ var FlatColorPickerVue2 = {
87
89
  return [// @ts-ignore function children
88
90
  h(Button, {
89
91
  type: "button",
90
- attrs: _this.v3 ? undefined : {
92
+ attrs: _this2.v3 ? undefined : {
91
93
  type: "button",
92
94
  togglable: true,
93
95
  fillMode: 'flat',
94
- selected: _this.colorGradientView
96
+ selected: _this2.isColorGradient
95
97
  },
96
98
  togglable: true,
97
99
  fillMode: 'flat',
98
- selected: _this.colorGradientView
99
- }, _this.v3 ? function () {
100
+ selected: _this2.isColorGradient,
101
+ onClick: function onClick(e) {
102
+ return _this.handleViewChange(e, 'ColorGradient');
103
+ },
104
+ on: _this2.v3 ? undefined : {
105
+ "click": function onClick(e) {
106
+ return _this.handleViewChange(e, 'ColorGradient');
107
+ }
108
+ }
109
+ }, _this2.v3 ? function () {
100
110
  return [h("span", {
101
111
  "class": "k-icon k-i-color-canvas"
102
112
  })];
@@ -105,16 +115,24 @@ var FlatColorPickerVue2 = {
105
115
  })]), // @ts-ignore function children
106
116
  h(Button, {
107
117
  type: "button",
108
- attrs: _this.v3 ? undefined : {
118
+ attrs: _this2.v3 ? undefined : {
109
119
  type: "button",
110
120
  togglable: true,
111
121
  fillMode: 'flat',
112
- selected: !_this.colorGradientView
122
+ selected: !_this2.isColorGradient
113
123
  },
114
124
  togglable: true,
115
125
  fillMode: 'flat',
116
- selected: !_this.colorGradientView
117
- }, _this.v3 ? function () {
126
+ selected: !_this2.isColorGradient,
127
+ onClick: function onClick(e) {
128
+ return _this.handleViewChange(e, 'ColorPalette');
129
+ },
130
+ on: _this2.v3 ? undefined : {
131
+ "click": function onClick(e) {
132
+ return _this.handleViewChange(e, 'ColorPalette');
133
+ }
134
+ }
135
+ }, _this2.v3 ? function () {
118
136
  return [h("span", {
119
137
  "class": "k-icon k-i-palette"
120
138
  })];
@@ -123,16 +141,24 @@ var FlatColorPickerVue2 = {
123
141
  })])];
124
142
  } : [h(Button, {
125
143
  type: "button",
126
- attrs: _this.v3 ? undefined : {
144
+ attrs: _this2.v3 ? undefined : {
127
145
  type: "button",
128
146
  togglable: true,
129
147
  fillMode: 'flat',
130
- selected: _this.colorGradientView
148
+ selected: _this2.isColorGradient
131
149
  },
132
150
  togglable: true,
133
151
  fillMode: 'flat',
134
- selected: _this.colorGradientView
135
- }, _this.v3 ? function () {
152
+ selected: _this2.isColorGradient,
153
+ onClick: function onClick(e) {
154
+ return _this.handleViewChange(e, 'ColorGradient');
155
+ },
156
+ on: _this2.v3 ? undefined : {
157
+ "click": function onClick(e) {
158
+ return _this.handleViewChange(e, 'ColorGradient');
159
+ }
160
+ }
161
+ }, _this2.v3 ? function () {
136
162
  return [h("span", {
137
163
  "class": "k-icon k-i-color-canvas"
138
164
  })];
@@ -140,16 +166,24 @@ var FlatColorPickerVue2 = {
140
166
  "class": "k-icon k-i-color-canvas"
141
167
  })]), h(Button, {
142
168
  type: "button",
143
- attrs: _this.v3 ? undefined : {
169
+ attrs: _this2.v3 ? undefined : {
144
170
  type: "button",
145
171
  togglable: true,
146
172
  fillMode: 'flat',
147
- selected: !_this.colorGradientView
173
+ selected: !_this2.isColorGradient
148
174
  },
149
175
  togglable: true,
150
176
  fillMode: 'flat',
151
- selected: !_this.colorGradientView
152
- }, _this.v3 ? function () {
177
+ selected: !_this2.isColorGradient,
178
+ onClick: function onClick(e) {
179
+ return _this.handleViewChange(e, 'ColorPalette');
180
+ },
181
+ on: _this2.v3 ? undefined : {
182
+ "click": function onClick(e) {
183
+ return _this.handleViewChange(e, 'ColorPalette');
184
+ }
185
+ }
186
+ }, _this2.v3 ? function () {
153
187
  return [h("span", {
154
188
  "class": "k-icon k-i-palette"
155
189
  })];
@@ -254,8 +288,12 @@ var FlatColorPickerVue2 = {
254
288
  this.$el.focus();
255
289
  }
256
290
  },
257
- handleViewChange: function handleViewChange(viewType) {
291
+ handleViewChange: function handleViewChange(event, viewType) {
258
292
  this.currentView = viewType;
293
+ this.$emit('viewchange', {
294
+ event: event,
295
+ viewType: viewType
296
+ });
259
297
  },
260
298
  handleResetColor: function handleResetColor() {
261
299
  this.colorValue = 'rgba(255, 255, 255, 1)';
@@ -278,7 +316,7 @@ var FlatColorPickerVue2 = {
278
316
  }
279
317
  },
280
318
  handleFlatColorPickerBlur: function handleFlatColorPickerBlur() {
281
- this.prevColor(this.colorValue);
319
+ this.prevColor = this.colorValue;
282
320
  }
283
321
  }
284
322
  };
@@ -12,16 +12,27 @@ import { Input } from '../input/Input';
12
12
 
13
13
  var HexInputVue2 = {
14
14
  name: 'KendoHexInput',
15
+ // @ts-ignore
16
+ emits: {
17
+ 'hexchange': null,
18
+ 'blur': null,
19
+ 'focus': null
20
+ },
15
21
  props: {
16
22
  hex: String,
17
23
  disabled: Boolean
18
24
  },
19
25
  data: function data() {
20
26
  return {
21
- hex: this.$props.hex,
27
+ currentHex: this.$props.hex,
22
28
  originalHex: this.$props.hex
23
29
  };
24
30
  },
31
+ computed: {
32
+ computedHex: function computedHex() {
33
+ return this.hex !== undefined ? this.hex : this.currentHex;
34
+ }
35
+ },
25
36
  // @ts-ignore
26
37
  setup: !isV3 ? undefined : function () {
27
38
  var v3 = !!isV3;
@@ -33,16 +44,18 @@ var HexInputVue2 = {
33
44
  render: function render(createElement) {
34
45
  var h = gh || createElement;
35
46
  return h(Input, {
36
- value: this.hex,
47
+ value: this.computedHex,
37
48
  attrs: this.v3 ? undefined : {
38
- value: this.hex,
49
+ value: this.computedHex,
39
50
  disabled: this.$props.disabled
40
51
  },
41
52
  onChange: this.onChange,
42
53
  on: this.v3 ? undefined : {
43
54
  "change": this.onChange,
55
+ "focus": this.onFocus,
44
56
  "blur": this.onBlur
45
57
  },
58
+ onFocus: this.onFocus,
46
59
  onBlur: this.onBlur,
47
60
  disabled: this.$props.disabled
48
61
  });
@@ -51,16 +64,21 @@ var HexInputVue2 = {
51
64
  onChange: function onChange(event) {
52
65
  var hex = event.target.value;
53
66
  var value = parseColor(hex, 'rgba');
54
- this.hex = hex;
67
+ this.currentHex = hex;
55
68
 
56
69
  if (isPresent(value)) {
57
- this.$props.onHexChange(hex, value, event);
70
+ this.$emit('hexchange', hex, value, event);
58
71
  }
59
72
  },
60
- onBlur: function onBlur() {
73
+ onBlur: function onBlur(event) {
61
74
  if (!isPresent(parseColor(this.hex, 'rgba'))) {
62
- this.hex = this.originalHex;
75
+ this.currentHex = this.originalHex;
63
76
  }
77
+
78
+ this.$emit('blur', event);
79
+ },
80
+ onFocus: function onFocus(event) {
81
+ this.$emit('focus', event);
64
82
  }
65
83
  }
66
84
  };
@@ -5,6 +5,7 @@ import { ColorPickerActiveColorClick } from './ColorPickerActiveColorClick';
5
5
  import { ColorPickerPopupSettings } from './ColorPickerPopupSettings';
6
6
  import { ColorPickerPaletteSettings } from './ColorPickerPaletteSettings';
7
7
  import { ColorPickerView } from './ColorPickerView';
8
+ import { ColorGradientProps } from './ColorGradientProps';
8
9
  /**
9
10
  * Represents the props of the [Kendo UI for Vue ColorPicker component]({% slug overview_colorpicker %}).
10
11
  */
@@ -46,7 +47,7 @@ export interface ColorPickerProps {
46
47
  * Sets the view which the ColorPicker will render in the popup
47
48
  * ([see example]({% slug combinedview_colorpicker %})).
48
49
  */
49
- view?: ColorPickerView;
50
+ view?: ColorPickerView | string;
50
51
  /**
51
52
  * Represents the `dir` HTML attribute.
52
53
  */
@@ -68,6 +69,10 @@ export interface ColorPickerProps {
68
69
  * ([see example]({% slug customizecolorpicker_colorpicker %}#toc-customizing-the-palette-popup)).
69
70
  */
70
71
  paletteSettings?: ColorPickerPaletteSettings;
72
+ /**
73
+ * Configures the ColorGradient that is displayed in the ColorPicker popup.
74
+ */
75
+ gradientSettings?: ColorGradientProps;
71
76
  /**
72
77
  * Configures the popup of the ColorPicker.
73
78
  */
@@ -5,6 +5,7 @@ import { TableCell } from '../models/table-cell';
5
5
  export declare class ColorPaletteService {
6
6
  colorRows: string[][];
7
7
  setColorMatrix(palette: string[], columns: number): void;
8
+ isInColors(colors: any, current: any): boolean;
8
9
  getCellCoordsFor(color?: string): TableCell | undefined;
9
10
  getColorAt(cellCoords: TableCell): string | undefined;
10
11
  getNextCell(current: TableCell, horizontalStep: number, verticalStep: number): TableCell;