@progress/kendo-angular-inputs 7.5.2 → 8.0.0-dev.202112161434

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 (151) hide show
  1. package/dist/cdn/js/kendo-angular-inputs.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/colorpicker/color-contrast-svg.component.js +95 -0
  4. package/dist/es/colorpicker/color-gradient.component.js +109 -81
  5. package/dist/es/colorpicker/color-input.component.js +39 -18
  6. package/dist/es/colorpicker/color-palette.component.js +28 -18
  7. package/dist/es/colorpicker/colorpicker.component.js +170 -76
  8. package/dist/es/colorpicker/constants.js +12 -0
  9. package/dist/es/colorpicker/contrast-validation.component.js +8 -6
  10. package/dist/es/colorpicker/contrast.component.js +6 -8
  11. package/dist/es/colorpicker/{models → events}/active-color-click-event.js +0 -0
  12. package/dist/es/colorpicker/events/cancel-event.js +19 -0
  13. package/dist/es/colorpicker/events/close-event.js +17 -0
  14. package/dist/es/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  15. package/dist/es/colorpicker/events/open-event.js +17 -0
  16. package/dist/es/colorpicker/events.js +8 -0
  17. package/dist/es/colorpicker/flatcolorpicker-actions.component.js +50 -0
  18. package/dist/es/colorpicker/flatcolorpicker-header.component.js +94 -0
  19. package/dist/es/colorpicker/flatcolorpicker.component.js +553 -0
  20. package/dist/es/colorpicker/localization/colorgradient-localization.service.js +7 -7
  21. package/dist/es/colorpicker/localization/colorpalette-localization.service.js +7 -7
  22. package/dist/es/colorpicker/localization/custom-messages.component.js +1 -1
  23. package/dist/es/colorpicker/localization/flatcolorpicker-localization.service.js +34 -0
  24. package/dist/es/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  25. package/dist/es/colorpicker/localization/messages.js +36 -0
  26. package/dist/es/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
  27. package/dist/{es2015/colorpicker/models/color-picker-view.js → es/colorpicker/models/colorpicker-view.js} +0 -0
  28. package/dist/es/colorpicker/{utils → models}/palette-presets.js +0 -0
  29. package/dist/es/colorpicker/models.js +1 -2
  30. package/dist/es/colorpicker/services/flatcolorpicker.service.js +41 -0
  31. package/dist/es/colorpicker/utils/color-parser.js +18 -5
  32. package/dist/es/colorpicker/utils/contrast-curve.js +91 -0
  33. package/dist/es/colorpicker/utils.js +1 -1
  34. package/dist/es/colorpicker.module.js +9 -1
  35. package/dist/es/index.js +5 -0
  36. package/dist/es/main.js +4 -1
  37. package/dist/es/package-metadata.js +1 -1
  38. package/dist/es2015/colorpicker/color-contrast-svg.component.d.ts +26 -0
  39. package/dist/es2015/colorpicker/color-contrast-svg.component.js +97 -0
  40. package/dist/es2015/colorpicker/color-gradient.component.d.ts +32 -43
  41. package/dist/es2015/colorpicker/color-gradient.component.js +125 -92
  42. package/dist/es2015/colorpicker/color-input.component.d.ts +11 -4
  43. package/dist/es2015/colorpicker/color-input.component.js +52 -32
  44. package/dist/es2015/colorpicker/color-palette.component.d.ts +8 -3
  45. package/dist/es2015/colorpicker/color-palette.component.js +28 -18
  46. package/dist/es2015/colorpicker/colorpicker.component.d.ts +84 -24
  47. package/dist/es2015/colorpicker/colorpicker.component.js +195 -112
  48. package/dist/es2015/colorpicker/constants.d.ts +12 -0
  49. package/dist/es2015/colorpicker/constants.js +12 -0
  50. package/dist/es2015/colorpicker/contrast-validation.component.d.ts +1 -1
  51. package/dist/es2015/colorpicker/contrast-validation.component.js +16 -12
  52. package/dist/es2015/colorpicker/contrast.component.d.ts +1 -3
  53. package/dist/es2015/colorpicker/contrast.component.js +17 -17
  54. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.d.ts +0 -0
  55. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.js +0 -0
  56. package/dist/es2015/colorpicker/events/cancel-event.d.ts +15 -0
  57. package/dist/es2015/colorpicker/events/cancel-event.js +14 -0
  58. package/dist/es2015/colorpicker/events/close-event.d.ts +10 -0
  59. package/dist/es2015/colorpicker/events/close-event.js +10 -0
  60. package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.d.ts +0 -0
  61. package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  62. package/dist/es2015/colorpicker/events/open-event.d.ts +10 -0
  63. package/dist/es2015/colorpicker/events/open-event.js +10 -0
  64. package/dist/es2015/colorpicker/events.d.ts +8 -0
  65. package/dist/es2015/colorpicker/events.js +8 -0
  66. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.d.ts +18 -0
  67. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +60 -0
  68. package/dist/es2015/colorpicker/flatcolorpicker-header.component.d.ts +30 -0
  69. package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +131 -0
  70. package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +214 -0
  71. package/dist/es2015/colorpicker/flatcolorpicker.component.js +593 -0
  72. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.d.ts +3 -3
  73. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.js +7 -7
  74. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.d.ts +3 -3
  75. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.js +7 -7
  76. package/dist/es2015/colorpicker/localization/custom-messages.component.js +1 -1
  77. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.d.ts +14 -0
  78. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.js +31 -0
  79. package/dist/es2015/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  80. package/dist/es2015/colorpicker/localization/messages.d.ts +36 -0
  81. package/dist/es2015/colorpicker/localization/messages.js +36 -0
  82. package/dist/es2015/colorpicker/models/actions-layout.d.ts +8 -0
  83. package/dist/es2015/colorpicker/models/actions-layout.js +4 -0
  84. package/dist/es2015/colorpicker/models/colorpicker-view.d.ts +8 -0
  85. package/dist/es2015/colorpicker/models/colorpicker-view.js +4 -0
  86. package/dist/es2015/colorpicker/models/gradient-settings.d.ts +4 -3
  87. package/dist/es2015/colorpicker/models/output-format.d.ts +0 -5
  88. package/dist/es2015/colorpicker/{utils → models}/palette-presets.d.ts +0 -0
  89. package/dist/es2015/colorpicker/{utils → models}/palette-presets.js +0 -0
  90. package/dist/es2015/colorpicker/models/palette-settings.d.ts +2 -3
  91. package/dist/es2015/colorpicker/models/tile-size.d.ts +1 -5
  92. package/dist/es2015/colorpicker/models.d.ts +10 -10
  93. package/dist/es2015/colorpicker/models.js +1 -2
  94. package/dist/es2015/colorpicker/{models/color-picker-view.d.ts → services/flatcolorpicker.service.d.ts} +6 -7
  95. package/dist/es2015/colorpicker/services/flatcolorpicker.service.js +38 -0
  96. package/dist/es2015/colorpicker/utils/color-parser.d.ts +8 -2
  97. package/dist/es2015/colorpicker/utils/color-parser.js +15 -5
  98. package/dist/es2015/colorpicker/utils/contrast-curve.d.ts +37 -0
  99. package/dist/es2015/colorpicker/utils/contrast-curve.js +85 -0
  100. package/dist/es2015/colorpicker/utils.d.ts +1 -1
  101. package/dist/es2015/colorpicker/utils.js +1 -1
  102. package/dist/es2015/colorpicker.module.js +9 -1
  103. package/dist/es2015/index.d.ts +5 -0
  104. package/dist/es2015/index.js +5 -0
  105. package/dist/es2015/index.metadata.json +1 -1
  106. package/dist/es2015/main.d.ts +4 -1
  107. package/dist/es2015/main.js +4 -1
  108. package/dist/es2015/package-metadata.js +1 -1
  109. package/dist/fesm2015/index.js +2207 -1043
  110. package/dist/fesm5/index.js +2010 -907
  111. package/dist/npm/colorpicker/color-contrast-svg.component.js +97 -0
  112. package/dist/npm/colorpicker/color-gradient.component.js +109 -81
  113. package/dist/npm/colorpicker/color-input.component.js +38 -17
  114. package/dist/npm/colorpicker/color-palette.component.js +29 -19
  115. package/dist/npm/colorpicker/colorpicker.component.js +177 -83
  116. package/dist/npm/colorpicker/constants.js +12 -0
  117. package/dist/npm/colorpicker/contrast-validation.component.js +8 -6
  118. package/dist/npm/colorpicker/contrast.component.js +6 -8
  119. package/dist/npm/colorpicker/{models → events}/active-color-click-event.js +0 -0
  120. package/dist/npm/colorpicker/events/cancel-event.js +21 -0
  121. package/dist/npm/colorpicker/events/close-event.js +19 -0
  122. package/dist/npm/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  123. package/dist/npm/colorpicker/events/open-event.js +19 -0
  124. package/dist/npm/colorpicker/events.js +11 -0
  125. package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +52 -0
  126. package/dist/npm/colorpicker/flatcolorpicker-header.component.js +96 -0
  127. package/dist/npm/colorpicker/flatcolorpicker.component.js +555 -0
  128. package/dist/npm/colorpicker/localization/colorgradient-localization.service.js +7 -7
  129. package/dist/npm/colorpicker/localization/colorpalette-localization.service.js +7 -7
  130. package/dist/npm/colorpicker/localization/custom-messages.component.js +1 -1
  131. package/dist/npm/colorpicker/localization/flatcolorpicker-localization.service.js +36 -0
  132. package/dist/npm/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  133. package/dist/npm/colorpicker/localization/messages.js +36 -0
  134. package/dist/npm/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
  135. package/dist/npm/colorpicker/models/colorpicker-view.js +6 -0
  136. package/dist/npm/colorpicker/{utils → models}/palette-presets.js +0 -0
  137. package/dist/npm/colorpicker/models.js +1 -2
  138. package/dist/npm/colorpicker/services/flatcolorpicker.service.js +43 -0
  139. package/dist/npm/colorpicker/utils/color-parser.js +18 -5
  140. package/dist/npm/colorpicker/utils/contrast-curve.js +93 -0
  141. package/dist/npm/colorpicker/utils.js +1 -1
  142. package/dist/npm/colorpicker.module.js +9 -1
  143. package/dist/npm/index.js +10 -0
  144. package/dist/npm/main.js +7 -2
  145. package/dist/npm/package-metadata.js +1 -1
  146. package/dist/systemjs/kendo-angular-inputs.js +1 -1
  147. package/package.json +3 -2
  148. package/dist/es/colorpicker/models/preventable-event.js +0 -29
  149. package/dist/es2015/colorpicker/models/preventable-event.d.ts +0 -21
  150. package/dist/es2015/colorpicker/models/preventable-event.js +0 -27
  151. package/dist/npm/colorpicker/models/preventable-event.js +0 -31
@@ -6,17 +6,22 @@ import * as tslib_1 from "tslib";
6
6
  import { Component, Input, Output, EventEmitter, ElementRef, HostBinding, ViewChild, Renderer2 } from '@angular/core';
7
7
  import { getRGBA, parseColor, getColorFromRGBA } from './utils';
8
8
  import { isPresent } from '../common/utils';
9
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
10
- import { LocalizationService } from '@progress/kendo-angular-l10n';
9
+ import { guid, isDocumentAvailable } from '@progress/kendo-angular-common';
11
10
  import { Subscription } from 'rxjs';
11
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
12
+ import { NumericTextBoxComponent } from './../numerictextbox/numerictextbox.component';
12
13
  /**
13
14
  * @hidden
14
15
  */
15
16
  let ColorInputComponent = class ColorInputComponent {
16
- constructor(localization, host, renderer) {
17
- this.localization = localization;
17
+ constructor(host, renderer, localizationService) {
18
18
  this.host = host;
19
19
  this.renderer = renderer;
20
+ this.localizationService = localizationService;
21
+ /**
22
+ * The id of the hex input.
23
+ */
24
+ this.focusableId = `k-${guid()}`;
20
25
  /**
21
26
  * Sets whether the alpha slider will be shown.
22
27
  */
@@ -66,11 +71,14 @@ let ColorInputComponent = class ColorInputComponent {
66
71
  }
67
72
  ngOnChanges(changes) {
68
73
  if (isPresent(changes.value) && !this.isFocused) {
69
- this.hex = parseColor(this.value, 'hex');
74
+ this.hex = parseColor(this.value, 'hex', this.opacity);
70
75
  this.rgba = getRGBA(this.value);
71
- this.rgba.a = parseColor(this.value, 'rgba') ? this.rgba.a : 1;
76
+ this.rgba.a = parseColor(this.value, 'rgba', this.opacity) ? this.rgba.a : 1;
72
77
  }
73
78
  }
79
+ get formatButtonTitle() {
80
+ return this.localizationService.get('formatButton');
81
+ }
74
82
  handleRgbaValueChange() {
75
83
  const color = getColorFromRGBA(this.rgba);
76
84
  if (!this.rgbaInputValid || color === this.value) {
@@ -78,12 +86,12 @@ let ColorInputComponent = class ColorInputComponent {
78
86
  }
79
87
  this.value = color;
80
88
  this.rgba = getRGBA(this.value);
81
- this.hex = parseColor(color, 'hex');
89
+ this.hex = parseColor(color, 'hex', this.opacity);
82
90
  this.valueChange.emit(color);
83
91
  }
84
92
  handleHexValueChange(hex) {
85
93
  this.hex = hex;
86
- const color = parseColor(hex, 'rgba');
94
+ const color = parseColor(hex, 'rgba', this.opacity);
87
95
  if (!isPresent(color) || color === this.value) {
88
96
  return;
89
97
  }
@@ -97,10 +105,7 @@ let ColorInputComponent = class ColorInputComponent {
97
105
  }
98
106
  }
99
107
  handleHexInputBlur() {
100
- this.hex = parseColor(this.value, 'hex');
101
- }
102
- textFor(key) {
103
- return this.localization.get(key);
108
+ this.hex = parseColor(this.value, 'hex', this.opacity);
104
109
  }
105
110
  toggleFormatView() {
106
111
  this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
@@ -112,6 +117,10 @@ let ColorInputComponent = class ColorInputComponent {
112
117
  this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', () => this.toggleFormatView()));
113
118
  }
114
119
  };
120
+ tslib_1.__decorate([
121
+ Input(),
122
+ tslib_1.__metadata("design:type", String)
123
+ ], ColorInputComponent.prototype, "focusableId", void 0);
115
124
  tslib_1.__decorate([
116
125
  Input(),
117
126
  tslib_1.__metadata("design:type", String)
@@ -142,9 +151,17 @@ tslib_1.__decorate([
142
151
  tslib_1.__metadata("design:type", Boolean)
143
152
  ], ColorInputComponent.prototype, "colorInputClass", void 0);
144
153
  tslib_1.__decorate([
145
- ViewChild('opacityInput', { read: ElementRef, static: false }),
146
- tslib_1.__metadata("design:type", ElementRef)
154
+ ViewChild('opacityInput', { static: false }),
155
+ tslib_1.__metadata("design:type", NumericTextBoxComponent)
147
156
  ], ColorInputComponent.prototype, "opacityInput", void 0);
157
+ tslib_1.__decorate([
158
+ ViewChild('hexInput', { read: ElementRef, static: false }),
159
+ tslib_1.__metadata("design:type", ElementRef)
160
+ ], ColorInputComponent.prototype, "hexInput", void 0);
161
+ tslib_1.__decorate([
162
+ ViewChild('blueInput', { read: ElementRef, static: false }),
163
+ tslib_1.__metadata("design:type", ElementRef)
164
+ ], ColorInputComponent.prototype, "blueInput", void 0);
148
165
  tslib_1.__decorate([
149
166
  ViewChild('toggleFormatButton', { static: false }),
150
167
  tslib_1.__metadata("design:type", ElementRef)
@@ -154,20 +171,27 @@ ColorInputComponent = tslib_1.__decorate([
154
171
  selector: 'kendo-colorinput',
155
172
  template: `
156
173
  <div class="k-vstack">
157
- <button class="k-colorgradient-toggle-mode k-button k-icon-button k-flat" #toggleFormatButton>
174
+ <button #toggleFormatButton
175
+ class="k-colorgradient-toggle-mode k-button k-icon-button k-flat"
176
+ [attr.aria-label]="formatButtonTitle"
177
+ [attr.title]="formatButtonTitle"
178
+ >
158
179
  <span class="k-button-icon k-icon k-i-arrows-kpi"></span>
159
180
  </button>
160
181
  </div>
161
- <input *ngIf="formatView === 'hex'"
162
- #hexInput
163
- class="k-textbox k-hex-value"
164
- [disabled]="disabled"
165
- [readonly]="readonly"
166
- [value]="hex || ''"
167
- [placeholder]="textFor('hexInputPlaceholder')"
168
- (blur)="handleHexInputBlur()"
169
- (input)="handleHexValueChange(hexInput.value)"
170
- />
182
+ <div *ngIf="formatView === 'hex'" class="k-vstack">
183
+ <input
184
+ #hexInput
185
+ [id]="focusableId"
186
+ class="k-textbox k-hex-value"
187
+ [disabled]="disabled"
188
+ [readonly]="readonly"
189
+ [value]="hex || ''"
190
+ (blur)="handleHexInputBlur()"
191
+ (input)="handleHexValueChange(hexInput.value)"
192
+ />
193
+ <label [for]="focusableId" class="k-colorgradient-input-label">HEX</label>
194
+ </div>
171
195
  <ng-container *ngIf="formatView === 'rgba'">
172
196
  <div class="k-vstack">
173
197
  <kendo-numerictextbox
@@ -176,7 +200,6 @@ ColorInputComponent = tslib_1.__decorate([
176
200
  [readonly]="readonly"
177
201
  [min]="0"
178
202
  [max]="255"
179
- [placeholder]="textFor('redInputPlaceholder')"
180
203
  [(value)]="rgba.r"
181
204
  [autoCorrect]="true"
182
205
  [spinners]="false"
@@ -194,7 +217,6 @@ ColorInputComponent = tslib_1.__decorate([
194
217
  [readonly]="readonly"
195
218
  [min]="0"
196
219
  [max]="255"
197
- [placeholder]="textFor('greenInputPlaceholder')"
198
220
  [(value)]="rgba.g"
199
221
  [autoCorrect]="true"
200
222
  [spinners]="false"
@@ -212,7 +234,6 @@ ColorInputComponent = tslib_1.__decorate([
212
234
  [readonly]="readonly"
213
235
  [min]="0"
214
236
  [max]="255"
215
- [placeholder]="textFor('blueInputPlaceholder')"
216
237
  [(value)]="rgba.b"
217
238
  [autoCorrect]="true"
218
239
  [spinners]="false"
@@ -230,7 +251,6 @@ ColorInputComponent = tslib_1.__decorate([
230
251
  [readonly]="readonly"
231
252
  [min]="0"
232
253
  [max]="1"
233
- [placeholder]="textFor('alphaInputPlaceholder')"
234
254
  [(value)]="rgba.a"
235
255
  [autoCorrect]="true"
236
256
  [spinners]="false"
@@ -245,8 +265,8 @@ ColorInputComponent = tslib_1.__decorate([
245
265
  </ng-container>
246
266
  `
247
267
  }),
248
- tslib_1.__metadata("design:paramtypes", [LocalizationService,
249
- ElementRef,
250
- Renderer2])
268
+ tslib_1.__metadata("design:paramtypes", [ElementRef,
269
+ Renderer2,
270
+ LocalizationService])
251
271
  ], ColorInputComponent);
252
272
  export { ColorInputComponent };
@@ -12,7 +12,7 @@ import { LocalizationService } from '@progress/kendo-angular-l10n';
12
12
  * The ColorPalette is independently used by `kendo-colorpicker` and can be directly added to the page.
13
13
  */
14
14
  export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges, ControlValueAccessor {
15
- private host;
15
+ host: ElementRef;
16
16
  private service;
17
17
  private cdr;
18
18
  private renderer;
@@ -132,6 +132,10 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
132
132
  * @hidden
133
133
  */
134
134
  focusInComponent: boolean;
135
+ /**
136
+ * @hidden
137
+ */
138
+ uniqueId: string;
135
139
  private selection;
136
140
  private _value;
137
141
  private _columns;
@@ -154,7 +158,7 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
154
158
  /**
155
159
  * @hidden
156
160
  */
157
- handleCellSelection(value: string, cell?: TableCell): void;
161
+ handleCellSelection(value: string, focusedCell?: TableCell): void;
158
162
  /**
159
163
  * @hidden
160
164
  */
@@ -173,13 +177,14 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
173
177
  setDisabledState(isDisabled: boolean): void;
174
178
  /**
175
179
  * @hidden
176
- * Used by the TextBoxContainer to determine if the component is empty.
180
+ * Used by the FloatingLabel to determine if the component is empty.
177
181
  */
178
182
  isEmpty(): boolean;
179
183
  /**
180
184
  * Clears the color value of the ColorPalette.
181
185
  */
182
186
  reset(): void;
187
+ private handleValueChange;
183
188
  private handleCellFocusOnBlur;
184
189
  private setRows;
185
190
  private handleCellNavigation;
@@ -6,10 +6,11 @@ import * as tslib_1 from "tslib";
6
6
  var ColorPaletteComponent_1;
7
7
  import { Component, Input, EventEmitter, Output, HostBinding, HostListener, forwardRef, ChangeDetectorRef, Renderer2, ElementRef } from '@angular/core';
8
8
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
9
- import { PALETTEPRESETS, parseColor } from './utils';
9
+ import { PALETTEPRESETS } from './models';
10
+ import { parseColor } from './utils';
10
11
  import { isPresent } from '../common/utils';
11
12
  import { ColorPaletteService } from './services/color-palette.service';
12
- import { Keys, KendoInput } from '@progress/kendo-angular-common';
13
+ import { Keys, KendoInput, guid } from '@progress/kendo-angular-common';
13
14
  import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
14
15
  import { ColorPaletteLocalizationService } from './localization/colorpalette-localization.service';
15
16
  const DEFAULT_TILE_SIZE = 24;
@@ -77,6 +78,10 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
77
78
  * @hidden
78
79
  */
79
80
  this.hostClasses = true;
81
+ /**
82
+ * @hidden
83
+ */
84
+ this.uniqueId = guid();
80
85
  this._tabindex = 0;
81
86
  this.notifyNgTouched = () => { };
82
87
  this.notifyNgChanged = () => { };
@@ -127,7 +132,7 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
127
132
  value = PALETTEPRESETS[value].colors;
128
133
  }
129
134
  const colors = (typeof value === 'string') ? value.split(',') : value;
130
- this._palette = colors.map(color => parseColor(color, this.format, false));
135
+ this._palette = colors.map(color => parseColor(color, this.format, false, false));
131
136
  }
132
137
  get palette() {
133
138
  return this._palette;
@@ -230,27 +235,22 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
230
235
  /**
231
236
  * @hidden
232
237
  */
233
- handleCellSelection(value, cell) {
238
+ handleCellSelection(value, focusedCell) {
234
239
  if (this.readonly) {
235
240
  return;
236
241
  }
237
- this.selectedCell = cell;
242
+ this.selectedCell = focusedCell;
238
243
  this.focusedCell = this.selectedCell;
239
244
  this.focusInComponent = true;
240
- const parsedColor = parseColor(value, this.format, false);
245
+ const parsedColor = parseColor(value, this.format, false, false);
241
246
  this.cellSelection.emit(parsedColor);
242
- if (this.value !== parsedColor) {
243
- this.value = parsedColor;
244
- this.valueChange.emit(parsedColor);
245
- this.notifyNgChanged(parsedColor);
246
- this.setHostElementAriaLabel();
247
- }
247
+ this.handleValueChange(parsedColor);
248
248
  if (this.selection !== parsedColor) {
249
249
  this.selection = parsedColor;
250
250
  this.selectionChange.emit(parsedColor);
251
251
  }
252
- if (cell) {
253
- this.activeCellId = `${this.selectedCell.row}-${this.selectedCell.col}`;
252
+ if (focusedCell) {
253
+ this.activeCellId = `k-${this.selectedCell.row}-${this.selectedCell.col}-${this.uniqueId}`;
254
254
  }
255
255
  }
256
256
  /**
@@ -281,7 +281,7 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
281
281
  }
282
282
  /**
283
283
  * @hidden
284
- * Used by the TextBoxContainer to determine if the component is empty.
284
+ * Used by the FloatingLabel to determine if the component is empty.
285
285
  */
286
286
  isEmpty() {
287
287
  return false;
@@ -292,9 +292,18 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
292
292
  reset() {
293
293
  this.focusedCell = null;
294
294
  if (isPresent(this.value)) {
295
- this._value = undefined;
296
- this.notifyNgChanged(undefined);
295
+ this.handleValueChange(undefined);
297
296
  }
297
+ this.selectedCell = undefined;
298
+ }
299
+ handleValueChange(color) {
300
+ if (this.value === color) {
301
+ return;
302
+ }
303
+ this.value = color;
304
+ this.valueChange.emit(color);
305
+ this.notifyNgChanged(color);
306
+ this.setHostElementAriaLabel();
298
307
  }
299
308
  handleCellFocusOnBlur() {
300
309
  this.focusInComponent = false;
@@ -421,6 +430,7 @@ tslib_1.__decorate([
421
430
  ], ColorPaletteComponent.prototype, "handleHostBlur", null);
422
431
  ColorPaletteComponent = ColorPaletteComponent_1 = tslib_1.__decorate([
423
432
  Component({
433
+ exportAs: 'kendoColorPalette',
424
434
  selector: 'kendo-colorpalette',
425
435
  providers: [
426
436
  {
@@ -459,7 +469,7 @@ ColorPaletteComponent = ColorPaletteComponent_1 = tslib_1.__decorate([
459
469
  [attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
460
470
  [attr.aria-label]="color"
461
471
  class="k-colorpalette-tile"
462
- [id]="rowIndex + '-' + colIndex"
472
+ [id]="'k-' + rowIndex + '-' + colIndex + '-' + uniqueId"
463
473
  [attr.value]="color"
464
474
  (click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
465
475
  [ngStyle]="{
@@ -2,55 +2,62 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { EventEmitter, OnDestroy, ViewContainerRef, ChangeDetectorRef, NgZone } from '@angular/core';
5
+ import { EventEmitter, OnDestroy, ViewContainerRef, ChangeDetectorRef, NgZone, OnChanges, OnInit } from '@angular/core';
6
6
  import { ControlValueAccessor } from '@angular/forms';
7
7
  import { PopupService } from '@progress/kendo-angular-popup';
8
- import { PopupSettings, PreventableEvent, PaletteSettings, OutputFormat, ActiveColorClickEvent, ColorPickerView, GradientSettings } from './models';
9
8
  import { LocalizationService } from '@progress/kendo-angular-l10n';
9
+ import { PopupSettings, PaletteSettings, OutputFormat, ColorPickerView, GradientSettings, ColorPickerActionsLayout } from './models';
10
+ import { ActiveColorClickEvent, ColorPickerCancelEvent, ColorPickerCloseEvent, ColorPickerOpenEvent } from './events';
10
11
  /**
11
12
  * Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
12
- * Designed to replace the `<input type="color">` HTML5 tag which is not widely supported in browsers.
13
+ *
14
+ * The ColorPicker is a powerful tool for choosing colors from Gradient and Palette views
15
+ * which are rendered in its popup. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
13
16
  */
14
- export declare class ColorPickerComponent implements OnDestroy, ControlValueAccessor {
17
+ export declare class ColorPickerComponent implements OnInit, OnChanges, OnDestroy, ControlValueAccessor {
15
18
  private popupService;
16
19
  private cdr;
17
20
  private localizationService;
18
21
  private ngZone;
19
- /**
20
- * @hidden
21
- */
22
22
  hostClasses: boolean;
23
- /**
24
- * @hidden
25
- */
26
23
  direction: string;
27
24
  /**
28
25
  * @hidden
29
26
  */
30
27
  focusableId: string;
31
28
  /**
32
- * Sets what view the ColorPicker will render in the popup.
29
+ * Specifies the views that will be rendered in the popup.
30
+ * By default both the gradient and palette views will be rendered.
31
+ */
32
+ views: Array<ColorPickerView>;
33
+ /**
34
+ * Sets the initially active view in the popup. The property supports two-way binding.
35
+ *
36
+ * The supported values are:
37
+ * * `gradient`
38
+ * * `palette`
33
39
  */
34
- view: ColorPickerView;
40
+ activeView: ColorPickerView;
35
41
  /**
36
42
  * Sets the read-only state of the ColorPicker.
43
+ *
44
+ * @default false
37
45
  */
38
46
  readonly: boolean;
39
47
  /**
40
48
  * Sets the disabled state of the ColorPicker.
49
+ *
50
+ * @default false
41
51
  */
42
52
  disabled: boolean;
43
53
  /**
44
54
  * Specifies the output format of the ColorPicker.
45
- * The input value may be in a different format. However, it will be parsed into the output `format`
46
- * after the component processes it.
47
55
  *
48
- * If the `gradient` view is used with the `opacity` option set to true, this setting will be ignored and `rgba` will be used instead.
56
+ * If the input value is in a different format, it will be parsed into the specified output `format`.
49
57
  *
50
58
  * The supported values are:
51
59
  * * `rgba` (default)
52
60
  * * `hex`
53
- * * [name](https://www.w3.org/wiki/CSS/Properties/color/keywords)
54
61
  */
55
62
  format: OutputFormat;
56
63
  /**
@@ -72,6 +79,7 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
72
79
  /**
73
80
  * Defines the name of an [existing icon in the Kendo UI theme]({% slug icons %}).
74
81
  * Provide only the name of the icon without the `k-icon` or the `k-i-` prefixes.
82
+ *
75
83
  * For example, `edit-tools` will be parsed to `k-icon k-i-edit-tools`.
76
84
  */
77
85
  icon: string;
@@ -84,10 +92,40 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
84
92
  iconClass: string | Array<string> | {
85
93
  [key: string]: boolean;
86
94
  };
95
+ /**
96
+ * Specifies whether the ColorPicker should display a 'Clear color' button.
97
+ *
98
+ * @default true
99
+ */
100
+ clearButton: boolean;
87
101
  /**
88
102
  * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
103
+ *
104
+ * @default 0
89
105
  */
90
106
  tabindex: number;
107
+ /**
108
+ * Displays `Apply` and `Cancel` action buttons and color preview panes.
109
+ *
110
+ * When enabled, the component value will not change immediately upon
111
+ * color selection, but only after the `Apply` button is clicked.
112
+ *
113
+ * The `Cancel` button reverts the current selection to its
114
+ * previous state i.e. to the current value.
115
+ *
116
+ * @default false
117
+ */
118
+ preview: boolean;
119
+ /**
120
+ * Configures the layout of the `Apply` and `Cancel` action buttons.
121
+ *
122
+ * The possible values are:
123
+ * * `start`
124
+ * * `center`
125
+ * * `end` (default)
126
+ * * `stretch`
127
+ */
128
+ actionsLayout: ColorPickerActionsLayout;
91
129
  /**
92
130
  * Fires each time the value is changed.
93
131
  */
@@ -96,12 +134,12 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
96
134
  * Fires each time the popup is about to open.
97
135
  * This event is preventable. If you cancel it, the popup will remain closed.
98
136
  */
99
- open: EventEmitter<PreventableEvent>;
137
+ open: EventEmitter<ColorPickerOpenEvent>;
100
138
  /**
101
139
  * Fires each time the popup is about to close.
102
140
  * This event is preventable. If you cancel it, the popup will remain open.
103
141
  */
104
- close: EventEmitter<PreventableEvent>;
142
+ close: EventEmitter<ColorPickerCloseEvent>;
105
143
  /**
106
144
  * Fires each time ColorPicker is focused.
107
145
  */
@@ -110,6 +148,12 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
110
148
  * Fires each time the ColorPicker is blurred.
111
149
  */
112
150
  onBlur: EventEmitter<any>;
151
+ /**
152
+ * Fires when the user cancels the current color selection.
153
+ *
154
+ * Fires on preview pane or 'Cancel' button click.
155
+ */
156
+ cancel: EventEmitter<ColorPickerCancelEvent>;
113
157
  /**
114
158
  * Fires each time the left side of the ColorPicker wrapper is clicked.
115
159
  * The event is triggered regardless of whether a ColorPicker icon is set or not.
@@ -117,6 +161,11 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
117
161
  * The [ActiveColorClickEvent]({% slug api_inputs_activecolorclickevent %}) event provides the option to prevent the popup opening.
118
162
  */
119
163
  activeColorClick: EventEmitter<ActiveColorClickEvent>;
164
+ /**
165
+ * Fires each time the view is about to change.
166
+ * Used to provide a two-way binding for the `activeView` property.
167
+ */
168
+ activeViewChange: EventEmitter<string>;
120
169
  /**
121
170
  * Indicates whether the ColorPicker wrapper is focused.
122
171
  */
@@ -139,8 +188,7 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
139
188
  container: ViewContainerRef;
140
189
  private wrapper;
141
190
  private popupTemplate;
142
- private palette;
143
- private colorGradient;
191
+ private flatColorPicker;
144
192
  private popupRef;
145
193
  private _value;
146
194
  private _tabindex;
@@ -155,7 +203,15 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
155
203
  /**
156
204
  * @hidden
157
205
  */
158
- handleWrapperClick(): void;
206
+ readonly colorPickerAriaLabel: string;
207
+ /**
208
+ * @hidden
209
+ */
210
+ handleCancelEvent(ev: ColorPickerCancelEvent): void;
211
+ /**
212
+ * @hidden
213
+ */
214
+ togglePopup(): void;
159
215
  /**
160
216
  * @hidden
161
217
  */
@@ -177,7 +233,7 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
177
233
  */
178
234
  handleWrapperBlur(): void;
179
235
  /**
180
- * Clears the color value of the ColorPicker.
236
+ * Clears the value of the ColorPicker.
181
237
  */
182
238
  reset(): void;
183
239
  /**
@@ -190,7 +246,7 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
190
246
  /**
191
247
  * @hidden
192
248
  */
193
- handleValueChange(color: string, closePopup: boolean): void;
249
+ handleValueChange(color: string): void;
194
250
  /**
195
251
  * @hidden
196
252
  */
@@ -221,12 +277,16 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
221
277
  handlePopupKeyDown(event: any): void;
222
278
  /**
223
279
  * @hidden
224
- * Used by the TextBoxContainer to determine if the component is empty.
280
+ * Used by the FloatingLabel to determine if the component is empty.
225
281
  */
226
282
  isEmpty(): boolean;
283
+ private popupBlurInvalid;
227
284
  private toggleWithEvents;
285
+ private focusFirstElement;
228
286
  private openPopup;
229
287
  private closePopup;
288
+ private readonly firstFocusableElement;
289
+ private readonly lastFocusableElement;
230
290
  private notifyNgTouched;
231
291
  private notifyNgChanged;
232
292
  }