@ng-matero/extensions 10.16.4 → 10.16.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/bundles/{ng-matero-extensions-button.umd.js → mtxButton.umd.js} +2 -2
  2. package/bundles/mtxButton.umd.js.map +1 -0
  3. package/bundles/{ng-matero-extensions-button.umd.min.js → mtxButton.umd.min.js} +1 -1
  4. package/bundles/mtxCheckboxGroup.umd.js +93 -20
  5. package/bundles/mtxCheckboxGroup.umd.js.map +1 -1
  6. package/bundles/mtxCheckboxGroup.umd.min.js +1 -1
  7. package/bundles/mtxCheckboxGroup.umd.min.js.map +1 -1
  8. package/bundles/mtxColorPicker.umd.js +27 -4
  9. package/bundles/mtxColorPicker.umd.js.map +1 -1
  10. package/bundles/mtxColorPicker.umd.min.js +1 -1
  11. package/bundles/mtxColorPicker.umd.min.js.map +1 -1
  12. package/bundles/mtxFormGroup.umd.js +2 -0
  13. package/bundles/mtxFormGroup.umd.js.map +1 -1
  14. package/bundles/mtxFormGroup.umd.min.js +1 -1
  15. package/bundles/mtxFormGroup.umd.min.js.map +1 -1
  16. package/bundles/mtxGrid.umd.js +34 -61
  17. package/bundles/mtxGrid.umd.js.map +1 -1
  18. package/bundles/mtxGrid.umd.min.js +2 -2
  19. package/bundles/mtxGrid.umd.min.js.map +1 -1
  20. package/bundles/mtxPopover.umd.js +7 -2
  21. package/bundles/mtxPopover.umd.js.map +1 -1
  22. package/bundles/mtxPopover.umd.min.js +1 -1
  23. package/bundles/mtxPopover.umd.min.js.map +1 -1
  24. package/bundles/mtxSelect.umd.js +1 -0
  25. package/bundles/mtxSelect.umd.js.map +1 -1
  26. package/bundles/mtxSelect.umd.min.js +1 -1
  27. package/bundles/mtxSelect.umd.min.js.map +1 -1
  28. package/bundles/mtxSplit.umd.js +1 -1
  29. package/bundles/mtxSplit.umd.js.map +1 -1
  30. package/bundles/mtxSplit.umd.min.js +1 -1
  31. package/bundles/mtxSplit.umd.min.js.map +1 -1
  32. package/button/package.json +7 -7
  33. package/checkbox-group/checkbox-group.component.d.ts +12 -8
  34. package/checkbox-group/mtxCheckboxGroup.metadata.json +1 -1
  35. package/color-picker/color-picker.component.d.ts +4 -0
  36. package/color-picker/mtxColorPicker.metadata.json +1 -1
  37. package/data-grid/cell.component.d.ts +3 -8
  38. package/data-grid/mtxGrid.metadata.json +1 -1
  39. package/esm2015/button/mtxButton.js +10 -0
  40. package/esm2015/checkbox-group/checkbox-group.component.js +82 -19
  41. package/esm2015/color-picker/color-picker.component.js +24 -5
  42. package/esm2015/data-grid/cell.component.js +34 -57
  43. package/esm2015/data-grid/column-menu.component.js +2 -2
  44. package/esm2015/data-grid/grid.component.js +3 -3
  45. package/esm2015/form-group/form-group.component.js +4 -2
  46. package/esm2015/popover/popover.js +8 -3
  47. package/esm2015/select/select.component.js +2 -1
  48. package/esm2015/split-pane/split.component.js +2 -2
  49. package/fesm2015/{ng-matero-extensions-button.js → mtxButton.js} +2 -2
  50. package/fesm2015/mtxButton.js.map +1 -0
  51. package/fesm2015/mtxCheckboxGroup.js +80 -17
  52. package/fesm2015/mtxCheckboxGroup.js.map +1 -1
  53. package/fesm2015/mtxColorPicker.js +23 -4
  54. package/fesm2015/mtxColorPicker.js.map +1 -1
  55. package/fesm2015/mtxFormGroup.js +3 -1
  56. package/fesm2015/mtxFormGroup.js.map +1 -1
  57. package/fesm2015/mtxGrid.js +36 -59
  58. package/fesm2015/mtxGrid.js.map +1 -1
  59. package/fesm2015/mtxPopover.js +7 -2
  60. package/fesm2015/mtxPopover.js.map +1 -1
  61. package/fesm2015/mtxSelect.js +1 -0
  62. package/fesm2015/mtxSelect.js.map +1 -1
  63. package/fesm2015/mtxSplit.js +1 -1
  64. package/fesm2015/mtxSplit.js.map +1 -1
  65. package/form-group/mtxFormGroup.metadata.json +1 -1
  66. package/package.json +1 -1
  67. package/select/mtxSelect.metadata.json +1 -1
  68. package/bundles/ng-matero-extensions-button.umd.js.map +0 -1
  69. package/esm2015/button/ng-matero-extensions-button.js +0 -10
  70. package/fesm2015/ng-matero-extensions-button.js.map +0 -1
  71. /package/bundles/{ng-matero-extensions-button.umd.min.js.map → mtxButton.umd.min.js.map} +0 -0
  72. /package/button/{ng-matero-extensions-button.d.ts → mtxButton.d.ts} +0 -0
  73. /package/button/{ng-matero-extensions-button.metadata.json → mtxButton.metadata.json} +0 -0
@@ -1,8 +1,9 @@
1
- import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, forwardRef, ChangeDetectorRef, ContentChildren, Input, Output, NgModule } from '@angular/core';
1
+ import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, forwardRef, ChangeDetectorRef, ElementRef, ContentChildren, Input, Output, NgModule } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
4
4
  import { MatCheckbox, MatCheckboxModule } from '@angular/material/checkbox';
5
5
  import { MtxUtilsModule } from '@ng-matero/extensions/utils';
6
+ import { FocusMonitor } from '@angular/cdk/a11y';
6
7
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
7
8
 
8
9
  /**
@@ -29,20 +30,23 @@ if (false) {
29
30
  class MtxCheckboxGroupComponent {
30
31
  /**
31
32
  * @param {?} _changeDetectorRef
33
+ * @param {?} _focusMonitor
34
+ * @param {?} _elementRef
32
35
  */
33
- constructor(_changeDetectorRef) {
36
+ constructor(_changeDetectorRef, _focusMonitor, _elementRef) {
34
37
  this._changeDetectorRef = _changeDetectorRef;
38
+ this._focusMonitor = _focusMonitor;
39
+ this._elementRef = _elementRef;
35
40
  this._items = [];
36
41
  this._originalItems = [];
37
42
  this.bindLabel = 'label';
38
43
  this.bindValue = 'value';
39
- this.showSelectAll = false;
44
+ this._showSelectAll = false;
40
45
  this.selectAllLabel = 'Select All';
41
46
  this._disabled = false;
42
47
  this.change = new EventEmitter();
43
48
  this.selectAll = false;
44
49
  this.selectAllIndeterminate = false;
45
- this.color = 'accent';
46
50
  this.selectedItems = [];
47
51
  this._onChange = (/**
48
52
  * @return {?}
@@ -64,16 +68,29 @@ class MtxCheckboxGroupComponent {
64
68
  * @return {?}
65
69
  */
66
70
  set items(value) {
67
- // TODO: Deep clone
71
+ // store the original data with deep clone
68
72
  this._originalItems = JSON.parse(JSON.stringify(value));
69
73
  this._items = value.map((/**
70
74
  * @param {?} option
71
75
  * @return {?}
72
76
  */
73
77
  option => {
74
- return option instanceof Object ? option : new MtxCheckboxBase(option, option);
78
+ return option instanceof Object ? Object.assign({}, option) : new MtxCheckboxBase(option, option);
75
79
  }));
76
80
  }
81
+ /**
82
+ * @return {?}
83
+ */
84
+ get showSelectAll() {
85
+ return this._showSelectAll;
86
+ }
87
+ /**
88
+ * @param {?} value
89
+ * @return {?}
90
+ */
91
+ set showSelectAll(value) {
92
+ this._showSelectAll = coerceBooleanProperty(value);
93
+ }
77
94
  /**
78
95
  * @return {?}
79
96
  */
@@ -85,7 +102,7 @@ class MtxCheckboxGroupComponent {
85
102
  * @return {?}
86
103
  */
87
104
  set compareWith(fn) {
88
- if (typeof fn !== 'function') {
105
+ if (fn != null && typeof fn !== 'function') {
89
106
  throw Error('`compareWith` must be a function.');
90
107
  }
91
108
  if (fn) {
@@ -104,11 +121,39 @@ class MtxCheckboxGroupComponent {
104
121
  */
105
122
  set disabled(value) {
106
123
  this._disabled = coerceBooleanProperty(value);
124
+ this._changeDetectorRef.markForCheck();
107
125
  }
108
126
  /**
109
127
  * @return {?}
110
128
  */
111
- ngAfterViewInit() { }
129
+ ngAfterViewInit() {
130
+ this._focusMonitor.monitor(this._elementRef, true).subscribe((/**
131
+ * @param {?} focusOrigin
132
+ * @return {?}
133
+ */
134
+ focusOrigin => {
135
+ if (!focusOrigin) {
136
+ // When a focused element becomes disabled, the browser *immediately* fires a blur event.
137
+ // Angular does not expect events to be raised during change detection, so any state change
138
+ // (such as a form control's 'ng-touched') will cause a changed-after-checked error.
139
+ // See https://github.com/angular/angular/issues/17793. To work around this, we defer
140
+ // telling the form control it has been touched until the next tick.
141
+ Promise.resolve().then((/**
142
+ * @return {?}
143
+ */
144
+ () => {
145
+ this._onTouched();
146
+ this._changeDetectorRef.markForCheck();
147
+ }));
148
+ }
149
+ }));
150
+ }
151
+ /**
152
+ * @return {?}
153
+ */
154
+ ngOnDestroy() {
155
+ this._focusMonitor.stopMonitoring(this._elementRef);
156
+ }
112
157
  /**
113
158
  * Finds and selects and option based on its value.
114
159
  * @private
@@ -143,6 +188,11 @@ class MtxCheckboxGroupComponent {
143
188
  * @return {?}
144
189
  */
145
190
  writeValue(value) {
191
+ this.items.forEach((/**
192
+ * @param {?} item
193
+ * @return {?}
194
+ */
195
+ item => (item.checked = false)));
146
196
  if (value) {
147
197
  if (!Array.isArray(value)) {
148
198
  throw Error('Value must be an array.');
@@ -151,7 +201,7 @@ class MtxCheckboxGroupComponent {
151
201
  * @param {?} currentValue
152
202
  * @return {?}
153
203
  */
154
- (currentValue) => this._selectValue(currentValue)));
204
+ currentValue => this._selectValue(currentValue)));
155
205
  this.selectedItems = value;
156
206
  }
157
207
  this._checkMasterCheckboxState();
@@ -181,7 +231,7 @@ class MtxCheckboxGroupComponent {
181
231
  * @return {?}
182
232
  */
183
233
  setDisabledState(isDisabled) {
184
- this._disabled = isDisabled;
234
+ this.disabled = isDisabled;
185
235
  }
186
236
  /**
187
237
  * @private
@@ -240,7 +290,7 @@ class MtxCheckboxGroupComponent {
240
290
  * @param {?} selectedOption
241
291
  * @return {?}
242
292
  */
243
- selectedOption => this._compareWith(option, selectedOption)))));
293
+ selectedOption => (/** @type {?} */ (this._compareWith))(option, selectedOption)))));
244
294
  }
245
295
  else {
246
296
  this.selectedItems = this.selectedItems.map((/**
@@ -307,7 +357,7 @@ MtxCheckboxGroupComponent.decorators = [
307
357
  host: {
308
358
  class: 'mtx-checkbox-group',
309
359
  },
310
- template: "<mat-checkbox class=\"mtx-checkbox-master\"\n *ngIf=\"showSelectAll\"\n [checked]=\"selectAll\"\n [(indeterminate)]=\"selectAllIndeterminate\"\n [disabled]=\"disabled\"\n (change)=\"_updateMasterCheckboxState($event, -1);\">\n {{selectAllLabel}}\n</mat-checkbox>\n\n<mat-checkbox class=\"mtx-checkbox-normal\"\n *ngFor=\"let option of items; let i = index;\"\n [(ngModel)]=\"option.checked\"\n [aria-describedby]=\"option.ariaDescribedby\"\n [aria-label]=\"option.ariaLabel\"\n [aria-labelledby]=\"option.ariaLabelledby\"\n [color]=\"option.color || color\"\n [disabled]=\"option.disabled || disabled\"\n [disableRipple]=\"option.disableRipple\"\n [labelPosition]=\"option.labelPosition\"\n [required]=\"option.required\"\n (change)=\"_updateNormalCheckboxState($event, i)\">\n {{option[bindLabel] | toObservable | async}}\n</mat-checkbox>\n",
360
+ template: "<mat-checkbox class=\"mtx-checkbox-master\"\n *ngIf=\"showSelectAll\"\n [checked]=\"selectAll\"\n [(indeterminate)]=\"selectAllIndeterminate\"\n [disabled]=\"disabled\"\n (change)=\"_updateMasterCheckboxState($event, -1)\">\n {{selectAllLabel}}\n</mat-checkbox>\n\n<mat-checkbox class=\"mtx-checkbox-normal\"\n *ngFor=\"let option of items; let i = index;\"\n [(ngModel)]=\"option.checked\"\n [aria-describedby]=\"option.ariaDescribedby\"\n [aria-label]=\"option.ariaLabel\"\n [aria-labelledby]=\"option.ariaLabelledby\"\n [color]=\"option.color\"\n [disabled]=\"option.disabled || disabled\"\n [disableRipple]=\"option.disableRipple\"\n [labelPosition]=\"option.labelPosition\"\n [required]=\"option.required\"\n (change)=\"_updateNormalCheckboxState($event, i)\">\n {{option[bindLabel] | toObservable | async}}\n</mat-checkbox>\n",
311
361
  encapsulation: ViewEncapsulation.None,
312
362
  changeDetection: ChangeDetectionStrategy.OnPush,
313
363
  providers: [
@@ -325,7 +375,9 @@ MtxCheckboxGroupComponent.decorators = [
325
375
  ];
326
376
  /** @nocollapse */
327
377
  MtxCheckboxGroupComponent.ctorParameters = () => [
328
- { type: ChangeDetectorRef }
378
+ { type: ChangeDetectorRef },
379
+ { type: FocusMonitor },
380
+ { type: ElementRef }
329
381
  ];
330
382
  MtxCheckboxGroupComponent.propDecorators = {
331
383
  _checkboxes: [{ type: ContentChildren, args: [forwardRef((/**
@@ -358,8 +410,11 @@ if (false) {
358
410
  MtxCheckboxGroupComponent.prototype.bindLabel;
359
411
  /** @type {?} */
360
412
  MtxCheckboxGroupComponent.prototype.bindValue;
361
- /** @type {?} */
362
- MtxCheckboxGroupComponent.prototype.showSelectAll;
413
+ /**
414
+ * @type {?}
415
+ * @private
416
+ */
417
+ MtxCheckboxGroupComponent.prototype._showSelectAll;
363
418
  /** @type {?} */
364
419
  MtxCheckboxGroupComponent.prototype.selectAllLabel;
365
420
  /**
@@ -379,8 +434,6 @@ if (false) {
379
434
  /** @type {?} */
380
435
  MtxCheckboxGroupComponent.prototype.selectAllIndeterminate;
381
436
  /** @type {?} */
382
- MtxCheckboxGroupComponent.prototype.color;
383
- /** @type {?} */
384
437
  MtxCheckboxGroupComponent.prototype.selectedItems;
385
438
  /** @type {?} */
386
439
  MtxCheckboxGroupComponent.prototype._onChange;
@@ -391,6 +444,16 @@ if (false) {
391
444
  * @private
392
445
  */
393
446
  MtxCheckboxGroupComponent.prototype._changeDetectorRef;
447
+ /**
448
+ * @type {?}
449
+ * @private
450
+ */
451
+ MtxCheckboxGroupComponent.prototype._focusMonitor;
452
+ /**
453
+ * @type {?}
454
+ * @private
455
+ */
456
+ MtxCheckboxGroupComponent.prototype._elementRef;
394
457
  }
395
458
 
396
459
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mtxCheckboxGroup.js","sources":["../../../projects/extensions/checkbox-group/checkbox-group.component.ts","../../../projects/extensions/checkbox-group/checkbox-group.module.ts","../../../projects/extensions/checkbox-group/checkbox-group.interface.ts"],"sourcesContent":["import {\n Component,\n ChangeDetectionStrategy,\n ViewEncapsulation,\n Input,\n Output,\n EventEmitter,\n ChangeDetectorRef,\n forwardRef,\n AfterViewInit,\n ContentChildren,\n QueryList,\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { ThemePalette } from '@angular/material/core';\nimport { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox';\nimport { MtxCheckboxGroupOption } from './checkbox-group.interface';\n\nexport class MtxCheckboxBase {\n constructor(public label?: any, public value?: any) {}\n}\n\n@Component({\n selector: 'mtx-checkbox-group',\n exportAs: 'mtxCheckboxGroup',\n host: {\n class: 'mtx-checkbox-group',\n },\n templateUrl: './checkbox-group.component.html',\n styleUrls: ['./checkbox-group.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MtxCheckboxGroupComponent),\n multi: true,\n },\n ],\n})\nexport class MtxCheckboxGroupComponent implements AfterViewInit, ControlValueAccessor {\n @ContentChildren(forwardRef(() => MatCheckbox), { descendants: true })\n _checkboxes: QueryList<MatCheckbox>;\n\n @Input()\n get items() {\n return this._items;\n }\n set items(value: any[]) {\n // TODO: Deep clone\n this._originalItems = JSON.parse(JSON.stringify(value));\n this._items = value.map(option => {\n return option instanceof Object ? option : new MtxCheckboxBase(option, option);\n });\n }\n private _items: any[] = [];\n private _originalItems: any[] = [];\n\n @Input() bindLabel = 'label';\n @Input() bindValue = 'value';\n @Input() showSelectAll = false;\n @Input() selectAllLabel = 'Select All';\n @Input()\n get compareWith() {\n return this._compareWith;\n }\n set compareWith(fn: (o1: any, o2: any) => boolean) {\n if (typeof fn !== 'function') {\n throw Error('`compareWith` must be a function.');\n }\n\n if (fn) {\n this._compareWith = fn;\n }\n }\n private _compareWith: (o1: any, o2: any) => boolean;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n }\n private _disabled = false;\n\n @Output() change = new EventEmitter<{ model: MtxCheckboxGroupOption[]; index: number }>();\n\n selectAll = false;\n selectAllIndeterminate = false;\n\n color: ThemePalette = 'accent';\n\n selectedItems: MtxCheckboxGroupOption[] = [];\n\n _onChange: (value: MtxCheckboxGroupOption[]) => void = () => null;\n _onTouched: () => void = () => null;\n\n constructor(private _changeDetectorRef: ChangeDetectorRef) {}\n\n ngAfterViewInit() {}\n\n /**\n * Finds and selects and option based on its value.\n * @returns Option that has the corresponding value.\n */\n private _selectValue(value: MtxCheckboxGroupOption) {\n const correspondingOption = (this.items as MtxCheckboxGroupOption[]).find(option => {\n try {\n const compareValue = option[this.bindValue] === value;\n return this._compareWith ? this._compareWith(option, value) : compareValue;\n } catch (error) {\n console.warn(error);\n return false;\n }\n });\n\n if (correspondingOption) {\n correspondingOption.checked = true;\n }\n\n return correspondingOption;\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: any[]): void {\n if (value) {\n if (!Array.isArray(value)) {\n throw Error('Value must be an array.');\n }\n\n value.forEach((currentValue: any) => this._selectValue(currentValue));\n this.selectedItems = value;\n }\n\n this._checkMasterCheckboxState();\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: (value: MtxCheckboxGroupOption[]) => {}): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: () => {}): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this._disabled = isDisabled;\n }\n\n private _checkMasterCheckboxState() {\n if (\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .every(option => !option.checked)\n ) {\n this.selectAll = false;\n this.selectAllIndeterminate = false;\n } else if (\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .every(option => option.checked)\n ) {\n this.selectAll = true;\n this.selectAllIndeterminate = false;\n } else {\n this.selectAllIndeterminate = true;\n }\n }\n\n private _getSelectedItems(index: number) {\n this.selectedItems = (this.items as MtxCheckboxGroupOption[]).filter(option => option.checked);\n\n if (this._compareWith) {\n this.selectedItems = (this._originalItems as MtxCheckboxGroupOption[]).filter(option =>\n this.selectedItems.find(selectedOption => this._compareWith(option, selectedOption))\n );\n } else {\n this.selectedItems = this.selectedItems.map(option => option[this.bindValue]);\n }\n\n this._onChange(this.selectedItems);\n\n this.change.emit({ model: this.selectedItems, index });\n }\n\n /** Handle normal checkbox toggle */\n _updateNormalCheckboxState(e: MatCheckboxChange, index: number): void {\n this._checkMasterCheckboxState();\n this._getSelectedItems(index);\n }\n\n /** Handle master checkbox toggle */\n _updateMasterCheckboxState(e: MatCheckboxChange, index: number): void {\n this.selectAll = !this.selectAll;\n this.selectAllIndeterminate = false;\n\n if (this.selectAll) {\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .forEach(option => (option.checked = true));\n } else {\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .forEach(option => (option.checked = !!option.disabled));\n }\n\n this._getSelectedItems(index);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\n\nimport { MtxUtilsModule } from '@ng-matero/extensions/utils';\nimport { MtxCheckboxGroupComponent } from './checkbox-group.component';\n\n@NgModule({\n imports: [CommonModule, FormsModule, MatCheckboxModule, MtxUtilsModule],\n exports: [MtxCheckboxGroupComponent],\n declarations: [MtxCheckboxGroupComponent],\n})\nexport class MtxCheckboxGroupModule {}\n","export interface MtxCheckboxGroupOption {\n ariaDescribedby?: string;\n ariaLabel?: string;\n ariaLabelledby?: string;\n label?: any;\n value?: any;\n color?: string;\n checked?: boolean;\n disabled?: boolean;\n disableRipple?: boolean;\n indeterminate?: boolean;\n labelPosition?: 'before' | 'after';\n id?: string;\n name?: string | null;\n required?: boolean;\n [k: string]: any;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;MAmBa,eAAe;;;;;IAC1B,YAAmB,KAAW,EAAS,KAAW;QAA/B,UAAK,GAAL,KAAK,CAAM;QAAS,UAAK,GAAL,KAAK,CAAM;KAAI;CACvD;;;IADa,gCAAkB;;IAAE,gCAAkB;;MAqBvC,yBAAyB;;;;IA0DpC,YAAoB,kBAAqC;QAArC,uBAAkB,GAAlB,kBAAkB,CAAmB;QA3CjD,WAAM,GAAU,EAAE,CAAC;QACnB,mBAAc,GAAU,EAAE,CAAC;QAE1B,cAAS,GAAG,OAAO,CAAC;QACpB,cAAS,GAAG,OAAO,CAAC;QACpB,kBAAa,GAAG,KAAK,CAAC;QACtB,mBAAc,GAAG,YAAY,CAAC;QAuB/B,cAAS,GAAG,KAAK,CAAC;QAEhB,WAAM,GAAG,IAAI,YAAY,EAAsD,CAAC;QAE1F,cAAS,GAAG,KAAK,CAAC;QAClB,2BAAsB,GAAG,KAAK,CAAC;QAE/B,UAAK,GAAiB,QAAQ,CAAC;QAE/B,kBAAa,GAA6B,EAAE,CAAC;QAE7C,cAAS;;;QAA8C,MAAM,IAAI,EAAC;QAClE,eAAU;;;QAAe,MAAM,IAAI,EAAC;KAEyB;;;;IAtD7D,IACI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;KACpB;;;;;IACD,IAAI,KAAK,CAAC,KAAY;;QAEpB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG;;;;QAAC,MAAM;YAC5B,OAAO,MAAM,YAAY,MAAM,GAAG,MAAM,GAAG,IAAI,eAAe,CA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vE,OAAO,EAAE,CAAC,yBAAyB,CAAC;gBACpC,YAAY,EAAE,CAAC,yBAAyB,CAAC;aAC1C;;;;;;;;;;;qCCIA;;;IAfC,iDAAyB;;IACzB,2CAAmB;;IACnB,gDAAwB;;IACxB,uCAAY;;IACZ,uCAAY;;IACZ,uCAAe;;IACf,yCAAkB;;IAClB,0CAAmB;;IACnB,+CAAwB;;IACxB,+CAAwB;;IACxB,+CAAmC;;IACnC,oCAAY;;IACZ,sCAAqB;;IACrB,0CAAmB;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"mtxCheckboxGroup.js","sources":["../../../projects/extensions/checkbox-group/checkbox-group.component.ts","../../../projects/extensions/checkbox-group/checkbox-group.module.ts","../../../projects/extensions/checkbox-group/checkbox-group.interface.ts"],"sourcesContent":["import { FocusMonitor } from '@angular/cdk/a11y';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n ElementRef,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n QueryList,\n ViewEncapsulation,\n forwardRef,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox';\nimport { MtxCheckboxGroupOption } from './checkbox-group.interface';\n\nexport class MtxCheckboxBase {\n constructor(public label?: any, public value?: any) {}\n}\n\n@Component({\n selector: 'mtx-checkbox-group',\n exportAs: 'mtxCheckboxGroup',\n host: {\n class: 'mtx-checkbox-group',\n },\n templateUrl: './checkbox-group.component.html',\n styleUrls: ['./checkbox-group.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MtxCheckboxGroupComponent),\n multi: true,\n },\n ],\n})\nexport class MtxCheckboxGroupComponent implements AfterViewInit, OnDestroy, ControlValueAccessor {\n @ContentChildren(forwardRef(() => MatCheckbox), { descendants: true })\n _checkboxes: QueryList<MatCheckbox>;\n\n @Input()\n get items() {\n return this._items;\n }\n set items(value: any[]) {\n // store the original data with deep clone\n this._originalItems = JSON.parse(JSON.stringify(value));\n this._items = value.map(option => {\n return option instanceof Object ? { ...option } : new MtxCheckboxBase(option, option);\n });\n }\n private _items: any[] = [];\n private _originalItems: any[] = [];\n\n @Input() bindLabel = 'label';\n\n @Input() bindValue = 'value';\n\n @Input()\n get showSelectAll(): boolean {\n return this._showSelectAll;\n }\n set showSelectAll(value: boolean) {\n this._showSelectAll = coerceBooleanProperty(value);\n }\n private _showSelectAll = false;\n\n @Input() selectAllLabel = 'Select All';\n\n @Input()\n get compareWith() {\n return this._compareWith;\n }\n set compareWith(fn: ((o1: any, o2: any) => boolean) | undefined) {\n if (fn != null && typeof fn !== 'function') {\n throw Error('`compareWith` must be a function.');\n }\n\n if (fn) {\n this._compareWith = fn;\n }\n }\n private _compareWith!: (o1: any, o2: any) => boolean;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n this._changeDetectorRef.markForCheck();\n }\n private _disabled = false;\n\n @Output() change = new EventEmitter<{ model: MtxCheckboxGroupOption[]; index: number }>();\n\n selectAll = false;\n selectAllIndeterminate = false;\n\n selectedItems: MtxCheckboxGroupOption[] = [];\n\n _onChange: (value: MtxCheckboxGroupOption[]) => void = () => null;\n _onTouched: () => void = () => null;\n\n constructor(\n private _changeDetectorRef: ChangeDetectorRef,\n private _focusMonitor: FocusMonitor,\n private _elementRef: ElementRef<HTMLElement>\n ) {}\n\n ngAfterViewInit() {\n this._focusMonitor.monitor(this._elementRef, true).subscribe(focusOrigin => {\n if (!focusOrigin) {\n // When a focused element becomes disabled, the browser *immediately* fires a blur event.\n // Angular does not expect events to be raised during change detection, so any state change\n // (such as a form control's 'ng-touched') will cause a changed-after-checked error.\n // See https://github.com/angular/angular/issues/17793. To work around this, we defer\n // telling the form control it has been touched until the next tick.\n Promise.resolve().then(() => {\n this._onTouched();\n this._changeDetectorRef.markForCheck();\n });\n }\n });\n }\n\n ngOnDestroy() {\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /**\n * Finds and selects and option based on its value.\n * @returns Option that has the corresponding value.\n */\n private _selectValue(value: MtxCheckboxGroupOption) {\n const correspondingOption = (this.items as MtxCheckboxGroupOption[]).find(option => {\n try {\n const compareValue = option[this.bindValue] === value;\n return this._compareWith ? this._compareWith(option, value) : compareValue;\n } catch (error) {\n console.warn(error);\n return false;\n }\n });\n\n if (correspondingOption) {\n correspondingOption.checked = true;\n }\n\n return correspondingOption;\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: any[]): void {\n this.items.forEach(item => (item.checked = false));\n\n if (value) {\n if (!Array.isArray(value)) {\n throw Error('Value must be an array.');\n }\n\n value.forEach(currentValue => this._selectValue(currentValue));\n this.selectedItems = value;\n }\n\n this._checkMasterCheckboxState();\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: (value: MtxCheckboxGroupOption[]) => {}): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: () => {}): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n }\n\n private _checkMasterCheckboxState() {\n if (\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .every(option => !option.checked)\n ) {\n this.selectAll = false;\n this.selectAllIndeterminate = false;\n } else if (\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .every(option => option.checked)\n ) {\n this.selectAll = true;\n this.selectAllIndeterminate = false;\n } else {\n this.selectAllIndeterminate = true;\n }\n }\n\n private _getSelectedItems(index: number) {\n this.selectedItems = (this.items as MtxCheckboxGroupOption[]).filter(option => option.checked);\n\n if (this._compareWith) {\n this.selectedItems = (this._originalItems as MtxCheckboxGroupOption[]).filter(option =>\n this.selectedItems.find(selectedOption => this._compareWith!(option, selectedOption))\n );\n } else {\n this.selectedItems = this.selectedItems.map(option => option[this.bindValue]);\n }\n\n this._onChange(this.selectedItems);\n\n this.change.emit({ model: this.selectedItems, index });\n }\n\n /** Handle normal checkbox toggle */\n _updateNormalCheckboxState(e: MatCheckboxChange, index: number): void {\n this._checkMasterCheckboxState();\n this._getSelectedItems(index);\n }\n\n /** Handle master checkbox toggle */\n _updateMasterCheckboxState(e: MatCheckboxChange, index: number): void {\n this.selectAll = !this.selectAll;\n this.selectAllIndeterminate = false;\n\n if (this.selectAll) {\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .forEach(option => (option.checked = true));\n } else {\n (this.items as MtxCheckboxGroupOption[])\n .filter(option => option.checked || !option.disabled)\n .forEach(option => (option.checked = !!option.disabled));\n }\n\n this._getSelectedItems(index);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\n\nimport { MtxUtilsModule } from '@ng-matero/extensions/utils';\nimport { MtxCheckboxGroupComponent } from './checkbox-group.component';\n\n@NgModule({\n imports: [CommonModule, FormsModule, MatCheckboxModule, MtxUtilsModule],\n exports: [MtxCheckboxGroupComponent],\n declarations: [MtxCheckboxGroupComponent],\n})\nexport class MtxCheckboxGroupModule {}\n","export interface MtxCheckboxGroupOption {\n ariaDescribedby?: string;\n ariaLabel?: string;\n ariaLabelledby?: string;\n label?: any;\n value?: any;\n color?: string;\n checked?: boolean;\n disabled?: boolean;\n disableRipple?: boolean;\n indeterminate?: boolean;\n labelPosition?: 'before' | 'after';\n id?: string;\n name?: string | null;\n required?: boolean;\n [k: string]: any;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;MAqBa,eAAe;;;;;IAC1B,YAAmB,KAAW,EAAS,KAAW;QAA/B,UAAK,GAAL,KAAK,CAAM;QAAS,UAAK,GAAL,KAAK,CAAM;KAAI;CACvD;;;IADa,gCAAkB;;IAAE,gCAAkB;;MAqBvC,yBAAyB;;;;;;IAoEpC,YACU,kBAAqC,EACrC,aAA2B,EAC3B,WAAoC;QAFpC,uBAAkB,GAAlB,kBAAkB,CAAmB;QACrC,kBAAa,GAAb,aAAa,CAAc;QAC3B,gBAAW,GAAX,WAAW,CAAyB;QAxDtC,WAAM,GAAU,EAAE,CAAC;QACnB,mBAAc,GAAU,EAAE,CAAC;QAE1B,cAAS,GAAG,OAAO,CAAC;QAEpB,cAAS,GAAG,OAAO,CAAC;QASrB,mBAAc,GAAG,KAAK,CAAC;QAEtB,mBAAc,GAAG,YAAY,CAAC;QAyB/B,cAAS,GAAG,KAAK,CAAC;QAEhB,WAAM,GAAG,IAAI,YAAY,EAAsD,CAAC;QAE1F,cAAS,GAAG,KAAK,CAAC;QAClB,2BAAsB,GAAG,KAAK,CAAC;QAE/B,kBAAa,GAA6B,EAAE,CAAC;QAE7C,cAAS;;;QAA8C,MAAM,IAAI,EAAC;QAClE,eAAU;;;QAAe,MAAM,IAAI,EAAC;KAMhC;;;;IApEJ,IACI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;KACpB;;;;;IACD,IAAI,KAAK,CAAC,KAAY;;QAEpB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG;;;;QAAC,MAAM;YAC5B,OAAO,MAAM,YAAY,MAAM,qBAAQ,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._focused = false;
49
49
  this._required = false;
50
50
  this._disabled = false;
51
+ this._readonly = false;
51
52
  this.errorState = false;
52
53
  /**
53
54
  * A name for this control that can be used by `mat-form-field`.
@@ -203,6 +204,20 @@ class MtxColorPickerComponent {
203
204
  this._disabled = coerceBooleanProperty(value);
204
205
  this.stateChanges.next();
205
206
  }
207
+ /**
208
+ * Whether the element is readonly.
209
+ * @return {?}
210
+ */
211
+ get readonly() {
212
+ return this._readonly;
213
+ }
214
+ /**
215
+ * @param {?} value
216
+ * @return {?}
217
+ */
218
+ set readonly(value) {
219
+ this._readonly = coerceBooleanProperty(value);
220
+ }
206
221
  /**
207
222
  * @return {?}
208
223
  */
@@ -351,9 +366,7 @@ class MtxColorPickerComponent {
351
366
  // If we're in the Shadow DOM, the event target will be the shadow root, so we have to
352
367
  // fall back to check the first element in the path of the click event.
353
368
  /** @type {?} */
354
- const clickTarget = (/** @type {?} */ ((this._isInsideShadowRoot && event.composedPath
355
- ? event.composedPath()[0]
356
- : event.target)));
369
+ const clickTarget = (/** @type {?} */ ((this._isInsideShadowRoot && event.composedPath ? event.composedPath()[0] : event.target)));
357
370
  /** @type {?} */
358
371
  const formField = this._formField ? this._formField._elementRef.nativeElement : null;
359
372
  return (clickTarget !== this._elementRef.nativeElement &&
@@ -365,7 +378,7 @@ MtxColorPickerComponent.decorators = [
365
378
  { type: Component, args: [{
366
379
  selector: 'mtx-color-picker',
367
380
  exportAs: 'mtxColorPicker',
368
- template: "<input matInput\n [(ngModel)]=\"value\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n (focus)=\"_handleFocus()\"\n autocomplete=\"off\">\n\n<div #colorPickerTrigger=\"matMenuTrigger\"\n [matMenuTriggerFor]=\"colorPickerPopover\"\n (menuOpened)=\"_openPanel()\"\n (menuClosed)=\"_closePanel()\">\n</div>\n\n<mat-menu #colorPickerPopover=\"matMenu\" class=\"mtx-color-picker-panel\" [hasBackdrop]=\"false\">\n <div class=\"mtx-color-picker\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\">\n <color-chrome [color]=\"value\" (onChangeComplete)=\"_onColorChanged($event)\"></color-chrome>\n </div>\n</mat-menu>\n",
381
+ template: "<input matInput\n [(ngModel)]=\"value\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n (focus)=\"_handleFocus()\"\n autocomplete=\"off\">\n\n<div #colorPickerTrigger=\"matMenuTrigger\"\n [matMenuTriggerFor]=\"colorPickerPopover\"\n (menuOpened)=\"_openPanel()\"\n (menuClosed)=\"_closePanel()\">\n</div>\n\n<mat-menu #colorPickerPopover=\"matMenu\" class=\"mtx-color-picker-panel\" [hasBackdrop]=\"false\">\n <div class=\"mtx-color-picker\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\">\n <color-chrome [color]=\"value\" (onChangeComplete)=\"_onColorChanged($event)\"></color-chrome>\n </div>\n</mat-menu>\n",
369
382
  encapsulation: ViewEncapsulation.None,
370
383
  changeDetection: ChangeDetectionStrategy.OnPush,
371
384
  providers: [{ provide: MatFormFieldControl, useExisting: MtxColorPickerComponent }],
@@ -388,6 +401,7 @@ MtxColorPickerComponent.propDecorators = {
388
401
  placeholder: [{ type: Input }],
389
402
  required: [{ type: Input }],
390
403
  disabled: [{ type: Input }],
404
+ readonly: [{ type: Input }],
391
405
  colorChange: [{ type: Output }],
392
406
  trigger: [{ type: ViewChild, args: [MatMenuTrigger, { static: true },] }]
393
407
  };
@@ -437,6 +451,11 @@ if (false) {
437
451
  * @private
438
452
  */
439
453
  MtxColorPickerComponent.prototype._disabled;
454
+ /**
455
+ * @type {?}
456
+ * @private
457
+ */
458
+ MtxColorPickerComponent.prototype._readonly;
440
459
  /** @type {?} */
441
460
  MtxColorPickerComponent.prototype.errorState;
442
461
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mtxColorPicker.js","sources":["../../../projects/extensions/color-picker/color-picker.component.ts","../../../projects/extensions/color-picker/color-picker.module.ts"],"sourcesContent":["import {\n Component,\n ViewEncapsulation,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnDestroy,\n Optional,\n Self,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Inject,\n DoCheck,\n ViewChild,\n Host,\n AfterViewInit,\n NgZone,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { _supportsShadowDom } from '@angular/cdk/platform';\nimport { MatFormFieldControl, MatFormField } from '@angular/material/form-field';\nimport { MatMenuTrigger } from '@angular/material/menu';\nimport { Subject, Observable, merge, fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { ColorEvent } from 'ngx-color';\n\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'mtx-color-picker',\n exportAs: 'mtxColorPicker',\n templateUrl: './color-picker.component.html',\n styleUrls: ['./color-picker.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: MatFormFieldControl, useExisting: MtxColorPickerComponent }],\n})\nexport class MtxColorPickerComponent\n implements OnDestroy, DoCheck, AfterViewInit, ControlValueAccessor, MatFormFieldControl<any> {\n /** Value of the color picker control. */\n @Input()\n get value(): string | null {\n return this._value;\n }\n set value(newValue: string | null) {\n this._value = newValue;\n this._onChange(newValue);\n this.stateChanges.next();\n }\n private _value: string | null = '';\n\n /** Implemented as part of MatFormFieldControl. */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /** Unique id for this input. */\n private _uid = `mtx-color-picker-${nextUniqueId++}`;\n\n /** Unique id of the element. */\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n this.stateChanges.next();\n }\n private _id: string;\n\n /** Placeholder to be shown if value is empty. */\n @Input()\n get placeholder(): string {\n return this._placeholder;\n }\n set placeholder(value: string) {\n this._placeholder = value;\n this.stateChanges.next();\n }\n private _placeholder: string;\n\n /** Whether the input is focused. */\n get focused(): boolean {\n return this._focused || this._panelOpen;\n }\n private _focused = false;\n\n get empty(): boolean {\n return !this.value;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _required = false;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _disabled = false;\n\n errorState = false;\n\n /** A name for this control that can be used by `mat-form-field`. */\n controlType = 'mtx-color-picker';\n\n /** The aria-describedby attribute on the color picker for improved a11y. */\n _ariaDescribedby: string;\n\n /** `View -> model callback called when value changes` */\n _onChange: (value: any) => void = () => {};\n\n /** `View -> model callback called when color picker has been touched` */\n _onTouched = () => {};\n\n /** Event emitted when the color changed */\n @Output() readonly colorChange = new EventEmitter<ColorEvent>();\n\n @ViewChild(MatMenuTrigger, { static: true }) trigger: MatMenuTrigger;\n\n /** Whether or not the overlay panel is open. */\n _panelOpen = false;\n\n /** The subscription for closing actions (some are bound to document). */\n private _closingActionsSubscription: Subscription;\n\n /** Whether the element is inside of a ShadowRoot component. */\n private _isInsideShadowRoot: boolean;\n\n /**\n * Whether the color picker can open the next time it is focused. Used to prevent a focused,\n * closed color picker from being reopened if the user switches to another browser tab and then\n * comes back.\n */\n private _canOpenOnNextFocus = true;\n\n /**\n * Event handler for when the window is blurred. Needs to be an\n * arrow function in order to preserve the context.\n */\n private _windowBlurHandler = () => {\n // If the user blurred the window while the color picker is focused, it means that it'll be\n // refocused when they come back. In this case we want to skip the first focus event, if the\n // pane was closed, in order to avoid reopening it unintentionally.\n this._canOpenOnNextFocus =\n this._document.activeElement !== this._elementRef.nativeElement || this._panelOpen;\n };\n\n constructor(\n private _focusMonitor: FocusMonitor,\n private _elementRef: ElementRef<HTMLElement>,\n private _changeDetectorRef: ChangeDetectorRef,\n private _zone: NgZone,\n @Optional() @Self() public ngControl: NgControl,\n @Optional() @Host() private _formField: MatFormField,\n @Optional() @Inject(DOCUMENT) private _document: any\n ) {\n _focusMonitor.monitor(_elementRef, true).subscribe(origin => {\n if (this._focused && !origin) {\n this._onTouched();\n }\n this._focused = !!origin;\n this.stateChanges.next();\n });\n\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngDoCheck(): void {\n if (this.ngControl) {\n this.errorState = (this.ngControl.invalid && this.ngControl.touched) as boolean;\n this.stateChanges.next();\n }\n }\n\n ngAfterViewInit() {\n if (typeof window !== 'undefined') {\n this._zone.runOutsideAngular(() => {\n window.addEventListener('blur', this._windowBlurHandler);\n });\n\n if (_supportsShadowDom()) {\n const element = this._elementRef.nativeElement;\n const rootNode = element.getRootNode ? element.getRootNode() : null;\n\n // We need to take the `ShadowRoot` off of `window`, because the built-in types are\n // incorrect. See https://github.com/Microsoft/TypeScript/issues/27929.\n this._isInsideShadowRoot = rootNode instanceof (window as any).ShadowRoot;\n }\n }\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /** Implemented as part of MatFormFieldControl. */\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n /** Implemented as part of MatFormFieldControl. */\n onContainerClick() {\n this._handleFocus();\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: string | null): void {\n this.value = value || '';\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n }\n\n /** Open panel with input focus event. */\n _handleFocus() {\n this.trigger.openMenu();\n\n this._closingActionsSubscription = merge(this._getOutsideClickStream())\n .pipe()\n .subscribe(event => {\n this.trigger.closeMenu();\n this._closingActionsSubscription.unsubscribe();\n });\n }\n\n /** Opens the overlay panel. */\n _openPanel() {\n if (this._focused) {\n this._panelOpen = true;\n }\n }\n\n /** Closes the overlay panel and focuses the host element. */\n _closePanel() {\n if (this._panelOpen) {\n this._panelOpen = false;\n this._changeDetectorRef.markForCheck();\n this._onTouched();\n }\n }\n\n /** The callback of color changed. */\n _onColorChanged(model: ColorEvent) {\n this.value = model.color.hex;\n this.colorChange.emit(model);\n }\n\n /** Stream of clicks outside of the color picker panel. */\n private _getOutsideClickStream(): Observable<any> {\n return merge(\n fromEvent(this._document, 'click') as Observable<MouseEvent>,\n fromEvent(this._document, 'touchend') as Observable<TouchEvent>\n ).pipe(\n filter(event => {\n // If we're in the Shadow DOM, the event target will be the shadow root, so we have to\n // fall back to check the first element in the path of the click event.\n const clickTarget = (this._isInsideShadowRoot && event.composedPath\n ? event.composedPath()[0]\n : event.target) as HTMLElement;\n const formField = this._formField ? this._formField._elementRef.nativeElement : null;\n\n return (\n clickTarget !== this._elementRef.nativeElement &&\n (!formField || !formField.contains(clickTarget))\n );\n })\n );\n }\n\n static ngAcceptInputType_required: BooleanInput;\n static ngAcceptInputType_disabled: BooleanInput;\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\n\nimport { ColorChromeModule } from 'ngx-color/chrome';\n\nimport { MtxColorPickerComponent } from './color-picker.component';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n MatMenuModule,\n MatFormFieldModule,\n MatInputModule,\n ColorChromeModule,\n ],\n exports: [MtxColorPickerComponent],\n declarations: [MtxColorPickerComponent],\n})\nexport class MtxColorPickerModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;IA+BI,YAAY,GAAG,CAAC;MAWP,uBAAuB;;;;;;;;;;IA2HlC,YACU,aAA2B,EAC3B,WAAoC,EACpC,kBAAqC,EACrC,KAAa,EACM,SAAoB,EACnB,UAAwB,EACd,SAAc;QAN5C,kBAAa,GAAb,aAAa,CAAc;QAC3B,gBAAW,GAAX,WAAW,CAAyB;QACpC,uBAAkB,GAAlB,kBAAkB,CAAmB;QACrC,UAAK,GAAL,KAAK,CAAQ;QACM,cAAS,GAAT,SAAS,CAAW;QACnB,eAAU,GAAV,UAAU,CAAc;QACd,cAAS,GAAT,SAAS,CAAK;QAtH9C,WAAM,GAAkB,EAAE,CAAC;;;;QAG1B,iBAAY,GAAkB,IAAI,OAAO,EAAQ,CAAC;;;;QAGnD,SAAI,GAAG,oBAAoB,YAAY,EAAE,EAAE,CAAC;QA4B5C,aAAQ,GAAG,KAAK,CAAC;QAkBjB,cAAS,GAAG,KAAK,CAAC;QAUlB,cAAS,GAAG,KAAK,CAAC;QAE1B,eAAU,GAAG,KAAK,CAAC;;;;QAGnB,gBAAW,GAAG,kBAAkB,CAAC;;;;QAMjC,cAAS;;;QAAyB,SAAQ,EAAC;;;;QAG3C,eAAU;;;QAAG,SAAQ,EAAC;;;;QAGH,gBAAW,GAAG,IAAI,YAAY,EAAc,CAAC;;;;QAKhE,eAAU,GAAG,KAAK,CAAC;;;;;;QAaX,wBAAmB,GAAG,IAAI,CAAC;;;;;QAM3B,uBAAkB;;;QAAG;;;;YAI3B,IAAI,CAAC,mBAAmB;gBACtB,IAAI,CAAC,SAAS,CAAC,aAAa,KAAK,IAAI,CAAC,WAAW,CAAC,aAAa,IAA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C,QAAQ,YAAI,IAAI;YAlJS,YAAY,uBAmJrC,QAAQ,YAAI,IAAI;4CAChB,QAAQ,YAAI,MAAM,SAAC,QAAQ;;;oBA/H7B,KAAK;iBAkBL,KAAK;0BAWL,KAAK;uBAwBL,KAAK;uBAUL,KAAK;0BAyBL,MAAM;sBAEN,SAAS,SAAC,cAAc,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;;IAsL3C,mDAAgD;;IAChD,mDAAgD;;;;;IAxQhD,yCAAmC;;;;;IAGnC,+CAA2D;;;;;;IAG3D,uCAAoD;;;;;IAWpD,sCAAoB;;;;;IAWpB,+CAA6B;;;;;IAM7B,2CAAyB;;;;;IAkBzB,4CAA0B;;;;;IAU1B,4CAA0B;;IAE1B,6CAAmB;;;;;IAGnB,8CAAiC;;;;;IAGjC,mDAAyB;;;;;IAGzB,4CAA2C;;;;;IAG3C,6CAAsB;;;;;IAGtB,8CAAgE;;IAEhE,0CAAqE;;;;;IAGrE,6CAAmB;;;;;;IAGnB,8DAAkD;;;;;;IAGlD,sDAAqC;;;;;;;;IAOrC,sDAAmC;;;;;;;IAMnC,qDAME;;;;;IAGA,gDAAmC;;;;;IACnC,8CAA4C;;;;;IAC5C,qDAA6C;;;;;IAC7C,wCAAqB;;IACrB,4CAA+C;;;;;IAC/C,6CAAoD;;;;;IACpD,4CAAoD;;;;;;;;MCrJ3C,oBAAoB;;;YAZhC,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,aAAa;oBACb,kBAAkB;oBAClB,cAAc;oBACd,iBAAiB;iBAClB;gBACD,OAAO,EAAE,CAAC,uBAAuB,CAAC;gBAClC,YAAY,EAAE,CAAC,uBAAuB,CAAC;aACxC;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"mtxColorPicker.js","sources":["../../../projects/extensions/color-picker/color-picker.component.ts","../../../projects/extensions/color-picker/color-picker.module.ts"],"sourcesContent":["import {\n Component,\n ViewEncapsulation,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnDestroy,\n Optional,\n Self,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Inject,\n DoCheck,\n ViewChild,\n Host,\n AfterViewInit,\n NgZone,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { _supportsShadowDom } from '@angular/cdk/platform';\nimport { MatFormFieldControl, MatFormField } from '@angular/material/form-field';\nimport { MatMenuTrigger } from '@angular/material/menu';\nimport { Subject, Observable, merge, fromEvent, Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\n\nimport { ColorEvent } from 'ngx-color';\n\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'mtx-color-picker',\n exportAs: 'mtxColorPicker',\n templateUrl: './color-picker.component.html',\n styleUrls: ['./color-picker.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: MatFormFieldControl, useExisting: MtxColorPickerComponent }],\n})\nexport class MtxColorPickerComponent\n implements OnDestroy, DoCheck, AfterViewInit, ControlValueAccessor, MatFormFieldControl<any>\n{\n /** Value of the color picker control. */\n @Input()\n get value(): string | null {\n return this._value;\n }\n set value(newValue: string | null) {\n this._value = newValue;\n this._onChange(newValue);\n this.stateChanges.next();\n }\n private _value: string | null = '';\n\n /** Implemented as part of MatFormFieldControl. */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /** Unique id for this input. */\n private _uid = `mtx-color-picker-${nextUniqueId++}`;\n\n /** Unique id of the element. */\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n this.stateChanges.next();\n }\n private _id: string;\n\n /** Placeholder to be shown if value is empty. */\n @Input()\n get placeholder(): string {\n return this._placeholder;\n }\n set placeholder(value: string) {\n this._placeholder = value;\n this.stateChanges.next();\n }\n private _placeholder: string;\n\n /** Whether the input is focused. */\n get focused(): boolean {\n return this._focused || this._panelOpen;\n }\n private _focused = false;\n\n get empty(): boolean {\n return !this.value;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _required = false;\n\n @Input()\n get disabled(): boolean {\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n this.stateChanges.next();\n }\n private _disabled = false;\n\n /** Whether the element is readonly. */\n @Input()\n get readonly(): boolean {\n return this._readonly;\n }\n set readonly(value: boolean) {\n this._readonly = coerceBooleanProperty(value);\n }\n private _readonly = false;\n\n errorState = false;\n\n /** A name for this control that can be used by `mat-form-field`. */\n controlType = 'mtx-color-picker';\n\n /** The aria-describedby attribute on the color picker for improved a11y. */\n _ariaDescribedby: string;\n\n /** `View -> model callback called when value changes` */\n _onChange: (value: any) => void = () => {};\n\n /** `View -> model callback called when color picker has been touched` */\n _onTouched = () => {};\n\n /** Event emitted when the color changed */\n @Output() readonly colorChange = new EventEmitter<ColorEvent>();\n\n @ViewChild(MatMenuTrigger, { static: true }) trigger: MatMenuTrigger;\n\n /** Whether or not the overlay panel is open. */\n _panelOpen = false;\n\n /** The subscription for closing actions (some are bound to document). */\n private _closingActionsSubscription: Subscription;\n\n /** Whether the element is inside of a ShadowRoot component. */\n private _isInsideShadowRoot: boolean;\n\n /**\n * Whether the color picker can open the next time it is focused. Used to prevent a focused,\n * closed color picker from being reopened if the user switches to another browser tab and then\n * comes back.\n */\n private _canOpenOnNextFocus = true;\n\n /**\n * Event handler for when the window is blurred. Needs to be an\n * arrow function in order to preserve the context.\n */\n private _windowBlurHandler = () => {\n // If the user blurred the window while the color picker is focused, it means that it'll be\n // refocused when they come back. In this case we want to skip the first focus event, if the\n // pane was closed, in order to avoid reopening it unintentionally.\n this._canOpenOnNextFocus =\n this._document.activeElement !== this._elementRef.nativeElement || this._panelOpen;\n };\n\n constructor(\n private _focusMonitor: FocusMonitor,\n private _elementRef: ElementRef<HTMLElement>,\n private _changeDetectorRef: ChangeDetectorRef,\n private _zone: NgZone,\n @Optional() @Self() public ngControl: NgControl,\n @Optional() @Host() private _formField: MatFormField,\n @Optional() @Inject(DOCUMENT) private _document: any\n ) {\n _focusMonitor.monitor(_elementRef, true).subscribe(origin => {\n if (this._focused && !origin) {\n this._onTouched();\n }\n this._focused = !!origin;\n this.stateChanges.next();\n });\n\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngDoCheck(): void {\n if (this.ngControl) {\n this.errorState = (this.ngControl.invalid && this.ngControl.touched) as boolean;\n this.stateChanges.next();\n }\n }\n\n ngAfterViewInit() {\n if (typeof window !== 'undefined') {\n this._zone.runOutsideAngular(() => {\n window.addEventListener('blur', this._windowBlurHandler);\n });\n\n if (_supportsShadowDom()) {\n const element = this._elementRef.nativeElement;\n const rootNode = element.getRootNode ? element.getRootNode() : null;\n\n // We need to take the `ShadowRoot` off of `window`, because the built-in types are\n // incorrect. See https://github.com/Microsoft/TypeScript/issues/27929.\n this._isInsideShadowRoot = rootNode instanceof (window as any).ShadowRoot;\n }\n }\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /** Implemented as part of MatFormFieldControl. */\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n /** Implemented as part of MatFormFieldControl. */\n onContainerClick() {\n this._handleFocus();\n }\n\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value New value to be written to the model.\n */\n writeValue(value: string | null): void {\n this.value = value || '';\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Registers a callback to be triggered when the model value changes.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n\n /**\n * Registers a callback to be triggered when the control is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /**\n * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.\n * @param isDisabled Whether the control should be disabled.\n */\n setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n }\n\n /** Open panel with input focus event. */\n _handleFocus() {\n this.trigger.openMenu();\n\n this._closingActionsSubscription = merge(this._getOutsideClickStream())\n .pipe()\n .subscribe(event => {\n this.trigger.closeMenu();\n this._closingActionsSubscription.unsubscribe();\n });\n }\n\n /** Opens the overlay panel. */\n _openPanel() {\n if (this._focused) {\n this._panelOpen = true;\n }\n }\n\n /** Closes the overlay panel and focuses the host element. */\n _closePanel() {\n if (this._panelOpen) {\n this._panelOpen = false;\n this._changeDetectorRef.markForCheck();\n this._onTouched();\n }\n }\n\n /** The callback of color changed. */\n _onColorChanged(model: ColorEvent) {\n this.value = model.color.hex;\n this.colorChange.emit(model);\n }\n\n /** Stream of clicks outside of the color picker panel. */\n private _getOutsideClickStream(): Observable<any> {\n return merge(\n fromEvent(this._document, 'click') as Observable<MouseEvent>,\n fromEvent(this._document, 'touchend') as Observable<TouchEvent>\n ).pipe(\n filter(event => {\n // If we're in the Shadow DOM, the event target will be the shadow root, so we have to\n // fall back to check the first element in the path of the click event.\n const clickTarget = (\n this._isInsideShadowRoot && event.composedPath ? event.composedPath()[0] : event.target\n ) as HTMLElement;\n const formField = this._formField ? this._formField._elementRef.nativeElement : null;\n\n return (\n clickTarget !== this._elementRef.nativeElement &&\n (!formField || !formField.contains(clickTarget))\n );\n })\n );\n }\n\n static ngAcceptInputType_required: BooleanInput;\n static ngAcceptInputType_disabled: BooleanInput;\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\n\nimport { ColorChromeModule } from 'ngx-color/chrome';\n\nimport { MtxColorPickerComponent } from './color-picker.component';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n MatMenuModule,\n MatFormFieldModule,\n MatInputModule,\n ColorChromeModule,\n ],\n exports: [MtxColorPickerComponent],\n declarations: [MtxColorPickerComponent],\n})\nexport class MtxColorPickerModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;IA+BI,YAAY,GAAG,CAAC;MAWP,uBAAuB;;;;;;;;;;IAsIlC,YACU,aAA2B,EAC3B,WAAoC,EACpC,kBAAqC,EACrC,KAAa,EACM,SAAoB,EACnB,UAAwB,EACd,SAAc;QAN5C,kBAAa,GAAb,aAAa,CAAc;QAC3B,gBAAW,GAAX,WAAW,CAAyB;QACpC,uBAAkB,GAAlB,kBAAkB,CAAmB;QACrC,UAAK,GAAL,KAAK,CAAQ;QACM,cAAS,GAAT,SAAS,CAAW;QACnB,eAAU,GAAV,UAAU,CAAc;QACd,cAAS,GAAT,SAAS,CAAK;QAhI9C,WAAM,GAAkB,EAAE,CAAC;;;;QAG1B,iBAAY,GAAkB,IAAI,OAAO,EAAQ,CAAC;;;;QAGnD,SAAI,GAAG,oBAAoB,YAAY,EAAE,EAAE,CAAC;QA4B5C,aAAQ,GAAG,KAAK,CAAC;QAkBjB,cAAS,GAAG,KAAK,CAAC;QAUlB,cAAS,GAAG,KAAK,CAAC;QAUlB,cAAS,GAAG,KAAK,CAAC;QAE1B,eAAU,GAAG,KAAK,CAAC;;;;QAGnB,gBAAW,GAAG,kBAAkB,CAAC;;;;QAMjC,cAAS;;;QAAyB,SAAQ,EAAC;;;;QAG3C,eAAU;;;QAAG,SAAQ,EAAC;;;;QAGH,gBAAW,GAAG,IAAI,YAAY,EAAc,CAAC;;;;QAKhE,eAAU,GAAG,KAAK,CAAC;;;;;;QAaX,wBAAmB,GAAG,IAAI,CAAC;;;;;QAM3B,uBAAkB;;;QAAG;;;;Y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oBACb,kBAAkB;oBAClB,cAAc;oBACd,iBAAiB;iBAClB;gBACD,OAAO,EAAE,CAAC,uBAAuB,CAAC;gBAClC,YAAY,EAAE,CAAC,uBAAuB,CAAC;aACxC;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Component, ViewEncapsulation, ContentChildren, Input, NgModule } from '@angular/core';
1
+ import { Component, ViewEncapsulation, ChangeDetectionStrategy, ContentChildren, Input, NgModule } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
4
4
  import { MatFormField } from '@angular/material/form-field';
@@ -45,11 +45,13 @@ class MtxFormGroupComponent {
45
45
  MtxFormGroupComponent.decorators = [
46
46
  { type: Component, args: [{
47
47
  selector: 'mtx-form-group',
48
+ exportAs: 'mtxFormGroup',
48
49
  host: {
49
50
  class: 'mtx-form-group',
50
51
  },
51
52
  template: "<div class=\"mtx-form-field-layout mtx-form-field-appearance-fluent\">\r\n <label *ngIf=\"label\"\r\n class=\"mtx-form-label\"\r\n [class.mtx-form-label-marker]=\"showRequiredMarker\">{{label}}</label>\r\n <ng-content></ng-content>\r\n</div>\r\n",
52
53
  encapsulation: ViewEncapsulation.None,
54
+ changeDetection: ChangeDetectionStrategy.OnPush,
53
55
  styles: [".mtx-form-group{display:inline-block}.mtx-form-group .mtx-form-field-layout{align-items:flex-start;display:inline-flex;width:100%}.mtx-form-group .mtx-form-label{display:inline-block;line-height:1.125;padding-bottom:calc(.375em + 1px);padding-right:1em;padding-top:calc(.375em + 1px);position:relative}[dir=rtl] .mtx-form-group .mtx-form-label{padding-left:1em;padding-right:unset}.mtx-form-group .mtx-form-label.mtx-form-label-marker:after{content:\"*\";margin-left:4px}[dir=rtl] .mtx-form-group .mtx-form-label.mtx-form-label-marker:after{margin-left:auto;margin-right:4px}.mtx-form-field-appearance-fluent .mat-form-field{margin-bottom:.25em}.mtx-form-field-appearance-fluent .mat-form-field .mat-form-field-suffix .mat-icon-button{height:1.5em;width:1.5em}.mtx-form-field-appearance-fluent .mat-form-field .mat-form-field-suffix .mat-icon-button .mat-datepicker-toggle-default-icon{width:1em}.mtx-form-field-appearance-fluent .mat-form-field-has-label .mat-form-field-flex{margin-top:.84375em}.mtx-form-field-appearance-fluent .mat-form-field-appearance-standard .mat-form-field-flex{padding-top:0}.mtx-form-field-appearance-fluent .mat-form-field-flex{align-items:center;border-radius:2px;padding:0 .5em}.mtx-form-field-appearance-fluent .mat-form-field-infix{border-top:0;padding:.375em 0}.mtx-form-field-appearance-fluent .mat-form-field-prefix,.mtx-form-field-appearance-fluent .mat-form-field-suffix{display:inline-flex}.mtx-form-field-appearance-fluent .mat-form-field-prefix .mat-icon,.mtx-form-field-appearance-fluent .mat-form-field-suffix .mat-icon{line-height:normal}.mtx-form-field-appearance-fluent .mat-form-field-underline{display:none}.mtx-form-field-appearance-fluent .mtx-select{display:block;margin:0 -8px}.mtx-form-field-appearance-fluent .ng-select{margin-top:-.4375em;padding-left:8px;padding-right:8px;padding-top:.4375em}"]
54
56
  }] }
55
57
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"mtxFormGroup.js","sources":["../../../projects/extensions/form-group/form-group.component.ts","../../../projects/extensions/form-group/form-group.module.ts"],"sourcesContent":["import {\r\n AfterContentInit,\r\n Component,\r\n ContentChildren,\r\n Input,\r\n OnInit,\r\n QueryList,\r\n ViewEncapsulation,\r\n} from '@angular/core';\r\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\r\nimport { MatFormField } from '@angular/material/form-field';\r\n\r\n@Component({\r\n selector: 'mtx-form-group',\r\n host: {\r\n class: 'mtx-form-group',\r\n },\r\n templateUrl: './form-group.component.html',\r\n styleUrls: ['./form-group.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n})\r\nexport class MtxFormGroupComponent implements OnInit, AfterContentInit {\r\n @ContentChildren(MatFormField) formFields!: QueryList<MatFormField>;\r\n\r\n @Input() label: string;\r\n @Input()\r\n get showRequiredMarker() {\r\n return this._showRequiredMarker;\r\n }\r\n set showRequiredMarker(value: boolean) {\r\n this._showRequiredMarker = coerceBooleanProperty(value);\r\n }\r\n private _showRequiredMarker = false;\r\n\r\n constructor() {}\r\n\r\n ngOnInit(): void {}\r\n\r\n ngAfterContentInit() {\r\n this.formFields.forEach(item => {\r\n item.appearance = 'standard';\r\n });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { MtxFormGroupComponent } from './form-group.component';\n\n@NgModule({\n imports: [CommonModule],\n exports: [MtxFormGroupComponent],\n declarations: [MtxFormGroupComponent],\n})\nexport class MtxFormGroupModule {}\n"],"names":[],"mappings":";;;;;;;;;;MAqBa,qBAAqB;IAahC;QAFQ,wBAAmB,GAAG,KAAK,CAAC;KAEpB;;;;IAThB,IACI,kBAAkB;QACpB,OAAO,IAAI,CAAC,mBAAmB,CAAC;KACjC;;;;;IACD,IAAI,kBAAkB,CAAC,KAAc;QACnC,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;KACzD;;;;IAKD,QAAQ,MAAW;;;;IAEnB,kBAAkB;QAChB,IAAI,CAAC,UAAU,CAAC,OAAO;;;;QAAC,IAAI;YAC1B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;SAC9B,EAAC,CAAC;KACJ;;;YA9BF,SAAS,SAAC;gBACT,QAAQ,EAAE,gBAAgB;gBAC1B,IAAI,EAAE;oBACJ,KAAK,EAAE,gBAAgB;iBACxB;gBACD,mRAA0C;gBAE1C,aAAa,EAAE,iBAAiB,CAAC,IAAI;;aACtC;;;;;yBAEE,eAAe,SAAC,YAAY;oBAE5B,KAAK;iCACL,KAAK;;;;IAHN,2CAAoE;;IAEpE,sCAAuB;;;;;IAQvB,oDAAoC;;;;;;;;MCtBzB,kBAAkB;;;YAL9B,QAAQ,SAAC;gBACR,OAAO,EAAE,CAAC,YAAY,CAAC;gBACvB,OAAO,EAAE,CAAC,qBAAqB,CAAC;gBAChC,YAAY,EAAE,CAAC,qBAAqB,CAAC;aACtC;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"mtxFormGroup.js","sources":["../../../projects/extensions/form-group/form-group.component.ts","../../../projects/extensions/form-group/form-group.module.ts"],"sourcesContent":["import {\r\n AfterContentInit,\r\n ChangeDetectionStrategy,\r\n Component,\r\n ContentChildren,\r\n Input,\r\n OnInit,\r\n QueryList,\r\n ViewEncapsulation,\r\n} from '@angular/core';\r\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\r\nimport { MatFormField } from '@angular/material/form-field';\r\n\r\n@Component({\r\n selector: 'mtx-form-group',\r\n exportAs: 'mtxFormGroup',\r\n host: {\r\n class: 'mtx-form-group',\r\n },\r\n templateUrl: './form-group.component.html',\r\n styleUrls: ['./form-group.component.scss'],\r\n encapsulation: ViewEncapsulation.None,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class MtxFormGroupComponent implements OnInit, AfterContentInit {\r\n @ContentChildren(MatFormField) formFields!: QueryList<MatFormField>;\r\n\r\n @Input() label: string;\r\n @Input()\r\n get showRequiredMarker() {\r\n return this._showRequiredMarker;\r\n }\r\n set showRequiredMarker(value: boolean) {\r\n this._showRequiredMarker = coerceBooleanProperty(value);\r\n }\r\n private _showRequiredMarker = false;\r\n\r\n constructor() {}\r\n\r\n ngOnInit(): void {}\r\n\r\n ngAfterContentInit() {\r\n this.formFields.forEach(item => {\r\n item.appearance = 'standard';\r\n });\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { MtxFormGroupComponent } from './form-group.component';\n\n@NgModule({\n imports: [CommonModule],\n exports: [MtxFormGroupComponent],\n declarations: [MtxFormGroupComponent],\n})\nexport class MtxFormGroupModule {}\n"],"names":[],"mappings":";;;;;;;;;;MAwBa,qBAAqB;IAahC;QAFQ,wBAAmB,GAAG,KAAK,CAAC;KAEpB;;;;IAThB,IACI,kBAAkB;QACpB,OAAO,IAAI,CAAC,mBAAmB,CAAC;KACjC;;;;;IACD,IAAI,kBAAkB,CAAC,KAAc;QACnC,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;KACzD;;;;IAKD,QAAQ,MAAW;;;;IAEnB,kBAAkB;QAChB,IAAI,CAAC,UAAU,CAAC,OAAO;;;;QAAC,IAAI;YAC1B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;SAC9B,EAAC,CAAC;KACJ;;;YAhCF,SAAS,SAAC;gBACT,QAAQ,EAAE,gBAAgB;gBAC1B,QAAQ,EAAE,cAAc;gBACxB,IAAI,EAAE;oBACJ,KAAK,EAAE,gBAAgB;iBACxB;gBACD,mRAA0C;gBAE1C,aAAa,EAAE,iBAAiB,CAAC,IAAI;gBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;;;yBAEE,eAAe,SAAC,YAAY;oBAE5B,KAAK;iCACL,KAAK;;;;IAHN,2CAAoE;;IAEpE,sCAAuB;;;;;IAQvB,oDAAoC;;;;;;;;MCzBzB,kBAAkB;;;YAL9B,QAAQ,SAAC;gBACR,OAAO,EAAE,CAAC,YAAY,CAAC;gBACvB,OAAO,EAAE,CAAC,qBAAqB,CAAC;gBAChC,YAAY,EAAE,CAAC,qBAAqB,CAAC;aACtC;;;;;;;;;;;;;;;;;"}