@progress/kendo-angular-inputs 13.2.1-develop.11 → 13.2.1-develop.13

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 (289) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +654 -0
  3. package/README.md +184 -0
  4. package/checkbox/checkbox.directive.d.ts +52 -0
  5. package/checkbox.module.d.ts +43 -0
  6. package/colorpicker/color-contrast-svg.component.d.ts +29 -0
  7. package/colorpicker/color-gradient-numeric-label.directive.d.ts +20 -0
  8. package/colorpicker/color-gradient.component.d.ts +281 -0
  9. package/colorpicker/color-input.component.d.ts +95 -0
  10. package/colorpicker/color-palette.component.d.ts +221 -0
  11. package/colorpicker/colorpicker.component.d.ts +383 -0
  12. package/colorpicker/constants.d.ts +41 -0
  13. package/colorpicker/contrast-validation.component.d.ts +24 -0
  14. package/colorpicker/contrast.component.d.ts +25 -0
  15. package/colorpicker/events/active-color-click-event.d.ts +53 -0
  16. package/colorpicker/events/cancel-event.d.ts +15 -0
  17. package/colorpicker/events/close-event.d.ts +10 -0
  18. package/colorpicker/events/kendo-drag-event.d.ts +21 -0
  19. package/colorpicker/events/open-event.d.ts +10 -0
  20. package/colorpicker/events.d.ts +8 -0
  21. package/colorpicker/flatcolorpicker-actions.component.d.ts +24 -0
  22. package/colorpicker/flatcolorpicker-header.component.d.ts +43 -0
  23. package/colorpicker/flatcolorpicker.component.d.ts +267 -0
  24. package/colorpicker/focus-on-dom-ready.directive.d.ts +18 -0
  25. package/colorpicker/localization/colorgradient-localization.service.d.ts +17 -0
  26. package/colorpicker/localization/colorpalette-localization.service.d.ts +17 -0
  27. package/colorpicker/localization/colorpicker-localization.service.d.ts +14 -0
  28. package/colorpicker/localization/custom-messages.component.d.ts +17 -0
  29. package/colorpicker/localization/flatcolorpicker-localization.service.d.ts +17 -0
  30. package/colorpicker/localization/localized-colorpicker-messages.directive.d.ts +16 -0
  31. package/colorpicker/localization/messages.d.ts +121 -0
  32. package/colorpicker/models/actions-layout.d.ts +8 -0
  33. package/colorpicker/models/colorpicker-view.d.ts +8 -0
  34. package/colorpicker/models/gradient-settings.d.ts +35 -0
  35. package/colorpicker/models/hsva.d.ts +13 -0
  36. package/colorpicker/models/output-format.d.ts +8 -0
  37. package/colorpicker/models/palette-presets.d.ts +61 -0
  38. package/colorpicker/models/palette-settings.d.ts +33 -0
  39. package/colorpicker/models/popup-settings.d.ts +18 -0
  40. package/colorpicker/models/rgb.d.ts +12 -0
  41. package/colorpicker/models/rgba.d.ts +13 -0
  42. package/colorpicker/models/table-cell.d.ts +11 -0
  43. package/colorpicker/models/tile-size.d.ts +11 -0
  44. package/colorpicker/models.d.ts +16 -0
  45. package/colorpicker/services/color-palette.service.d.ts +19 -0
  46. package/colorpicker/services/flatcolorpicker.service.d.ts +15 -0
  47. package/colorpicker/utils/color-parser.d.ts +77 -0
  48. package/colorpicker/utils/contrast-curve.d.ts +37 -0
  49. package/colorpicker/utils.d.ts +6 -0
  50. package/colorpicker.module.d.ts +35 -0
  51. package/common/dom-utils.d.ts +25 -0
  52. package/common/math.d.ts +36 -0
  53. package/common/models/fillmode.d.ts +9 -0
  54. package/common/models/rounded.d.ts +14 -0
  55. package/common/models/size.d.ts +9 -0
  56. package/common/models/styling-classes.d.ts +11 -0
  57. package/common/models.d.ts +8 -0
  58. package/common/utils.d.ts +56 -0
  59. package/esm2020/checkbox/checkbox.directive.mjs +94 -0
  60. package/esm2020/checkbox.module.mjs +52 -0
  61. package/esm2020/colorpicker/color-contrast-svg.component.mjs +97 -0
  62. package/esm2020/colorpicker/color-gradient-numeric-label.directive.mjs +31 -0
  63. package/esm2020/colorpicker/color-gradient.component.mjs +1003 -0
  64. package/esm2020/colorpicker/color-input.component.mjs +433 -0
  65. package/esm2020/colorpicker/color-palette.component.mjs +553 -0
  66. package/esm2020/colorpicker/colorpicker.component.mjs +1086 -0
  67. package/esm2020/colorpicker/constants.mjs +40 -0
  68. package/esm2020/colorpicker/contrast-validation.component.mjs +72 -0
  69. package/esm2020/colorpicker/contrast.component.mjs +100 -0
  70. package/esm2020/colorpicker/events/active-color-click-event.mjs +58 -0
  71. package/esm2020/colorpicker/events/cancel-event.mjs +14 -0
  72. package/esm2020/colorpicker/events/close-event.mjs +10 -0
  73. package/esm2020/colorpicker/events/kendo-drag-event.mjs +5 -0
  74. package/esm2020/colorpicker/events/open-event.mjs +10 -0
  75. package/esm2020/colorpicker/events.mjs +8 -0
  76. package/esm2020/colorpicker/flatcolorpicker-actions.component.mjs +93 -0
  77. package/esm2020/colorpicker/flatcolorpicker-header.component.mjs +217 -0
  78. package/esm2020/colorpicker/flatcolorpicker.component.mjs +829 -0
  79. package/esm2020/colorpicker/focus-on-dom-ready.directive.mjs +29 -0
  80. package/esm2020/colorpicker/localization/colorgradient-localization.service.mjs +45 -0
  81. package/esm2020/colorpicker/localization/colorpalette-localization.service.mjs +45 -0
  82. package/esm2020/colorpicker/localization/colorpicker-localization.service.mjs +31 -0
  83. package/esm2020/colorpicker/localization/custom-messages.component.mjs +41 -0
  84. package/esm2020/colorpicker/localization/flatcolorpicker-localization.service.mjs +45 -0
  85. package/esm2020/colorpicker/localization/localized-colorpicker-messages.directive.mjs +37 -0
  86. package/esm2020/colorpicker/localization/messages.mjs +75 -0
  87. package/esm2020/colorpicker/models/actions-layout.mjs +5 -0
  88. package/esm2020/colorpicker/models/colorpicker-view.mjs +5 -0
  89. package/esm2020/colorpicker/models/gradient-settings.mjs +5 -0
  90. package/esm2020/colorpicker/models/hsva.mjs +5 -0
  91. package/esm2020/colorpicker/models/output-format.mjs +5 -0
  92. package/esm2020/colorpicker/models/palette-presets.mjs +62 -0
  93. package/esm2020/colorpicker/models/palette-settings.mjs +5 -0
  94. package/esm2020/colorpicker/models/popup-settings.mjs +5 -0
  95. package/esm2020/colorpicker/models/rgb.mjs +5 -0
  96. package/esm2020/colorpicker/models/rgba.mjs +5 -0
  97. package/esm2020/colorpicker/models/table-cell.mjs +5 -0
  98. package/esm2020/colorpicker/models/tile-size.mjs +6 -0
  99. package/esm2020/colorpicker/models.mjs +16 -0
  100. package/esm2020/colorpicker/services/color-palette.service.mjs +67 -0
  101. package/esm2020/colorpicker/services/flatcolorpicker.service.mjs +39 -0
  102. package/esm2020/colorpicker/utils/color-parser.mjs +164 -0
  103. package/esm2020/colorpicker/utils/contrast-curve.mjs +85 -0
  104. package/esm2020/colorpicker/utils.mjs +6 -0
  105. package/esm2020/colorpicker.module.mjs +104 -0
  106. package/esm2020/common/dom-utils.mjs +36 -0
  107. package/esm2020/common/math.mjs +65 -0
  108. package/esm2020/common/models/fillmode.mjs +5 -0
  109. package/esm2020/common/models/rounded.mjs +5 -0
  110. package/esm2020/common/models/size.mjs +5 -0
  111. package/esm2020/common/models/styling-classes.mjs +5 -0
  112. package/esm2020/common/models.mjs +8 -0
  113. package/esm2020/common/utils.mjs +81 -0
  114. package/esm2020/formfield/error.component.mjs +68 -0
  115. package/esm2020/formfield/formfield.component.mjs +284 -0
  116. package/esm2020/formfield/hint.component.mjs +63 -0
  117. package/esm2020/formfield/models/message-align.mjs +5 -0
  118. package/esm2020/formfield/models/orientation.mjs +5 -0
  119. package/esm2020/formfield/models/show-options.mjs +5 -0
  120. package/esm2020/formfield.module.mjs +54 -0
  121. package/esm2020/index.mjs +66 -0
  122. package/esm2020/inputs.module.mjs +98 -0
  123. package/esm2020/maskedtextbox/maskedtextbox.component.mjs +711 -0
  124. package/esm2020/maskedtextbox/masking.service.mjs +191 -0
  125. package/esm2020/maskedtextbox/parsing/combinators.mjs +28 -0
  126. package/esm2020/maskedtextbox/parsing/parsers.mjs +147 -0
  127. package/esm2020/maskedtextbox/parsing/result.mjs +41 -0
  128. package/esm2020/maskedtextbox/parsing/stream.mjs +41 -0
  129. package/esm2020/maskedtextbox.module.mjs +53 -0
  130. package/esm2020/numerictextbox/arrow-direction.mjs +13 -0
  131. package/esm2020/numerictextbox/constants.mjs +28 -0
  132. package/esm2020/numerictextbox/localization/custom-messages.component.mjs +41 -0
  133. package/esm2020/numerictextbox/localization/localized-numerictextbox-messages.directive.mjs +37 -0
  134. package/esm2020/numerictextbox/localization/messages.mjs +25 -0
  135. package/esm2020/numerictextbox/numerictextbox.component.mjs +1105 -0
  136. package/esm2020/numerictextbox/utils.mjs +92 -0
  137. package/esm2020/numerictextbox.module.mjs +66 -0
  138. package/esm2020/package-metadata.mjs +15 -0
  139. package/esm2020/progress-kendo-angular-inputs.mjs +8 -0
  140. package/esm2020/radiobutton/radiobutton.directive.mjs +76 -0
  141. package/esm2020/radiobutton.module.mjs +52 -0
  142. package/esm2020/rangeslider/localization/custom-messages.component.mjs +41 -0
  143. package/esm2020/rangeslider/localization/localized-rangeslider-messages.directive.mjs +37 -0
  144. package/esm2020/rangeslider/localization/messages.mjs +25 -0
  145. package/esm2020/rangeslider/rangeslider-model.mjs +52 -0
  146. package/esm2020/rangeslider/rangeslider-value.type.mjs +5 -0
  147. package/esm2020/rangeslider/rangeslider.component.mjs +605 -0
  148. package/esm2020/rangeslider.module.mjs +71 -0
  149. package/esm2020/shared/input-separator.component.mjs +41 -0
  150. package/esm2020/shared/textarea.directive.mjs +260 -0
  151. package/esm2020/shared/utils.mjs +13 -0
  152. package/esm2020/shared.module.mjs +32 -0
  153. package/esm2020/signature/events/close-event.mjs +10 -0
  154. package/esm2020/signature/events/index.mjs +6 -0
  155. package/esm2020/signature/events/open-event.mjs +10 -0
  156. package/esm2020/signature/localization/custom-messages.component.mjs +41 -0
  157. package/esm2020/signature/localization/index.mjs +7 -0
  158. package/esm2020/signature/localization/localized-signature-messages.directive.mjs +37 -0
  159. package/esm2020/signature/localization/messages.mjs +29 -0
  160. package/esm2020/signature/signature.component.mjs +906 -0
  161. package/esm2020/signature.module.mjs +79 -0
  162. package/esm2020/slider/localization/custom-messages.component.mjs +41 -0
  163. package/esm2020/slider/localization/localized-slider-messages.directive.mjs +37 -0
  164. package/esm2020/slider/localization/messages.mjs +27 -0
  165. package/esm2020/slider/slider-model.mjs +34 -0
  166. package/esm2020/slider/slider.component.mjs +646 -0
  167. package/esm2020/slider.module.mjs +73 -0
  168. package/esm2020/sliders-common/label-template.directive.mjs +45 -0
  169. package/esm2020/sliders-common/slider-base.mjs +255 -0
  170. package/esm2020/sliders-common/slider-model.base.mjs +93 -0
  171. package/esm2020/sliders-common/slider-ticks.component.mjs +125 -0
  172. package/esm2020/sliders-common/sliders-common.module.mjs +42 -0
  173. package/esm2020/sliders-common/sliders-util.mjs +219 -0
  174. package/esm2020/sliders-common/title-callback.mjs +5 -0
  175. package/esm2020/switch/events/blur-event.mjs +9 -0
  176. package/esm2020/switch/events/focus-event.mjs +9 -0
  177. package/esm2020/switch/localization/custom-messages.component.mjs +41 -0
  178. package/esm2020/switch/localization/localized-switch-messages.directive.mjs +37 -0
  179. package/esm2020/switch/localization/messages.mjs +25 -0
  180. package/esm2020/switch/switch.component.mjs +577 -0
  181. package/esm2020/switch.module.mjs +68 -0
  182. package/esm2020/text-fields-common/text-fields-base.mjs +128 -0
  183. package/esm2020/textarea/models/flow.mjs +5 -0
  184. package/esm2020/textarea/models/resize.mjs +5 -0
  185. package/esm2020/textarea/textarea-suffix.component.mjs +40 -0
  186. package/esm2020/textarea/textarea.component.mjs +604 -0
  187. package/esm2020/textarea.module.mjs +68 -0
  188. package/esm2020/textbox/localization/custom-messages.component.mjs +41 -0
  189. package/esm2020/textbox/localization/localized-textbox-messages.directive.mjs +37 -0
  190. package/esm2020/textbox/localization/messages.mjs +23 -0
  191. package/esm2020/textbox/models/icon-show-options.mjs +5 -0
  192. package/esm2020/textbox/textbox-prefix.directive.mjs +38 -0
  193. package/esm2020/textbox/textbox-suffix.directive.mjs +37 -0
  194. package/esm2020/textbox/textbox.component.mjs +849 -0
  195. package/esm2020/textbox/textbox.directive.mjs +121 -0
  196. package/esm2020/textbox.module.mjs +89 -0
  197. package/esm2020/validators/max.validator.mjs +21 -0
  198. package/esm2020/validators/min.validator.mjs +21 -0
  199. package/fesm2015/progress-kendo-angular-inputs.mjs +15090 -0
  200. package/fesm2020/progress-kendo-angular-inputs.mjs +15055 -0
  201. package/formfield/error.component.d.ts +31 -0
  202. package/formfield/formfield.component.d.ts +98 -0
  203. package/formfield/hint.component.d.ts +29 -0
  204. package/formfield/models/message-align.d.ts +8 -0
  205. package/formfield/models/orientation.d.ts +9 -0
  206. package/formfield/models/show-options.d.ts +16 -0
  207. package/formfield.module.d.ts +45 -0
  208. package/index.d.ts +76 -0
  209. package/inputs.module.d.ts +55 -0
  210. package/maskedtextbox/maskedtextbox.component.d.ts +315 -0
  211. package/maskedtextbox/masking.service.d.ts +48 -0
  212. package/maskedtextbox/parsing/combinators.d.ts +13 -0
  213. package/maskedtextbox/parsing/parsers.d.ts +51 -0
  214. package/maskedtextbox/parsing/result.d.ts +27 -0
  215. package/maskedtextbox/parsing/stream.d.ts +26 -0
  216. package/maskedtextbox.module.d.ts +44 -0
  217. package/numerictextbox/arrow-direction.d.ts +12 -0
  218. package/numerictextbox/constants.d.ts +28 -0
  219. package/numerictextbox/localization/custom-messages.component.d.ts +17 -0
  220. package/numerictextbox/localization/localized-numerictextbox-messages.directive.d.ts +16 -0
  221. package/numerictextbox/localization/messages.d.ts +21 -0
  222. package/numerictextbox/numerictextbox.component.d.ts +364 -0
  223. package/numerictextbox/utils.d.ts +44 -0
  224. package/numerictextbox.module.d.ts +47 -0
  225. package/package-metadata.d.ts +9 -0
  226. package/package.json +74 -0
  227. package/progress-kendo-angular-inputs.d.ts +9 -0
  228. package/radiobutton/radiobutton.directive.d.ts +38 -0
  229. package/radiobutton.module.d.ts +43 -0
  230. package/rangeslider/localization/custom-messages.component.d.ts +17 -0
  231. package/rangeslider/localization/localized-rangeslider-messages.directive.d.ts +16 -0
  232. package/rangeslider/localization/messages.d.ts +21 -0
  233. package/rangeslider/rangeslider-model.d.ts +15 -0
  234. package/rangeslider/rangeslider-value.type.d.ts +9 -0
  235. package/rangeslider/rangeslider.component.d.ts +139 -0
  236. package/rangeslider.module.d.ts +48 -0
  237. package/schematics/collection.json +12 -0
  238. package/schematics/ngAdd/index.js +11 -0
  239. package/schematics/ngAdd/schema.json +28 -0
  240. package/shared/input-separator.component.d.ts +28 -0
  241. package/shared/textarea.directive.d.ts +99 -0
  242. package/shared/utils.d.ts +10 -0
  243. package/shared.module.d.ts +19 -0
  244. package/signature/events/close-event.d.ts +10 -0
  245. package/signature/events/index.d.ts +6 -0
  246. package/signature/events/open-event.d.ts +10 -0
  247. package/signature/localization/custom-messages.component.d.ts +17 -0
  248. package/signature/localization/index.d.ts +7 -0
  249. package/signature/localization/localized-signature-messages.directive.d.ts +16 -0
  250. package/signature/localization/messages.d.ts +29 -0
  251. package/signature/signature.component.d.ts +364 -0
  252. package/signature.module.d.ts +48 -0
  253. package/slider/localization/custom-messages.component.d.ts +17 -0
  254. package/slider/localization/localized-slider-messages.directive.d.ts +16 -0
  255. package/slider/localization/messages.d.ts +25 -0
  256. package/slider/slider-model.d.ts +14 -0
  257. package/slider/slider.component.d.ts +175 -0
  258. package/slider.module.d.ts +50 -0
  259. package/sliders-common/label-template.directive.d.ts +36 -0
  260. package/sliders-common/slider-base.d.ts +141 -0
  261. package/sliders-common/slider-model.base.d.ts +26 -0
  262. package/sliders-common/slider-ticks.component.d.ts +26 -0
  263. package/sliders-common/sliders-common.module.d.ts +17 -0
  264. package/sliders-common/sliders-util.d.ts +119 -0
  265. package/sliders-common/title-callback.d.ts +10 -0
  266. package/switch/events/blur-event.d.ts +13 -0
  267. package/switch/events/focus-event.d.ts +13 -0
  268. package/switch/localization/custom-messages.component.d.ts +17 -0
  269. package/switch/localization/localized-switch-messages.directive.d.ts +16 -0
  270. package/switch/localization/messages.d.ts +21 -0
  271. package/switch/switch.component.d.ts +216 -0
  272. package/switch.module.d.ts +46 -0
  273. package/text-fields-common/text-fields-base.d.ts +91 -0
  274. package/textarea/models/flow.d.ts +12 -0
  275. package/textarea/models/resize.d.ts +16 -0
  276. package/textarea/textarea-suffix.component.d.ts +26 -0
  277. package/textarea/textarea.component.d.ts +225 -0
  278. package/textarea.module.d.ts +48 -0
  279. package/textbox/localization/custom-messages.component.d.ts +17 -0
  280. package/textbox/localization/localized-textbox-messages.directive.d.ts +16 -0
  281. package/textbox/localization/messages.d.ts +17 -0
  282. package/textbox/models/icon-show-options.d.ts +13 -0
  283. package/textbox/textbox-prefix.directive.d.ts +29 -0
  284. package/textbox/textbox-suffix.directive.d.ts +28 -0
  285. package/textbox/textbox.component.d.ts +376 -0
  286. package/textbox/textbox.directive.d.ts +59 -0
  287. package/textbox.module.d.ts +53 -0
  288. package/validators/max.validator.d.ts +8 -0
  289. package/validators/min.validator.d.ts +8 -0
@@ -0,0 +1,553 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ /* eslint-disable @typescript-eslint/no-explicit-any */
6
+ import { Component, Input, EventEmitter, Output, HostBinding, forwardRef, ChangeDetectorRef, Renderer2, ElementRef, NgZone } from '@angular/core';
7
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
8
+ import { Keys, KendoInput, guid } from '@progress/kendo-angular-common';
9
+ import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
10
+ import { validatePackage } from '@progress/kendo-licensing';
11
+ import { Subscription } from 'rxjs';
12
+ import { take } from 'rxjs/operators';
13
+ import { ColorPaletteLocalizationService } from './localization/colorpalette-localization.service';
14
+ import { packageMetadata } from '../package-metadata';
15
+ import { PALETTEPRESETS } from './models';
16
+ import { parseColor } from './utils';
17
+ import { isPresent } from '../common/utils';
18
+ import { ColorPaletteService } from './services/color-palette.service';
19
+ import * as i0 from "@angular/core";
20
+ import * as i1 from "./services/color-palette.service";
21
+ import * as i2 from "@progress/kendo-angular-l10n";
22
+ import * as i3 from "./localization/localized-colorpicker-messages.directive";
23
+ import * as i4 from "@angular/common";
24
+ const DEFAULT_TILE_SIZE = 24;
25
+ const DEFAULT_COLUMNS_COUNT = 10;
26
+ const DEFAULT_PRESET = 'office';
27
+ const DEFAULT_ACCESSIBLE_PRESET = 'accessible';
28
+ let serial = 0;
29
+ /**
30
+ * The ColorPalette component provides a set of predefined palette presets and enables you to implement a custom color palette.
31
+ * The ColorPalette is independently used by `kendo-colorpicker` and can be directly added to the page.
32
+ */
33
+ export class ColorPaletteComponent {
34
+ constructor(host, service, cdr, renderer, localizationService, ngZone) {
35
+ this.host = host;
36
+ this.service = service;
37
+ this.cdr = cdr;
38
+ this.renderer = renderer;
39
+ this.localizationService = localizationService;
40
+ this.ngZone = ngZone;
41
+ /**
42
+ * @hidden
43
+ */
44
+ this.role = 'grid';
45
+ /**
46
+ * @hidden
47
+ */
48
+ this.id = `k-colorpalette-${serial++}`;
49
+ /**
50
+ * Specifies the output format of the ColorPaletteComponent.
51
+ * The input value may be in a different format. However, it will be parsed into the output `format`
52
+ * after the component processes it.
53
+ *
54
+ * The supported values are:
55
+ * * (Default) `hex`
56
+ * * `rgba`
57
+ * * `name`
58
+ */
59
+ this.format = 'hex';
60
+ /**
61
+ * Sets the disabled state of the ColorPalette.
62
+ */
63
+ this.disabled = false;
64
+ /**
65
+ * Sets the read-only state of the ColorPalette.
66
+ */
67
+ this.readonly = false;
68
+ /**
69
+ * Specifies the size of a color cell.
70
+ *
71
+ * The possible values are:
72
+ * * (Default) `tileSize = 24`
73
+ * * `{ width: number, height: number }`
74
+ */
75
+ this.tileSize = { width: DEFAULT_TILE_SIZE, height: DEFAULT_TILE_SIZE };
76
+ /**
77
+ * Fires each time the color selection is changed.
78
+ */
79
+ this.selectionChange = new EventEmitter();
80
+ /**
81
+ * Fires each time the value is changed.
82
+ */
83
+ this.valueChange = new EventEmitter();
84
+ /**
85
+ * Fires each time the user selects a cell with the mouse or presses `Enter`.
86
+ *
87
+ * @hidden
88
+ */
89
+ this.cellSelection = new EventEmitter();
90
+ /**
91
+ * @hidden
92
+ */
93
+ this.hostClasses = true;
94
+ /**
95
+ * @hidden
96
+ */
97
+ this.uniqueId = guid();
98
+ this._tabindex = 0;
99
+ this.subs = new Subscription();
100
+ this.notifyNgTouched = () => { };
101
+ this.notifyNgChanged = () => { };
102
+ validatePackage(packageMetadata);
103
+ this.dynamicRTLSubscription = localizationService.changes.subscribe(({ rtl }) => {
104
+ this.direction = rtl ? 'rtl' : 'ltr';
105
+ });
106
+ }
107
+ /**
108
+ * @hidden
109
+ */
110
+ get activeDescendant() {
111
+ return this.activeCellId;
112
+ }
113
+ ;
114
+ /**
115
+ * @hidden
116
+ */
117
+ get paletteId() {
118
+ return this.id;
119
+ }
120
+ /**
121
+ * Specifies the value of the initially selected color.
122
+ */
123
+ set value(value) {
124
+ this._value = parseColor(value, this.format);
125
+ }
126
+ get value() {
127
+ return this._value;
128
+ }
129
+ /**
130
+ * Specifies the number of columns that will be displayed.
131
+ * Defaults to `10`.
132
+ */
133
+ set columns(value) {
134
+ const minColumnsCount = 1;
135
+ this._columns = value > minColumnsCount ? value : minColumnsCount;
136
+ }
137
+ get columns() {
138
+ return this._columns;
139
+ }
140
+ /**
141
+ * The color palette that will be displayed.
142
+ *
143
+ * The supported values are:
144
+ * * The name of the predefined palette preset (for example, `office`, `basic`, and `apex`).
145
+ * * A string with comma-separated colors.
146
+ * * A string array.
147
+ */
148
+ set palette(value) {
149
+ if (!isPresent(value)) {
150
+ value = DEFAULT_PRESET;
151
+ }
152
+ if (typeof value === 'string' && isPresent(PALETTEPRESETS[value])) {
153
+ this.columns = this.columns || PALETTEPRESETS[value].columns;
154
+ value = PALETTEPRESETS[value].colors;
155
+ }
156
+ const colors = (typeof value === 'string') ? value.split(',') : value;
157
+ this._palette = colors.map(color => parseColor(color, this.format, false, false));
158
+ }
159
+ get palette() {
160
+ return this._palette;
161
+ }
162
+ /**
163
+ * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
164
+ */
165
+ set tabindex(value) {
166
+ const tabindex = Number(value);
167
+ const defaultValue = 0;
168
+ this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
169
+ }
170
+ get tabindex() {
171
+ return !this.disabled ? this._tabindex : undefined;
172
+ }
173
+ /**
174
+ * @hidden
175
+ */
176
+ get tileLayout() {
177
+ if (typeof this.tileSize !== 'number') {
178
+ return this.tileSize;
179
+ }
180
+ return { width: this.tileSize, height: this.tileSize };
181
+ }
182
+ /**
183
+ * @hidden
184
+ */
185
+ get colorRows() {
186
+ return this.service.colorRows;
187
+ }
188
+ /**
189
+ * @hidden
190
+ */
191
+ get hostTabindex() { return this.tabindex; }
192
+ /**
193
+ * @hidden
194
+ */
195
+ get disabledClass() { return this.disabled; }
196
+ /**
197
+ * @hidden
198
+ */
199
+ get readonlyAttribute() { return this.readonly; }
200
+ ngOnInit() {
201
+ if (this.colorRows.length === 0) {
202
+ const defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
203
+ this.palette = this.palette || defaultPreset;
204
+ this.setRows();
205
+ }
206
+ const elem = this.host.nativeElement;
207
+ this.subs.add(this.renderer.listen(elem, 'keydown', event => this.handleKeydown(event)));
208
+ this.subs.add(this.renderer.listen(elem, 'focus', () => this.handleFocus()));
209
+ this.subs.add(this.renderer.listen(elem, 'blur', () => this.handleHostBlur()));
210
+ }
211
+ ngAfterViewInit() {
212
+ this.setHostElementAriaLabel();
213
+ if (this.value) {
214
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
215
+ this.selectCell(this.value);
216
+ });
217
+ }
218
+ }
219
+ ngOnDestroy() {
220
+ this.subs.unsubscribe();
221
+ if (this.dynamicRTLSubscription) {
222
+ this.dynamicRTLSubscription.unsubscribe();
223
+ }
224
+ }
225
+ ngOnChanges(changes) {
226
+ if (changes['palette'] || changes['columns']) {
227
+ this.setRows();
228
+ }
229
+ if (changes['palette'] || changes['value'] || changes['columns']) {
230
+ this.selectCell(this.value);
231
+ this.setHostElementAriaLabel();
232
+ }
233
+ }
234
+ /**
235
+ * @hidden
236
+ */
237
+ handleKeydown(event) {
238
+ const isRTL = this.direction === 'rtl';
239
+ switch (event.keyCode) {
240
+ case Keys.ArrowDown:
241
+ this.handleCellNavigation(0, 1);
242
+ break;
243
+ case Keys.ArrowUp:
244
+ this.handleCellNavigation(0, -1);
245
+ break;
246
+ case Keys.ArrowRight:
247
+ this.handleCellNavigation(isRTL ? -1 : 1, 0);
248
+ break;
249
+ case Keys.ArrowLeft:
250
+ this.handleCellNavigation(isRTL ? 1 : -1, 0);
251
+ break;
252
+ case Keys.Enter:
253
+ this.handleEnter();
254
+ break;
255
+ default: return;
256
+ }
257
+ event.preventDefault();
258
+ }
259
+ /**
260
+ * @hidden
261
+ */
262
+ handleFocus() {
263
+ if (!this.focusInComponent) {
264
+ this.focus();
265
+ }
266
+ }
267
+ /**
268
+ * @hidden
269
+ */
270
+ handleHostBlur() {
271
+ this.notifyNgTouched();
272
+ this.handleCellFocusOnBlur();
273
+ }
274
+ /**
275
+ * @hidden
276
+ */
277
+ handleCellSelection(value, focusedCell) {
278
+ if (this.readonly) {
279
+ return;
280
+ }
281
+ this.selectedCell = focusedCell;
282
+ this.focusedCell = this.selectedCell;
283
+ this.focusInComponent = true;
284
+ const parsedColor = parseColor(value, this.format, false, false);
285
+ this.cellSelection.emit(parsedColor);
286
+ this.handleValueChange(parsedColor);
287
+ if (this.selection !== parsedColor) {
288
+ this.selection = parsedColor;
289
+ this.selectionChange.emit(parsedColor);
290
+ }
291
+ if (focusedCell) {
292
+ this.activeCellId = `k-${this.selectedCell.row}-${this.selectedCell.col}-${this.uniqueId}`;
293
+ }
294
+ }
295
+ /**
296
+ * @hidden
297
+ */
298
+ writeValue(value) {
299
+ this.value = value;
300
+ this.selectCell(value);
301
+ }
302
+ /**
303
+ * @hidden
304
+ */
305
+ registerOnChange(fn) {
306
+ this.notifyNgChanged = fn;
307
+ }
308
+ /**
309
+ * @hidden
310
+ */
311
+ registerOnTouched(fn) {
312
+ this.notifyNgTouched = fn;
313
+ }
314
+ /**
315
+ * @hidden
316
+ */
317
+ setDisabledState(isDisabled) {
318
+ this.cdr.markForCheck();
319
+ this.disabled = isDisabled;
320
+ }
321
+ /**
322
+ * @hidden
323
+ */
324
+ focus() {
325
+ this.host.nativeElement.focus();
326
+ if (!this.focusedCell && !this.readonly && !this.disabled) {
327
+ this.focusedCell = {
328
+ row: 0,
329
+ col: 0
330
+ };
331
+ this.activeCellId = `k-${this.focusedCell.row}-${this.focusedCell.col}-${this.uniqueId}`;
332
+ }
333
+ }
334
+ /**
335
+ * @hidden
336
+ * Used by the FloatingLabel to determine if the component is empty.
337
+ */
338
+ isEmpty() {
339
+ return false;
340
+ }
341
+ /**
342
+ * Clears the color value of the ColorPalette.
343
+ */
344
+ reset() {
345
+ this.focusedCell = null;
346
+ if (isPresent(this.value)) {
347
+ this.handleValueChange(undefined);
348
+ }
349
+ this.selectedCell = undefined;
350
+ }
351
+ handleValueChange(color) {
352
+ if (this.value === color) {
353
+ return;
354
+ }
355
+ this.value = color;
356
+ this.valueChange.emit(color);
357
+ this.notifyNgChanged(color);
358
+ this.setHostElementAriaLabel();
359
+ }
360
+ handleCellFocusOnBlur() {
361
+ this.focusInComponent = false;
362
+ this.focusedCell = this.selectedCell;
363
+ }
364
+ selectCell(value) {
365
+ const parsedColor = parseColor(value, 'hex');
366
+ this.selectedCell = this.service.getCellCoordsFor(parsedColor);
367
+ this.focusedCell = this.selectedCell;
368
+ }
369
+ setRows() {
370
+ if (!isPresent(this.palette)) {
371
+ return;
372
+ }
373
+ this.columns = this.columns || DEFAULT_COLUMNS_COUNT;
374
+ this.service.setColorMatrix(this.palette, this.columns);
375
+ }
376
+ handleCellNavigation(horizontalStep, verticalStep) {
377
+ if (this.readonly) {
378
+ return;
379
+ }
380
+ this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
381
+ this.focusInComponent = true;
382
+ if (this.focusedCell) {
383
+ this.activeCellId = `k-${this.focusedCell.row}-${this.focusedCell.col}-${this.uniqueId}`;
384
+ }
385
+ }
386
+ setHostElementAriaLabel() {
387
+ const parsed = parseColor(this.value, this.format);
388
+ this.renderer.setAttribute(this.host.nativeElement, 'aria-label', `${this.value ? parsed : this.localizationService.get('colorPaletteNoColor')}`);
389
+ }
390
+ handleEnter() {
391
+ if (!isPresent(this.focusedCell)) {
392
+ return;
393
+ }
394
+ const selectedColor = this.service.getColorAt(this.focusedCell);
395
+ this.handleCellSelection(selectedColor, this.focusedCell);
396
+ }
397
+ }
398
+ ColorPaletteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ColorPaletteComponent, deps: [{ token: i0.ElementRef }, { token: i1.ColorPaletteService }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
399
+ ColorPaletteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: ColorPaletteComponent, selector: "kendo-colorpalette", inputs: { id: "id", format: "format", value: "value", columns: "columns", palette: "palette", tabindex: "tabindex", disabled: "disabled", readonly: "readonly", tileSize: "tileSize" }, outputs: { selectionChange: "selectionChange", valueChange: "valueChange", cellSelection: "cellSelection" }, host: { properties: { "attr.dir": "this.direction", "attr.role": "this.role", "attr.aria-activedescendant": "this.activeDescendant", "attr.id": "this.paletteId", "attr.tabindex": "this.hostTabindex", "class.k-colorpalette": "this.hostClasses", "attr.aria-disabled": "this.disabledClass", "class.k-disabled": "this.disabledClass", "attr.aria-readonly": "this.readonlyAttribute" } }, providers: [
400
+ {
401
+ multi: true,
402
+ provide: NG_VALUE_ACCESSOR,
403
+ useExisting: forwardRef(() => ColorPaletteComponent)
404
+ }, {
405
+ provide: KendoInput,
406
+ useExisting: forwardRef(() => ColorPaletteComponent)
407
+ },
408
+ ColorPaletteService,
409
+ ColorPaletteLocalizationService,
410
+ {
411
+ provide: LocalizationService,
412
+ useExisting: ColorPaletteLocalizationService
413
+ },
414
+ {
415
+ provide: L10N_PREFIX,
416
+ useValue: 'kendo.colorpalette'
417
+ }
418
+ ], exportAs: ["kendoColorPalette"], usesOnChanges: true, ngImport: i0, template: `
419
+ <ng-container kendoColorPaletteLocalizedMessages
420
+ i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
421
+ colorPaletteNoColor="Colorpalette no color chosen">
422
+ </ng-container>
423
+ <table role="presentation" class="k-colorpalette-table">
424
+ <tbody>
425
+ <tr *ngFor="let row of colorRows; let rowIndex = index" role="row">
426
+ <td *ngFor="let color of row; let colIndex = index"
427
+ role="gridcell"
428
+ [class.k-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
429
+ [class.k-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
430
+ [attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex ? 'true' : undefined"
431
+ [attr.aria-label]="color"
432
+ class="k-colorpalette-tile"
433
+ [id]="'k-' + rowIndex + '-' + colIndex + '-' + uniqueId"
434
+ [attr.value]="color"
435
+ (click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
436
+ [ngStyle]="{
437
+ backgroundColor: color,
438
+ width: tileLayout.width + 'px',
439
+ height: tileLayout.height + 'px',
440
+ minWidth: tileLayout.width + 'px'
441
+ }">
442
+ </td>
443
+ </tr>
444
+ </tbody>
445
+ </table>
446
+ `, isInline: true, directives: [{ type: i3.LocalizedColorPickerMessagesDirective, selector: "[kendoColorPickerLocalizedMessages], [kendoFlatColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]" }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
447
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ColorPaletteComponent, decorators: [{
448
+ type: Component,
449
+ args: [{
450
+ exportAs: 'kendoColorPalette',
451
+ selector: 'kendo-colorpalette',
452
+ providers: [
453
+ {
454
+ multi: true,
455
+ provide: NG_VALUE_ACCESSOR,
456
+ useExisting: forwardRef(() => ColorPaletteComponent)
457
+ }, {
458
+ provide: KendoInput,
459
+ useExisting: forwardRef(() => ColorPaletteComponent)
460
+ },
461
+ ColorPaletteService,
462
+ ColorPaletteLocalizationService,
463
+ {
464
+ provide: LocalizationService,
465
+ useExisting: ColorPaletteLocalizationService
466
+ },
467
+ {
468
+ provide: L10N_PREFIX,
469
+ useValue: 'kendo.colorpalette'
470
+ }
471
+ ],
472
+ template: `
473
+ <ng-container kendoColorPaletteLocalizedMessages
474
+ i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
475
+ colorPaletteNoColor="Colorpalette no color chosen">
476
+ </ng-container>
477
+ <table role="presentation" class="k-colorpalette-table">
478
+ <tbody>
479
+ <tr *ngFor="let row of colorRows; let rowIndex = index" role="row">
480
+ <td *ngFor="let color of row; let colIndex = index"
481
+ role="gridcell"
482
+ [class.k-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
483
+ [class.k-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
484
+ [attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex ? 'true' : undefined"
485
+ [attr.aria-label]="color"
486
+ class="k-colorpalette-tile"
487
+ [id]="'k-' + rowIndex + '-' + colIndex + '-' + uniqueId"
488
+ [attr.value]="color"
489
+ (click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
490
+ [ngStyle]="{
491
+ backgroundColor: color,
492
+ width: tileLayout.width + 'px',
493
+ height: tileLayout.height + 'px',
494
+ minWidth: tileLayout.width + 'px'
495
+ }">
496
+ </td>
497
+ </tr>
498
+ </tbody>
499
+ </table>
500
+ `
501
+ }]
502
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ColorPaletteService }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { direction: [{
503
+ type: HostBinding,
504
+ args: ['attr.dir']
505
+ }], role: [{
506
+ type: HostBinding,
507
+ args: ['attr.role']
508
+ }], activeDescendant: [{
509
+ type: HostBinding,
510
+ args: ['attr.aria-activedescendant']
511
+ }], paletteId: [{
512
+ type: HostBinding,
513
+ args: ['attr.id']
514
+ }], id: [{
515
+ type: Input
516
+ }], format: [{
517
+ type: Input
518
+ }], value: [{
519
+ type: Input
520
+ }], columns: [{
521
+ type: Input
522
+ }], palette: [{
523
+ type: Input
524
+ }], tabindex: [{
525
+ type: Input
526
+ }], disabled: [{
527
+ type: Input
528
+ }], readonly: [{
529
+ type: Input
530
+ }], tileSize: [{
531
+ type: Input
532
+ }], selectionChange: [{
533
+ type: Output
534
+ }], valueChange: [{
535
+ type: Output
536
+ }], cellSelection: [{
537
+ type: Output
538
+ }], hostTabindex: [{
539
+ type: HostBinding,
540
+ args: ['attr.tabindex']
541
+ }], hostClasses: [{
542
+ type: HostBinding,
543
+ args: ['class.k-colorpalette']
544
+ }], disabledClass: [{
545
+ type: HostBinding,
546
+ args: ['attr.aria-disabled']
547
+ }, {
548
+ type: HostBinding,
549
+ args: ['class.k-disabled']
550
+ }], readonlyAttribute: [{
551
+ type: HostBinding,
552
+ args: ['attr.aria-readonly']
553
+ }] } });