@ng-matero/extensions 17.0.0 → 17.1.0
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.
- package/_index.scss +24 -12
- package/alert/alert-module.d.ts +3 -3
- package/alert/alert.d.ts +1 -1
- package/checkbox-group/checkbox-group-module.d.ts +6 -6
- package/checkbox-group/checkbox-group.d.ts +1 -1
- package/colorpicker/colorpicker-input.d.ts +1 -1
- package/colorpicker/colorpicker-module.d.ts +10 -10
- package/colorpicker/colorpicker-toggle.d.ts +2 -2
- package/colorpicker/colorpicker.d.ts +3 -3
- package/column-resize/column-resize-directives/column-resize-flex.d.ts +1 -1
- package/column-resize/column-resize-directives/column-resize.d.ts +1 -1
- package/column-resize/column-resize-module.d.ts +1 -1
- package/core/color/_all-color.scss +3 -3
- package/core/datetime/datetime.module.d.ts +4 -1
- package/core/density/_all-density.scss +2 -2
- package/core/pipes/is-template-ref.pipe.d.ts +1 -1
- package/core/pipes/pipes.module.d.ts +4 -4
- package/core/pipes/to-observable.pipe.d.ts +1 -1
- package/core/tokens/m2/mdc/_plain-tooltip.scss +6 -6
- package/core/tokens/m2/mtx/_select.scss +1 -42
- package/core/typography/_all-typography.scss +2 -2
- package/datetimepicker/calendar-body.d.ts +1 -1
- package/datetimepicker/calendar.d.ts +1 -1
- package/datetimepicker/clock.d.ts +1 -1
- package/datetimepicker/datetimepicker-input.d.ts +1 -1
- package/datetimepicker/datetimepicker-module.d.ts +16 -16
- package/datetimepicker/datetimepicker-toggle.d.ts +2 -2
- package/datetimepicker/datetimepicker.d.ts +3 -3
- package/datetimepicker/month-view.d.ts +1 -1
- package/datetimepicker/multi-year-view.d.ts +1 -1
- package/datetimepicker/time.d.ts +3 -3
- package/datetimepicker/year-view.d.ts +1 -1
- package/dialog/dialog-container.d.ts +1 -1
- package/dialog/dialog-module.d.ts +7 -7
- package/drawer/drawer-container.d.ts +1 -1
- package/drawer/drawer-module.d.ts +5 -5
- package/esm2022/alert/alert-module.mjs +6 -7
- package/esm2022/alert/alert.mjs +5 -5
- package/esm2022/button/button-loading.mjs +4 -4
- package/esm2022/button/button-module.mjs +4 -4
- package/esm2022/checkbox-group/checkbox-group-module.mjs +6 -7
- package/esm2022/checkbox-group/checkbox-group.mjs +9 -10
- package/esm2022/colorpicker/colorpicker-input.mjs +5 -4
- package/esm2022/colorpicker/colorpicker-module.mjs +20 -19
- package/esm2022/colorpicker/colorpicker-toggle.mjs +10 -9
- package/esm2022/colorpicker/colorpicker.mjs +25 -18
- package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +5 -4
- package/esm2022/column-resize/column-resize-directives/column-resize.mjs +5 -4
- package/esm2022/column-resize/column-resize-module.mjs +6 -6
- package/esm2022/column-resize/column-resize-notifier.mjs +6 -6
- package/esm2022/column-resize/column-resize.mjs +4 -4
- package/esm2022/column-resize/column-size-store.mjs +3 -3
- package/esm2022/column-resize/event-dispatcher.mjs +4 -4
- package/esm2022/column-resize/overlay-handle.mjs +4 -4
- package/esm2022/column-resize/polyfill.mjs +1 -1
- package/esm2022/column-resize/resizable.mjs +4 -4
- package/esm2022/column-resize/resize-strategy.mjs +10 -10
- package/esm2022/core/datetime/datetime-adapter.mjs +1 -1
- package/esm2022/core/datetime/datetime.module.mjs +19 -23
- package/esm2022/core/datetime/native-datetime-adapter.mjs +4 -4
- package/esm2022/core/pipes/is-template-ref.pipe.mjs +5 -5
- package/esm2022/core/pipes/pipes.module.mjs +6 -7
- package/esm2022/core/pipes/to-observable.pipe.mjs +5 -5
- package/esm2022/datetimepicker/calendar-body.mjs +5 -5
- package/esm2022/datetimepicker/calendar.mjs +19 -12
- package/esm2022/datetimepicker/clock.mjs +6 -7
- package/esm2022/datetimepicker/datetimepicker-errors.mjs +4 -3
- package/esm2022/datetimepicker/datetimepicker-input.mjs +6 -5
- package/esm2022/datetimepicker/datetimepicker-intl.mjs +3 -3
- package/esm2022/datetimepicker/datetimepicker-module.mjs +28 -11
- package/esm2022/datetimepicker/datetimepicker-toggle.mjs +10 -9
- package/esm2022/datetimepicker/datetimepicker.mjs +23 -19
- package/esm2022/datetimepicker/month-view.mjs +6 -7
- package/esm2022/datetimepicker/multi-year-view.mjs +6 -7
- package/esm2022/datetimepicker/time.mjs +11 -10
- package/esm2022/datetimepicker/year-view.mjs +6 -7
- package/esm2022/dialog/dialog-container.mjs +19 -10
- package/esm2022/dialog/dialog-module.mjs +23 -7
- package/esm2022/dialog/dialog.mjs +6 -5
- package/esm2022/drawer/drawer-container.mjs +5 -6
- package/esm2022/drawer/drawer-module.mjs +6 -7
- package/esm2022/drawer/drawer-ref.mjs +1 -1
- package/esm2022/drawer/drawer.mjs +6 -5
- package/esm2022/grid/cell.mjs +35 -13
- package/esm2022/grid/column-menu.mjs +31 -15
- package/esm2022/grid/column-resize/column-resize-directives/column-resize-flex.mjs +5 -4
- package/esm2022/grid/column-resize/column-resize-directives/column-resize.mjs +5 -4
- package/esm2022/grid/column-resize/column-resize-module.mjs +14 -14
- package/esm2022/grid/column-resize/index.mjs +8 -0
- package/esm2022/grid/column-resize/overlay-handle.mjs +5 -4
- package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +5 -4
- package/esm2022/grid/column-resize/resize-strategy.mjs +3 -3
- package/esm2022/grid/expansion-toggle.mjs +5 -4
- package/esm2022/grid/grid-module.mjs +39 -37
- package/esm2022/grid/grid-pipes.mjs +29 -29
- package/esm2022/grid/grid-utils.mjs +6 -5
- package/esm2022/grid/grid.mjs +108 -76
- package/esm2022/loader/loader-module.mjs +6 -7
- package/esm2022/loader/loader.mjs +7 -7
- package/esm2022/photoviewer/photoviewer-module.mjs +6 -7
- package/esm2022/photoviewer/photoviewer.mjs +5 -4
- package/esm2022/popover/popover-content.mjs +8 -7
- package/esm2022/popover/popover-module.mjs +22 -7
- package/esm2022/popover/popover-target.mjs +5 -4
- package/esm2022/popover/popover-trigger.mjs +13 -6
- package/esm2022/popover/popover.mjs +7 -7
- package/esm2022/progress/progress-module.mjs +6 -7
- package/esm2022/progress/progress.mjs +6 -6
- package/esm2022/select/option.mjs +5 -4
- package/esm2022/select/select-module.mjs +20 -9
- package/esm2022/select/select.mjs +11 -11
- package/esm2022/select/templates.mjs +45 -45
- package/esm2022/split/split-module.mjs +6 -7
- package/esm2022/split/split-pane.mjs +5 -4
- package/esm2022/split/split.mjs +6 -6
- package/esm2022/split/utils.mjs +1 -1
- package/esm2022/tooltip/tooltip-module.mjs +24 -7
- package/esm2022/tooltip/tooltip.mjs +101 -114
- package/fesm2022/mtxAlert.mjs +9 -10
- package/fesm2022/mtxAlert.mjs.map +1 -1
- package/fesm2022/mtxButton.mjs +7 -7
- package/fesm2022/mtxButton.mjs.map +1 -1
- package/fesm2022/mtxCheckboxGroup.mjs +12 -16
- package/fesm2022/mtxCheckboxGroup.mjs.map +1 -1
- package/fesm2022/mtxColorpicker.mjs +462 -454
- package/fesm2022/mtxColorpicker.mjs.map +1 -1
- package/fesm2022/mtxColumnResize.mjs +43 -41
- package/fesm2022/mtxColumnResize.mjs.map +1 -1
- package/fesm2022/mtxCore.mjs +34 -39
- package/fesm2022/mtxCore.mjs.map +1 -1
- package/fesm2022/mtxDatetimepicker.mjs +814 -781
- package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
- package/fesm2022/mtxDialog.mjs +44 -22
- package/fesm2022/mtxDialog.mjs.map +1 -1
- package/fesm2022/mtxDrawer.mjs +14 -15
- package/fesm2022/mtxDrawer.mjs.map +1 -1
- package/fesm2022/mtxGrid.mjs +249 -180
- package/fesm2022/mtxGrid.mjs.map +1 -1
- package/fesm2022/mtxLoader.mjs +11 -14
- package/fesm2022/mtxLoader.mjs.map +1 -1
- package/fesm2022/mtxPhotoviewer.mjs +9 -9
- package/fesm2022/mtxPhotoviewer.mjs.map +1 -1
- package/fesm2022/mtxPopover.mjs +52 -29
- package/fesm2022/mtxPopover.mjs.map +1 -1
- package/fesm2022/mtxProgress.mjs +10 -12
- package/fesm2022/mtxProgress.mjs.map +1 -1
- package/fesm2022/mtxSelect.mjs +75 -64
- package/fesm2022/mtxSelect.mjs.map +1 -1
- package/fesm2022/mtxSplit.mjs +14 -15
- package/fesm2022/mtxSplit.mjs.map +1 -1
- package/fesm2022/mtxTooltip.mjs +124 -121
- package/fesm2022/mtxTooltip.mjs.map +1 -1
- package/grid/cell.d.ts +1 -1
- package/grid/column-menu.d.ts +1 -1
- package/grid/column-resize/column-resize-directives/column-resize-flex.d.ts +1 -1
- package/grid/column-resize/column-resize-directives/column-resize.d.ts +1 -1
- package/grid/column-resize/column-resize-module.d.ts +7 -6
- package/grid/column-resize/index.d.ts +7 -0
- package/grid/column-resize/overlay-handle.d.ts +1 -1
- package/grid/column-resize/resizable-directives/resizable.d.ts +1 -1
- package/grid/expansion-toggle.d.ts +1 -1
- package/grid/grid-module.d.ts +25 -25
- package/grid/grid-pipes.d.ts +7 -7
- package/grid/grid.d.ts +24 -24
- package/loader/loader-module.d.ts +5 -5
- package/loader/loader.d.ts +1 -1
- package/package.json +6 -6
- package/photoviewer/photoviewer-module.d.ts +1 -1
- package/photoviewer/photoviewer.d.ts +1 -1
- package/popover/popover-content.d.ts +1 -1
- package/popover/popover-module.d.ts +8 -8
- package/popover/popover-target.d.ts +1 -1
- package/popover/popover-trigger.d.ts +1 -1
- package/popover/popover.d.ts +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/progress/progress-module.d.ts +3 -3
- package/progress/progress.d.ts +1 -1
- package/select/option.d.ts +1 -1
- package/select/select-module.d.ts +7 -7
- package/select/select.d.ts +1 -1
- package/select/select.scss +9 -10
- package/select/templates.d.ts +11 -11
- package/split/split-module.d.ts +4 -4
- package/split/split-pane.d.ts +1 -1
- package/split/split.d.ts +1 -1
- package/tooltip/tooltip-module.d.ts +7 -7
- package/tooltip/tooltip.d.ts +30 -44
- package/tooltip/tooltip.scss +2 -4
- package/core/mdc-helpers/_mdc-helpers.scss +0 -31
- package/core/style/_validation.scss +0 -43
- package/core/theming/_inspection.scss +0 -303
- package/core/theming/_m2-inspection.scss +0 -266
|
@@ -1,342 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import * as i1
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import * as
|
|
21
|
-
import { ColorChromeModule } from 'ngx-color/chrome';
|
|
22
|
-
import * as i4 from '@angular/cdk/bidi';
|
|
23
|
-
|
|
24
|
-
class MtxColorPickerInputEvent {
|
|
25
|
-
constructor(
|
|
26
|
-
/** Reference to the colorpicker input component that emitted the event. */
|
|
27
|
-
target,
|
|
28
|
-
/** Reference to the native input element associated with the colorpicker input. */
|
|
29
|
-
targetElement) {
|
|
30
|
-
this.target = target;
|
|
31
|
-
this.targetElement = targetElement;
|
|
32
|
-
this.value = this.target.value;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const MTX_COLORPICKER_VALUE_ACCESSOR = {
|
|
36
|
-
provide: NG_VALUE_ACCESSOR,
|
|
37
|
-
useExisting: forwardRef(() => MtxColorpickerInput),
|
|
38
|
-
multi: true,
|
|
39
|
-
};
|
|
40
|
-
const MTX_COLORPICKER_VALIDATORS = {
|
|
41
|
-
provide: NG_VALIDATORS,
|
|
42
|
-
useExisting: forwardRef(() => MtxColorpickerInput),
|
|
43
|
-
multi: true,
|
|
44
|
-
};
|
|
45
|
-
class MtxColorpickerInput {
|
|
46
|
-
set mtxColorpicker(value) {
|
|
47
|
-
if (!value) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
this._picker = value;
|
|
51
|
-
this._picker.registerInput(this);
|
|
52
|
-
this._pickerSubscription.unsubscribe();
|
|
53
|
-
this._pickerSubscription = this._picker._selectedChanged.subscribe((selected) => {
|
|
54
|
-
this.value = selected;
|
|
55
|
-
this._cvaOnChange(selected);
|
|
56
|
-
this._onTouched();
|
|
57
|
-
this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
58
|
-
this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/** Whether the colorpicker-input is disabled. */
|
|
62
|
-
get disabled() {
|
|
63
|
-
return !!this._disabled;
|
|
64
|
-
}
|
|
65
|
-
set disabled(value) {
|
|
66
|
-
const element = this._elementRef.nativeElement;
|
|
67
|
-
if (this._disabled !== value) {
|
|
68
|
-
this._disabled = value;
|
|
69
|
-
this._disabledChange.emit(value);
|
|
70
|
-
}
|
|
71
|
-
// We need to null check the `blur` method, because it's undefined during SSR.
|
|
72
|
-
// In Ivy static bindings are invoked earlier, before the element is attached to the DOM.
|
|
73
|
-
// This can cause an error to be thrown in some browsers (IE/Edge) which assert that the
|
|
74
|
-
// element has been inserted.
|
|
75
|
-
if (value && this._isInitialized && element.blur) {
|
|
76
|
-
// Normally, native input elements automatically blur if they turn disabled. This behavior
|
|
77
|
-
// is problematic, because it would mean that it triggers another change detection cycle,
|
|
78
|
-
// which then causes a changed after checked error if the input element was focused before.
|
|
79
|
-
element.blur();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/** The value of the input. */
|
|
83
|
-
get value() {
|
|
84
|
-
return this._value;
|
|
85
|
-
}
|
|
86
|
-
set value(value) {
|
|
87
|
-
const oldValue = this.value;
|
|
88
|
-
this._value = value;
|
|
89
|
-
this._formatValue(value);
|
|
90
|
-
this._valueChange.emit(value);
|
|
91
|
-
}
|
|
92
|
-
constructor(_elementRef, _formField) {
|
|
93
|
-
this._elementRef = _elementRef;
|
|
94
|
-
this._formField = _formField;
|
|
95
|
-
/** The input and output color format. */
|
|
96
|
-
this.format = 'hex';
|
|
97
|
-
/** Emits when a `change` event is fired on this `<input>`. */
|
|
98
|
-
this.colorChange = new EventEmitter();
|
|
99
|
-
/** Emits when an `input` event is fired on this `<input>`. */
|
|
100
|
-
this.colorInput = new EventEmitter();
|
|
101
|
-
/** Emits when the disabled state has changed */
|
|
102
|
-
this._disabledChange = new EventEmitter();
|
|
103
|
-
/** Emits when the value changes (either due to user input or programmatic change). */
|
|
104
|
-
this._valueChange = new EventEmitter();
|
|
105
|
-
this._onTouched = () => { };
|
|
106
|
-
this._validatorOnChange = () => { };
|
|
107
|
-
this._cvaOnChange = () => { };
|
|
108
|
-
this._pickerSubscription = Subscription.EMPTY;
|
|
109
|
-
/** The combined form control validator for this input. */
|
|
110
|
-
this._validator = Validators.compose([]);
|
|
111
|
-
/** Whether the last value set on the input was valid. */
|
|
112
|
-
this._lastValueValid = false;
|
|
113
|
-
}
|
|
114
|
-
ngAfterViewInit() {
|
|
115
|
-
this._isInitialized = true;
|
|
116
|
-
}
|
|
117
|
-
ngOnDestroy() {
|
|
118
|
-
this._pickerSubscription.unsubscribe();
|
|
119
|
-
this._valueChange.complete();
|
|
120
|
-
this._disabledChange.complete();
|
|
121
|
-
}
|
|
122
|
-
registerOnValidatorChange(fn) {
|
|
123
|
-
this._validatorOnChange = fn;
|
|
124
|
-
}
|
|
125
|
-
/** @docs-private */
|
|
126
|
-
validate(c) {
|
|
127
|
-
return this._validator ? this._validator(c) : null;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* @deprecated
|
|
131
|
-
* @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
|
|
132
|
-
*/
|
|
133
|
-
getPopupConnectionElementRef() {
|
|
134
|
-
return this.getConnectedOverlayOrigin();
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Gets the element that the colorpicker popup should be connected to.
|
|
138
|
-
* @return The element to connect the popup to.
|
|
139
|
-
*/
|
|
140
|
-
getConnectedOverlayOrigin() {
|
|
141
|
-
return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
|
|
142
|
-
}
|
|
143
|
-
/** Gets the ID of an element that should be used a description for the overlay. */
|
|
144
|
-
getOverlayLabelId() {
|
|
145
|
-
if (this._formField) {
|
|
146
|
-
return this._formField.getLabelId();
|
|
147
|
-
}
|
|
148
|
-
return this._elementRef.nativeElement.getAttribute('aria-labelledby');
|
|
149
|
-
}
|
|
150
|
-
// Implemented as part of ControlValueAccessor.
|
|
151
|
-
writeValue(value) {
|
|
152
|
-
this.value = value;
|
|
153
|
-
}
|
|
154
|
-
// Implemented as part of ControlValueAccessor.
|
|
155
|
-
registerOnChange(fn) {
|
|
156
|
-
this._cvaOnChange = fn;
|
|
157
|
-
}
|
|
158
|
-
// Implemented as part of ControlValueAccessor.
|
|
159
|
-
registerOnTouched(fn) {
|
|
160
|
-
this._onTouched = fn;
|
|
161
|
-
}
|
|
162
|
-
// Implemented as part of ControlValueAccessor.
|
|
163
|
-
setDisabledState(isDisabled) {
|
|
164
|
-
this.disabled = isDisabled;
|
|
165
|
-
}
|
|
166
|
-
_onKeydown(event) {
|
|
167
|
-
const isAltDownArrow = event.altKey && event.keyCode === DOWN_ARROW;
|
|
168
|
-
if (this._picker && isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
|
|
169
|
-
this._picker.open();
|
|
170
|
-
event.preventDefault();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
/** Handles blur events on the input. */
|
|
174
|
-
_onBlur() {
|
|
175
|
-
// Reformat the input only if we have a valid value.
|
|
176
|
-
if (this.value) {
|
|
177
|
-
this._formatValue(this.value);
|
|
178
|
-
}
|
|
179
|
-
this._onTouched();
|
|
180
|
-
}
|
|
181
|
-
_onInput(value) {
|
|
182
|
-
const nextValue = value;
|
|
183
|
-
this._value = nextValue;
|
|
184
|
-
this._cvaOnChange(nextValue);
|
|
185
|
-
this._valueChange.emit(nextValue);
|
|
186
|
-
this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
187
|
-
}
|
|
188
|
-
_onChange() {
|
|
189
|
-
this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
190
|
-
}
|
|
191
|
-
/** Returns the palette used by the input's form field, if any. */
|
|
192
|
-
getThemePalette() {
|
|
193
|
-
return this._formField ? this._formField.color : undefined;
|
|
194
|
-
}
|
|
195
|
-
/** TODO: Formats a value and sets it on the input element. */
|
|
196
|
-
_formatValue(value) {
|
|
197
|
-
this._elementRef.nativeElement.value = value ? value : '';
|
|
198
|
-
}
|
|
199
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerInput, deps: [{ token: i0.ElementRef }, { token: i1.MatFormField, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
200
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.0.7", type: MtxColorpickerInput, selector: "input[mtxColorpicker]", inputs: { mtxColorpicker: "mtxColorpicker", disabled: ["disabled", "disabled", booleanAttribute], value: "value", format: "format" }, outputs: { colorChange: "colorChange", colorInput: "colorInput" }, host: { listeners: { "input": "_onInput($event.target.value)", "change": "_onChange()", "blur": "_onBlur()", "keydown": "_onKeydown($event)" }, properties: { "attr.aria-haspopup": "_picker ? \"dialog\" : null", "attr.aria-owns": "(_picker?.opened && _picker.id) || null", "disabled": "disabled" }, classAttribute: "mtx-colorpicker-input" }, providers: [
|
|
201
|
-
MTX_COLORPICKER_VALUE_ACCESSOR,
|
|
202
|
-
MTX_COLORPICKER_VALIDATORS,
|
|
203
|
-
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
|
|
204
|
-
], exportAs: ["mtxColorpickerInput"], ngImport: i0 }); }
|
|
205
|
-
}
|
|
206
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerInput, decorators: [{
|
|
207
|
-
type: Directive,
|
|
208
|
-
args: [{
|
|
209
|
-
selector: 'input[mtxColorpicker]',
|
|
210
|
-
providers: [
|
|
211
|
-
MTX_COLORPICKER_VALUE_ACCESSOR,
|
|
212
|
-
MTX_COLORPICKER_VALIDATORS,
|
|
213
|
-
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
|
|
214
|
-
],
|
|
215
|
-
host: {
|
|
216
|
-
'class': 'mtx-colorpicker-input',
|
|
217
|
-
'[attr.aria-haspopup]': '_picker ? "dialog" : null',
|
|
218
|
-
'[attr.aria-owns]': '(_picker?.opened && _picker.id) || null',
|
|
219
|
-
'[disabled]': 'disabled',
|
|
220
|
-
'(input)': '_onInput($event.target.value)',
|
|
221
|
-
'(change)': '_onChange()',
|
|
222
|
-
'(blur)': '_onBlur()',
|
|
223
|
-
'(keydown)': '_onKeydown($event)',
|
|
224
|
-
},
|
|
225
|
-
exportAs: 'mtxColorpickerInput',
|
|
226
|
-
}]
|
|
227
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.MatFormField, decorators: [{
|
|
228
|
-
type: Optional
|
|
229
|
-
}] }], propDecorators: { mtxColorpicker: [{
|
|
230
|
-
type: Input
|
|
231
|
-
}], disabled: [{
|
|
232
|
-
type: Input,
|
|
233
|
-
args: [{ transform: booleanAttribute }]
|
|
234
|
-
}], value: [{
|
|
235
|
-
type: Input
|
|
236
|
-
}], format: [{
|
|
237
|
-
type: Input
|
|
238
|
-
}], colorChange: [{
|
|
239
|
-
type: Output
|
|
240
|
-
}], colorInput: [{
|
|
241
|
-
type: Output
|
|
242
|
-
}] } });
|
|
243
|
-
|
|
244
|
-
/** Can be used to override the icon of a `mtxColorpickerToggle`. */
|
|
245
|
-
class MtxColorpickerToggleIcon {
|
|
246
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
247
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.7", type: MtxColorpickerToggleIcon, selector: "[mtxColorpickerToggleIcon]", ngImport: i0 }); }
|
|
248
|
-
}
|
|
249
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerToggleIcon, decorators: [{
|
|
250
|
-
type: Directive,
|
|
251
|
-
args: [{
|
|
252
|
-
selector: '[mtxColorpickerToggleIcon]',
|
|
253
|
-
}]
|
|
254
|
-
}] });
|
|
255
|
-
class MtxColorpickerToggle {
|
|
256
|
-
/** Whether the toggle button is disabled. */
|
|
257
|
-
get disabled() {
|
|
258
|
-
if (this._disabled == null && this.picker) {
|
|
259
|
-
return this.picker.disabled;
|
|
260
|
-
}
|
|
261
|
-
return !!this._disabled;
|
|
262
|
-
}
|
|
263
|
-
set disabled(value) {
|
|
264
|
-
this._disabled = value;
|
|
265
|
-
}
|
|
266
|
-
constructor(_changeDetectorRef, defaultTabIndex) {
|
|
267
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
268
|
-
this._stateChanges = Subscription.EMPTY;
|
|
269
|
-
const parsedTabIndex = Number(defaultTabIndex);
|
|
270
|
-
this.tabIndex = parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
|
|
271
|
-
}
|
|
272
|
-
ngOnChanges(changes) {
|
|
273
|
-
if (changes.picker) {
|
|
274
|
-
this._watchStateChanges();
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
ngOnDestroy() {
|
|
278
|
-
this._stateChanges.unsubscribe();
|
|
279
|
-
}
|
|
280
|
-
ngAfterContentInit() {
|
|
281
|
-
this._watchStateChanges();
|
|
282
|
-
}
|
|
283
|
-
_open(event) {
|
|
284
|
-
if (this.picker && !this.disabled) {
|
|
285
|
-
this.picker.open();
|
|
286
|
-
event.stopPropagation();
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
_watchStateChanges() {
|
|
290
|
-
const pickerDisabled = this.picker ? this.picker._disabledChange : of();
|
|
291
|
-
const inputDisabled = this.picker && this.picker.pickerInput
|
|
292
|
-
? this.picker.pickerInput._disabledChange
|
|
293
|
-
: of();
|
|
294
|
-
const pickerToggled = this.picker
|
|
295
|
-
? merge(this.picker.openedStream, this.picker.closedStream)
|
|
296
|
-
: of();
|
|
297
|
-
this._stateChanges.unsubscribe();
|
|
298
|
-
this._stateChanges = merge(pickerDisabled, inputDisabled, pickerToggled).subscribe(() => this._changeDetectorRef.markForCheck());
|
|
299
|
-
}
|
|
300
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerToggle, deps: [{ token: i0.ChangeDetectorRef }, { token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
301
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0.7", type: MtxColorpickerToggle, selector: "mtx-colorpicker-toggle", inputs: { picker: ["for", "picker"], tabIndex: "tabIndex", ariaLabel: ["aria-label", "ariaLabel"], disabled: ["disabled", "disabled", booleanAttribute], disableRipple: ["disableRipple", "disableRipple", booleanAttribute] }, host: { listeners: { "click": "_open($event)" }, properties: { "attr.tabindex": "null", "class.mtx-colorpicker-toggle-active": "picker && picker.opened", "class.mat-accent": "picker && picker.color === \"accent\"", "class.mat-warn": "picker && picker.color === \"warn\"" }, classAttribute: "mtx-colorpicker-toggle" }, queries: [{ propertyName: "_customIcon", first: true, predicate: MtxColorpickerToggleIcon, descendants: true }], viewQueries: [{ propertyName: "_button", first: true, predicate: ["button"], descendants: true }], exportAs: ["mtxColorpickerToggle"], usesOnChanges: true, ngImport: i0, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"picker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n <svg\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 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\n <ng-content select=\"[mtxColorpickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-colorpicker-toggle{pointer-events:auto;color:var(--mtx-colorpicker-toggle-icon-color)}.mtx-colorpicker-toggle-active{color:var(--mtx-colorpicker-toggle-active-state-icon-color)}.cdk-high-contrast-active .mtx-colorpicker-toggle-default-icon{color:CanvasText}\n"], dependencies: [{ kind: "component", type: i1$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
302
|
-
}
|
|
303
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImport: i0, type: MtxColorpickerToggle, decorators: [{
|
|
304
|
-
type: Component,
|
|
305
|
-
args: [{ selector: 'mtx-colorpicker-toggle', host: {
|
|
306
|
-
'class': 'mtx-colorpicker-toggle',
|
|
307
|
-
'[attr.tabindex]': 'null',
|
|
308
|
-
'[class.mtx-colorpicker-toggle-active]': 'picker && picker.opened',
|
|
309
|
-
'[class.mat-accent]': 'picker && picker.color === "accent"',
|
|
310
|
-
'[class.mat-warn]': 'picker && picker.color === "warn"',
|
|
311
|
-
// Bind the `click` on the host, rather than the inner `button`, so that we can call
|
|
312
|
-
// `stopPropagation` on it without affecting the user's `click` handlers. We need to stop
|
|
313
|
-
// it so that the input doesn't get focused automatically by the form field (See #21836).
|
|
314
|
-
'(click)': '_open($event)',
|
|
315
|
-
}, exportAs: 'mtxColorpickerToggle', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"picker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n <svg\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 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\n <ng-content select=\"[mtxColorpickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-colorpicker-toggle{pointer-events:auto;color:var(--mtx-colorpicker-toggle-icon-color)}.mtx-colorpicker-toggle-active{color:var(--mtx-colorpicker-toggle-active-state-icon-color)}.cdk-high-contrast-active .mtx-colorpicker-toggle-default-icon{color:CanvasText}\n"] }]
|
|
316
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
317
|
-
type: Attribute,
|
|
318
|
-
args: ['tabindex']
|
|
319
|
-
}] }], propDecorators: { picker: [{
|
|
320
|
-
type: Input,
|
|
321
|
-
args: ['for']
|
|
322
|
-
}], tabIndex: [{
|
|
323
|
-
type: Input
|
|
324
|
-
}], ariaLabel: [{
|
|
325
|
-
type: Input,
|
|
326
|
-
args: ['aria-label']
|
|
327
|
-
}], disabled: [{
|
|
328
|
-
type: Input,
|
|
329
|
-
args: [{ transform: booleanAttribute }]
|
|
330
|
-
}], disableRipple: [{
|
|
331
|
-
type: Input,
|
|
332
|
-
args: [{ transform: booleanAttribute }]
|
|
333
|
-
}], _customIcon: [{
|
|
334
|
-
type: ContentChild,
|
|
335
|
-
args: [MtxColorpickerToggleIcon]
|
|
336
|
-
}], _button: [{
|
|
337
|
-
type: ViewChild,
|
|
338
|
-
args: ['button']
|
|
339
|
-
}] } });
|
|
1
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
|
2
|
+
import * as i2 from '@angular/cdk/overlay';
|
|
3
|
+
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
4
|
+
import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
|
5
|
+
import { NgTemplateOutlet, DOCUMENT, CommonModule } from '@angular/common';
|
|
6
|
+
import * as i0 from '@angular/core';
|
|
7
|
+
import { inject, InjectionToken, Component, ViewEncapsulation, ChangeDetectionStrategy, EventEmitter, booleanAttribute, Inject, Optional, Input, Output, forwardRef, Directive, Attribute, ContentChild, ViewChild, NgModule } from '@angular/core';
|
|
8
|
+
import { MatIconButton, MatButtonModule } from '@angular/material/button';
|
|
9
|
+
import * as i1 from 'ngx-color/chrome';
|
|
10
|
+
import { ColorChromeModule } from 'ngx-color/chrome';
|
|
11
|
+
import { ESCAPE, hasModifierKey, UP_ARROW, DOWN_ARROW } from '@angular/cdk/keycodes';
|
|
12
|
+
import { mixinColor } from '@angular/material/core';
|
|
13
|
+
import { Subject, Subscription, merge, of } from 'rxjs';
|
|
14
|
+
import { take, filter } from 'rxjs/operators';
|
|
15
|
+
import { TinyColor } from '@ctrl/tinycolor';
|
|
16
|
+
import { style, keyframes, animate, transition, trigger } from '@angular/animations';
|
|
17
|
+
import * as i3 from '@angular/cdk/bidi';
|
|
18
|
+
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
|
|
19
|
+
import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
|
|
20
|
+
import * as i1$1 from '@angular/material/form-field';
|
|
340
21
|
|
|
341
22
|
/**
|
|
342
23
|
* Animations used by the colorpicker.
|
|
@@ -356,7 +37,13 @@ const mtxColorpickerAnimations = {
|
|
|
356
37
|
/** Used to generate a unique ID for each colorpicker instance. */
|
|
357
38
|
let colorpickerUid = 0;
|
|
358
39
|
/** Injection token that determines the scroll handling while the panel is open. */
|
|
359
|
-
const MTX_COLORPICKER_SCROLL_STRATEGY = new InjectionToken('mtx-colorpicker-scroll-strategy'
|
|
40
|
+
const MTX_COLORPICKER_SCROLL_STRATEGY = new InjectionToken('mtx-colorpicker-scroll-strategy', {
|
|
41
|
+
providedIn: 'root',
|
|
42
|
+
factory: () => {
|
|
43
|
+
const overlay = inject(Overlay);
|
|
44
|
+
return () => overlay.scrollStrategies.reposition();
|
|
45
|
+
},
|
|
46
|
+
});
|
|
360
47
|
function MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
|
|
361
48
|
return () => overlay.scrollStrategies.reposition();
|
|
362
49
|
}
|
|
@@ -396,16 +83,16 @@ class MtxColorpickerContent extends _MtxColorpickerContentBase {
|
|
|
396
83
|
hsv: new TinyColor(e.color.hsv).toHsvString(),
|
|
397
84
|
}[this.picker.format];
|
|
398
85
|
}
|
|
399
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0
|
|
400
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.0
|
|
86
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerContent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
87
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.0", type: MtxColorpickerContent, isStandalone: true, selector: "mtx-colorpicker-content", inputs: { color: "color" }, host: { listeners: { "@transformPanel.done": "_animationDone.next()" }, properties: { "@transformPanel": "_animationState" }, classAttribute: "mtx-colorpicker-content" }, exportAs: ["mtxColorpickerContent"], usesInheritance: true, ngImport: i0, template: "@if (picker.content) {\n <ng-template [ngTemplateOutlet]=\"picker.content\"></ng-template>\n} @else {\n <color-chrome [color]=\"picker.selected\" (onChangeComplete)=\"picker.select(getColorString($event))\" />\n}\n", styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"], dependencies: [{ kind: "ngmodule", type: ColorChromeModule }, { kind: "component", type: i1.ChromeComponent, selector: "color-chrome", inputs: ["disableAlpha"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [mtxColorpickerAnimations.transformPanel], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
401
88
|
}
|
|
402
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerContent, decorators: [{
|
|
403
90
|
type: Component,
|
|
404
91
|
args: [{ selector: 'mtx-colorpicker-content', host: {
|
|
405
92
|
'class': 'mtx-colorpicker-content',
|
|
406
93
|
'[@transformPanel]': '_animationState',
|
|
407
94
|
'(@transformPanel.done)': '_animationDone.next()',
|
|
408
|
-
}, animations: [mtxColorpickerAnimations.transformPanel], exportAs: 'mtxColorpickerContent', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color'], template: "@if (picker.content) {\n <ng-template [ngTemplateOutlet]=\"picker.content\"></ng-template>\n} @else {\n <color-chrome [color]=\"picker.selected\" (onChangeComplete)=\"picker.select(getColorString($event))\" />\n}\n", styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"] }]
|
|
95
|
+
}, animations: [mtxColorpickerAnimations.transformPanel], exportAs: 'mtxColorpickerContent', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color'], standalone: true, imports: [ColorChromeModule, NgTemplateOutlet], template: "@if (picker.content) {\n <ng-template [ngTemplateOutlet]=\"picker.content\"></ng-template>\n} @else {\n <color-chrome [color]=\"picker.selected\" (onChangeComplete)=\"picker.select(getColorString($event))\" />\n}\n", styles: [".mtx-colorpicker-content{display:block;border-radius:4px}\n"] }]
|
|
409
96
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }] });
|
|
410
97
|
class MtxColorpicker {
|
|
411
98
|
get disabled() {
|
|
@@ -579,149 +266,472 @@ class MtxColorpicker {
|
|
|
579
266
|
if (labelId) {
|
|
580
267
|
overlayElement.setAttribute('aria-labelledby', labelId);
|
|
581
268
|
}
|
|
582
|
-
this._getCloseStream(overlayRef).subscribe(event => {
|
|
583
|
-
if (event) {
|
|
584
|
-
event.preventDefault();
|
|
585
|
-
}
|
|
586
|
-
this.close();
|
|
587
|
-
});
|
|
588
|
-
this._componentRef = overlayRef.attach(portal);
|
|
589
|
-
this._forwardContentValues(this._componentRef.instance);
|
|
590
|
-
// Update the position once the panel has rendered. Only relevant in dropdown mode.
|
|
591
|
-
this._ngZone.onStable.pipe(take(1)).subscribe(() => overlayRef.updatePosition());
|
|
269
|
+
this._getCloseStream(overlayRef).subscribe(event => {
|
|
270
|
+
if (event) {
|
|
271
|
+
event.preventDefault();
|
|
272
|
+
}
|
|
273
|
+
this.close();
|
|
274
|
+
});
|
|
275
|
+
this._componentRef = overlayRef.attach(portal);
|
|
276
|
+
this._forwardContentValues(this._componentRef.instance);
|
|
277
|
+
// Update the position once the panel has rendered. Only relevant in dropdown mode.
|
|
278
|
+
this._ngZone.onStable.pipe(take(1)).subscribe(() => overlayRef.updatePosition());
|
|
279
|
+
}
|
|
280
|
+
/** Destroys the current overlay. */
|
|
281
|
+
_destroyOverlay() {
|
|
282
|
+
if (this._overlayRef) {
|
|
283
|
+
this._overlayRef.dispose();
|
|
284
|
+
this._overlayRef = this._componentRef = null;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/** Gets a position strategy that will open the panel as a dropdown. */
|
|
288
|
+
_getDropdownStrategy() {
|
|
289
|
+
const strategy = this._overlay
|
|
290
|
+
.position()
|
|
291
|
+
.flexibleConnectedTo(this.pickerInput.getConnectedOverlayOrigin())
|
|
292
|
+
.withTransformOriginOn('.mtx-colorpicker-content')
|
|
293
|
+
.withFlexibleDimensions(false)
|
|
294
|
+
.withViewportMargin(8)
|
|
295
|
+
.withLockedPosition();
|
|
296
|
+
return this._setConnectedPositions(strategy);
|
|
297
|
+
}
|
|
298
|
+
/** Sets the positions of the colorpicker in dropdown mode based on the current configuration. */
|
|
299
|
+
_setConnectedPositions(strategy) {
|
|
300
|
+
const primaryX = this.xPosition === 'end' ? 'end' : 'start';
|
|
301
|
+
const secondaryX = primaryX === 'start' ? 'end' : 'start';
|
|
302
|
+
const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
|
|
303
|
+
const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
|
|
304
|
+
return strategy.withPositions([
|
|
305
|
+
{
|
|
306
|
+
originX: primaryX,
|
|
307
|
+
originY: secondaryY,
|
|
308
|
+
overlayX: primaryX,
|
|
309
|
+
overlayY: primaryY,
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
originX: primaryX,
|
|
313
|
+
originY: primaryY,
|
|
314
|
+
overlayX: primaryX,
|
|
315
|
+
overlayY: secondaryY,
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
originX: secondaryX,
|
|
319
|
+
originY: secondaryY,
|
|
320
|
+
overlayX: secondaryX,
|
|
321
|
+
overlayY: primaryY,
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
originX: secondaryX,
|
|
325
|
+
originY: primaryY,
|
|
326
|
+
overlayX: secondaryX,
|
|
327
|
+
overlayY: secondaryY,
|
|
328
|
+
},
|
|
329
|
+
]);
|
|
330
|
+
}
|
|
331
|
+
/** Gets an observable that will emit when the overlay is supposed to be closed. */
|
|
332
|
+
_getCloseStream(overlayRef) {
|
|
333
|
+
return merge(overlayRef.backdropClick(), overlayRef.detachments(), overlayRef.keydownEvents().pipe(filter(event => {
|
|
334
|
+
// Closing on alt + up is only valid when there's an input associated with the colorpicker.
|
|
335
|
+
return ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
|
|
336
|
+
(this.pickerInput && hasModifierKey(event, 'altKey') && event.keyCode === UP_ARROW));
|
|
337
|
+
})));
|
|
338
|
+
}
|
|
339
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpicker, deps: [{ token: i2.Overlay }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: MTX_COLORPICKER_SCROLL_STRATEGY }, { token: i3.Directionality, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
340
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.1.0", type: MtxColorpicker, isStandalone: true, selector: "mtx-colorpicker", inputs: { content: "content", disabled: ["disabled", "disabled", booleanAttribute], xPosition: "xPosition", yPosition: "yPosition", restoreFocus: ["restoreFocus", "restoreFocus", booleanAttribute], opened: ["opened", "opened", booleanAttribute], color: "color", format: "format" }, outputs: { openedStream: "opened", closedStream: "closed" }, exportAs: ["mtxColorpicker"], usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
341
|
+
}
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpicker, decorators: [{
|
|
343
|
+
type: Component,
|
|
344
|
+
args: [{
|
|
345
|
+
selector: 'mtx-colorpicker',
|
|
346
|
+
template: '',
|
|
347
|
+
exportAs: 'mtxColorpicker',
|
|
348
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
349
|
+
encapsulation: ViewEncapsulation.None,
|
|
350
|
+
standalone: true,
|
|
351
|
+
}]
|
|
352
|
+
}], ctorParameters: () => [{ type: i2.Overlay }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
353
|
+
type: Inject,
|
|
354
|
+
args: [MTX_COLORPICKER_SCROLL_STRATEGY]
|
|
355
|
+
}] }, { type: i3.Directionality, decorators: [{
|
|
356
|
+
type: Optional
|
|
357
|
+
}] }, { type: undefined, decorators: [{
|
|
358
|
+
type: Optional
|
|
359
|
+
}, {
|
|
360
|
+
type: Inject,
|
|
361
|
+
args: [DOCUMENT]
|
|
362
|
+
}] }], propDecorators: { content: [{
|
|
363
|
+
type: Input
|
|
364
|
+
}], openedStream: [{
|
|
365
|
+
type: Output,
|
|
366
|
+
args: ['opened']
|
|
367
|
+
}], closedStream: [{
|
|
368
|
+
type: Output,
|
|
369
|
+
args: ['closed']
|
|
370
|
+
}], disabled: [{
|
|
371
|
+
type: Input,
|
|
372
|
+
args: [{ transform: booleanAttribute }]
|
|
373
|
+
}], xPosition: [{
|
|
374
|
+
type: Input
|
|
375
|
+
}], yPosition: [{
|
|
376
|
+
type: Input
|
|
377
|
+
}], restoreFocus: [{
|
|
378
|
+
type: Input,
|
|
379
|
+
args: [{ transform: booleanAttribute }]
|
|
380
|
+
}], opened: [{
|
|
381
|
+
type: Input,
|
|
382
|
+
args: [{ transform: booleanAttribute }]
|
|
383
|
+
}], color: [{
|
|
384
|
+
type: Input
|
|
385
|
+
}], format: [{
|
|
386
|
+
type: Input
|
|
387
|
+
}] } });
|
|
388
|
+
|
|
389
|
+
class MtxColorPickerInputEvent {
|
|
390
|
+
constructor(
|
|
391
|
+
/** Reference to the colorpicker input component that emitted the event. */
|
|
392
|
+
target,
|
|
393
|
+
/** Reference to the native input element associated with the colorpicker input. */
|
|
394
|
+
targetElement) {
|
|
395
|
+
this.target = target;
|
|
396
|
+
this.targetElement = targetElement;
|
|
397
|
+
this.value = this.target.value;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
const MTX_COLORPICKER_VALUE_ACCESSOR = {
|
|
401
|
+
provide: NG_VALUE_ACCESSOR,
|
|
402
|
+
useExisting: forwardRef(() => MtxColorpickerInput),
|
|
403
|
+
multi: true,
|
|
404
|
+
};
|
|
405
|
+
const MTX_COLORPICKER_VALIDATORS = {
|
|
406
|
+
provide: NG_VALIDATORS,
|
|
407
|
+
useExisting: forwardRef(() => MtxColorpickerInput),
|
|
408
|
+
multi: true,
|
|
409
|
+
};
|
|
410
|
+
class MtxColorpickerInput {
|
|
411
|
+
set mtxColorpicker(value) {
|
|
412
|
+
if (!value) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
this._picker = value;
|
|
416
|
+
this._picker.registerInput(this);
|
|
417
|
+
this._pickerSubscription.unsubscribe();
|
|
418
|
+
this._pickerSubscription = this._picker._selectedChanged.subscribe((selected) => {
|
|
419
|
+
this.value = selected;
|
|
420
|
+
this._cvaOnChange(selected);
|
|
421
|
+
this._onTouched();
|
|
422
|
+
this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
423
|
+
this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
/** Whether the colorpicker-input is disabled. */
|
|
427
|
+
get disabled() {
|
|
428
|
+
return !!this._disabled;
|
|
429
|
+
}
|
|
430
|
+
set disabled(value) {
|
|
431
|
+
const element = this._elementRef.nativeElement;
|
|
432
|
+
if (this._disabled !== value) {
|
|
433
|
+
this._disabled = value;
|
|
434
|
+
this._disabledChange.emit(value);
|
|
435
|
+
}
|
|
436
|
+
// We need to null check the `blur` method, because it's undefined during SSR.
|
|
437
|
+
// In Ivy static bindings are invoked earlier, before the element is attached to the DOM.
|
|
438
|
+
// This can cause an error to be thrown in some browsers (IE/Edge) which assert that the
|
|
439
|
+
// element has been inserted.
|
|
440
|
+
if (value && this._isInitialized && element.blur) {
|
|
441
|
+
// Normally, native input elements automatically blur if they turn disabled. This behavior
|
|
442
|
+
// is problematic, because it would mean that it triggers another change detection cycle,
|
|
443
|
+
// which then causes a changed after checked error if the input element was focused before.
|
|
444
|
+
element.blur();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
/** The value of the input. */
|
|
448
|
+
get value() {
|
|
449
|
+
return this._value;
|
|
450
|
+
}
|
|
451
|
+
set value(value) {
|
|
452
|
+
const oldValue = this.value;
|
|
453
|
+
this._value = value;
|
|
454
|
+
this._formatValue(value);
|
|
455
|
+
this._valueChange.emit(value);
|
|
456
|
+
}
|
|
457
|
+
constructor(_elementRef, _formField) {
|
|
458
|
+
this._elementRef = _elementRef;
|
|
459
|
+
this._formField = _formField;
|
|
460
|
+
/** The input and output color format. */
|
|
461
|
+
this.format = 'hex';
|
|
462
|
+
/** Emits when a `change` event is fired on this `<input>`. */
|
|
463
|
+
this.colorChange = new EventEmitter();
|
|
464
|
+
/** Emits when an `input` event is fired on this `<input>`. */
|
|
465
|
+
this.colorInput = new EventEmitter();
|
|
466
|
+
/** Emits when the disabled state has changed */
|
|
467
|
+
this._disabledChange = new EventEmitter();
|
|
468
|
+
/** Emits when the value changes (either due to user input or programmatic change). */
|
|
469
|
+
this._valueChange = new EventEmitter();
|
|
470
|
+
this._onTouched = () => { };
|
|
471
|
+
this._validatorOnChange = () => { };
|
|
472
|
+
this._cvaOnChange = () => { };
|
|
473
|
+
this._pickerSubscription = Subscription.EMPTY;
|
|
474
|
+
/** The combined form control validator for this input. */
|
|
475
|
+
this._validator = Validators.compose([]);
|
|
476
|
+
/** Whether the last value set on the input was valid. */
|
|
477
|
+
this._lastValueValid = false;
|
|
478
|
+
}
|
|
479
|
+
ngAfterViewInit() {
|
|
480
|
+
this._isInitialized = true;
|
|
481
|
+
}
|
|
482
|
+
ngOnDestroy() {
|
|
483
|
+
this._pickerSubscription.unsubscribe();
|
|
484
|
+
this._valueChange.complete();
|
|
485
|
+
this._disabledChange.complete();
|
|
486
|
+
}
|
|
487
|
+
registerOnValidatorChange(fn) {
|
|
488
|
+
this._validatorOnChange = fn;
|
|
489
|
+
}
|
|
490
|
+
/** @docs-private */
|
|
491
|
+
validate(c) {
|
|
492
|
+
return this._validator ? this._validator(c) : null;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* @deprecated
|
|
496
|
+
* @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
|
|
497
|
+
*/
|
|
498
|
+
getPopupConnectionElementRef() {
|
|
499
|
+
return this.getConnectedOverlayOrigin();
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Gets the element that the colorpicker popup should be connected to.
|
|
503
|
+
* @return The element to connect the popup to.
|
|
504
|
+
*/
|
|
505
|
+
getConnectedOverlayOrigin() {
|
|
506
|
+
return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
|
|
507
|
+
}
|
|
508
|
+
/** Gets the ID of an element that should be used a description for the overlay. */
|
|
509
|
+
getOverlayLabelId() {
|
|
510
|
+
if (this._formField) {
|
|
511
|
+
return this._formField.getLabelId();
|
|
512
|
+
}
|
|
513
|
+
return this._elementRef.nativeElement.getAttribute('aria-labelledby');
|
|
514
|
+
}
|
|
515
|
+
// Implemented as part of ControlValueAccessor.
|
|
516
|
+
writeValue(value) {
|
|
517
|
+
this.value = value;
|
|
518
|
+
}
|
|
519
|
+
// Implemented as part of ControlValueAccessor.
|
|
520
|
+
registerOnChange(fn) {
|
|
521
|
+
this._cvaOnChange = fn;
|
|
522
|
+
}
|
|
523
|
+
// Implemented as part of ControlValueAccessor.
|
|
524
|
+
registerOnTouched(fn) {
|
|
525
|
+
this._onTouched = fn;
|
|
526
|
+
}
|
|
527
|
+
// Implemented as part of ControlValueAccessor.
|
|
528
|
+
setDisabledState(isDisabled) {
|
|
529
|
+
this.disabled = isDisabled;
|
|
530
|
+
}
|
|
531
|
+
_onKeydown(event) {
|
|
532
|
+
const isAltDownArrow = event.altKey && event.keyCode === DOWN_ARROW;
|
|
533
|
+
if (this._picker && isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
|
|
534
|
+
this._picker.open();
|
|
535
|
+
event.preventDefault();
|
|
536
|
+
}
|
|
592
537
|
}
|
|
593
|
-
/**
|
|
594
|
-
|
|
595
|
-
if
|
|
596
|
-
|
|
597
|
-
this.
|
|
538
|
+
/** Handles blur events on the input. */
|
|
539
|
+
_onBlur() {
|
|
540
|
+
// Reformat the input only if we have a valid value.
|
|
541
|
+
if (this.value) {
|
|
542
|
+
this._formatValue(this.value);
|
|
598
543
|
}
|
|
544
|
+
this._onTouched();
|
|
599
545
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
.withFlexibleDimensions(false)
|
|
607
|
-
.withViewportMargin(8)
|
|
608
|
-
.withLockedPosition();
|
|
609
|
-
return this._setConnectedPositions(strategy);
|
|
546
|
+
_onInput(value) {
|
|
547
|
+
const nextValue = value;
|
|
548
|
+
this._value = nextValue;
|
|
549
|
+
this._cvaOnChange(nextValue);
|
|
550
|
+
this._valueChange.emit(nextValue);
|
|
551
|
+
this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
610
552
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
const primaryX = this.xPosition === 'end' ? 'end' : 'start';
|
|
614
|
-
const secondaryX = primaryX === 'start' ? 'end' : 'start';
|
|
615
|
-
const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
|
|
616
|
-
const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
|
|
617
|
-
return strategy.withPositions([
|
|
618
|
-
{
|
|
619
|
-
originX: primaryX,
|
|
620
|
-
originY: secondaryY,
|
|
621
|
-
overlayX: primaryX,
|
|
622
|
-
overlayY: primaryY,
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
originX: primaryX,
|
|
626
|
-
originY: primaryY,
|
|
627
|
-
overlayX: primaryX,
|
|
628
|
-
overlayY: secondaryY,
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
originX: secondaryX,
|
|
632
|
-
originY: secondaryY,
|
|
633
|
-
overlayX: secondaryX,
|
|
634
|
-
overlayY: primaryY,
|
|
635
|
-
},
|
|
636
|
-
{
|
|
637
|
-
originX: secondaryX,
|
|
638
|
-
originY: primaryY,
|
|
639
|
-
overlayX: secondaryX,
|
|
640
|
-
overlayY: secondaryY,
|
|
641
|
-
},
|
|
642
|
-
]);
|
|
553
|
+
_onChange() {
|
|
554
|
+
this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
643
555
|
}
|
|
644
|
-
/**
|
|
645
|
-
|
|
646
|
-
return
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
556
|
+
/** Returns the palette used by the input's form field, if any. */
|
|
557
|
+
getThemePalette() {
|
|
558
|
+
return this._formField ? this._formField.color : undefined;
|
|
559
|
+
}
|
|
560
|
+
/** TODO: Formats a value and sets it on the input element. */
|
|
561
|
+
_formatValue(value) {
|
|
562
|
+
this._elementRef.nativeElement.value = value ? value : '';
|
|
651
563
|
}
|
|
652
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0
|
|
653
|
-
/** @nocollapse */ static { this.ɵ
|
|
564
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerInput, deps: [{ token: i0.ElementRef }, { token: i1$1.MatFormField, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
565
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.1.0", type: MtxColorpickerInput, isStandalone: true, selector: "input[mtxColorpicker]", inputs: { mtxColorpicker: "mtxColorpicker", disabled: ["disabled", "disabled", booleanAttribute], value: "value", format: "format" }, outputs: { colorChange: "colorChange", colorInput: "colorInput" }, host: { listeners: { "input": "_onInput($event.target.value)", "change": "_onChange()", "blur": "_onBlur()", "keydown": "_onKeydown($event)" }, properties: { "attr.aria-haspopup": "_picker ? \"dialog\" : null", "attr.aria-owns": "(_picker?.opened && _picker.id) || null", "disabled": "disabled" }, classAttribute: "mtx-colorpicker-input" }, providers: [
|
|
566
|
+
MTX_COLORPICKER_VALUE_ACCESSOR,
|
|
567
|
+
MTX_COLORPICKER_VALIDATORS,
|
|
568
|
+
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
|
|
569
|
+
], exportAs: ["mtxColorpickerInput"], ngImport: i0 }); }
|
|
654
570
|
}
|
|
655
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0
|
|
656
|
-
type:
|
|
571
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerInput, decorators: [{
|
|
572
|
+
type: Directive,
|
|
657
573
|
args: [{
|
|
658
|
-
selector: '
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
574
|
+
selector: 'input[mtxColorpicker]',
|
|
575
|
+
providers: [
|
|
576
|
+
MTX_COLORPICKER_VALUE_ACCESSOR,
|
|
577
|
+
MTX_COLORPICKER_VALIDATORS,
|
|
578
|
+
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
|
|
579
|
+
],
|
|
580
|
+
host: {
|
|
581
|
+
'class': 'mtx-colorpicker-input',
|
|
582
|
+
'[attr.aria-haspopup]': '_picker ? "dialog" : null',
|
|
583
|
+
'[attr.aria-owns]': '(_picker?.opened && _picker.id) || null',
|
|
584
|
+
'[disabled]': 'disabled',
|
|
585
|
+
'(input)': '_onInput($event.target.value)',
|
|
586
|
+
'(change)': '_onChange()',
|
|
587
|
+
'(blur)': '_onBlur()',
|
|
588
|
+
'(keydown)': '_onKeydown($event)',
|
|
589
|
+
},
|
|
590
|
+
exportAs: 'mtxColorpickerInput',
|
|
591
|
+
standalone: true,
|
|
663
592
|
}]
|
|
664
|
-
}], ctorParameters: () => [{ type:
|
|
665
|
-
type: Inject,
|
|
666
|
-
args: [MTX_COLORPICKER_SCROLL_STRATEGY]
|
|
667
|
-
}] }, { type: i4.Directionality, decorators: [{
|
|
668
|
-
type: Optional
|
|
669
|
-
}] }, { type: undefined, decorators: [{
|
|
593
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.MatFormField, decorators: [{
|
|
670
594
|
type: Optional
|
|
671
|
-
}, {
|
|
672
|
-
type: Inject,
|
|
673
|
-
args: [DOCUMENT]
|
|
674
|
-
}] }], propDecorators: { content: [{
|
|
595
|
+
}] }], propDecorators: { mtxColorpicker: [{
|
|
675
596
|
type: Input
|
|
676
|
-
}], openedStream: [{
|
|
677
|
-
type: Output,
|
|
678
|
-
args: ['opened']
|
|
679
|
-
}], closedStream: [{
|
|
680
|
-
type: Output,
|
|
681
|
-
args: ['closed']
|
|
682
597
|
}], disabled: [{
|
|
683
598
|
type: Input,
|
|
684
599
|
args: [{ transform: booleanAttribute }]
|
|
685
|
-
}],
|
|
600
|
+
}], value: [{
|
|
686
601
|
type: Input
|
|
687
|
-
}],
|
|
602
|
+
}], format: [{
|
|
688
603
|
type: Input
|
|
689
|
-
}],
|
|
604
|
+
}], colorChange: [{
|
|
605
|
+
type: Output
|
|
606
|
+
}], colorInput: [{
|
|
607
|
+
type: Output
|
|
608
|
+
}] } });
|
|
609
|
+
|
|
610
|
+
/** Can be used to override the icon of a `mtxColorpickerToggle`. */
|
|
611
|
+
class MtxColorpickerToggleIcon {
|
|
612
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
613
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.0", type: MtxColorpickerToggleIcon, isStandalone: true, selector: "[mtxColorpickerToggleIcon]", ngImport: i0 }); }
|
|
614
|
+
}
|
|
615
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerToggleIcon, decorators: [{
|
|
616
|
+
type: Directive,
|
|
617
|
+
args: [{
|
|
618
|
+
selector: '[mtxColorpickerToggleIcon]',
|
|
619
|
+
standalone: true,
|
|
620
|
+
}]
|
|
621
|
+
}] });
|
|
622
|
+
class MtxColorpickerToggle {
|
|
623
|
+
/** Whether the toggle button is disabled. */
|
|
624
|
+
get disabled() {
|
|
625
|
+
if (this._disabled == null && this.picker) {
|
|
626
|
+
return this.picker.disabled;
|
|
627
|
+
}
|
|
628
|
+
return !!this._disabled;
|
|
629
|
+
}
|
|
630
|
+
set disabled(value) {
|
|
631
|
+
this._disabled = value;
|
|
632
|
+
}
|
|
633
|
+
constructor(_changeDetectorRef, defaultTabIndex) {
|
|
634
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
635
|
+
this._stateChanges = Subscription.EMPTY;
|
|
636
|
+
const parsedTabIndex = Number(defaultTabIndex);
|
|
637
|
+
this.tabIndex = parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
|
|
638
|
+
}
|
|
639
|
+
ngOnChanges(changes) {
|
|
640
|
+
if (changes.picker) {
|
|
641
|
+
this._watchStateChanges();
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
ngOnDestroy() {
|
|
645
|
+
this._stateChanges.unsubscribe();
|
|
646
|
+
}
|
|
647
|
+
ngAfterContentInit() {
|
|
648
|
+
this._watchStateChanges();
|
|
649
|
+
}
|
|
650
|
+
_open(event) {
|
|
651
|
+
if (this.picker && !this.disabled) {
|
|
652
|
+
this.picker.open();
|
|
653
|
+
event.stopPropagation();
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
_watchStateChanges() {
|
|
657
|
+
const pickerDisabled = this.picker ? this.picker._disabledChange : of();
|
|
658
|
+
const inputDisabled = this.picker && this.picker.pickerInput
|
|
659
|
+
? this.picker.pickerInput._disabledChange
|
|
660
|
+
: of();
|
|
661
|
+
const pickerToggled = this.picker
|
|
662
|
+
? merge(this.picker.openedStream, this.picker.closedStream)
|
|
663
|
+
: of();
|
|
664
|
+
this._stateChanges.unsubscribe();
|
|
665
|
+
this._stateChanges = merge(pickerDisabled, inputDisabled, pickerToggled).subscribe(() => this._changeDetectorRef.markForCheck());
|
|
666
|
+
}
|
|
667
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerToggle, deps: [{ token: i0.ChangeDetectorRef }, { token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
668
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.0", type: MtxColorpickerToggle, isStandalone: true, selector: "mtx-colorpicker-toggle", inputs: { picker: ["for", "picker"], tabIndex: "tabIndex", ariaLabel: ["aria-label", "ariaLabel"], disabled: ["disabled", "disabled", booleanAttribute], disableRipple: ["disableRipple", "disableRipple", booleanAttribute] }, host: { listeners: { "click": "_open($event)" }, properties: { "attr.tabindex": "null", "class.mtx-colorpicker-toggle-active": "picker && picker.opened", "class.mat-accent": "picker && picker.color === \"accent\"", "class.mat-warn": "picker && picker.color === \"warn\"" }, classAttribute: "mtx-colorpicker-toggle" }, queries: [{ propertyName: "_customIcon", first: true, predicate: MtxColorpickerToggleIcon, descendants: true }], viewQueries: [{ propertyName: "_button", first: true, predicate: ["button"], descendants: true }], exportAs: ["mtxColorpickerToggle"], usesOnChanges: true, ngImport: i0, template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"picker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n <svg\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 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\n <ng-content select=\"[mtxColorpickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-colorpicker-toggle{pointer-events:auto;color:var(--mtx-colorpicker-toggle-icon-color)}.mtx-colorpicker-toggle-active{color:var(--mtx-colorpicker-toggle-active-state-icon-color)}.cdk-high-contrast-active .mtx-colorpicker-toggle-default-icon{color:CanvasText}\n"], dependencies: [{ kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
669
|
+
}
|
|
670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerToggle, decorators: [{
|
|
671
|
+
type: Component,
|
|
672
|
+
args: [{ selector: 'mtx-colorpicker-toggle', host: {
|
|
673
|
+
'class': 'mtx-colorpicker-toggle',
|
|
674
|
+
'[attr.tabindex]': 'null',
|
|
675
|
+
'[class.mtx-colorpicker-toggle-active]': 'picker && picker.opened',
|
|
676
|
+
'[class.mat-accent]': 'picker && picker.color === "accent"',
|
|
677
|
+
'[class.mat-warn]': 'picker && picker.color === "warn"',
|
|
678
|
+
// Bind the `click` on the host, rather than the inner `button`, so that we can call
|
|
679
|
+
// `stopPropagation` on it without affecting the user's `click` handlers. We need to stop
|
|
680
|
+
// it so that the input doesn't get focused automatically by the form field (See #21836).
|
|
681
|
+
'(click)': '_open($event)',
|
|
682
|
+
}, exportAs: 'mtxColorpickerToggle', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [MatIconButton], template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"picker ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple\">\n\n @if (!_customIcon) {\n <svg\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 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\n <ng-content select=\"[mtxColorpickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mtx-colorpicker-toggle{pointer-events:auto;color:var(--mtx-colorpicker-toggle-icon-color)}.mtx-colorpicker-toggle-active{color:var(--mtx-colorpicker-toggle-active-state-icon-color)}.cdk-high-contrast-active .mtx-colorpicker-toggle-default-icon{color:CanvasText}\n"] }]
|
|
683
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
684
|
+
type: Attribute,
|
|
685
|
+
args: ['tabindex']
|
|
686
|
+
}] }], propDecorators: { picker: [{
|
|
687
|
+
type: Input,
|
|
688
|
+
args: ['for']
|
|
689
|
+
}], tabIndex: [{
|
|
690
|
+
type: Input
|
|
691
|
+
}], ariaLabel: [{
|
|
692
|
+
type: Input,
|
|
693
|
+
args: ['aria-label']
|
|
694
|
+
}], disabled: [{
|
|
690
695
|
type: Input,
|
|
691
696
|
args: [{ transform: booleanAttribute }]
|
|
692
|
-
}],
|
|
697
|
+
}], disableRipple: [{
|
|
693
698
|
type: Input,
|
|
694
699
|
args: [{ transform: booleanAttribute }]
|
|
695
|
-
}],
|
|
696
|
-
type:
|
|
697
|
-
|
|
698
|
-
|
|
700
|
+
}], _customIcon: [{
|
|
701
|
+
type: ContentChild,
|
|
702
|
+
args: [MtxColorpickerToggleIcon]
|
|
703
|
+
}], _button: [{
|
|
704
|
+
type: ViewChild,
|
|
705
|
+
args: ['button']
|
|
699
706
|
}] } });
|
|
700
707
|
|
|
701
708
|
class MtxColorpickerModule {
|
|
702
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0
|
|
703
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0
|
|
704
|
-
MtxColorpickerContent,
|
|
705
|
-
MtxColorpickerInput,
|
|
706
|
-
MtxColorpickerToggle,
|
|
707
|
-
MtxColorpickerToggleIcon], imports: [CommonModule,
|
|
709
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
710
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, imports: [CommonModule,
|
|
708
711
|
OverlayModule,
|
|
709
712
|
A11yModule,
|
|
710
713
|
PortalModule,
|
|
711
714
|
MatButtonModule,
|
|
712
|
-
ColorChromeModule
|
|
715
|
+
ColorChromeModule,
|
|
716
|
+
MtxColorpicker,
|
|
717
|
+
MtxColorpickerContent,
|
|
718
|
+
MtxColorpickerInput,
|
|
719
|
+
MtxColorpickerToggle,
|
|
720
|
+
MtxColorpickerToggleIcon], exports: [MtxColorpicker,
|
|
713
721
|
MtxColorpickerContent,
|
|
714
722
|
MtxColorpickerInput,
|
|
715
723
|
MtxColorpickerToggle,
|
|
716
724
|
MtxColorpickerToggleIcon] }); }
|
|
717
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0
|
|
725
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, providers: [MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [CommonModule,
|
|
718
726
|
OverlayModule,
|
|
719
727
|
A11yModule,
|
|
720
728
|
PortalModule,
|
|
721
729
|
MatButtonModule,
|
|
722
|
-
ColorChromeModule
|
|
730
|
+
ColorChromeModule,
|
|
731
|
+
MtxColorpickerContent,
|
|
732
|
+
MtxColorpickerToggle] }); }
|
|
723
733
|
}
|
|
724
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0
|
|
734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, decorators: [{
|
|
725
735
|
type: NgModule,
|
|
726
736
|
args: [{
|
|
727
737
|
imports: [
|
|
@@ -731,15 +741,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.7", ngImpor
|
|
|
731
741
|
PortalModule,
|
|
732
742
|
MatButtonModule,
|
|
733
743
|
ColorChromeModule,
|
|
734
|
-
],
|
|
735
|
-
exports: [
|
|
736
744
|
MtxColorpicker,
|
|
737
745
|
MtxColorpickerContent,
|
|
738
746
|
MtxColorpickerInput,
|
|
739
747
|
MtxColorpickerToggle,
|
|
740
748
|
MtxColorpickerToggleIcon,
|
|
741
749
|
],
|
|
742
|
-
|
|
750
|
+
exports: [
|
|
743
751
|
MtxColorpicker,
|
|
744
752
|
MtxColorpickerContent,
|
|
745
753
|
MtxColorpickerInput,
|