@ng-matero/extensions 16.3.2 → 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 +26 -13
- package/alert/_alert-theme.scss +54 -24
- package/alert/alert-module.d.ts +3 -3
- package/alert/alert.d.ts +4 -7
- package/alert/alert.scss +3 -3
- package/button/_button-theme.scss +6 -4
- package/button/button-loading.d.ts +5 -10
- package/button/button-module.d.ts +5 -5
- package/checkbox-group/checkbox-group-module.d.ts +6 -6
- package/checkbox-group/checkbox-group.d.ts +5 -10
- package/colorpicker/_colorpicker-theme.scss +62 -34
- package/colorpicker/colorpicker-input.d.ts +2 -4
- package/colorpicker/colorpicker-module.d.ts +10 -10
- package/colorpicker/colorpicker-toggle.d.ts +4 -5
- package/colorpicker/colorpicker.d.ts +8 -9
- 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 +7 -18
- package/core/datetime/datetime.module.d.ts +4 -1
- package/core/density/_all-density.scss +17 -25
- 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/style/_sass-utils.scss +13 -1
- package/core/theming/_all-theme.scss +32 -17
- package/core/tokens/_token-utils.scss +4 -5
- package/core/tokens/m2/mdc/_plain-tooltip.scss +21 -29
- package/core/tokens/m2/mtx/_alert.scss +14 -15
- package/core/tokens/m2/mtx/_colorpicker.scss +8 -11
- package/core/tokens/m2/mtx/_datetimepicker.scss +38 -47
- package/core/tokens/m2/mtx/_drawer.scss +9 -10
- package/core/tokens/m2/mtx/_grid.scss +23 -22
- package/core/tokens/m2/mtx/_loader.scss +6 -6
- package/core/tokens/m2/mtx/_popover.scss +10 -11
- package/core/tokens/m2/mtx/_progress.scss +18 -17
- package/core/tokens/m2/mtx/_select.scss +23 -24
- package/core/tokens/m2/mtx/_split.scss +8 -11
- package/core/typography/_all-typography.scss +40 -0
- package/core/typography/_typography.scss +1 -579
- package/datetimepicker/_datetimepicker-theme.scss +75 -48
- package/datetimepicker/calendar-body.d.ts +1 -1
- package/datetimepicker/calendar.d.ts +8 -15
- package/datetimepicker/calendar.scss +16 -4
- package/datetimepicker/clock.d.ts +2 -3
- package/datetimepicker/datetimepicker-content.scss +3 -3
- package/datetimepicker/datetimepicker-input.d.ts +2 -3
- package/datetimepicker/datetimepicker-module.d.ts +16 -16
- package/datetimepicker/datetimepicker-toggle.d.ts +4 -5
- package/datetimepicker/datetimepicker.d.ts +16 -27
- package/datetimepicker/month-view.d.ts +2 -2
- package/datetimepicker/multi-year-view.d.ts +2 -2
- package/datetimepicker/time.d.ts +6 -8
- package/datetimepicker/time.scss +2 -2
- package/datetimepicker/year-view.d.ts +2 -2
- package/dialog/dialog-container.d.ts +1 -1
- package/dialog/dialog-module.d.ts +7 -7
- package/drawer/_drawer-theme.scss +55 -22
- package/drawer/drawer-container.d.ts +1 -1
- package/drawer/drawer-container.scss +25 -4
- package/drawer/drawer-module.d.ts +5 -5
- package/esm2022/alert/alert-module.mjs +6 -7
- package/esm2022/alert/alert.mjs +11 -18
- package/esm2022/button/button-loading.mjs +13 -23
- package/esm2022/button/button-module.mjs +6 -7
- package/esm2022/checkbox-group/checkbox-group-module.mjs +6 -7
- package/esm2022/checkbox-group/checkbox-group.mjs +19 -31
- package/esm2022/colorpicker/colorpicker-input.mjs +14 -14
- package/esm2022/colorpicker/colorpicker-module.mjs +20 -19
- package/esm2022/colorpicker/colorpicker-toggle.mjs +19 -18
- package/esm2022/colorpicker/colorpicker.mjs +46 -44
- package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +6 -5
- package/esm2022/column-resize/column-resize-directives/column-resize.mjs +6 -5
- package/esm2022/column-resize/column-resize-module.mjs +6 -6
- package/esm2022/column-resize/column-resize-notifier.mjs +7 -7
- 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 +5 -5
- 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 +14 -14
- 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 +6 -6
- 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 -6
- package/esm2022/datetimepicker/calendar.mjs +38 -48
- package/esm2022/datetimepicker/clock.mjs +11 -11
- package/esm2022/datetimepicker/datetimepicker-errors.mjs +4 -3
- package/esm2022/datetimepicker/datetimepicker-input.mjs +14 -14
- package/esm2022/datetimepicker/datetimepicker-intl.mjs +3 -3
- package/esm2022/datetimepicker/datetimepicker-module.mjs +28 -11
- package/esm2022/datetimepicker/datetimepicker-toggle.mjs +19 -18
- package/esm2022/datetimepicker/datetimepicker.mjs +70 -89
- package/esm2022/datetimepicker/month-view.mjs +8 -10
- package/esm2022/datetimepicker/multi-year-view.mjs +10 -11
- package/esm2022/datetimepicker/time.mjs +19 -24
- package/esm2022/datetimepicker/year-view.mjs +10 -11
- package/esm2022/dialog/dialog-container.mjs +21 -12
- package/esm2022/dialog/dialog-module.mjs +23 -7
- package/esm2022/dialog/dialog.mjs +7 -6
- package/esm2022/drawer/drawer-container.mjs +7 -8
- package/esm2022/drawer/drawer-module.mjs +6 -7
- package/esm2022/drawer/drawer-ref.mjs +1 -1
- package/esm2022/drawer/drawer.mjs +8 -7
- package/esm2022/grid/cell.mjs +36 -14
- package/esm2022/grid/column-menu.mjs +31 -15
- package/esm2022/grid/column-resize/column-resize-directives/column-resize-flex.mjs +6 -5
- package/esm2022/grid/column-resize/column-resize-directives/column-resize.mjs +6 -5
- 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 +7 -6
- package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +7 -6
- package/esm2022/grid/column-resize/resize-strategy.mjs +5 -5
- package/esm2022/grid/expansion-toggle.mjs +6 -5
- package/esm2022/grid/grid-module.mjs +39 -37
- package/esm2022/grid/grid-pipes.mjs +30 -30
- package/esm2022/grid/grid-utils.mjs +7 -6
- package/esm2022/grid/grid.mjs +175 -111
- package/esm2022/loader/loader-module.mjs +6 -7
- package/esm2022/loader/loader.mjs +17 -29
- package/esm2022/photoviewer/photoviewer-module.mjs +6 -7
- package/esm2022/photoviewer/photoviewer.mjs +8 -7
- package/esm2022/popover/popover-content.mjs +10 -9
- package/esm2022/popover/popover-module.mjs +22 -7
- package/esm2022/popover/popover-target.mjs +6 -5
- package/esm2022/popover/popover-trigger.mjs +15 -8
- package/esm2022/popover/popover.mjs +54 -139
- package/esm2022/progress/progress-module.mjs +6 -7
- package/esm2022/progress/progress.mjs +15 -26
- package/esm2022/select/option.mjs +12 -17
- package/esm2022/select/select-module.mjs +20 -9
- package/esm2022/select/select.mjs +19 -19
- package/esm2022/select/templates.mjs +56 -56
- package/esm2022/split/split-module.mjs +6 -7
- package/esm2022/split/split-pane.mjs +6 -5
- package/esm2022/split/split.mjs +8 -8
- package/esm2022/split/utils.mjs +1 -1
- package/esm2022/tooltip/tooltip-module.mjs +24 -7
- package/esm2022/tooltip/tooltip.mjs +104 -117
- package/fesm2022/mtxAlert.mjs +15 -23
- package/fesm2022/mtxAlert.mjs.map +1 -1
- package/fesm2022/mtxButton.mjs +17 -28
- package/fesm2022/mtxButton.mjs.map +1 -1
- package/fesm2022/mtxCheckboxGroup.mjs +22 -37
- package/fesm2022/mtxCheckboxGroup.mjs.map +1 -1
- package/fesm2022/mtxColorpicker.mjs +479 -474
- package/fesm2022/mtxColorpicker.mjs.map +1 -1
- package/fesm2022/mtxColumnResize.mjs +51 -49
- package/fesm2022/mtxColumnResize.mjs.map +1 -1
- package/fesm2022/mtxCore.mjs +36 -41
- package/fesm2022/mtxCore.mjs.map +1 -1
- package/fesm2022/mtxDatetimepicker.mjs +898 -905
- package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
- package/fesm2022/mtxDialog.mjs +47 -25
- package/fesm2022/mtxDialog.mjs.map +1 -1
- package/fesm2022/mtxDrawer.mjs +20 -21
- package/fesm2022/mtxDrawer.mjs.map +1 -1
- package/fesm2022/mtxGrid.mjs +330 -229
- package/fesm2022/mtxGrid.mjs.map +1 -1
- package/fesm2022/mtxLoader.mjs +21 -36
- package/fesm2022/mtxLoader.mjs.map +1 -1
- package/fesm2022/mtxPhotoviewer.mjs +12 -12
- package/fesm2022/mtxPhotoviewer.mjs.map +1 -1
- package/fesm2022/mtxPopover.mjs +103 -165
- package/fesm2022/mtxPopover.mjs.map +1 -1
- package/fesm2022/mtxProgress.mjs +19 -32
- package/fesm2022/mtxProgress.mjs.map +1 -1
- package/fesm2022/mtxSelect.mjs +99 -93
- package/fesm2022/mtxSelect.mjs.map +1 -1
- package/fesm2022/mtxSplit.mjs +17 -18
- package/fesm2022/mtxSplit.mjs.map +1 -1
- package/fesm2022/mtxTooltip.mjs +128 -125
- package/fesm2022/mtxTooltip.mjs.map +1 -1
- package/grid/_grid-theme.scss +58 -29
- 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 +57 -25
- package/grid/grid.scss +8 -1
- package/loader/_loader-theme.scss +55 -22
- package/loader/loader-module.d.ts +5 -5
- package/loader/loader.d.ts +5 -10
- package/loader/loader.scss +1 -1
- package/package.json +13 -19
- package/photoviewer/photoviewer-module.d.ts +1 -1
- package/photoviewer/photoviewer.d.ts +2 -1
- package/popover/_popover-theme.scss +55 -22
- 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 +24 -55
- package/popover/popover.scss +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-theme.scss +60 -22
- package/progress/progress-module.d.ts +3 -3
- package/progress/progress.d.ts +5 -10
- package/progress/progress.scss +3 -3
- package/select/_select-theme.scss +66 -34
- package/select/option.d.ts +3 -6
- package/select/select-module.d.ts +7 -7
- package/select/select.d.ts +2 -4
- package/select/select.scss +109 -109
- package/select/templates.d.ts +11 -11
- package/split/_split-theme.scss +62 -32
- package/split/split-module.d.ts +4 -4
- package/split/split-pane.d.ts +1 -1
- package/split/split.d.ts +1 -1
- package/split/split.scss +2 -4
- package/tooltip/_tooltip-theme.scss +66 -34
- package/tooltip/tooltip-module.d.ts +7 -7
- package/tooltip/tooltip.d.ts +30 -44
- package/tooltip/tooltip.scss +2 -4
- package/_theming.scss +0 -16
- package/alert/_alert-theme.import.scss +0 -2
- package/button/_button-theme.import.scss +0 -2
- package/colorpicker/_colorpicker-theme.import.scss +0 -2
- package/core/density/_compatibility.scss +0 -74
- package/core/mdc-helpers/_mdc-helpers.scss +0 -242
- package/core/style/_elevation.scss +0 -91
- package/core/style/_private.scss +0 -32
- package/core/style/_variables.scss +0 -44
- package/core/style/_vendor-prefixes.scss +0 -46
- package/core/theming/_palette.scss +0 -746
- package/core/theming/_theming.scss +0 -497
- package/core/typography/_typography-utils.scss +0 -101
- package/datetimepicker/_datetimepicker-theme.import.scss +0 -4
- package/drawer/_drawer-theme.import.scss +0 -2
- package/grid/_grid-theme.import.scss +0 -2
- package/loader/_loader-theme.import.scss +0 -2
- package/popover/_popover-theme.import.scss +0 -2
- package/progress/_progress-theme.import.scss +0 -2
- package/select/_select-density.scss +0 -68
- package/select/_select-theme.import.scss +0 -3
- package/split/_split-theme.import.scss +0 -2
- package/tooltip/_tooltip-theme.import.scss +0 -1
|
@@ -1,341 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import * as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import * as i2$1 from 'ngx-color/chrome';
|
|
22
|
-
import { ColorChromeModule } from 'ngx-color/chrome';
|
|
23
|
-
import * as i4 from '@angular/cdk/bidi';
|
|
24
|
-
|
|
25
|
-
class MtxColorPickerInputEvent {
|
|
26
|
-
constructor(
|
|
27
|
-
/** Reference to the colorpicker input component that emitted the event. */
|
|
28
|
-
target,
|
|
29
|
-
/** Reference to the native input element associated with the colorpicker input. */
|
|
30
|
-
targetElement) {
|
|
31
|
-
this.target = target;
|
|
32
|
-
this.targetElement = targetElement;
|
|
33
|
-
this.value = this.target.value;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const MTX_COLORPICKER_VALUE_ACCESSOR = {
|
|
37
|
-
provide: NG_VALUE_ACCESSOR,
|
|
38
|
-
useExisting: forwardRef(() => MtxColorpickerInput),
|
|
39
|
-
multi: true,
|
|
40
|
-
};
|
|
41
|
-
const MTX_COLORPICKER_VALIDATORS = {
|
|
42
|
-
provide: NG_VALIDATORS,
|
|
43
|
-
useExisting: forwardRef(() => MtxColorpickerInput),
|
|
44
|
-
multi: true,
|
|
45
|
-
};
|
|
46
|
-
class MtxColorpickerInput {
|
|
47
|
-
set mtxColorpicker(value) {
|
|
48
|
-
if (!value) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
this._picker = value;
|
|
52
|
-
this._picker.registerInput(this);
|
|
53
|
-
this._pickerSubscription.unsubscribe();
|
|
54
|
-
this._pickerSubscription = this._picker._selectedChanged.subscribe((selected) => {
|
|
55
|
-
this.value = selected;
|
|
56
|
-
this._cvaOnChange(selected);
|
|
57
|
-
this._onTouched();
|
|
58
|
-
this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
59
|
-
this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/** Whether the colorpicker-input is disabled. */
|
|
63
|
-
get disabled() {
|
|
64
|
-
return !!this._disabled;
|
|
65
|
-
}
|
|
66
|
-
set disabled(value) {
|
|
67
|
-
const newValue = coerceBooleanProperty(value);
|
|
68
|
-
const element = this._elementRef.nativeElement;
|
|
69
|
-
if (this._disabled !== newValue) {
|
|
70
|
-
this._disabled = newValue;
|
|
71
|
-
this._disabledChange.emit(newValue);
|
|
72
|
-
}
|
|
73
|
-
// We need to null check the `blur` method, because it's undefined during SSR.
|
|
74
|
-
// In Ivy static bindings are invoked earlier, before the element is attached to the DOM.
|
|
75
|
-
// This can cause an error to be thrown in some browsers (IE/Edge) which assert that the
|
|
76
|
-
// element has been inserted.
|
|
77
|
-
if (newValue && this._isInitialized && element.blur) {
|
|
78
|
-
// Normally, native input elements automatically blur if they turn disabled. This behavior
|
|
79
|
-
// is problematic, because it would mean that it triggers another change detection cycle,
|
|
80
|
-
// which then causes a changed after checked error if the input element was focused before.
|
|
81
|
-
element.blur();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/** The value of the input. */
|
|
85
|
-
get value() {
|
|
86
|
-
return this._value;
|
|
87
|
-
}
|
|
88
|
-
set value(value) {
|
|
89
|
-
const oldValue = this.value;
|
|
90
|
-
this._value = value;
|
|
91
|
-
this._formatValue(value);
|
|
92
|
-
this._valueChange.emit(value);
|
|
93
|
-
}
|
|
94
|
-
constructor(_elementRef, _formField) {
|
|
95
|
-
this._elementRef = _elementRef;
|
|
96
|
-
this._formField = _formField;
|
|
97
|
-
/** The input and output color format. */
|
|
98
|
-
this.format = 'hex';
|
|
99
|
-
/** Emits when a `change` event is fired on this `<input>`. */
|
|
100
|
-
this.colorChange = new EventEmitter();
|
|
101
|
-
/** Emits when an `input` event is fired on this `<input>`. */
|
|
102
|
-
this.colorInput = new EventEmitter();
|
|
103
|
-
/** Emits when the disabled state has changed */
|
|
104
|
-
this._disabledChange = new EventEmitter();
|
|
105
|
-
/** Emits when the value changes (either due to user input or programmatic change). */
|
|
106
|
-
this._valueChange = new EventEmitter();
|
|
107
|
-
this._onTouched = () => { };
|
|
108
|
-
this._validatorOnChange = () => { };
|
|
109
|
-
this._cvaOnChange = () => { };
|
|
110
|
-
this._pickerSubscription = Subscription.EMPTY;
|
|
111
|
-
/** The combined form control validator for this input. */
|
|
112
|
-
this._validator = Validators.compose([]);
|
|
113
|
-
/** Whether the last value set on the input was valid. */
|
|
114
|
-
this._lastValueValid = false;
|
|
115
|
-
}
|
|
116
|
-
ngAfterViewInit() {
|
|
117
|
-
this._isInitialized = true;
|
|
118
|
-
}
|
|
119
|
-
ngOnDestroy() {
|
|
120
|
-
this._pickerSubscription.unsubscribe();
|
|
121
|
-
this._valueChange.complete();
|
|
122
|
-
this._disabledChange.complete();
|
|
123
|
-
}
|
|
124
|
-
registerOnValidatorChange(fn) {
|
|
125
|
-
this._validatorOnChange = fn;
|
|
126
|
-
}
|
|
127
|
-
/** @docs-private */
|
|
128
|
-
validate(c) {
|
|
129
|
-
return this._validator ? this._validator(c) : null;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* @deprecated
|
|
133
|
-
* @breaking-change 8.0.0 Use `getConnectedOverlayOrigin` instead
|
|
134
|
-
*/
|
|
135
|
-
getPopupConnectionElementRef() {
|
|
136
|
-
return this.getConnectedOverlayOrigin();
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Gets the element that the colorpicker popup should be connected to.
|
|
140
|
-
* @return The element to connect the popup to.
|
|
141
|
-
*/
|
|
142
|
-
getConnectedOverlayOrigin() {
|
|
143
|
-
return this._formField ? this._formField.getConnectedOverlayOrigin() : this._elementRef;
|
|
144
|
-
}
|
|
145
|
-
/** Gets the ID of an element that should be used a description for the overlay. */
|
|
146
|
-
getOverlayLabelId() {
|
|
147
|
-
if (this._formField) {
|
|
148
|
-
return this._formField.getLabelId();
|
|
149
|
-
}
|
|
150
|
-
return this._elementRef.nativeElement.getAttribute('aria-labelledby');
|
|
151
|
-
}
|
|
152
|
-
// Implemented as part of ControlValueAccessor.
|
|
153
|
-
writeValue(value) {
|
|
154
|
-
this.value = value;
|
|
155
|
-
}
|
|
156
|
-
// Implemented as part of ControlValueAccessor.
|
|
157
|
-
registerOnChange(fn) {
|
|
158
|
-
this._cvaOnChange = fn;
|
|
159
|
-
}
|
|
160
|
-
// Implemented as part of ControlValueAccessor.
|
|
161
|
-
registerOnTouched(fn) {
|
|
162
|
-
this._onTouched = fn;
|
|
163
|
-
}
|
|
164
|
-
// Implemented as part of ControlValueAccessor.
|
|
165
|
-
setDisabledState(isDisabled) {
|
|
166
|
-
this.disabled = isDisabled;
|
|
167
|
-
}
|
|
168
|
-
_onKeydown(event) {
|
|
169
|
-
const isAltDownArrow = event.altKey && event.keyCode === DOWN_ARROW;
|
|
170
|
-
if (this._picker && isAltDownArrow && !this._elementRef.nativeElement.readOnly) {
|
|
171
|
-
this._picker.open();
|
|
172
|
-
event.preventDefault();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
/** Handles blur events on the input. */
|
|
176
|
-
_onBlur() {
|
|
177
|
-
// Reformat the input only if we have a valid value.
|
|
178
|
-
if (this.value) {
|
|
179
|
-
this._formatValue(this.value);
|
|
180
|
-
}
|
|
181
|
-
this._onTouched();
|
|
182
|
-
}
|
|
183
|
-
_onInput(value) {
|
|
184
|
-
const nextValue = value;
|
|
185
|
-
this._value = nextValue;
|
|
186
|
-
this._cvaOnChange(nextValue);
|
|
187
|
-
this._valueChange.emit(nextValue);
|
|
188
|
-
this.colorInput.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
189
|
-
}
|
|
190
|
-
_onChange() {
|
|
191
|
-
this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
192
|
-
}
|
|
193
|
-
/** Returns the palette used by the input's form field, if any. */
|
|
194
|
-
getThemePalette() {
|
|
195
|
-
return this._formField ? this._formField.color : undefined;
|
|
196
|
-
}
|
|
197
|
-
/** TODO: Formats a value and sets it on the input element. */
|
|
198
|
-
_formatValue(value) {
|
|
199
|
-
this._elementRef.nativeElement.value = value ? value : '';
|
|
200
|
-
}
|
|
201
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerInput, deps: [{ token: i0.ElementRef }, { token: i1.MatFormField, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
202
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.7", type: MtxColorpickerInput, selector: "input[mtxColorpicker]", inputs: { mtxColorpicker: "mtxColorpicker", disabled: "disabled", 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: [
|
|
203
|
-
MTX_COLORPICKER_VALUE_ACCESSOR,
|
|
204
|
-
MTX_COLORPICKER_VALIDATORS,
|
|
205
|
-
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
|
|
206
|
-
], exportAs: ["mtxColorpickerInput"], ngImport: i0 }); }
|
|
207
|
-
}
|
|
208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerInput, decorators: [{
|
|
209
|
-
type: Directive,
|
|
210
|
-
args: [{
|
|
211
|
-
selector: 'input[mtxColorpicker]',
|
|
212
|
-
providers: [
|
|
213
|
-
MTX_COLORPICKER_VALUE_ACCESSOR,
|
|
214
|
-
MTX_COLORPICKER_VALIDATORS,
|
|
215
|
-
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: MtxColorpickerInput },
|
|
216
|
-
],
|
|
217
|
-
host: {
|
|
218
|
-
'class': 'mtx-colorpicker-input',
|
|
219
|
-
'[attr.aria-haspopup]': '_picker ? "dialog" : null',
|
|
220
|
-
'[attr.aria-owns]': '(_picker?.opened && _picker.id) || null',
|
|
221
|
-
'[disabled]': 'disabled',
|
|
222
|
-
'(input)': '_onInput($event.target.value)',
|
|
223
|
-
'(change)': '_onChange()',
|
|
224
|
-
'(blur)': '_onBlur()',
|
|
225
|
-
'(keydown)': '_onKeydown($event)',
|
|
226
|
-
},
|
|
227
|
-
exportAs: 'mtxColorpickerInput',
|
|
228
|
-
}]
|
|
229
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.MatFormField, decorators: [{
|
|
230
|
-
type: Optional
|
|
231
|
-
}] }]; }, propDecorators: { mtxColorpicker: [{
|
|
232
|
-
type: Input
|
|
233
|
-
}], disabled: [{
|
|
234
|
-
type: Input
|
|
235
|
-
}], value: [{
|
|
236
|
-
type: Input
|
|
237
|
-
}], format: [{
|
|
238
|
-
type: Input
|
|
239
|
-
}], colorChange: [{
|
|
240
|
-
type: Output
|
|
241
|
-
}], colorInput: [{
|
|
242
|
-
type: Output
|
|
243
|
-
}] } });
|
|
244
|
-
|
|
245
|
-
/** Can be used to override the icon of a `mtxColorpickerToggle`. */
|
|
246
|
-
class MtxColorpickerToggleIcon {
|
|
247
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerToggleIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
248
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.7", type: MtxColorpickerToggleIcon, selector: "[mtxColorpickerToggleIcon]", ngImport: i0 }); }
|
|
249
|
-
}
|
|
250
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerToggleIcon, decorators: [{
|
|
251
|
-
type: Directive,
|
|
252
|
-
args: [{
|
|
253
|
-
selector: '[mtxColorpickerToggleIcon]',
|
|
254
|
-
}]
|
|
255
|
-
}] });
|
|
256
|
-
class MtxColorpickerToggle {
|
|
257
|
-
/** Whether the toggle button is disabled. */
|
|
258
|
-
get disabled() {
|
|
259
|
-
if (this._disabled == null && this.picker) {
|
|
260
|
-
return this.picker.disabled;
|
|
261
|
-
}
|
|
262
|
-
return !!this._disabled;
|
|
263
|
-
}
|
|
264
|
-
set disabled(value) {
|
|
265
|
-
this._disabled = coerceBooleanProperty(value);
|
|
266
|
-
}
|
|
267
|
-
constructor(_changeDetectorRef, defaultTabIndex) {
|
|
268
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
269
|
-
this._stateChanges = Subscription.EMPTY;
|
|
270
|
-
const parsedTabIndex = Number(defaultTabIndex);
|
|
271
|
-
this.tabIndex = parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
|
|
272
|
-
}
|
|
273
|
-
ngOnChanges(changes) {
|
|
274
|
-
if (changes.picker) {
|
|
275
|
-
this._watchStateChanges();
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
ngOnDestroy() {
|
|
279
|
-
this._stateChanges.unsubscribe();
|
|
280
|
-
}
|
|
281
|
-
ngAfterContentInit() {
|
|
282
|
-
this._watchStateChanges();
|
|
283
|
-
}
|
|
284
|
-
_open(event) {
|
|
285
|
-
if (this.picker && !this.disabled) {
|
|
286
|
-
this.picker.open();
|
|
287
|
-
event.stopPropagation();
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
_watchStateChanges() {
|
|
291
|
-
const pickerDisabled = this.picker ? this.picker._disabledChange : of();
|
|
292
|
-
const inputDisabled = this.picker && this.picker.pickerInput
|
|
293
|
-
? this.picker.pickerInput._disabledChange
|
|
294
|
-
: of();
|
|
295
|
-
const pickerToggled = this.picker
|
|
296
|
-
? merge(this.picker.openedStream, this.picker.closedStream)
|
|
297
|
-
: of();
|
|
298
|
-
this._stateChanges.unsubscribe();
|
|
299
|
-
this._stateChanges = merge(pickerDisabled, inputDisabled, pickerToggled).subscribe(() => this._changeDetectorRef.markForCheck());
|
|
300
|
-
}
|
|
301
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerToggle, deps: [{ token: i0.ChangeDetectorRef }, { token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
302
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: MtxColorpickerToggle, selector: "mtx-colorpicker-toggle", inputs: { picker: ["for", "picker"], tabIndex: "tabIndex", ariaLabel: ["aria-label", "ariaLabel"], disabled: "disabled", disableRipple: "disableRipple" }, 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 <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", 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: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
303
|
-
}
|
|
304
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: MtxColorpickerToggle, decorators: [{
|
|
305
|
-
type: Component,
|
|
306
|
-
args: [{ selector: 'mtx-colorpicker-toggle', host: {
|
|
307
|
-
'class': 'mtx-colorpicker-toggle',
|
|
308
|
-
'[attr.tabindex]': 'null',
|
|
309
|
-
'[class.mtx-colorpicker-toggle-active]': 'picker && picker.opened',
|
|
310
|
-
'[class.mat-accent]': 'picker && picker.color === "accent"',
|
|
311
|
-
'[class.mat-warn]': 'picker && picker.color === "warn"',
|
|
312
|
-
// Bind the `click` on the host, rather than the inner `button`, so that we can call
|
|
313
|
-
// `stopPropagation` on it without affecting the user's `click` handlers. We need to stop
|
|
314
|
-
// it so that the input doesn't get focused automatically by the form field (See #21836).
|
|
315
|
-
'(click)': '_open($event)',
|
|
316
|
-
}, 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 <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", 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"] }]
|
|
317
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
318
|
-
type: Attribute,
|
|
319
|
-
args: ['tabindex']
|
|
320
|
-
}] }]; }, propDecorators: { picker: [{
|
|
321
|
-
type: Input,
|
|
322
|
-
args: ['for']
|
|
323
|
-
}], tabIndex: [{
|
|
324
|
-
type: Input
|
|
325
|
-
}], ariaLabel: [{
|
|
326
|
-
type: Input,
|
|
327
|
-
args: ['aria-label']
|
|
328
|
-
}], disabled: [{
|
|
329
|
-
type: Input
|
|
330
|
-
}], disableRipple: [{
|
|
331
|
-
type: Input
|
|
332
|
-
}], _customIcon: [{
|
|
333
|
-
type: ContentChild,
|
|
334
|
-
args: [MtxColorpickerToggleIcon]
|
|
335
|
-
}], _button: [{
|
|
336
|
-
type: ViewChild,
|
|
337
|
-
args: ['button']
|
|
338
|
-
}] } });
|
|
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';
|
|
339
21
|
|
|
340
22
|
/**
|
|
341
23
|
* Animations used by the colorpicker.
|
|
@@ -355,7 +37,13 @@ const mtxColorpickerAnimations = {
|
|
|
355
37
|
/** Used to generate a unique ID for each colorpicker instance. */
|
|
356
38
|
let colorpickerUid = 0;
|
|
357
39
|
/** Injection token that determines the scroll handling while the panel is open. */
|
|
358
|
-
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
|
+
});
|
|
359
47
|
function MTX_COLORPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
|
|
360
48
|
return () => overlay.scrollStrategies.reposition();
|
|
361
49
|
}
|
|
@@ -395,17 +83,17 @@ class MtxColorpickerContent extends _MtxColorpickerContentBase {
|
|
|
395
83
|
hsv: new TinyColor(e.color.hsv).toHsvString(),
|
|
396
84
|
}[this.picker.format];
|
|
397
85
|
}
|
|
398
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
399
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
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 }); }
|
|
400
88
|
}
|
|
401
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerContent, decorators: [{
|
|
402
90
|
type: Component,
|
|
403
91
|
args: [{ selector: 'mtx-colorpicker-content', host: {
|
|
404
92
|
'class': 'mtx-colorpicker-content',
|
|
405
93
|
'[@transformPanel]': '_animationState',
|
|
406
94
|
'(@transformPanel.done)': '_animationDone.next()',
|
|
407
|
-
}, animations: [mtxColorpickerAnimations.transformPanel], exportAs: 'mtxColorpickerContent', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['color'],
|
|
408
|
-
}], ctorParameters:
|
|
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"] }]
|
|
96
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }] });
|
|
409
97
|
class MtxColorpicker {
|
|
410
98
|
get disabled() {
|
|
411
99
|
return this._disabled === undefined && this.pickerInput
|
|
@@ -413,29 +101,17 @@ class MtxColorpicker {
|
|
|
413
101
|
: !!this._disabled;
|
|
414
102
|
}
|
|
415
103
|
set disabled(value) {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
this.
|
|
419
|
-
this._disabledChange.next(newValue);
|
|
104
|
+
if (value !== this._disabled) {
|
|
105
|
+
this._disabled = value;
|
|
106
|
+
this._disabledChange.next(value);
|
|
420
107
|
}
|
|
421
108
|
}
|
|
422
|
-
/**
|
|
423
|
-
* Whether to restore focus to the previously-focused element when the panel is closed.
|
|
424
|
-
* Note that automatic focus restoration is an accessibility feature and it is recommended that
|
|
425
|
-
* you provide your own equivalent, if you decide to turn it off.
|
|
426
|
-
*/
|
|
427
|
-
get restoreFocus() {
|
|
428
|
-
return this._restoreFocus;
|
|
429
|
-
}
|
|
430
|
-
set restoreFocus(value) {
|
|
431
|
-
this._restoreFocus = coerceBooleanProperty(value);
|
|
432
|
-
}
|
|
433
109
|
/** Whether the panel is open. */
|
|
434
110
|
get opened() {
|
|
435
111
|
return this._opened;
|
|
436
112
|
}
|
|
437
113
|
set opened(value) {
|
|
438
|
-
|
|
114
|
+
value ? this.open() : this.close();
|
|
439
115
|
}
|
|
440
116
|
/** Color palette to use on the colorpicker's panel. */
|
|
441
117
|
get color() {
|
|
@@ -473,7 +149,12 @@ class MtxColorpicker {
|
|
|
473
149
|
this.xPosition = 'start';
|
|
474
150
|
/** Preferred position of the colorpicker in the Y axis. */
|
|
475
151
|
this.yPosition = 'below';
|
|
476
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Whether to restore focus to the previously-focused element when the panel is closed.
|
|
154
|
+
* Note that automatic focus restoration is an accessibility feature and it is recommended that
|
|
155
|
+
* you provide your own equivalent, if you decide to turn it off.
|
|
156
|
+
*/
|
|
157
|
+
this.restoreFocus = true;
|
|
477
158
|
this._opened = false;
|
|
478
159
|
/** The id for the colorpicker panel. */
|
|
479
160
|
this.id = `mtx-colorpicker-${colorpickerUid++}`;
|
|
@@ -547,7 +228,7 @@ class MtxColorpicker {
|
|
|
547
228
|
this._focusedElementBeforeOpen = null;
|
|
548
229
|
}
|
|
549
230
|
};
|
|
550
|
-
if (this.
|
|
231
|
+
if (this.restoreFocus &&
|
|
551
232
|
this._focusedElementBeforeOpen &&
|
|
552
233
|
typeof this._focusedElementBeforeOpen.focus === 'function') {
|
|
553
234
|
// Because IE moves focus asynchronously, we can't count on it being restored before we've
|
|
@@ -585,146 +266,472 @@ class MtxColorpicker {
|
|
|
585
266
|
if (labelId) {
|
|
586
267
|
overlayElement.setAttribute('aria-labelledby', labelId);
|
|
587
268
|
}
|
|
588
|
-
this._getCloseStream(overlayRef).subscribe(event => {
|
|
589
|
-
if (event) {
|
|
590
|
-
event.preventDefault();
|
|
591
|
-
}
|
|
592
|
-
this.close();
|
|
593
|
-
});
|
|
594
|
-
this._componentRef = overlayRef.attach(portal);
|
|
595
|
-
this._forwardContentValues(this._componentRef.instance);
|
|
596
|
-
// Update the position once the panel has rendered. Only relevant in dropdown mode.
|
|
597
|
-
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
|
+
}
|
|
598
537
|
}
|
|
599
|
-
/**
|
|
600
|
-
|
|
601
|
-
if
|
|
602
|
-
|
|
603
|
-
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);
|
|
604
543
|
}
|
|
544
|
+
this._onTouched();
|
|
605
545
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
.withFlexibleDimensions(false)
|
|
613
|
-
.withViewportMargin(8)
|
|
614
|
-
.withLockedPosition();
|
|
615
|
-
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));
|
|
616
552
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
const primaryX = this.xPosition === 'end' ? 'end' : 'start';
|
|
620
|
-
const secondaryX = primaryX === 'start' ? 'end' : 'start';
|
|
621
|
-
const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
|
|
622
|
-
const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
|
|
623
|
-
return strategy.withPositions([
|
|
624
|
-
{
|
|
625
|
-
originX: primaryX,
|
|
626
|
-
originY: secondaryY,
|
|
627
|
-
overlayX: primaryX,
|
|
628
|
-
overlayY: primaryY,
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
originX: primaryX,
|
|
632
|
-
originY: primaryY,
|
|
633
|
-
overlayX: primaryX,
|
|
634
|
-
overlayY: secondaryY,
|
|
635
|
-
},
|
|
636
|
-
{
|
|
637
|
-
originX: secondaryX,
|
|
638
|
-
originY: secondaryY,
|
|
639
|
-
overlayX: secondaryX,
|
|
640
|
-
overlayY: primaryY,
|
|
641
|
-
},
|
|
642
|
-
{
|
|
643
|
-
originX: secondaryX,
|
|
644
|
-
originY: primaryY,
|
|
645
|
-
overlayX: secondaryX,
|
|
646
|
-
overlayY: secondaryY,
|
|
647
|
-
},
|
|
648
|
-
]);
|
|
553
|
+
_onChange() {
|
|
554
|
+
this.colorChange.emit(new MtxColorPickerInputEvent(this, this._elementRef.nativeElement));
|
|
649
555
|
}
|
|
650
|
-
/**
|
|
651
|
-
|
|
652
|
-
return
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
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 : '';
|
|
657
563
|
}
|
|
658
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
659
|
-
/** @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 }); }
|
|
660
570
|
}
|
|
661
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
662
|
-
type:
|
|
571
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerInput, decorators: [{
|
|
572
|
+
type: Directive,
|
|
663
573
|
args: [{
|
|
664
|
-
selector: '
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
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,
|
|
669
592
|
}]
|
|
670
|
-
}], ctorParameters:
|
|
671
|
-
type: Inject,
|
|
672
|
-
args: [MTX_COLORPICKER_SCROLL_STRATEGY]
|
|
673
|
-
}] }, { type: i4.Directionality, decorators: [{
|
|
674
|
-
type: Optional
|
|
675
|
-
}] }, { type: undefined, decorators: [{
|
|
593
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.MatFormField, decorators: [{
|
|
676
594
|
type: Optional
|
|
677
|
-
}, {
|
|
678
|
-
type: Inject,
|
|
679
|
-
args: [DOCUMENT]
|
|
680
|
-
}] }]; }, propDecorators: { content: [{
|
|
595
|
+
}] }], propDecorators: { mtxColorpicker: [{
|
|
681
596
|
type: Input
|
|
682
|
-
}], openedStream: [{
|
|
683
|
-
type: Output,
|
|
684
|
-
args: ['opened']
|
|
685
|
-
}], closedStream: [{
|
|
686
|
-
type: Output,
|
|
687
|
-
args: ['closed']
|
|
688
597
|
}], disabled: [{
|
|
689
|
-
type: Input
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
}], yPosition: [{
|
|
693
|
-
type: Input
|
|
694
|
-
}], restoreFocus: [{
|
|
695
|
-
type: Input
|
|
696
|
-
}], opened: [{
|
|
697
|
-
type: Input
|
|
698
|
-
}], color: [{
|
|
598
|
+
type: Input,
|
|
599
|
+
args: [{ transform: booleanAttribute }]
|
|
600
|
+
}], value: [{
|
|
699
601
|
type: Input
|
|
700
602
|
}], format: [{
|
|
701
603
|
type: Input
|
|
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: [{
|
|
695
|
+
type: Input,
|
|
696
|
+
args: [{ transform: booleanAttribute }]
|
|
697
|
+
}], disableRipple: [{
|
|
698
|
+
type: Input,
|
|
699
|
+
args: [{ transform: booleanAttribute }]
|
|
700
|
+
}], _customIcon: [{
|
|
701
|
+
type: ContentChild,
|
|
702
|
+
args: [MtxColorpickerToggleIcon]
|
|
703
|
+
}], _button: [{
|
|
704
|
+
type: ViewChild,
|
|
705
|
+
args: ['button']
|
|
702
706
|
}] } });
|
|
703
707
|
|
|
704
708
|
class MtxColorpickerModule {
|
|
705
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
706
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
707
|
-
MtxColorpickerContent,
|
|
708
|
-
MtxColorpickerInput,
|
|
709
|
-
MtxColorpickerToggle,
|
|
710
|
-
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,
|
|
711
711
|
OverlayModule,
|
|
712
712
|
A11yModule,
|
|
713
713
|
PortalModule,
|
|
714
714
|
MatButtonModule,
|
|
715
|
-
ColorChromeModule
|
|
715
|
+
ColorChromeModule,
|
|
716
|
+
MtxColorpicker,
|
|
717
|
+
MtxColorpickerContent,
|
|
718
|
+
MtxColorpickerInput,
|
|
719
|
+
MtxColorpickerToggle,
|
|
720
|
+
MtxColorpickerToggleIcon], exports: [MtxColorpicker,
|
|
716
721
|
MtxColorpickerContent,
|
|
717
722
|
MtxColorpickerInput,
|
|
718
723
|
MtxColorpickerToggle,
|
|
719
724
|
MtxColorpickerToggleIcon] }); }
|
|
720
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
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,
|
|
721
726
|
OverlayModule,
|
|
722
727
|
A11yModule,
|
|
723
728
|
PortalModule,
|
|
724
729
|
MatButtonModule,
|
|
725
|
-
ColorChromeModule
|
|
730
|
+
ColorChromeModule,
|
|
731
|
+
MtxColorpickerContent,
|
|
732
|
+
MtxColorpickerToggle] }); }
|
|
726
733
|
}
|
|
727
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.0", ngImport: i0, type: MtxColorpickerModule, decorators: [{
|
|
728
735
|
type: NgModule,
|
|
729
736
|
args: [{
|
|
730
737
|
imports: [
|
|
@@ -734,15 +741,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImpor
|
|
|
734
741
|
PortalModule,
|
|
735
742
|
MatButtonModule,
|
|
736
743
|
ColorChromeModule,
|
|
737
|
-
],
|
|
738
|
-
exports: [
|
|
739
744
|
MtxColorpicker,
|
|
740
745
|
MtxColorpickerContent,
|
|
741
746
|
MtxColorpickerInput,
|
|
742
747
|
MtxColorpickerToggle,
|
|
743
748
|
MtxColorpickerToggleIcon,
|
|
744
749
|
],
|
|
745
|
-
|
|
750
|
+
exports: [
|
|
746
751
|
MtxColorpicker,
|
|
747
752
|
MtxColorpickerContent,
|
|
748
753
|
MtxColorpickerInput,
|