@progress/kendo-vue-inputs 3.4.2 → 3.4.3

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 +170 -87
  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 +169 -85
  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
@@ -8,7 +8,7 @@ import { HSVA } from './models/hsva';
8
8
  * @hidden
9
9
  */
10
10
  export interface ColorContrastSvgProps {
11
- metrics: ClientRect | undefined;
11
+ metrics: any;
12
12
  backgroundColor: string;
13
13
  hsva: HSVA;
14
14
  }
@@ -12,6 +12,7 @@ import { ColorGradientProps } from './interfaces/ColorGradientProps';
12
12
  export interface ColorGradientState {
13
13
  guidId: string;
14
14
  gradientWrapper: any;
15
+ alphaSlider: any;
15
16
  }
16
17
  /**
17
18
  * @hidden
@@ -1,20 +1,4 @@
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
-
1
+ // @ts-ignore
18
2
  import * as Vue from 'vue';
19
3
  var allVue = Vue;
20
4
  var gh = allVue.h;
@@ -40,7 +24,9 @@ var ColorGradientVue2 = {
40
24
  // @ts-ignore
41
25
  emits: {
42
26
  'change': null,
43
- 'focus': null
27
+ 'focus': null,
28
+ 'blur': null,
29
+ 'keydown': null
44
30
  },
45
31
  props: {
46
32
  defaultValue: String,
@@ -64,9 +50,9 @@ var ColorGradientVue2 = {
64
50
  return this.$props.value === undefined;
65
51
  },
66
52
  computedValue: function computedValue() {
67
- var value = this.value || this.defaultValue || parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
53
+ var value = this.value || this.defaultValue || this.currentValue || parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
68
54
 
69
- if (!isPresent(parseColor(this.value, 'hex'))) {
55
+ if (!isPresent(parseColor(value, 'hex'))) {
70
56
  // Validate/sanitize the input.
71
57
  value = DEFAULT_SELECTED_COLOR;
72
58
  }
@@ -74,13 +60,13 @@ var ColorGradientVue2 = {
74
60
  return value;
75
61
  },
76
62
  hsva: function hsva() {
77
- return getCachedHsva(this.guid, this.computedValue) || getHSV(this.computedValue);
63
+ return this.currentHsva || getCachedHsva(this.guid, this.computedValue) || getHSV(this.computedValue);
78
64
  },
79
65
  rgba: function rgba() {
80
- return getCachedRgba(this.guid, this.computedValue) || getRGBA(this.computedValue);
66
+ return this.currentRgba || getCachedRgba(this.guid, this.computedValue) || getRGBA(this.computedValue);
81
67
  },
82
68
  hex: function hex() {
83
- return getCachedHex(this.guid, this.computedValue) || parseColor(this.computedValue, 'hex');
69
+ return this.currentHex || getCachedHex(this.guid, this.computedValue) || parseColor(this.computedValue, 'hex');
84
70
  },
85
71
  computedBgColor: function computedBgColor() {
86
72
  return this.backgroundColor !== undefined ? this.backgroundColor : this.currentBgColor || getColorFromHue(this.hsva.h);
@@ -88,8 +74,12 @@ var ColorGradientVue2 = {
88
74
  },
89
75
  data: function data() {
90
76
  return {
77
+ currentValue: undefined,
91
78
  currentBgColor: undefined,
92
- isFirstRender: true
79
+ isFirstRender: true,
80
+ currentHsva: undefined,
81
+ currentRgba: undefined,
82
+ currentHex: undefined
93
83
  };
94
84
  },
95
85
  mounted: function mounted() {
@@ -109,11 +99,10 @@ var ColorGradientVue2 = {
109
99
  destroyed: function destroyed() {
110
100
  removeCachedColor(this.guid);
111
101
  },
112
- updated: function updated() {// if (prevState.backgroundColor !== this.backgroundColor) {
113
- // this.setAlphaSliderBackground(this.backgroundColor);
114
- // }
102
+ updated: function updated() {
103
+ // if (prevState.backgroundColor !== this.backgroundColor) {
104
+ this.setAlphaSliderBackground(this.computedBgColor); // }
115
105
  },
116
- // private alphaSlider: any;
117
106
  // @ts-ignore
118
107
  setup: !isV3 ? undefined : function () {
119
108
  var v3 = !!isV3;
@@ -165,8 +154,12 @@ var ColorGradientVue2 = {
165
154
  "aria-describedby": this.$props.ariaDescribedBy,
166
155
  onFocus: this.onFocus,
167
156
  on: this.v3 ? undefined : {
168
- "focus": this.onFocus
169
- }
157
+ "focus": this.onFocus,
158
+ "blur": this.onBlur,
159
+ "keydown": this.onKeyDownHandler
160
+ },
161
+ onBlur: this.onBlur,
162
+ onKeydown: this.onKeyDownHandler
170
163
  }, [h("div", {
171
164
  "class": "k-colorgradient-canvas k-hstack"
172
165
  }, [h("div", {
@@ -232,8 +225,12 @@ var ColorGradientVue2 = {
232
225
  step: 5,
233
226
  onChange: this.onHueSliderChange,
234
227
  on: this.v3 ? undefined : {
235
- "change": this.onHueSliderChange
228
+ "change": this.onHueSliderChange,
229
+ "focus": this.onFocus,
230
+ "blur": this.onBlur
236
231
  },
232
+ onFocus: this.onFocus,
233
+ onBlur: this.onBlur,
237
234
  "class": "k-hue-slider k-colorgradient-slider",
238
235
  disabled: this.$props.disabled
239
236
  }), this.$props.opacity && h(Slider, {
@@ -254,8 +251,12 @@ var ColorGradientVue2 = {
254
251
  step: 1,
255
252
  onChange: this.onAlphaSliderChange,
256
253
  on: this.v3 ? undefined : {
257
- "change": this.onAlphaSliderChange
254
+ "change": this.onAlphaSliderChange,
255
+ "focus": this.onFocus,
256
+ "blur": this.onBlur
258
257
  },
258
+ onFocus: this.onFocus,
259
+ onBlur: this.onBlur,
259
260
  "class": "k-alpha-slider k-colorgradient-slider",
260
261
  disabled: this.$props.disabled,
261
262
  ref: this.v3 ? function (el) {
@@ -269,13 +270,17 @@ var ColorGradientVue2 = {
269
270
  opacity: this.$props.opacity,
270
271
  disabled: this.$props.disabled
271
272
  },
272
- onRgbaChange: this.onRgbaChange,
273
+ onRgbachange: this.onRgbaChange,
273
274
  on: this.v3 ? undefined : {
274
- "rgbaChange": this.onRgbaChange,
275
- "hexChange": this.onHexChange
275
+ "rgbachange": this.onRgbaChange,
276
+ "focus": this.onFocus,
277
+ "blur": this.onBlur,
278
+ "hexchange": this.onHexChange
276
279
  },
277
280
  hex: this.hex,
278
- onHexChange: this.onHexChange,
281
+ onFocus: this.onFocus,
282
+ onBlur: this.onBlur,
283
+ onHexchange: this.onHexChange,
279
284
  opacity: this.$props.opacity,
280
285
  disabled: this.$props.disabled
281
286
  }), this.computedBgColor && h(ColorContrastLabels, {
@@ -295,13 +300,16 @@ var ColorGradientVue2 = {
295
300
  // }
296
301
  // return null;
297
302
  // },
303
+ onKeyDownHandler: function onKeyDownHandler(e) {
304
+ this.$emit('keydown', e);
305
+ },
298
306
  onHexChange: function onHexChange(hex, value, event) {
299
307
  if (this.isUncontrolled) {
300
308
  var hsva = getHSV(value);
301
- this.hsva = hsva;
302
- this.cu = getColorFromHue(hsva.h);
303
- this.rgba = getRGBA(value);
304
- this.hex = hex;
309
+ this.currentHsva = hsva;
310
+ this.currentBgColor = getColorFromHue(hsva.h);
311
+ this.currentRgba = getRGBA(value);
312
+ this.currentHex = hex;
305
313
  } else {
306
314
  cacheHex(this.guid, value, hex);
307
315
  }
@@ -314,10 +322,10 @@ var ColorGradientVue2 = {
314
322
  if (this.isUncontrolled) {
315
323
  var hsva = getHSV(value);
316
324
  var hex = parseColor(value, 'hex');
317
- this.hsva = hsva;
325
+ this.currentHsva = hsva;
318
326
  this.currentBgColor = getColorFromHue(hsva.h);
319
- this.rgba = rgba;
320
- this.hex = hex;
327
+ this.currentRgba = rgba;
328
+ this.currentHex = hex;
321
329
  } else {
322
330
  cacheRgba(this.guid, value, rgba);
323
331
  }
@@ -361,10 +369,10 @@ var ColorGradientVue2 = {
361
369
 
362
370
  if (this.isUncontrolled) {
363
371
  var hex = parseColor(value, 'hex');
364
- this.hsva = hsva;
372
+ this.currentHsva = hsva;
365
373
  this.currentBgColor = getColorFromHue(hsva.h);
366
- this.rgba = getRGBA(value);
367
- this.hex = hex;
374
+ this.currentRgba = getRGBA(value);
375
+ this.currentHex = hex;
368
376
  } else {
369
377
  cacheHsva(this.guid, value, hsva);
370
378
  }
@@ -372,19 +380,24 @@ var ColorGradientVue2 = {
372
380
  this.dispatchChangeEvent(value, event);
373
381
  },
374
382
  dispatchChangeEvent: function dispatchChangeEvent(value, event) {
383
+ this.currentValue = value;
375
384
  this.$emit('change', {
376
385
  event: event,
377
386
  target: this,
378
387
  value: value
379
388
  });
380
389
  },
381
- onFocus: function onFocus(nativeEvent) {
382
- if (this.$props.onFocus) {
383
- this.$props.onFocus.call(undefined, {
384
- nativeEvent: nativeEvent,
385
- target: this
386
- });
387
- }
390
+ onFocus: function onFocus(event) {
391
+ this.$emit('focus', {
392
+ event: event,
393
+ target: this
394
+ });
395
+ },
396
+ onBlur: function onBlur(event) {
397
+ this.$emit('blur', {
398
+ event: event,
399
+ target: this
400
+ });
388
401
  },
389
402
  setAlphaSliderBackground: function setAlphaSliderBackground(backgroundColor) {
390
403
  if (this.$props.opacity && this.alphaSlider && this.alphaSlider.sliderTrack) {
@@ -392,8 +405,17 @@ var ColorGradientVue2 = {
392
405
  }
393
406
  },
394
407
  getGradientRectMetrics: function getGradientRectMetrics() {
395
- var clientRect = this.gradientWrapper.getBoundingClientRect();
396
- return __assign({}, clientRect);
408
+ var rect = this.gradientWrapper.getBoundingClientRect();
409
+ return {
410
+ top: rect.top,
411
+ right: rect.right,
412
+ bottom: rect.bottom,
413
+ left: rect.left,
414
+ width: rect.width,
415
+ height: rect.height,
416
+ x: rect.x,
417
+ y: rect.y
418
+ };
397
419
  },
398
420
  focus: function focus() {
399
421
  focusFirstFocusableChild(this.$el);
@@ -36,12 +36,24 @@ var modes = ['rgba', 'rgb', 'hex'];
36
36
 
37
37
  var ColorInputVue2 = {
38
38
  name: 'KendoColorInput',
39
+ // @ts-ignore
40
+ emits: {
41
+ 'focus': null,
42
+ 'blur': null,
43
+ 'hexchange': null,
44
+ 'rgbachange': null
45
+ },
39
46
  props: {
40
47
  rgba: Object,
41
48
  hex: String,
42
49
  opacity: Boolean,
43
50
  disabled: Boolean
44
51
  },
52
+ inject: {
53
+ kendoLocalizationService: {
54
+ default: null
55
+ }
56
+ },
45
57
  data: function data() {
46
58
  return {
47
59
  inputMode: modes[1]
@@ -74,11 +86,15 @@ var ColorInputVue2 = {
74
86
  icon: 'arrows-kpi'
75
87
  },
76
88
  icon: 'arrows-kpi',
77
- "class": "k-colorgradient-toggle-mode k-icon-button",
78
- onClick: this.onToggleModeChange.bind(this),
89
+ onFocus: this.onFocus,
79
90
  on: this.v3 ? undefined : {
80
- "click": this.onToggleModeChange.bind(this)
81
- }
91
+ "focus": this.onFocus,
92
+ "blur": this.onBlur,
93
+ "click": this.onToggleModeChange
94
+ },
95
+ onBlur: this.onBlur,
96
+ "class": "k-colorgradient-toggle-mode k-icon-button",
97
+ onClick: this.onToggleModeChange
82
98
  })]), this.inputMode === 'hex' && h("div", {
83
99
  "class": "k-vstack k-flex-1"
84
100
  }, [h("span", {
@@ -89,10 +105,14 @@ var ColorInputVue2 = {
89
105
  hex: this.$props.hex,
90
106
  disabled: this.$props.disabled
91
107
  },
92
- onHexChange: this.$props.onHexChange,
108
+ onFocus: this.onFocus,
93
109
  on: this.v3 ? undefined : {
94
- "hexChange": this.$props.onHexChange
110
+ "focus": this.onFocus,
111
+ "blur": this.onBlur,
112
+ "hexchange": this.onHexChange
95
113
  },
114
+ onBlur: this.onBlur,
115
+ onHexchange: this.onHexChange,
96
116
  disabled: this.$props.disabled
97
117
  })]), // @ts-ignore function children
98
118
  h(Label, {
@@ -115,10 +135,14 @@ var ColorInputVue2 = {
115
135
  max: 255,
116
136
  spinners: false,
117
137
  format: "n",
118
- onChange: this.onRgbaRChange,
138
+ onFocus: this.onFocus,
119
139
  on: this.v3 ? undefined : {
140
+ "focus": this.onFocus,
141
+ "blur": this.onBlur,
120
142
  "change": this.onRgbaRChange
121
143
  },
144
+ onBlur: this.onBlur,
145
+ onChange: this.onRgbaRChange,
122
146
  disabled: this.$props.disabled
123
147
  }), // @ts-ignore function children
124
148
  h(Label, {
@@ -141,10 +165,14 @@ var ColorInputVue2 = {
141
165
  max: 255,
142
166
  spinners: false,
143
167
  format: "n",
144
- onChange: this.onRgbaGChange,
168
+ onFocus: this.onFocus,
145
169
  on: this.v3 ? undefined : {
170
+ "focus": this.onFocus,
171
+ "blur": this.onBlur,
146
172
  "change": this.onRgbaGChange
147
173
  },
174
+ onBlur: this.onBlur,
175
+ onChange: this.onRgbaGChange,
148
176
  disabled: this.$props.disabled
149
177
  }), // @ts-ignore function children
150
178
  h(Label, {
@@ -167,10 +195,14 @@ var ColorInputVue2 = {
167
195
  max: 255,
168
196
  spinners: false,
169
197
  format: "n",
170
- onChange: this.onRgbaBChange,
198
+ onFocus: this.onFocus,
171
199
  on: this.v3 ? undefined : {
200
+ "focus": this.onFocus,
201
+ "blur": this.onBlur,
172
202
  "change": this.onRgbaBChange
173
203
  },
204
+ onBlur: this.onBlur,
205
+ onChange: this.onRgbaBChange,
174
206
  disabled: this.$props.disabled
175
207
  }), // @ts-ignore function children
176
208
  h(Label, {
@@ -195,19 +227,32 @@ var ColorInputVue2 = {
195
227
  step: 0.01,
196
228
  spinners: false,
197
229
  format: "n2",
198
- onChange: this.onRgbaAChange,
230
+ onFocus: this.onFocus,
199
231
  on: this.v3 ? undefined : {
232
+ "focus": this.onFocus,
233
+ "blur": this.onBlur,
200
234
  "change": this.onRgbaAChange
201
235
  },
236
+ onBlur: this.onBlur,
237
+ onChange: this.onRgbaAChange,
202
238
  disabled: this.$props.disabled
203
- }), "(this.$props.opacity &&", // @ts-ignore function children
239
+ }), this.$props.opacity && // @ts-ignore function children
204
240
  h(Label, {
205
241
  "class": "k-colorgradient-input-label"
206
242
  }, this.v3 ? function () {
207
243
  return [aMessage];
208
- } : [aMessage]), ")"])]);
244
+ } : [aMessage])])]);
209
245
  },
210
246
  methods: {
247
+ onFocus: function onFocus(event) {
248
+ this.$emit('focus', event);
249
+ },
250
+ onBlur: function onBlur(event) {
251
+ this.$emit('blur', event);
252
+ },
253
+ onHexChange: function onHexChange(event) {
254
+ this.$emit('hexchange', event);
255
+ },
211
256
  onRgbaRChange: function onRgbaRChange(event) {
212
257
  this.dispatchRgbaChange({
213
258
  r: event.value
@@ -247,7 +292,7 @@ var ColorInputVue2 = {
247
292
  rgba.a = newValue.a;
248
293
  }
249
294
 
250
- this.$props.onRgbaChange(rgba, event);
295
+ this.$emit('rgbachange', rgba, event);
251
296
  },
252
297
  onToggleModeChange: function onToggleModeChange() {
253
298
  var index = modes.length - 1 === modes.indexOf(this.inputMode) ? 0 : modes.indexOf(this.inputMode) + 1;
@@ -43,7 +43,6 @@ export interface ColorPaletteMethods {
43
43
  export interface ColorPaletteData {
44
44
  selectedColor?: string;
45
45
  focusedColor?: string;
46
- isFirstRender: boolean;
47
46
  }
48
47
  /**
49
48
  * @hidden
@@ -78,9 +78,8 @@ var ColorPaletteVue2 = {
78
78
  },
79
79
  data: function data() {
80
80
  return {
81
- focusedColor: undefined,
82
- currentValue: undefined,
83
- isFirstRender: true
81
+ focusedColor: this.$props.value,
82
+ currentValue: undefined
84
83
  };
85
84
  },
86
85
  // @ts-ignore
@@ -99,7 +98,7 @@ var ColorPaletteVue2 = {
99
98
  var selectedCellCoords = svc.getCellCoordsFor(this.selectedColor);
100
99
  var focusedCellCoords = svc.getCellCoordsFor(this.focusedColor);
101
100
  var className = classNames('k-colorpalette', {
102
- 'k-state-disabled': this.$props.disabled
101
+ 'k-disabled': this.$props.disabled
103
102
  });
104
103
 
105
104
  var renderColumns = function renderColumns(columns, rowIndex, cSelectedCellCoords, cFocusedCellCoords) {
@@ -118,8 +117,8 @@ var ColorPaletteVue2 = {
118
117
 
119
118
  var isSelected = rowIsSelected && selectedColumn === i;
120
119
  var tdClassName = classNames('k-colorpalette-tile', {
121
- 'k-state-selected': isSelected,
122
- 'k-state-focus': rowIsFocused && focusedColumn === i
120
+ 'k-selected': isSelected,
121
+ 'k-focus': rowIsFocused && focusedColumn === i
123
122
  });
124
123
  return h("td", {
125
124
  "class": tdClassName,
@@ -219,27 +218,6 @@ var ColorPaletteVue2 = {
219
218
  this.wrapper.focus();
220
219
  }
221
220
  },
222
- getDerivedStateFromProps: function getDerivedStateFromProps(props, state) {
223
- if (!state.isFirstRender && props.value !== undefined) {
224
- // The component is in controlled mode.
225
- if (props.value === '' && state.selectedColor !== undefined) {
226
- // The selection has to be removed.
227
- return {
228
- selectedColor: undefined
229
- };
230
- } else if (props.value !== '' && props.value !== state.selectedColor) {
231
- return {
232
- selectedColor: props.value
233
- };
234
- }
235
- } else if (state.isFirstRender) {
236
- return {
237
- isFirstRender: false
238
- };
239
- }
240
-
241
- return null;
242
- },
243
221
  onKeyDown: function onKeyDown(event) {
244
222
  switch (event.keyCode) {
245
223
  case Keys.down:
@@ -267,7 +245,6 @@ var ColorPaletteVue2 = {
267
245
  return;
268
246
  }
269
247
 
270
- event.preventDefault();
271
248
  this.$emit('keydown', event);
272
249
  },
273
250
  onColorClick: function onColorClick(color, event) {
@@ -15,7 +15,6 @@ export interface ColorPickerHandle {
15
15
  */
16
16
  export interface ColorPickerState {
17
17
  focusableElementGuid: string;
18
- focusableElement: any;
19
18
  palette: any | null;
20
19
  blurTimeout: any | undefined;
21
20
  button: HTMLSpanElement | null;