@ng-matero/extensions 12.5.3 → 12.7.1

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 (143) hide show
  1. package/_all-theme.scss +2 -0
  2. package/_index.scss +2 -0
  3. package/_theming.scss +2 -0
  4. package/bundles/extensions.umd.js +7 -7
  5. package/bundles/extensions.umd.js.map +1 -1
  6. package/bundles/mtxColorpicker.umd.js +1123 -0
  7. package/bundles/mtxColorpicker.umd.js.map +1 -0
  8. package/bundles/mtxDatetimepicker.umd.js +603 -148
  9. package/bundles/mtxDatetimepicker.umd.js.map +1 -1
  10. package/bundles/mtxDialog.umd.js +0 -2
  11. package/bundles/mtxDialog.umd.js.map +1 -1
  12. package/bundles/mtxFormGroup.umd.js +2 -9
  13. package/bundles/mtxFormGroup.umd.js.map +1 -1
  14. package/bundles/mtxLoader.umd.js +7 -4
  15. package/bundles/mtxLoader.umd.js.map +1 -1
  16. package/bundles/mtxPopover.umd.js +5 -8
  17. package/bundles/mtxPopover.umd.js.map +1 -1
  18. package/bundles/mtxSelect.umd.js +1 -0
  19. package/bundles/mtxSelect.umd.js.map +1 -1
  20. package/bundles/mtxSplit.umd.js +80 -81
  21. package/bundles/mtxSplit.umd.js.map +1 -1
  22. package/bundles/mtxText3d.umd.js +0 -8
  23. package/bundles/mtxText3d.umd.js.map +1 -1
  24. package/bundles/mtxTooltip.umd.js +2 -0
  25. package/bundles/mtxTooltip.umd.js.map +1 -1
  26. package/colorpicker/_colorpicker-theme.import.scss +2 -0
  27. package/colorpicker/_colorpicker-theme.scss +43 -0
  28. package/colorpicker/colorpicker-animations.d.ts +8 -0
  29. package/colorpicker/colorpicker-content.scss +4 -0
  30. package/colorpicker/colorpicker-input.d.ts +89 -0
  31. package/colorpicker/colorpicker-module.d.ts +2 -0
  32. package/colorpicker/colorpicker-toggle.d.ts +33 -0
  33. package/colorpicker/colorpicker-toggle.scss +23 -0
  34. package/colorpicker/colorpicker.d.ts +126 -0
  35. package/{color-picker/mtxColorPicker.d.ts → colorpicker/mtxColorpicker.d.ts} +0 -0
  36. package/colorpicker/mtxColorpicker.metadata.json +1 -0
  37. package/colorpicker/package.json +11 -0
  38. package/colorpicker/public-api.d.ts +5 -0
  39. package/datetimepicker/_datetimepicker-theme.scss +12 -0
  40. package/datetimepicker/calendar.d.ts +2 -10
  41. package/datetimepicker/clock.d.ts +10 -9
  42. package/datetimepicker/datetimepicker-animations.d.ts +7 -5
  43. package/datetimepicker/datetimepicker-input.d.ts +4 -2
  44. package/datetimepicker/{datetimepicker.module.d.ts → datetimepicker-module.d.ts} +0 -0
  45. package/datetimepicker/datetimepicker-toggle.d.ts +15 -2
  46. package/datetimepicker/datetimepicker-toggle.scss +23 -0
  47. package/datetimepicker/datetimepicker.d.ts +67 -24
  48. package/datetimepicker/month-view.d.ts +3 -3
  49. package/datetimepicker/mtxDatetimepicker.d.ts +0 -2
  50. package/datetimepicker/mtxDatetimepicker.metadata.json +1 -1
  51. package/datetimepicker/multi-year-view.d.ts +3 -3
  52. package/datetimepicker/public-api.d.ts +3 -1
  53. package/datetimepicker/year-view.d.ts +3 -3
  54. package/dialog/{dialog.config.d.ts → dialog-config.d.ts} +0 -0
  55. package/dialog/dialog.component.d.ts +1 -1
  56. package/dialog/dialog.d.ts +1 -1
  57. package/dialog/mtxDialog.metadata.json +1 -1
  58. package/dialog/public-api.d.ts +2 -2
  59. package/esm2015/colorpicker/colorpicker-animations.js +16 -0
  60. package/esm2015/colorpicker/colorpicker-input.js +228 -0
  61. package/esm2015/colorpicker/colorpicker-module.js +41 -0
  62. package/esm2015/colorpicker/colorpicker-toggle.js +97 -0
  63. package/esm2015/colorpicker/colorpicker.js +372 -0
  64. package/esm2015/colorpicker/mtxColorpicker.js +5 -0
  65. package/esm2015/colorpicker/public-api.js +6 -0
  66. package/esm2015/datetimepicker/calendar-body.js +2 -1
  67. package/esm2015/datetimepicker/calendar.js +14 -29
  68. package/esm2015/datetimepicker/clock.js +7 -7
  69. package/esm2015/datetimepicker/datetimepicker-animations.js +38 -24
  70. package/esm2015/datetimepicker/datetimepicker-input.js +6 -3
  71. package/esm2015/datetimepicker/datetimepicker-module.js +52 -0
  72. package/esm2015/datetimepicker/datetimepicker-toggle.js +30 -8
  73. package/esm2015/datetimepicker/datetimepicker.js +150 -71
  74. package/esm2015/datetimepicker/month-view.js +8 -7
  75. package/esm2015/datetimepicker/mtxDatetimepicker.js +1 -3
  76. package/esm2015/datetimepicker/multi-year-view.js +8 -7
  77. package/esm2015/datetimepicker/public-api.js +4 -2
  78. package/esm2015/datetimepicker/year-view.js +8 -7
  79. package/esm2015/dialog/{dialog.config.js → dialog-config.js} +1 -1
  80. package/esm2015/dialog/dialog.component.js +1 -1
  81. package/esm2015/dialog/dialog.js +1 -1
  82. package/esm2015/dialog/public-api.js +3 -3
  83. package/esm2015/extensions.module.js +3 -3
  84. package/esm2015/form-group/form-group.component.js +4 -11
  85. package/esm2015/loader/loader.component.js +8 -5
  86. package/esm2015/popover/popover.js +5 -9
  87. package/esm2015/public-api.js +2 -2
  88. package/esm2015/select/select.component.js +2 -1
  89. package/esm2015/split/split.component.js +13 -11
  90. package/esm2015/split/utils.js +1 -6
  91. package/esm2015/text3d/text3d.component.js +1 -9
  92. package/esm2015/tooltip/tooltip.js +3 -1
  93. package/extensions.metadata.json +1 -1
  94. package/fesm2015/extensions.js +3 -3
  95. package/fesm2015/extensions.js.map +1 -1
  96. package/fesm2015/mtxColorpicker.js +743 -0
  97. package/fesm2015/mtxColorpicker.js.map +1 -0
  98. package/fesm2015/mtxDatetimepicker.js +259 -146
  99. package/fesm2015/mtxDatetimepicker.js.map +1 -1
  100. package/fesm2015/mtxDialog.js +1 -1
  101. package/fesm2015/mtxDialog.js.map +1 -1
  102. package/fesm2015/mtxFormGroup.js +3 -10
  103. package/fesm2015/mtxFormGroup.js.map +1 -1
  104. package/fesm2015/mtxLoader.js +7 -4
  105. package/fesm2015/mtxLoader.js.map +1 -1
  106. package/fesm2015/mtxPopover.js +4 -8
  107. package/fesm2015/mtxPopover.js.map +1 -1
  108. package/fesm2015/mtxSelect.js +1 -0
  109. package/fesm2015/mtxSelect.js.map +1 -1
  110. package/fesm2015/mtxSplit.js +12 -15
  111. package/fesm2015/mtxSplit.js.map +1 -1
  112. package/fesm2015/mtxText3d.js +0 -8
  113. package/fesm2015/mtxText3d.js.map +1 -1
  114. package/fesm2015/mtxTooltip.js +2 -0
  115. package/fesm2015/mtxTooltip.js.map +1 -1
  116. package/form-group/form-group.component.d.ts +2 -4
  117. package/form-group/mtxFormGroup.metadata.json +1 -1
  118. package/loader/loader.component.d.ts +4 -1
  119. package/loader/mtxLoader.metadata.json +1 -1
  120. package/package.json +1 -1
  121. package/popover/popover.d.ts +0 -4
  122. package/public-api.d.ts +1 -1
  123. package/select/mtxSelect.metadata.json +1 -1
  124. package/split/_split-theme.scss +9 -2
  125. package/split/mtxSplit.metadata.json +1 -1
  126. package/split/split.component.d.ts +9 -1
  127. package/text3d/mtxText3d.metadata.json +1 -1
  128. package/text3d/text3d.component.d.ts +0 -1
  129. package/tooltip/mtxTooltip.metadata.json +1 -1
  130. package/bundles/mtxColorPicker.umd.js +0 -337
  131. package/bundles/mtxColorPicker.umd.js.map +0 -1
  132. package/color-picker/color-picker.component.d.ts +0 -120
  133. package/color-picker/color-picker.module.d.ts +0 -2
  134. package/color-picker/mtxColorPicker.metadata.json +0 -1
  135. package/color-picker/package.json +0 -11
  136. package/color-picker/public-api.d.ts +0 -2
  137. package/esm2015/color-picker/color-picker.component.js +0 -268
  138. package/esm2015/color-picker/color-picker.module.js +0 -26
  139. package/esm2015/color-picker/mtxColorPicker.js +0 -5
  140. package/esm2015/color-picker/public-api.js +0 -3
  141. package/esm2015/datetimepicker/datetimepicker.module.js +0 -49
  142. package/fesm2015/mtxColorPicker.js +0 -295
  143. package/fesm2015/mtxColorPicker.js.map +0 -1
@@ -0,0 +1,1123 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/cdk/overlay'), require('@angular/cdk/a11y'), require('@angular/cdk/portal'), require('@angular/material/button'), require('@angular/cdk/coercion'), require('@angular/cdk/keycodes'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('rxjs'), require('@angular/cdk/bidi'), require('@angular/material/core'), require('rxjs/operators'), require('@angular/animations'), require('@ctrl/tinycolor'), require('ngx-color/chrome')) :
3
+ typeof define === 'function' && define.amd ? define('@ng-matero/extensions/colorpicker', ['exports', '@angular/common', '@angular/core', '@angular/cdk/overlay', '@angular/cdk/a11y', '@angular/cdk/portal', '@angular/material/button', '@angular/cdk/coercion', '@angular/cdk/keycodes', '@angular/forms', '@angular/material/form-field', '@angular/material/input', 'rxjs', '@angular/cdk/bidi', '@angular/material/core', 'rxjs/operators', '@angular/animations', '@ctrl/tinycolor', 'ngx-color/chrome'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["ng-matero"] = global["ng-matero"] || {}, global["ng-matero"].extensions = global["ng-matero"].extensions || {}, global["ng-matero"].extensions.colorpicker = {}), global.ng.common, global.ng.core, global.ng.cdk.overlay, global.ng.cdk.a11y, global.ng.cdk.portal, global.ng.material.button, global.ng.cdk.coercion, global.ng.cdk.keycodes, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.rxjs, global.ng.cdk.bidi, global.ng.material.core, global.rxjs.operators, global.ng.animations, global.tinycolor, global["ngx-color-chrome"]));
5
+ })(this, (function (exports, common, core, overlay, a11y, portal, button, coercion, keycodes, forms, formField, input, rxjs, bidi, core$1, operators, animations, tinycolor, chrome) { 'use strict';
6
+
7
+ var MtxColorPickerInputEvent = /** @class */ (function () {
8
+ function MtxColorPickerInputEvent(
9
+ /** Reference to the colorpicker input component that emitted the event. */
10
+ target,
11
+ /** Reference to the native input element associated with the colorpicker input. */
12
+ targetElement) {
13
+ this.target = target;
14
+ this.targetElement = targetElement;
15
+ this.value = this.target.value;
16
+ }
17
+ return MtxColorPickerInputEvent;
18
+ }());
19
+ var MTX_COLORPICKER_VALUE_ACCESSOR = {
20
+ provide: forms.NG_VALUE_ACCESSOR,
21
+ useExisting: core.forwardRef(function () { return MtxColorpickerInput; }),
22
+ multi: true,
23
+ };
24
+ var MTX_COLORPICKER_VALIDATORS = {
25
+ provide: forms.NG_VALIDATORS,
26
+ useExisting: core.forwardRef(function () { return MtxColorpickerInput; }),
27
+ multi: true,
28
+ };
29
+ var MtxColorpickerInput = /** @class */ (function () {
30
+ function MtxColorpickerInput(_elementRef, _formField) {
31
+ this._elementRef = _elementRef;
32
+ this._formField = _formField;
33
+ /** The input and output color format. */
34
+ this.format = 'hex';
35
+ /** Emits when a `change` event is fired on this `<input>`. */
36
+ this.colorChange = new core.EventEmitter();
37
+ /** Emits when an `input` event is fired on this `<input>`. */
38
+ this.colorInput = new core.EventEmitter();
39
+ /** Emits when the disabled state has changed */
40
+ this._disabledChange = new core.EventEmitter();
41
+ /** Emits when the value changes (either due to user input or programmatic change). */
42
+ this._valueChange = new core.EventEmitter();
43
+ this._onTouched = function () { };
44
+ this._validatorOnChange = function () { };
45
+ this._cvaOnChange = function () { };
46
+ this._pickerSubscription = rxjs.Subscription.EMPTY;
47
+ /** The combined form control validator for this input. */
48
+ this._validator = forms.Validators.compose([]);
49
+ /** Whether the last value set on the input was valid. */
50
+ this._lastValueValid = false;
51
+ }
52
+ Object.defineProperty(MtxColorpickerInput.prototype, "mtxColorpicker", {
53
+ set: function (value) {
54
+ var _this = this;
55
+ if (!value) {
56
+ return;
57
+ }
58
+ this._picker = value;
59
+ this._picker.registerInput(this);
60
+ this._pickerSubscription.unsubscribe();
61
+ this._pickerSubscription = this._picker._selectedChanged.subscribe(function (selected) {
62
+ _this.value = selected;
63
+ _this._cvaOnChange(selected);
64
+ _this._onTouched();
65
+ _this.colorInput.emit(new MtxColorPickerInputEvent(_this, _this._elementRef.nativeElement));
66
+ _this.colorChange.emit(new MtxColorPickerInputEvent(_this, _this._elementRef.nativeElement));
67
+ });
68
+ },
69
+ enumerable: false,
70
+ configurable: true
71
+ });
72
+ Object.defineProperty(MtxColorpickerInput.prototype, "disabled", {
73
+ /** Whether the colorpicker-input is disabled. */
74
+ get: function () {
75
+ return !!this._disabled;
76
+ },
77
+ set: function (value) {
78
+ var newValue = coercion.coerceBooleanProperty(value);
79
+ var element = this._elementRef.nativeElement;
80
+ if (this._disabled !== newValue) {
81
+ this._disabled = newValue;
82
+ this._disabledChange.emit(newValue);
83
+ }
84
+ // We need to null check the `blur` method, because it's undefined during SSR.
85
+ // In Ivy static bindings are invoked earlier, before the element is attached to the DOM.
86
+ // This can cause an error to be thrown in some browsers (IE/Edge) which assert that the
87
+ // element has been inserted.
88
+ if (newValue && this._isInitialized && element.blur) {
89
+ // Normally, native input elements automatically blur if they turn disabled. This behavior
90
+ // is problematic, because it would mean that it triggers another change detection cycle,
91
+ // which then causes a changed after checked error if the input element was focused before.
92
+ element.blur();
93
+ }
94
+ },
95
+ enumerable: false,
96
+ configurable: true
97
+ });
98
+ Object.defineProperty(MtxColorpickerInput.prototype, "value", {
99
+ /** The value of the input. */
100
+ get: function () {
101
+ return this._value;
102
+ },
103
+ set: function (value) {
104
+ var oldValue = this.value;
105
+ this._value = value;
106
+ this._formatValue(value);
107
+ this._valueChange.emit(value);
108
+ },
109
+ enumerable: false,
110
+ configurable: true
111
+ });
112
+ MtxColorpickerInput.prototype.ngAfterViewInit = function () {
113
+ this._isInitialized = true;
114
+ };
115
+ MtxColorpickerInput.prototype.ngOnDestroy = function () {
116
+ this._pickerSubscription.unsubscribe();
117
+ this._valueChange.complete();
118
+ this._disabledChange.complete();
119
+ };
120
+ MtxColorpickerInput.prototype.registerOnValidatorChange = function (fn) {
121
+ this._validatorOnChange = fn;
122
+ };
123
+ /** @docs-private */
124
+ MtxColorpickerInput.prototype.validate = function (c) {
125
+ return this._validator ? this._validator(c) : null;
126
+ };
127
+ /**
128
+ * @deprecated
129
+ * @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
130
+ */
131
+ MtxColorpickerInput.prototype.getPopupConnectionElementRef = function () {
132
+ return this.getConnectedOverlayOrigin();
133
+ };
134
+ /**
135
+ * Gets the element that the colorpicker popup should be connected to.
136
+ * @return The element to connect the popup to.
137
+ */
138
+ MtxColorpickerInput.prototype.getConnectedOverlayOrigin = function () {
139
+ return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
140
+ };
141
+ /** Gets the ID of an element that should be used a description for the overlay. */
142
+ MtxColorpickerInput.prototype.getOverlayLabelId = function () {
143
+ if (this._formField) {
144
+ return this._formField.getLabelId();
145
+ }
146
+ return this._elementRef.nativeElement.getAttribute('aria-labelledby');
147
+ };
148
+ // Implemented as part of ControlValueAccessor.
149
+ MtxColorpickerInput.prototype.writeValue = function (value) {
150
+ this.value = value;
151
+ };
152
+ // Implemented as part of ControlValueAccessor.
153
+ MtxColorpickerInput.prototype.registerOnChange = function (fn) {
154
+ this._cvaOnChange = fn;
155
+ };
156
+ // Implemented as part of ControlValueAccessor.
157
+ MtxColorpickerInput.prototype.registerOnTouched = function (fn) {
158
+ this._onTouched = fn;
159
+ };
160
+ // Implemented as part of ControlValueAccessor.
161
+ MtxColorpickerInput.prototype.setDisabledState = function (isDisabled) {
162
+ this.disabled = isDisabled;
163
+ };
164
+ MtxColorpickerInput.prototype._onKeydown = function (event) {
165
+ var isAltDownArrow = event.altKey && event.keyCode === keycodes.DOWN_ARROW;
166
+ if (this._picker && isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
167
+ this._picker.open();
168
+ event.preventDefault();
169
+ }
170
+ };
171
+ /** Handles blur events on the input. */
172
+ MtxColorpickerInput.prototype._onBlur = function () {
173
+ // Reformat the input only if we have a valid value.
174
+ if (this.value) {
175
+ this._formatValue(this.value);
176
+ }
177
+ this._onTouched();
178
+ };
179
+ MtxColorpickerInput.prototype._onInput = function (value) {
180
+ var nextValue = value;
181
+ this._value = nextValue;
182
+ this._cvaOnChange(nextValue);
183
+ this._valueChange.emit(nextValue);
184
+ this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
185
+ };
186
+ MtxColorpickerInput.prototype._onChange = function () {
187
+ this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
188
+ };
189
+ /** Returns the palette used by the input's form field, if any. */
190
+ MtxColorpickerInput.prototype.getThemePalette = function () {
191
+ return this._formField ? this._formField.color : undefined;
192
+ };
193
+ /** TODO: Formats a value and sets it on the input element. */
194
+ MtxColorpickerInput.prototype._formatValue = function (value) {
195
+ this._elementRef.nativeElement.value = value ? value : '';
196
+ };
197
+ return MtxColorpickerInput;
198
+ }());
199
+ /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
200
+ MtxColorpickerInput.decorators = [
201
+ { type: core.Directive, args: [{
202
+ selector: 'input[mtxColorpicker]',
203
+ providers: [
204
+ MTX_COLORPICKER_VALUE_ACCESSOR,
205
+ MTX_COLORPICKER_VALIDATORS,
206
+ { provide: input.MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
207
+ ],
208
+ host: {
209
+ 'class': 'mtx-colorpicker-input',
210
+ '[attr.aria-haspopup]': '_picker ? "dialog" : null',
211
+ '[attr.aria-owns]': '(_picker?.opened && _picker.id) || null',
212
+ '[disabled]': 'disabled',
213
+ '(input)': '_onInput($event.target.value)',
214
+ '(change)': '_onChange()',
215
+ '(blur)': '_onBlur()',
216
+ '(keydown)': '_onKeydown($event)',
217
+ },
218
+ exportAs: 'mtxColorpickerInput',
219
+ },] }
220
+ ];
221
+ /**
222
+ * @type {function(): !Array<(null|{
223
+ * type: ?,
224
+ * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
225
+ * })>}
226
+ * @nocollapse
227
+ */
228
+ MtxColorpickerInput.ctorParameters = function () { return [
229
+ { type: core.ElementRef },
230
+ { type: formField.MatFormField, decorators: [{ type: core.Optional }] }
231
+ ]; };
232
+ /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
233
+ MtxColorpickerInput.propDecorators = {
234
+ mtxColorpicker: [{ type: core.Input }],
235
+ disabled: [{ type: core.Input }],
236
+ value: [{ type: core.Input }],
237
+ format: [{ type: core.Input }],
238
+ colorChange: [{ type: core.Output }],
239
+ colorInput: [{ type: core.Output }]
240
+ };
241
+
242
+ /** Can be used to override the icon of a `mtxColorpickerToggle`. */
243
+ var MtxColorpickerToggleIcon = /** @class */ (function () {
244
+ function MtxColorpickerToggleIcon() {
245
+ }
246
+ return MtxColorpickerToggleIcon;
247
+ }());
248
+ /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
249
+ MtxColorpickerToggleIcon.decorators = [
250
+ { type: core.Directive, args: [{
251
+ selector: '[mtxColorpickerToggleIcon]',
252
+ },] }
253
+ ];
254
+ var MtxColorpickerToggle = /** @class */ (function () {
255
+ function MtxColorpickerToggle(_changeDetectorRef) {
256
+ this._changeDetectorRef = _changeDetectorRef;
257
+ this._stateChanges = rxjs.Subscription.EMPTY;
258
+ }
259
+ Object.defineProperty(MtxColorpickerToggle.prototype, "disabled", {
260
+ /** Whether the toggle button is disabled. */
261
+ get: function () {
262
+ if (this._disabled == null && this.picker) {
263
+ return this.picker.disabled;
264
+ }
265
+ return !!this._disabled;
266
+ },
267
+ set: function (value) {
268
+ this._disabled = coercion.coerceBooleanProperty(value);
269
+ },
270
+ enumerable: false,
271
+ configurable: true
272
+ });
273
+ MtxColorpickerToggle.prototype.ngOnChanges = function (changes) {
274
+ if (changes.picker) {
275
+ this._watchStateChanges();
276
+ }
277
+ };
278
+ MtxColorpickerToggle.prototype.ngOnDestroy = function () {
279
+ this._stateChanges.unsubscribe();
280
+ };
281
+ MtxColorpickerToggle.prototype.ngAfterContentInit = function () {
282
+ this._watchStateChanges();
283
+ };
284
+ MtxColorpickerToggle.prototype.open = function (event) {
285
+ if (this.picker && !this.disabled) {
286
+ this.picker.open();
287
+ event.stopPropagation();
288
+ }
289
+ };
290
+ MtxColorpickerToggle.prototype._watchStateChanges = function () {
291
+ var _this = this;
292
+ var pickerDisabled = this.picker ? this.picker._disabledChange : rxjs.of();
293
+ var inputDisabled = this.picker && this.picker.pickerInput ? this.picker.pickerInput._disabledChange : rxjs.of();
294
+ var datepickerToggled = this.picker
295
+ ? rxjs.merge(this.picker.openedStream, this.picker.closedStream)
296
+ : rxjs.of();
297
+ this._stateChanges.unsubscribe();
298
+ this._stateChanges = rxjs.merge([pickerDisabled, inputDisabled, datepickerToggled]).subscribe(function () { return _this._changeDetectorRef.markForCheck(); });
299
+ };
300
+ return MtxColorpickerToggle;
301
+ }());
302
+ /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
303
+ MtxColorpickerToggle.decorators = [
304
+ { type: core.Component, args: [{
305
+ selector: 'mtx-colorpicker-toggle',
306
+ template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"picker ? 'dialog' : null\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\"\n (click)=\"open($event)\">\n\n <svg *ngIf=\"!_customIcon\"\n class=\"mtx-colorpicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path\n d=\"M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z\" />\n </svg>\n\n <ng-content select=\"[mtxColorpickerToggleIcon]\"></ng-content>\n</button>\n",
307
+ host: {
308
+ 'class': 'mtx-colorpicker-toggle',
309
+ // Always set the tabindex to -1 so that it doesn't overlap with any custom tabindex the
310
+ // consumer may have provided, while still being able to receive focus.
311
+ '[attr.tabindex]': 'disabled ? null : -1',
312
+ '[class.mtx-colorpicker-toggle-active]': 'picker && picker.opened',
313
+ '[class.mat-accent]': 'picker && picker.color === "accent"',
314
+ '[class.mat-warn]': 'picker && picker.color === "warn"',
315
+ '(focus)': '_button.focus()',
316
+ },
317
+ exportAs: 'mtxColorpickerToggle',
318
+ encapsulation: core.ViewEncapsulation.None,
319
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
320
+ styles: [".mat-form-field-appearance-legacy .mat-form-field-prefix .mtx-colorpicker-toggle-default-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mtx-colorpicker-toggle-default-icon{width:1em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mtx-colorpicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mtx-colorpicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mtx-colorpicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mtx-colorpicker-toggle-default-icon{margin:auto}\n"]
321
+ },] }
322
+ ];
323
+ /**
324
+ * @type {function(): !Array<(null|{
325
+ * type: ?,
326
+ * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
327
+ * })>}
328
+ * @nocollapse
329
+ */
330
+ MtxColorpickerToggle.ctorParameters = function () { return [
331
+ { type: core.ChangeDetectorRef }
332
+ ]; };
333
+ /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
334
+ MtxColorpickerToggle.propDecorators = {
335
+ picker: [{ type: core.Input, args: ['for',] }],
336
+ tabIndex: [{ type: core.Input }],
337
+ disabled: [{ type: core.Input }],
338
+ disableRipple: [{ type: core.Input }],
339
+ _customIcon: [{ type: core.ContentChild, args: [MtxColorpickerToggleIcon,] }],
340
+ _button: [{ type: core.ViewChild, args: ['button',] }]
341
+ };
342
+
343
+ /*! *****************************************************************************
344
+ Copyright (c) Microsoft Corporation.
345
+
346
+ Permission to use, copy, modify, and/or distribute this software for any
347
+ purpose with or without fee is hereby granted.
348
+
349
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
350
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
351
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
352
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
353
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
354
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
355
+ PERFORMANCE OF THIS SOFTWARE.
356
+ ***************************************************************************** */
357
+ /* global Reflect, Promise */
358
+ var extendStatics = function (d, b) {
359
+ extendStatics = Object.setPrototypeOf ||
360
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
361
+ function (d, b) { for (var p in b)
362
+ if (Object.prototype.hasOwnProperty.call(b, p))
363
+ d[p] = b[p]; };
364
+ return extendStatics(d, b);
365
+ };
366
+ function __extends(d, b) {
367
+ if (typeof b !== "function" && b !== null)
368
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
369
+ extendStatics(d, b);
370
+ function __() { this.constructor = d; }
371
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
372
+ }
373
+ var __assign = function () {
374
+ __assign = Object.assign || function __assign(t) {
375
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
376
+ s = arguments[i];
377
+ for (var p in s)
378
+ if (Object.prototype.hasOwnProperty.call(s, p))
379
+ t[p] = s[p];
380
+ }
381
+ return t;
382
+ };
383
+ return __assign.apply(this, arguments);
384
+ };
385
+ function __rest(s, e) {
386
+ var t = {};
387
+ for (var p in s)
388
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
389
+ t[p] = s[p];
390
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
391
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
392
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
393
+ t[p[i]] = s[p[i]];
394
+ }
395
+ return t;
396
+ }
397
+ function __decorate(decorators, target, key, desc) {
398
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
399
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
400
+ r = Reflect.decorate(decorators, target, key, desc);
401
+ else
402
+ for (var i = decorators.length - 1; i >= 0; i--)
403
+ if (d = decorators[i])
404
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
405
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
406
+ }
407
+ function __param(paramIndex, decorator) {
408
+ return function (target, key) { decorator(target, key, paramIndex); };
409
+ }
410
+ function __metadata(metadataKey, metadataValue) {
411
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
412
+ return Reflect.metadata(metadataKey, metadataValue);
413
+ }
414
+ function __awaiter(thisArg, _arguments, P, generator) {
415
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
416
+ return new (P || (P = Promise))(function (resolve, reject) {
417
+ function fulfilled(value) { try {
418
+ step(generator.next(value));
419
+ }
420
+ catch (e) {
421
+ reject(e);
422
+ } }
423
+ function rejected(value) { try {
424
+ step(generator["throw"](value));
425
+ }
426
+ catch (e) {
427
+ reject(e);
428
+ } }
429
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
430
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
431
+ });
432
+ }
433
+ function __generator(thisArg, body) {
434
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
435
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
436
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
437
+ function verb(n) { return function (v) { return step([n, v]); }; }
438
+ function step(op) {
439
+ if (f)
440
+ throw new TypeError("Generator is already executing.");
441
+ while (_)
442
+ try {
443
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
444
+ return t;
445
+ if (y = 0, t)
446
+ op = [op[0] & 2, t.value];
447
+ switch (op[0]) {
448
+ case 0:
449
+ case 1:
450
+ t = op;
451
+ break;
452
+ case 4:
453
+ _.label++;
454
+ return { value: op[1], done: false };
455
+ case 5:
456
+ _.label++;
457
+ y = op[1];
458
+ op = [0];
459
+ continue;
460
+ case 7:
461
+ op = _.ops.pop();
462
+ _.trys.pop();
463
+ continue;
464
+ default:
465
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
466
+ _ = 0;
467
+ continue;
468
+ }
469
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
470
+ _.label = op[1];
471
+ break;
472
+ }
473
+ if (op[0] === 6 && _.label < t[1]) {
474
+ _.label = t[1];
475
+ t = op;
476
+ break;
477
+ }
478
+ if (t && _.label < t[2]) {
479
+ _.label = t[2];
480
+ _.ops.push(op);
481
+ break;
482
+ }
483
+ if (t[2])
484
+ _.ops.pop();
485
+ _.trys.pop();
486
+ continue;
487
+ }
488
+ op = body.call(thisArg, _);
489
+ }
490
+ catch (e) {
491
+ op = [6, e];
492
+ y = 0;
493
+ }
494
+ finally {
495
+ f = t = 0;
496
+ }
497
+ if (op[0] & 5)
498
+ throw op[1];
499
+ return { value: op[0] ? op[1] : void 0, done: true };
500
+ }
501
+ }
502
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
503
+ if (k2 === undefined)
504
+ k2 = k;
505
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
506
+ }) : (function (o, m, k, k2) {
507
+ if (k2 === undefined)
508
+ k2 = k;
509
+ o[k2] = m[k];
510
+ });
511
+ function __exportStar(m, o) {
512
+ for (var p in m)
513
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
514
+ __createBinding(o, m, p);
515
+ }
516
+ function __values(o) {
517
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
518
+ if (m)
519
+ return m.call(o);
520
+ if (o && typeof o.length === "number")
521
+ return {
522
+ next: function () {
523
+ if (o && i >= o.length)
524
+ o = void 0;
525
+ return { value: o && o[i++], done: !o };
526
+ }
527
+ };
528
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
529
+ }
530
+ function __read(o, n) {
531
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
532
+ if (!m)
533
+ return o;
534
+ var i = m.call(o), r, ar = [], e;
535
+ try {
536
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
537
+ ar.push(r.value);
538
+ }
539
+ catch (error) {
540
+ e = { error: error };
541
+ }
542
+ finally {
543
+ try {
544
+ if (r && !r.done && (m = i["return"]))
545
+ m.call(i);
546
+ }
547
+ finally {
548
+ if (e)
549
+ throw e.error;
550
+ }
551
+ }
552
+ return ar;
553
+ }
554
+ /** @deprecated */
555
+ function __spread() {
556
+ for (var ar = [], i = 0; i < arguments.length; i++)
557
+ ar = ar.concat(__read(arguments[i]));
558
+ return ar;
559
+ }
560
+ /** @deprecated */
561
+ function __spreadArrays() {
562
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
563
+ s += arguments[i].length;
564
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
565
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
566
+ r[k] = a[j];
567
+ return r;
568
+ }
569
+ function __spreadArray(to, from, pack) {
570
+ if (pack || arguments.length === 2)
571
+ for (var i = 0, l = from.length, ar; i < l; i++) {
572
+ if (ar || !(i in from)) {
573
+ if (!ar)
574
+ ar = Array.prototype.slice.call(from, 0, i);
575
+ ar[i] = from[i];
576
+ }
577
+ }
578
+ return to.concat(ar || from);
579
+ }
580
+ function __await(v) {
581
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
582
+ }
583
+ function __asyncGenerator(thisArg, _arguments, generator) {
584
+ if (!Symbol.asyncIterator)
585
+ throw new TypeError("Symbol.asyncIterator is not defined.");
586
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
587
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
588
+ function verb(n) { if (g[n])
589
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
590
+ function resume(n, v) { try {
591
+ step(g[n](v));
592
+ }
593
+ catch (e) {
594
+ settle(q[0][3], e);
595
+ } }
596
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
597
+ function fulfill(value) { resume("next", value); }
598
+ function reject(value) { resume("throw", value); }
599
+ function settle(f, v) { if (f(v), q.shift(), q.length)
600
+ resume(q[0][0], q[0][1]); }
601
+ }
602
+ function __asyncDelegator(o) {
603
+ var i, p;
604
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
605
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
606
+ }
607
+ function __asyncValues(o) {
608
+ if (!Symbol.asyncIterator)
609
+ throw new TypeError("Symbol.asyncIterator is not defined.");
610
+ var m = o[Symbol.asyncIterator], i;
611
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
612
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
613
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
614
+ }
615
+ function __makeTemplateObject(cooked, raw) {
616
+ if (Object.defineProperty) {
617
+ Object.defineProperty(cooked, "raw", { value: raw });
618
+ }
619
+ else {
620
+ cooked.raw = raw;
621
+ }
622
+ return cooked;
623
+ }
624
+ ;
625
+ var __setModuleDefault = Object.create ? (function (o, v) {
626
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
627
+ }) : function (o, v) {
628
+ o["default"] = v;
629
+ };
630
+ function __importStar(mod) {
631
+ if (mod && mod.__esModule)
632
+ return mod;
633
+ var result = {};
634
+ if (mod != null)
635
+ for (var k in mod)
636
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
637
+ __createBinding(result, mod, k);
638
+ __setModuleDefault(result, mod);
639
+ return result;
640
+ }
641
+ function __importDefault(mod) {
642
+ return (mod && mod.__esModule) ? mod : { default: mod };
643
+ }
644
+ function __classPrivateFieldGet(receiver, state, kind, f) {
645
+ if (kind === "a" && !f)
646
+ throw new TypeError("Private accessor was defined without a getter");
647
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
648
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
649
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
650
+ }
651
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
652
+ if (kind === "m")
653
+ throw new TypeError("Private method is not writable");
654
+ if (kind === "a" && !f)
655
+ throw new TypeError("Private accessor was defined without a setter");
656
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
657
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
658
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
659
+ }
660
+
661
+ /**
662
+ * Animations used by the colorpicker.
663
+ * @docs-private
664
+ */
665
+ var mtxColorpickerAnimations = {
666
+ /** Transforms the height of the colorpicker's panel. */
667
+ transformPanel: animations.trigger('transformPanel', [
668
+ animations.transition('void => enter-dropdown', animations.animate('120ms cubic-bezier(0, 0, 0.2, 1)', animations.keyframes([
669
+ animations.style({ opacity: 0, transform: 'scale(1, 0.8)' }),
670
+ animations.style({ opacity: 1, transform: 'scale(1, 1)' }),
671
+ ]))),
672
+ animations.transition('* => void', animations.animate('100ms linear', animations.style({ opacity: 0 }))),
673
+ ]),
674
+ };
675
+
676
+ /** Used to generate a unique ID for each colorpicker instance. */
677
+ var colorpickerUid = 0;
678
+ /** Injection token that determines the scroll handling while the panel is open. */
679
+ var MTX_COLORPICKER_SCROLL_STRATEGY = new core.InjectionToken('mtx-colorpicker-scroll-strategy');
680
+ function MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
681
+ return function () { return overlay.scrollStrategies.reposition(); };
682
+ }
683
+ var MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
684
+ provide: MTX_COLORPICKER_SCROLL_STRATEGY,
685
+ deps: [overlay.Overlay],
686
+ useFactory: MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY,
687
+ };
688
+ // Boilerplate for applying mixins to MtxColorpickerContent.
689
+ /** @docs-private */
690
+ var _MtxColorpickerContentBase = core$1.mixinColor(/** @class */ (function () {
691
+ function class_1(_elementRef) {
692
+ this._elementRef = _elementRef;
693
+ }
694
+ return class_1;
695
+ }()));
696
+ var MtxColorpickerContent = /** @class */ (function (_super) {
697
+ __extends(MtxColorpickerContent, _super);
698
+ function MtxColorpickerContent(elementRef, _changeDetectorRef) {
699
+ var _this = _super.call(this, elementRef) || this;
700
+ _this._changeDetectorRef = _changeDetectorRef;
701
+ /** Current state of the animation. */
702
+ _this._animationState = 'enter-dropdown';
703
+ /** Emits when an animation has finished. */
704
+ _this._animationDone = new rxjs.Subject();
705
+ return _this;
706
+ }
707
+ MtxColorpickerContent.prototype._startExitAnimation = function () {
708
+ this._animationState = 'void';
709
+ this._changeDetectorRef.markForCheck();
710
+ };
711
+ MtxColorpickerContent.prototype.ngOnDestroy = function () {
712
+ this._animationDone.complete();
713
+ };
714
+ MtxColorpickerContent.prototype.getColorString = function (e) {
715
+ return {
716
+ hex: e.color.rgb.a === 1 ? e.color.hex : new tinycolor.TinyColor(e.color.rgb).toHex8String(),
717
+ rgb: new tinycolor.TinyColor(e.color.rgb).toRgbString(),
718
+ hsl: new tinycolor.TinyColor(e.color.hsl).toHslString(),
719
+ hsv: new tinycolor.TinyColor(e.color.hsv).toHsvString(),
720
+ }[this.picker.format];
721
+ };
722
+ return MtxColorpickerContent;
723
+ }(_MtxColorpickerContentBase));
724
+ /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
725
+ MtxColorpickerContent.decorators = [
726
+ { type: core.Component, args: [{
727
+ selector: 'mtx-colorpicker-content',
728
+ template: "<ng-template [ngIf]=\"picker.content\" [ngIfElse]=\"default\"\n [ngTemplateOutlet]=\"picker.content\">\n</ng-template>\n<ng-template #default>\n <color-chrome [color]=\"picker.selected\"\n (onChangeComplete)=\"picker.select(getColorString($event))\">\n </color-chrome>\n</ng-template>\n",
729
+ host: {
730
+ 'class': 'mtx-colorpicker-content',
731
+ '[@transformPanel]': '_animationState',
732
+ '(@transformPanel.done)': '_animationDone.next()',
733
+ },
734
+ animations: [mtxColorpickerAnimations.transformPanel],
735
+ exportAs: 'mtxColorpickerContent',
736
+ encapsulation: core.ViewEncapsulation.None,
737
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
738
+ inputs: ['color'],
739
+ styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"]
740
+ },] }
741
+ ];
742
+ /**
743
+ * @type {function(): !Array<(null|{
744
+ * type: ?,
745
+ * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
746
+ * })>}
747
+ * @nocollapse
748
+ */
749
+ MtxColorpickerContent.ctorParameters = function () { return [
750
+ { type: core.ElementRef },
751
+ { type: core.ChangeDetectorRef }
752
+ ]; };
753
+ var MtxColorpicker = /** @class */ (function () {
754
+ function MtxColorpicker(_overlay, _ngZone, _viewContainerRef, scrollStrategy, _dir, _document) {
755
+ this._overlay = _overlay;
756
+ this._ngZone = _ngZone;
757
+ this._viewContainerRef = _viewContainerRef;
758
+ this._dir = _dir;
759
+ this._document = _document;
760
+ this._inputStateChanges = rxjs.Subscription.EMPTY;
761
+ /** Emits when the colorpicker has been opened. */
762
+ this.openedStream = new core.EventEmitter();
763
+ /** Emits when the colorpicker has been closed. */
764
+ this.closedStream = new core.EventEmitter();
765
+ /** Preferred position of the colorpicker in the X axis. */
766
+ this.xPosition = 'start';
767
+ /** Preferred position of the colorpicker in the Y axis. */
768
+ this.yPosition = 'below';
769
+ this._restoreFocus = true;
770
+ this._opened = false;
771
+ /** The id for the colorpicker panel. */
772
+ this.id = "mtx-colorpicker-" + colorpickerUid++;
773
+ this._validSelected = '';
774
+ /** The element that was focused before the colorpicker was opened. */
775
+ this._focusedElementBeforeOpen = null;
776
+ /** Unique class that will be added to the backdrop so that the test harnesses can look it up. */
777
+ this._backdropHarnessClass = this.id + "-backdrop";
778
+ /** Emits when the datepicker is disabled. */
779
+ this._disabledChange = new rxjs.Subject();
780
+ /** Emits new selected color when selected color changes. */
781
+ this._selectedChanged = new rxjs.Subject();
782
+ this._scrollStrategy = scrollStrategy;
783
+ }
784
+ Object.defineProperty(MtxColorpicker.prototype, "disabled", {
785
+ get: function () {
786
+ return this._disabled === undefined && this.pickerInput
787
+ ? this.pickerInput.disabled
788
+ : !!this._disabled;
789
+ },
790
+ set: function (value) {
791
+ var newValue = coercion.coerceBooleanProperty(value);
792
+ if (newValue !== this._disabled) {
793
+ this._disabled = newValue;
794
+ this._disabledChange.next(newValue);
795
+ }
796
+ },
797
+ enumerable: false,
798
+ configurable: true
799
+ });
800
+ Object.defineProperty(MtxColorpicker.prototype, "restoreFocus", {
801
+ /**
802
+ * Whether to restore focus to the previously-focused element when the panel is closed.
803
+ * Note that automatic focus restoration is an accessibility feature and it is recommended that
804
+ * you provide your own equivalent, if you decide to turn it off.
805
+ */
806
+ get: function () {
807
+ return this._restoreFocus;
808
+ },
809
+ set: function (value) {
810
+ this._restoreFocus = coercion.coerceBooleanProperty(value);
811
+ },
812
+ enumerable: false,
813
+ configurable: true
814
+ });
815
+ Object.defineProperty(MtxColorpicker.prototype, "opened", {
816
+ /** Whether the panel is open. */
817
+ get: function () {
818
+ return this._opened;
819
+ },
820
+ set: function (value) {
821
+ coercion.coerceBooleanProperty(value) ? this.open() : this.close();
822
+ },
823
+ enumerable: false,
824
+ configurable: true
825
+ });
826
+ Object.defineProperty(MtxColorpicker.prototype, "color", {
827
+ /** Color palette to use on the colorpicker's panel. */
828
+ get: function () {
829
+ return this._color || (this.pickerInput ? this.pickerInput.getThemePalette() : undefined);
830
+ },
831
+ set: function (value) {
832
+ this._color = value;
833
+ },
834
+ enumerable: false,
835
+ configurable: true
836
+ });
837
+ Object.defineProperty(MtxColorpicker.prototype, "format", {
838
+ /** The input and output color format. */
839
+ get: function () {
840
+ return this._format || this.pickerInput.format;
841
+ },
842
+ set: function (value) {
843
+ this._format = value;
844
+ },
845
+ enumerable: false,
846
+ configurable: true
847
+ });
848
+ Object.defineProperty(MtxColorpicker.prototype, "selected", {
849
+ /** The currently selected color. */
850
+ get: function () {
851
+ return this._validSelected;
852
+ },
853
+ set: function (value) {
854
+ this._validSelected = value;
855
+ },
856
+ enumerable: false,
857
+ configurable: true
858
+ });
859
+ MtxColorpicker.prototype.ngOnChanges = function () { };
860
+ MtxColorpicker.prototype.ngOnDestroy = function () {
861
+ this._destroyOverlay();
862
+ this.close();
863
+ this._inputStateChanges.unsubscribe();
864
+ this._disabledChange.complete();
865
+ };
866
+ /** Selects the given color */
867
+ MtxColorpicker.prototype.select = function (nextVal) {
868
+ var oldValue = this.selected;
869
+ this.selected = nextVal;
870
+ // TODO: `nextVal` should compare with `oldValue`
871
+ this._selectedChanged.next(nextVal);
872
+ };
873
+ /**
874
+ * Register an input with this colorpicker.
875
+ * @param input The colorpicker input to register with this colorpicker.
876
+ */
877
+ MtxColorpicker.prototype.registerInput = function (input) {
878
+ var _this = this;
879
+ if (this.pickerInput) {
880
+ throw Error('A Colorpicker can only be associated with a single input.');
881
+ }
882
+ this.pickerInput = input;
883
+ this._inputStateChanges = input._valueChange.subscribe(function (value) { return (_this.selected = value); });
884
+ };
885
+ MtxColorpicker.prototype.open = function () {
886
+ if (this._opened || this.disabled) {
887
+ return;
888
+ }
889
+ if (!this.pickerInput) {
890
+ throw Error('Attempted to open an Colorpicker with no associated input.');
891
+ }
892
+ if (this._document) {
893
+ this._focusedElementBeforeOpen = this._document.activeElement;
894
+ }
895
+ this._openOverlay();
896
+ this._opened = true;
897
+ this.openedStream.emit();
898
+ };
899
+ /** Close the panel. */
900
+ MtxColorpicker.prototype.close = function () {
901
+ var _this = this;
902
+ if (!this._opened) {
903
+ return;
904
+ }
905
+ if (this._componentRef) {
906
+ var instance = this._componentRef.instance;
907
+ instance._startExitAnimation();
908
+ instance._animationDone.pipe(operators.take(1)).subscribe(function () { return _this._destroyOverlay(); });
909
+ }
910
+ var completeClose = function () {
911
+ // The `_opened` could've been reset already if
912
+ // we got two events in quick succession.
913
+ if (_this._opened) {
914
+ _this._opened = false;
915
+ _this.closedStream.emit();
916
+ _this._focusedElementBeforeOpen = null;
917
+ }
918
+ };
919
+ if (this._restoreFocus &&
920
+ this._focusedElementBeforeOpen &&
921
+ typeof this._focusedElementBeforeOpen.focus === 'function') {
922
+ // Because IE moves focus asynchronously, we can't count on it being restored before we've
923
+ // marked the colorpicker as closed. If the event fires out of sequence and the element that
924
+ // we're refocusing opens the colorpicker on focus, the user could be stuck with not being
925
+ // able to close the panel at all. We work around it by making the logic, that marks
926
+ // the colorpicker as closed, async as well.
927
+ this._focusedElementBeforeOpen.focus();
928
+ setTimeout(completeClose);
929
+ }
930
+ else {
931
+ completeClose();
932
+ }
933
+ };
934
+ /** Forwards relevant values from the colorpicker to the colorpicker content inside the overlay. */
935
+ MtxColorpicker.prototype._forwardContentValues = function (instance) {
936
+ instance.picker = this;
937
+ instance.color = this.color;
938
+ };
939
+ /** Open the colopicker as a popup. */
940
+ MtxColorpicker.prototype._openOverlay = function () {
941
+ var _this = this;
942
+ this._destroyOverlay();
943
+ var labelId = this.pickerInput.getOverlayLabelId();
944
+ var portal$1 = new portal.ComponentPortal(MtxColorpickerContent, this._viewContainerRef);
945
+ var overlayRef = (this._overlayRef = this._overlay.create(new overlay.OverlayConfig({
946
+ positionStrategy: this._getDropdownStrategy(),
947
+ hasBackdrop: true,
948
+ backdropClass: ['mat-overlay-transparent-backdrop', this._backdropHarnessClass],
949
+ direction: this._dir,
950
+ scrollStrategy: this._scrollStrategy(),
951
+ panelClass: "mtx-colorpicker-popup",
952
+ })));
953
+ var overlayElement = overlayRef.overlayElement;
954
+ overlayElement.setAttribute('role', 'dialog');
955
+ if (labelId) {
956
+ overlayElement.setAttribute('aria-labelledby', labelId);
957
+ }
958
+ this._getCloseStream(overlayRef).subscribe(function (event) {
959
+ if (event) {
960
+ event.preventDefault();
961
+ }
962
+ _this.close();
963
+ });
964
+ this._componentRef = overlayRef.attach(portal$1);
965
+ this._forwardContentValues(this._componentRef.instance);
966
+ // Update the position once the panel has rendered. Only relevant in dropdown mode.
967
+ this._ngZone.onStable.pipe(operators.take(1)).subscribe(function () { return overlayRef.updatePosition(); });
968
+ };
969
+ MtxColorpicker.prototype._destroyOverlay = function () {
970
+ if (this._overlayRef) {
971
+ this._overlayRef.dispose();
972
+ this._overlayRef = this._componentRef = null;
973
+ }
974
+ };
975
+ /** Gets a position strategy that will open the panel as a dropdown. */
976
+ MtxColorpicker.prototype._getDropdownStrategy = function () {
977
+ var strategy = this._overlay
978
+ .position()
979
+ .flexibleConnectedTo(this.pickerInput.getConnectedOverlayOrigin())
980
+ .withTransformOriginOn('.mtx-colorpicker-content')
981
+ .withFlexibleDimensions(false)
982
+ .withViewportMargin(8)
983
+ .withLockedPosition();
984
+ return this._setConnectedPositions(strategy);
985
+ };
986
+ /** Sets the positions of the colorpicker in dropdown mode based on the current configuration. */
987
+ MtxColorpicker.prototype._setConnectedPositions = function (strategy) {
988
+ var primaryX = this.xPosition === 'end' ? 'end' : 'start';
989
+ var secondaryX = primaryX === 'start' ? 'end' : 'start';
990
+ var primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
991
+ var secondaryY = primaryY === 'top' ? 'bottom' : 'top';
992
+ return strategy.withPositions([
993
+ {
994
+ originX: primaryX,
995
+ originY: secondaryY,
996
+ overlayX: primaryX,
997
+ overlayY: primaryY,
998
+ },
999
+ {
1000
+ originX: primaryX,
1001
+ originY: primaryY,
1002
+ overlayX: primaryX,
1003
+ overlayY: secondaryY,
1004
+ },
1005
+ {
1006
+ originX: secondaryX,
1007
+ originY: secondaryY,
1008
+ overlayX: secondaryX,
1009
+ overlayY: primaryY,
1010
+ },
1011
+ {
1012
+ originX: secondaryX,
1013
+ originY: primaryY,
1014
+ overlayX: secondaryX,
1015
+ overlayY: secondaryY,
1016
+ },
1017
+ ]);
1018
+ };
1019
+ /** Gets an observable that will emit when the overlay is supposed to be closed. */
1020
+ MtxColorpicker.prototype._getCloseStream = function (overlayRef) {
1021
+ var _this = this;
1022
+ return rxjs.merge(overlayRef.backdropClick(), overlayRef.detachments(), overlayRef.keydownEvents().pipe(operators.filter(function (event) {
1023
+ // Closing on alt + up is only valid when there's an input associated with the colorpicker.
1024
+ return ((event.keyCode === keycodes.ESCAPE && !keycodes.hasModifierKey(event)) ||
1025
+ (_this.pickerInput && keycodes.hasModifierKey(event, 'altKey') && event.keyCode === keycodes.UP_ARROW));
1026
+ })));
1027
+ };
1028
+ return MtxColorpicker;
1029
+ }());
1030
+ /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1031
+ MtxColorpicker.decorators = [
1032
+ { type: core.Component, args: [{
1033
+ selector: 'mtx-colorpicker',
1034
+ template: '',
1035
+ exportAs: 'mtxColorpicker',
1036
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1037
+ encapsulation: core.ViewEncapsulation.None
1038
+ },] }
1039
+ ];
1040
+ /**
1041
+ * @type {function(): !Array<(null|{
1042
+ * type: ?,
1043
+ * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1044
+ * })>}
1045
+ * @nocollapse
1046
+ */
1047
+ MtxColorpicker.ctorParameters = function () { return [
1048
+ { type: overlay.Overlay },
1049
+ { type: core.NgZone },
1050
+ { type: core.ViewContainerRef },
1051
+ { type: undefined, decorators: [{ type: core.Inject, args: [MTX_COLORPICKER_SCROLL_STRATEGY,] }] },
1052
+ { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
1053
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
1054
+ ]; };
1055
+ /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
1056
+ MtxColorpicker.propDecorators = {
1057
+ content: [{ type: core.Input }],
1058
+ openedStream: [{ type: core.Output, args: ['opened',] }],
1059
+ closedStream: [{ type: core.Output, args: ['closed',] }],
1060
+ disabled: [{ type: core.Input }],
1061
+ xPosition: [{ type: core.Input }],
1062
+ yPosition: [{ type: core.Input }],
1063
+ restoreFocus: [{ type: core.Input }],
1064
+ opened: [{ type: core.Input }],
1065
+ color: [{ type: core.Input }],
1066
+ format: [{ type: core.Input }]
1067
+ };
1068
+
1069
+ var MtxColorpickerModule = /** @class */ (function () {
1070
+ function MtxColorpickerModule() {
1071
+ }
1072
+ return MtxColorpickerModule;
1073
+ }());
1074
+ /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1075
+ MtxColorpickerModule.decorators = [
1076
+ { type: core.NgModule, args: [{
1077
+ imports: [
1078
+ common.CommonModule,
1079
+ overlay.OverlayModule,
1080
+ a11y.A11yModule,
1081
+ portal.PortalModule,
1082
+ button.MatButtonModule,
1083
+ chrome.ColorChromeModule,
1084
+ ],
1085
+ exports: [
1086
+ MtxColorpicker,
1087
+ MtxColorpickerContent,
1088
+ MtxColorpickerInput,
1089
+ MtxColorpickerToggle,
1090
+ MtxColorpickerToggleIcon,
1091
+ ],
1092
+ declarations: [
1093
+ MtxColorpicker,
1094
+ MtxColorpickerContent,
1095
+ MtxColorpickerInput,
1096
+ MtxColorpickerToggle,
1097
+ MtxColorpickerToggleIcon,
1098
+ ],
1099
+ providers: [MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER],
1100
+ },] }
1101
+ ];
1102
+
1103
+ /**
1104
+ * Generated bundle index. Do not edit.
1105
+ */
1106
+
1107
+ exports.MTX_COLORPICKER_SCROLL_STRATEGY = MTX_COLORPICKER_SCROLL_STRATEGY;
1108
+ exports.MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY = MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY;
1109
+ exports.MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER;
1110
+ exports.MTX_COLORPICKER_VALIDATORS = MTX_COLORPICKER_VALIDATORS;
1111
+ exports.MTX_COLORPICKER_VALUE_ACCESSOR = MTX_COLORPICKER_VALUE_ACCESSOR;
1112
+ exports.MtxColorpicker = MtxColorpicker;
1113
+ exports.MtxColorpickerContent = MtxColorpickerContent;
1114
+ exports.MtxColorpickerInput = MtxColorpickerInput;
1115
+ exports.MtxColorpickerModule = MtxColorpickerModule;
1116
+ exports.MtxColorpickerToggle = MtxColorpickerToggle;
1117
+ exports.MtxColorpickerToggleIcon = MtxColorpickerToggleIcon;
1118
+ exports.mtxColorpickerAnimations = mtxColorpickerAnimations;
1119
+
1120
+ Object.defineProperty(exports, '__esModule', { value: true });
1121
+
1122
+ }));
1123
+ //# sourceMappingURL=mtxColorpicker.umd.js.map