@progress/kendo-vue-inputs 3.4.4 → 3.4.5-dev.202207300828

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/cdn/js/kendo-vue-inputs.js +1 -1
  2. package/dist/es/checkbox/Checkbox.js +2 -2
  3. package/dist/es/colors/ColorGradient.d.ts +2 -0
  4. package/dist/es/colors/ColorGradient.js +152 -47
  5. package/dist/es/colors/ColorInput.d.ts +3 -0
  6. package/dist/es/colors/ColorInput.js +80 -56
  7. package/dist/es/colors/ColorPalette.js +30 -16
  8. package/dist/es/colors/ColorPicker.d.ts +1 -0
  9. package/dist/es/colors/ColorPicker.js +89 -69
  10. package/dist/es/colors/FlatColorPicker.d.ts +41 -5
  11. package/dist/es/colors/FlatColorPicker.js +306 -109
  12. package/dist/es/colors/HexInput.d.ts +1 -0
  13. package/dist/es/colors/HexInput.js +16 -2
  14. package/dist/es/colors/Picker.js +19 -11
  15. package/dist/es/colors/interfaces/ColorGradientChangeEvent.d.ts +4 -0
  16. package/dist/es/colors/interfaces/ColorGradientProps.d.ts +12 -0
  17. package/dist/es/colors/interfaces/ColorPaletteChangeEvent.d.ts +0 -3
  18. package/dist/es/colors/interfaces/ColorPaletteProps.d.ts +8 -3
  19. package/dist/es/colors/interfaces/ColorPickerActiveColorClick.d.ts +0 -3
  20. package/dist/es/colors/interfaces/ColorPickerBlurEvent.d.ts +0 -3
  21. package/dist/es/colors/interfaces/ColorPickerChangeEvent.d.ts +4 -3
  22. package/dist/es/colors/interfaces/ColorPickerFocusEvent.d.ts +0 -3
  23. package/dist/es/colors/interfaces/ColorPickerPaletteSettings.d.ts +0 -3
  24. package/dist/es/colors/interfaces/ColorPickerPopupSettings.d.ts +0 -3
  25. package/dist/es/colors/interfaces/ColorPickerProps.d.ts +30 -4
  26. package/dist/es/colors/interfaces/ColorPickerView.d.ts +0 -3
  27. package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
  28. package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.js +0 -0
  29. package/dist/es/colors/interfaces/PickerProps.d.ts +4 -0
  30. package/dist/es/colors/utils/color-cache.d.ts +13 -0
  31. package/dist/es/colors/utils/color-cache.js +14 -0
  32. package/dist/es/colors/utils/color-parser.d.ts +7 -1
  33. package/dist/es/colors/utils/color-parser.js +11 -2
  34. package/dist/es/input/Input.d.ts +4 -0
  35. package/dist/es/input/Input.js +8 -3
  36. package/dist/es/messages/index.d.ts +45 -0
  37. package/dist/es/messages/index.js +46 -0
  38. package/dist/es/numerictextbox/NumericTextBox.js +3 -0
  39. package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.d.ts +4 -0
  40. package/dist/es/package-metadata.js +1 -1
  41. package/dist/es/radiobutton/RadioButton.js +1 -1
  42. package/dist/es/radiobutton/RadioGroup.js +1 -1
  43. package/dist/es/range-slider/RangeSlider.js +1 -1
  44. package/dist/es/slider/Slider.js +2 -2
  45. package/dist/npm/checkbox/Checkbox.js +2 -2
  46. package/dist/npm/colors/ColorGradient.d.ts +2 -0
  47. package/dist/npm/colors/ColorGradient.js +153 -46
  48. package/dist/npm/colors/ColorInput.d.ts +3 -0
  49. package/dist/npm/colors/ColorInput.js +80 -55
  50. package/dist/npm/colors/ColorPalette.js +30 -16
  51. package/dist/npm/colors/ColorPicker.d.ts +1 -0
  52. package/dist/npm/colors/ColorPicker.js +90 -70
  53. package/dist/npm/colors/FlatColorPicker.d.ts +41 -5
  54. package/dist/npm/colors/FlatColorPicker.js +306 -106
  55. package/dist/npm/colors/HexInput.d.ts +1 -0
  56. package/dist/npm/colors/HexInput.js +16 -2
  57. package/dist/npm/colors/Picker.js +18 -10
  58. package/dist/npm/colors/interfaces/ColorGradientChangeEvent.d.ts +4 -0
  59. package/dist/npm/colors/interfaces/ColorGradientProps.d.ts +12 -0
  60. package/dist/npm/colors/interfaces/ColorPaletteChangeEvent.d.ts +0 -3
  61. package/dist/npm/colors/interfaces/ColorPaletteProps.d.ts +8 -3
  62. package/dist/npm/colors/interfaces/ColorPickerActiveColorClick.d.ts +0 -3
  63. package/dist/npm/colors/interfaces/ColorPickerBlurEvent.d.ts +0 -3
  64. package/dist/npm/colors/interfaces/ColorPickerChangeEvent.d.ts +4 -3
  65. package/dist/npm/colors/interfaces/ColorPickerFocusEvent.d.ts +0 -3
  66. package/dist/npm/colors/interfaces/ColorPickerPaletteSettings.d.ts +0 -3
  67. package/dist/npm/colors/interfaces/ColorPickerPopupSettings.d.ts +0 -3
  68. package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +30 -4
  69. package/dist/npm/colors/interfaces/ColorPickerView.d.ts +0 -3
  70. package/dist/npm/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
  71. package/dist/npm/colors/interfaces/FlatColorPickerViewChangeEvent.js +2 -0
  72. package/dist/npm/colors/interfaces/PickerProps.d.ts +4 -0
  73. package/dist/npm/colors/utils/color-cache.d.ts +13 -0
  74. package/dist/npm/colors/utils/color-cache.js +15 -1
  75. package/dist/npm/colors/utils/color-parser.d.ts +7 -1
  76. package/dist/npm/colors/utils/color-parser.js +12 -3
  77. package/dist/npm/input/Input.d.ts +4 -0
  78. package/dist/npm/input/Input.js +8 -3
  79. package/dist/npm/messages/index.d.ts +45 -0
  80. package/dist/npm/messages/index.js +47 -1
  81. package/dist/npm/numerictextbox/NumericTextBox.js +3 -0
  82. package/dist/npm/numerictextbox/interfaces/NumericTextBoxProps.d.ts +4 -0
  83. package/dist/npm/package-metadata.js +1 -1
  84. package/dist/npm/radiobutton/RadioButton.js +1 -1
  85. package/dist/npm/radiobutton/RadioGroup.js +1 -1
  86. package/dist/npm/range-slider/RangeSlider.js +1 -1
  87. package/dist/npm/slider/Slider.js +2 -2
  88. package/package.json +11 -11
@@ -24,23 +24,8 @@ import { classNames, Keys, // useDir,
24
24
  getTabIndex, guid, kendoThemeMaps, validatePackage, setRef, getRef } from '@progress/kendo-vue-common';
25
25
  import { packageMetadata } from '../package-metadata';
26
26
  import { Picker } from './Picker';
27
- import { ColorPalette, DEFAULT_PRESET, DEFAULT_TILE_SIZE } from './ColorPalette';
28
- import { ColorGradient } from './ColorGradient';
29
- /**
30
- * @hidden
31
- */
32
-
33
- var DEFAULT_GRADIENT_SETTINGS = {
34
- opacity: true
35
- };
36
- /**
37
- * @hidden
38
- */
39
-
40
- var DEFAULT_PALETTE_SETTINGS = {
41
- palette: DEFAULT_PRESET,
42
- tileSize: DEFAULT_TILE_SIZE
43
- };
27
+ import { FlatColorPicker } from './FlatColorPicker';
28
+ import { DEFAULT_GRADIENT_SETTINGS, DEFAULT_PALETTE_SETTINGS } from './utils/color-cache';
44
29
  /**
45
30
  * @hidden
46
31
  */
@@ -55,16 +40,25 @@ var isControlled = function isControlled(prop) {
55
40
 
56
41
  var ColorPickerVue2 = {
57
42
  name: 'KendoColorPicker',
43
+ model: {
44
+ event: 'changemodel'
45
+ },
58
46
  // @ts-ignore
59
47
  emits: {
60
48
  'open': null,
61
49
  'close': null,
50
+ 'changemodel': null,
51
+ 'update:modelValue': null,
52
+ 'update:modelRgbaValue': null,
62
53
  'activecolorclick': null,
63
54
  'focus': null,
64
55
  'blur': null,
65
- 'change': null
56
+ 'change': null,
57
+ 'viewchange': null
66
58
  },
67
59
  props: {
60
+ modelValue: String,
61
+ modelRgbaValue: String,
68
62
  value: {
69
63
  type: String,
70
64
  default: undefined
@@ -75,6 +69,18 @@ var ColorPickerVue2 = {
75
69
  id: String,
76
70
  ariaLabelledBy: String,
77
71
  ariaDescribedBy: String,
72
+ showClearButton: {
73
+ type: Boolean,
74
+ default: true
75
+ },
76
+ showPreview: {
77
+ type: Boolean,
78
+ default: true
79
+ },
80
+ showButtons: {
81
+ type: Boolean,
82
+ default: true
83
+ },
78
84
  paletteSettings: {
79
85
  type: Object,
80
86
  default: function _default() {
@@ -99,6 +105,12 @@ var ColorPickerVue2 = {
99
105
  }
100
106
  },
101
107
  gradientSettings: {
108
+ type: Object,
109
+ default: function _default() {
110
+ return DEFAULT_GRADIENT_SETTINGS;
111
+ }
112
+ },
113
+ flatColorPickerSettings: {
102
114
  type: Object,
103
115
  default: function _default() {
104
116
  return {};
@@ -131,10 +143,14 @@ var ColorPickerVue2 = {
131
143
  },
132
144
  view: {
133
145
  type: String,
134
- default: 'palette',
146
+ default: 'combo',
135
147
  validator: function validator(value) {
136
148
  return ['gradient', 'palette', 'combo'].includes(value);
137
149
  }
150
+ },
151
+ selectedView: {
152
+ type: Number,
153
+ default: undefined
138
154
  }
139
155
  },
140
156
  data: function data() {
@@ -152,7 +168,7 @@ var ColorPickerVue2 = {
152
168
  return this.$props.open !== undefined;
153
169
  },
154
170
  computedValue: function computedValue() {
155
- return this.isValueControlled ? this.$props.value : this.currentValue;
171
+ return this.isValueControlled ? this.$props.value : this.$props.modelValue !== undefined ? this.$props.modelValue : this.$props.modelRgbaValue !== undefined ? this.$props.modelRgbaValue : this.currentValue !== undefined ? this.currentValue : this.defaultValue;
156
172
  },
157
173
  computedOpen: function computedOpen() {
158
174
  return this.isOpenControlled ? this.$props.open : this.currentOpen;
@@ -177,6 +193,7 @@ var ColorPickerVue2 = {
177
193
  },
178
194
  created: function created() {
179
195
  validatePackage(packageMetadata);
196
+ this._popupId = 'popup' + guid();
180
197
  this.focusableElementGuid = guid();
181
198
  },
182
199
  mounted: function mounted() {
@@ -204,46 +221,43 @@ var ColorPickerVue2 = {
204
221
  disabled = _b.disabled,
205
222
  tabIndex = _b.tabIndex,
206
223
  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({
224
+ view = _b.view,
225
+ selectedView = _b.selectedView,
226
+ showClearButton = _b.showClearButton,
227
+ showPreview = _b.showPreview,
228
+ showButtons = _b.showButtons,
229
+ popupSettings = _b.popupSettings;
230
+
231
+ var renderFlatColorPicker = function renderFlatColorPicker() {
232
+ return h(FlatColorPicker, __assign({
233
233
  onKeydown: this.onKeyDownHandler,
234
234
  on: this.v3 ? undefined : {
235
235
  'keydown': this.onKeyDownHandler,
236
- 'change': this.onPaletteChangeHandler,
237
- 'blur': this.onBlurHandler
236
+ 'change': this.onFlatChangeHandler,
237
+ 'blur': this.onBlurHandler,
238
+ 'viewchange': this.onViewChange
238
239
  },
239
- ref: setRef(this, 'palette'),
240
+ ref: setRef(this, 'flatcolorpicker'),
241
+ view: view,
242
+ selectedView: selectedView,
243
+ showClearButton: showClearButton,
244
+ showPreview: showPreview,
245
+ showButtons: showButtons,
240
246
  value: this.computedValue || undefined,
241
247
  attrs: this.v3 ? undefined : __assign({
242
- value: this.computedValue || undefined
243
- }, this.paletteSettings),
244
- onChange: this.onPaletteChangeHandler,
245
- onBlur: this.onBlurHandler
246
- }, this.paletteSettings));
248
+ view: view,
249
+ selectedView: selectedView,
250
+ showClearButton: showClearButton,
251
+ showPreview: showPreview,
252
+ showButtons: showButtons,
253
+ value: this.computedValue || undefined,
254
+ paletteSettings: this.paletteSettings,
255
+ gradientSettings: this.gradientSettings
256
+ }, this.flatColorPickerSettings),
257
+ onChange: this.onFlatChangeHandler,
258
+ onBlur: this.onBlurHandler,
259
+ onViewchange: this.onViewChange
260
+ }, this.flatColorPickerSettings));
247
261
  }; // const dir = useDir(focusableElementGuid, props.dir);
248
262
 
249
263
 
@@ -315,18 +329,22 @@ var ColorPickerVue2 = {
315
329
  dir: dir,
316
330
  attrs: this.v3 ? undefined : {
317
331
  dir: dir,
332
+ id: this._popupId,
318
333
  open: this.computedOpen,
319
- popupAnchor: this.focusableElementGuid
334
+ popupAnchor: this.focusableElementGuid,
335
+ popupSettings: __assign({}, popupSettings)
320
336
  },
337
+ id: this._popupId,
321
338
  open: this.computedOpen,
322
339
  onOpen: this.onOpenHandler,
323
340
  on: this.v3 ? undefined : {
324
341
  "open": this.onOpenHandler
325
342
  },
326
- popupAnchor: this.focusableElementGuid
343
+ popupAnchor: this.focusableElementGuid,
344
+ popupSettings: __assign({}, popupSettings)
327
345
  }, this.v3 ? function () {
328
- return [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)];
329
- } : [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)])]);
346
+ return [renderFlatColorPicker.call(_this2)];
347
+ } : [renderFlatColorPicker.call(_this2)])]);
330
348
  },
331
349
  methods: {
332
350
  focusElement: function focusElement() {
@@ -393,10 +411,10 @@ var ColorPickerVue2 = {
393
411
  },
394
412
  onOpenHandler: function onOpenHandler() {
395
413
  // Skip content autofocus when in controlled mode
396
- var palette = getRef(this, 'palette');
414
+ var flatcolorpicker = getRef(this, 'flatcolorpicker');
397
415
 
398
- if (palette) {
399
- palette.focus();
416
+ if (flatcolorpicker) {
417
+ flatcolorpicker.focus();
400
418
  }
401
419
  },
402
420
  onClickHandler: function onClickHandler() {
@@ -409,9 +427,7 @@ var ColorPickerVue2 = {
409
427
  });
410
428
  },
411
429
  isViewFocused: function isViewFocused() {
412
- var _a, _b;
413
-
414
- return !!((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('.k-colorpalette')) || !!((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.closest('.k-colorgradient'));
430
+ return !!(document.activeElement && document.activeElement.closest("#" + this._popupId));
415
431
  },
416
432
  onButtonBlur: function onButtonBlur() {
417
433
  this.focused = this.isViewFocused();
@@ -451,8 +467,11 @@ var ColorPickerVue2 = {
451
467
  event: event
452
468
  });
453
469
  },
470
+ onViewChange: function onViewChange(event) {
471
+ this.$emit('viewchange', event);
472
+ },
454
473
  onChangeHandler: function onChangeHandler(event, isPalette) {
455
- var currentValue = isPalette ? event.rgbaValue : event.value;
474
+ var currentValue = event.value;
456
475
 
457
476
  if (!this.isValueControlled) {
458
477
  this.currentValue = currentValue;
@@ -462,15 +481,16 @@ var ColorPickerVue2 = {
462
481
  this.setOpen(false);
463
482
  }
464
483
 
484
+ this.$emit('changemodel', currentValue);
485
+ this.$emit('update:modelRgbaValue', event.rgbaValue);
486
+ this.$emit('update:modelValue', currentValue);
465
487
  this.$emit('change', {
466
488
  value: currentValue,
489
+ rgbaValue: event.rgbaValue,
467
490
  event: event
468
491
  });
469
492
  },
470
- onGradientChangeHandler: function onGradientChangeHandler(event) {
471
- this.onChangeHandler(event, false);
472
- },
473
- onPaletteChangeHandler: function onPaletteChangeHandler(event) {
493
+ onFlatChangeHandler: function onFlatChangeHandler(event) {
474
494
  this.onChangeHandler(event, true);
475
495
  }
476
496
  }
@@ -3,6 +3,10 @@ declare type DefaultData<V> = object | ((this: V) => {});
3
3
  declare type DefaultMethods<V> = {
4
4
  [key: string]: (this: V, ...args: any[]) => any;
5
5
  };
6
+ import { ColorPickerChangeEvent } from '../main';
7
+ import { FlatColorPickerViewChangeEvent } from './interfaces/FlatColorPickerViewChangeEvent';
8
+ import { ColorGradientProps } from './interfaces/ColorGradientProps';
9
+ import { ColorPickerPaletteSettings } from './interfaces/ColorPickerPaletteSettings';
6
10
  /**
7
11
  * Represents the properties of [FlatColorPicker](% slug api_inputs_flatcolorpicker %) component.
8
12
  */
@@ -12,13 +16,21 @@ export interface FlatColorPickerProps {
12
16
  */
13
17
  id?: string;
14
18
  /**
15
- * Sets additional classes to the FlatColorPicker.
19
+ * Sets the color model value.
16
20
  */
17
- className?: string;
21
+ modelValue?: string;
22
+ /**
23
+ * The model rgba value of the FlatColorPicker.
24
+ */
25
+ modelRgbaValue?: string;
18
26
  /**
19
27
  * Sets the color value.
20
28
  */
21
29
  value?: string;
30
+ /**
31
+ * Sets the previous color value.
32
+ */
33
+ prevValue?: string;
22
34
  /**
23
35
  * Sets the `tabIndex` property of the FlatColorPicker.
24
36
  */
@@ -28,13 +40,21 @@ export interface FlatColorPickerProps {
28
40
  */
29
41
  disabled?: boolean;
30
42
  /**
31
- * Sets the FlatColorPicker view. The default is `ColorGradient`.
43
+ * Sets the FlatColorPicker view. The default is `combo`.
32
44
  */
33
- view?: 'ColorGradient' | 'ColorPalette' | string;
45
+ view?: 'combo' | 'gradient' | 'palette' | string;
46
+ /**
47
+ * Sets the FlatColorPicker selected view index. The default is `0`.
48
+ */
49
+ selectedView?: number;
34
50
  /**
35
51
  * Sets custom header component.
36
52
  */
37
53
  header?: any;
54
+ /**
55
+ * Sets custom footer component.
56
+ */
57
+ footer?: any;
38
58
  /**
39
59
  * Specifies whether clear button will be rendered in the header.
40
60
  */
@@ -47,9 +67,25 @@ export interface FlatColorPickerProps {
47
67
  * Specifies whether action buttons will be rendered in the footer.
48
68
  */
49
69
  showButtons?: boolean;
70
+ /**
71
+ * Configures the ColorPalette that is displayed in the ColorPicker popup.
72
+ */
73
+ paletteSettings?: ColorPickerPaletteSettings;
74
+ /**
75
+ * Configures the ColorGradient that is displayed in the ColorPicker popup.
76
+ */
77
+ gradientSettings?: ColorGradientProps;
78
+ /**
79
+ * The event handler that will be fired when the view is changed.
80
+ */
81
+ onViewchange?: (event: FlatColorPickerViewChangeEvent) => void;
82
+ /**
83
+ * The event handler that will be fired when the user edits the value.
84
+ */
85
+ onChange?: (event: ColorPickerChangeEvent) => void;
50
86
  }
51
87
  /**
52
- * Represents the target (element and props) of the FlatColorPicker.
88
+ * @hidden
53
89
  */
54
90
  export interface FlatColorPickerHandle {
55
91
  /**