@ng-matero/extensions 12.9.1 → 12.10.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.
Files changed (66) hide show
  1. package/alert/alert.component.d.ts +1 -1
  2. package/alert/mtxAlert.metadata.json +1 -1
  3. package/bundles/mtxAlert.umd.js +2 -2
  4. package/bundles/mtxAlert.umd.js.map +1 -1
  5. package/bundles/mtxCore.umd.js.map +1 -1
  6. package/bundles/mtxDatetimepicker.umd.js +5 -0
  7. package/bundles/mtxDatetimepicker.umd.js.map +1 -1
  8. package/bundles/mtxFormGroup.umd.js +1 -1
  9. package/bundles/mtxFormGroup.umd.js.map +1 -1
  10. package/bundles/mtxGrid.umd.js +51 -54
  11. package/bundles/mtxGrid.umd.js.map +1 -1
  12. package/bundles/mtxPopover.umd.js +997 -803
  13. package/bundles/mtxPopover.umd.js.map +1 -1
  14. package/bundles/mtxSelect.umd.js +237 -156
  15. package/bundles/mtxSelect.umd.js.map +1 -1
  16. package/core/datetime/datetime-formats.d.ts +2 -0
  17. package/esm2015/alert/alert.component.js +3 -3
  18. package/esm2015/core/datetime/datetime-formats.js +1 -1
  19. package/esm2015/datetimepicker/datetimepicker-input.js +6 -1
  20. package/esm2015/form-group/form-group.component.js +2 -2
  21. package/esm2015/grid/cell.component.js +32 -32
  22. package/esm2015/grid/column-menu.component.js +10 -14
  23. package/esm2015/grid/grid.component.js +12 -7
  24. package/esm2015/popover/popover-animations.js +10 -13
  25. package/esm2015/popover/popover-content.js +99 -0
  26. package/esm2015/popover/popover-interfaces.js +1 -1
  27. package/esm2015/popover/popover-module.js +7 -5
  28. package/esm2015/popover/popover-target.js +3 -3
  29. package/esm2015/popover/popover-trigger.js +210 -172
  30. package/esm2015/popover/popover-types.js +1 -1
  31. package/esm2015/popover/popover.js +173 -125
  32. package/esm2015/popover/public-api.js +2 -1
  33. package/esm2015/select/option.component.js +4 -6
  34. package/esm2015/select/select.component.js +111 -31
  35. package/fesm2015/mtxAlert.js +2 -2
  36. package/fesm2015/mtxAlert.js.map +1 -1
  37. package/fesm2015/mtxCore.js.map +1 -1
  38. package/fesm2015/mtxDatetimepicker.js +5 -0
  39. package/fesm2015/mtxDatetimepicker.js.map +1 -1
  40. package/fesm2015/mtxFormGroup.js +1 -1
  41. package/fesm2015/mtxFormGroup.js.map +1 -1
  42. package/fesm2015/mtxGrid.js +51 -50
  43. package/fesm2015/mtxGrid.js.map +1 -1
  44. package/fesm2015/mtxPopover.js +526 -351
  45. package/fesm2015/mtxPopover.js.map +1 -1
  46. package/fesm2015/mtxSelect.js +169 -92
  47. package/fesm2015/mtxSelect.js.map +1 -1
  48. package/form-group/mtxFormGroup.metadata.json +1 -1
  49. package/grid/cell.component.d.ts +5 -8
  50. package/grid/column-menu.component.d.ts +3 -5
  51. package/grid/grid.component.d.ts +6 -4
  52. package/grid/mtxGrid.metadata.json +1 -1
  53. package/package.json +1 -1
  54. package/popover/mtxPopover.metadata.json +1 -1
  55. package/popover/popover-animations.d.ts +1 -1
  56. package/popover/popover-content.d.ts +38 -0
  57. package/popover/popover-interfaces.d.ts +37 -31
  58. package/popover/popover-target.d.ts +2 -2
  59. package/popover/popover-trigger.d.ts +65 -60
  60. package/popover/popover-types.d.ts +6 -1
  61. package/popover/popover.d.ts +97 -69
  62. package/popover/popover.scss +2 -0
  63. package/popover/public-api.d.ts +1 -0
  64. package/select/mtxSelect.metadata.json +1 -1
  65. package/select/option.component.d.ts +7 -6
  66. package/select/select.component.d.ts +59 -20
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@ng-select/ng-select'), require('@angular/material/form-field'), require('@angular/cdk/coercion'), require('@angular/cdk/a11y'), require('rxjs'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@ng-matero/extensions/select', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@ng-select/ng-select', '@angular/material/form-field', '@angular/cdk/coercion', '@angular/cdk/a11y', 'rxjs', 'rxjs/operators'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["ng-matero"] = global["ng-matero"] || {}, global["ng-matero"].extensions = global["ng-matero"].extensions || {}, global["ng-matero"].extensions.select = {}), global.ng.core, global.ng.common, global.ng.forms, global["ng-select"], global.ng.material.formField, global.ng.cdk.coercion, global.ng.cdk.a11y, global.rxjs, global.rxjs.operators));
5
- })(this, (function (exports, core, common, forms, ngSelect, formField, coercion, a11y, rxjs, operators) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@ng-select/ng-select'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/material/core'), require('@angular/material/form-field'), require('rxjs'), require('rxjs/operators')) :
3
+ typeof define === 'function' && define.amd ? define('@ng-matero/extensions/select', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@ng-select/ng-select', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/material/core', '@angular/material/form-field', 'rxjs', 'rxjs/operators'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["ng-matero"] = global["ng-matero"] || {}, global["ng-matero"].extensions = global["ng-matero"].extensions || {}, global["ng-matero"].extensions.select = {}), global.ng.core, global.ng.common, global.ng.forms, global["ng-select"], global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.material.core, global.ng.material.formField, global.rxjs, global.rxjs.operators));
5
+ })(this, (function (exports, core, common, forms, ngSelect, a11y, coercion, core$1, formField, rxjs, operators) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -322,6 +322,77 @@
322
322
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
323
323
  }
324
324
 
325
+ var MtxOptionComponent = /** @class */ (function () {
326
+ function MtxOptionComponent(elementRef) {
327
+ this.elementRef = elementRef;
328
+ this._disabled = false;
329
+ this.stateChange$ = new rxjs.Subject();
330
+ }
331
+ Object.defineProperty(MtxOptionComponent.prototype, "disabled", {
332
+ get: function () {
333
+ return this._disabled;
334
+ },
335
+ set: function (value) {
336
+ this._disabled = coercion.coerceBooleanProperty(value);
337
+ },
338
+ enumerable: false,
339
+ configurable: true
340
+ });
341
+ Object.defineProperty(MtxOptionComponent.prototype, "label", {
342
+ get: function () {
343
+ return (this.elementRef.nativeElement.textContent || '').trim();
344
+ },
345
+ enumerable: false,
346
+ configurable: true
347
+ });
348
+ MtxOptionComponent.prototype.ngOnChanges = function (changes) {
349
+ if (changes.disabled) {
350
+ this.stateChange$.next({
351
+ value: this.value,
352
+ disabled: this._disabled,
353
+ });
354
+ }
355
+ };
356
+ MtxOptionComponent.prototype.ngAfterViewChecked = function () {
357
+ if (this.label !== this._previousLabel) {
358
+ this._previousLabel = this.label;
359
+ this.stateChange$.next({
360
+ value: this.value,
361
+ disabled: this._disabled,
362
+ label: this.elementRef.nativeElement.innerHTML,
363
+ });
364
+ }
365
+ };
366
+ MtxOptionComponent.prototype.ngOnDestroy = function () {
367
+ this.stateChange$.complete();
368
+ };
369
+ return MtxOptionComponent;
370
+ }());
371
+ /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
372
+ MtxOptionComponent.decorators = [
373
+ { type: core.Component, args: [{
374
+ selector: 'mtx-option',
375
+ exportAs: 'mtxOption',
376
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
377
+ template: "<ng-content></ng-content>"
378
+ },] }
379
+ ];
380
+ /**
381
+ * @type {function(): !Array<(null|{
382
+ * type: ?,
383
+ * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
384
+ * })>}
385
+ * @nocollapse
386
+ */
387
+ MtxOptionComponent.ctorParameters = function () { return [
388
+ { type: core.ElementRef }
389
+ ]; };
390
+ /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
391
+ MtxOptionComponent.propDecorators = {
392
+ value: [{ type: core.Input }],
393
+ disabled: [{ type: core.Input }]
394
+ };
395
+
325
396
  var MtxSelectOptionTemplateDirective = /** @class */ (function () {
326
397
  function MtxSelectOptionTemplateDirective(template) {
327
398
  this.template = template;
@@ -543,163 +614,125 @@
543
614
  { type: core.TemplateRef }
544
615
  ]; };
545
616
 
546
- var MtxOptionComponent = /** @class */ (function () {
547
- function MtxOptionComponent(elementRef) {
548
- this.elementRef = elementRef;
549
- this.stateChange$ = new rxjs.Subject();
550
- this._disabled = false;
551
- }
552
- Object.defineProperty(MtxOptionComponent.prototype, "disabled", {
553
- get: function () {
554
- return this._disabled;
555
- },
556
- set: function (value) {
557
- this._disabled = this._isDisabled(value);
558
- },
559
- enumerable: false,
560
- configurable: true
561
- });
562
- Object.defineProperty(MtxOptionComponent.prototype, "label", {
563
- get: function () {
564
- return (this.elementRef.nativeElement.textContent || '').trim();
565
- },
566
- enumerable: false,
567
- configurable: true
568
- });
569
- MtxOptionComponent.prototype.ngOnChanges = function (changes) {
570
- if (changes.disabled) {
571
- this.stateChange$.next({
572
- value: this.value,
573
- disabled: this._disabled,
574
- });
575
- }
576
- };
577
- MtxOptionComponent.prototype.ngAfterViewChecked = function () {
578
- if (this.label !== this._previousLabel) {
579
- this._previousLabel = this.label;
580
- this.stateChange$.next({
581
- value: this.value,
582
- disabled: this._disabled,
583
- label: this.elementRef.nativeElement.innerHTML,
584
- });
585
- }
586
- };
587
- MtxOptionComponent.prototype.ngOnDestroy = function () {
588
- this.stateChange$.complete();
589
- };
590
- MtxOptionComponent.prototype._isDisabled = function (value) {
591
- return value != null && "" + value !== 'false';
592
- };
593
- return MtxOptionComponent;
594
- }());
595
- /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
596
- MtxOptionComponent.decorators = [
597
- { type: core.Component, args: [{
598
- selector: 'mtx-option',
599
- exportAs: 'mtxOption',
600
- changeDetection: core.ChangeDetectionStrategy.OnPush,
601
- template: "<ng-content></ng-content>"
602
- },] }
603
- ];
604
- /**
605
- * @type {function(): !Array<(null|{
606
- * type: ?,
607
- * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
608
- * })>}
609
- * @nocollapse
610
- */
611
- MtxOptionComponent.ctorParameters = function () { return [
612
- { type: core.ElementRef }
613
- ]; };
614
- /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
615
- MtxOptionComponent.propDecorators = {
616
- value: [{ type: core.Input }],
617
- disabled: [{ type: core.Input }]
618
- };
619
-
620
- function isDefined(value) {
621
- return value !== undefined && value !== null;
622
- }
623
617
  var nextUniqueId = 0;
624
- var MtxSelectComponent = /** @class */ (function () {
625
- function MtxSelectComponent(_focusMonitor, _elementRef, _changeDetectorRef, ngControl) {
626
- var _this = this;
627
- this._focusMonitor = _focusMonitor;
628
- this._elementRef = _elementRef;
629
- this._changeDetectorRef = _changeDetectorRef;
618
+ // Boilerplate for applying mixins to MtxSelect.
619
+ /** @docs-private */
620
+ var _MtxSelectMixinBase = core$1.mixinErrorState(/** @class */ (function () {
621
+ function class_1(_defaultErrorStateMatcher, _parentForm, _parentFormGroup,
622
+ /**
623
+ * Form control bound to the component.
624
+ * Implemented as part of `MatFormFieldControl`.
625
+ * @docs-private
626
+ */
627
+ ngControl) {
628
+ this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
629
+ this._parentForm = _parentForm;
630
+ this._parentFormGroup = _parentFormGroup;
630
631
  this.ngControl = ngControl;
631
- /** MtxSelect options */
632
- this.addTag = false;
633
- this.addTagText = 'Add item';
634
- this.appearance = 'underline';
635
- this.closeOnSelect = true;
636
- this.clearAllText = 'Clear all';
637
- this.clearable = true;
638
- this.clearOnBackspace = true;
639
- this.dropdownPosition = 'auto';
640
- this.selectableGroup = false;
641
- this.selectableGroupAsModel = true;
642
- this.hideSelected = false;
643
- this.loading = false;
644
- this.loadingText = 'Loading...';
645
- this.labelForId = null;
646
- this.markFirst = true;
647
- this.multiple = false;
648
- this.notFoundText = 'No items found';
649
- this.searchable = true;
650
- this.readonly = false;
651
- this.searchFn = null;
652
- this.searchWhileComposing = true;
653
- this.selectOnTab = false;
654
- this.trackByFn = null;
655
- this.inputAttrs = {};
656
- this.minTermLength = 0;
657
- this.editableSearchTerm = false;
658
- this.keyDownFn = function (_) { return true; };
659
- this.virtualScroll = false;
660
- this.typeToSearchText = 'Type to search';
661
- this.blurEvent = new core.EventEmitter();
662
- this.focusEvent = new core.EventEmitter();
663
- this.changeEvent = new core.EventEmitter();
664
- this.openEvent = new core.EventEmitter();
665
- this.closeEvent = new core.EventEmitter();
666
- this.searchEvent = new core.EventEmitter();
667
- this.clearEvent = new core.EventEmitter();
668
- this.addEvent = new core.EventEmitter();
669
- this.removeEvent = new core.EventEmitter();
670
- this.scroll = new core.EventEmitter();
671
- this.scrollToEnd = new core.EventEmitter();
672
- this._items = [];
673
- this._destroy$ = new rxjs.Subject();
674
- this._value = null;
675
- /** Implemented as part of MatFormFieldControl. */
632
+ /**
633
+ * Emits whenever the component state changes and should cause the parent
634
+ * form-field to update. Implemented as part of `MatFormFieldControl`.
635
+ * @docs-private
636
+ */
676
637
  this.stateChanges = new rxjs.Subject();
677
- /** Unique id for this input. */
678
- this._uid = "mtx-select-" + nextUniqueId++;
679
- this._focused = false;
680
- this._required = false;
681
- this._disabled = false;
682
- this.errorState = false;
638
+ }
639
+ return class_1;
640
+ }()));
641
+ var MtxSelectComponent = /** @class */ (function (_super) {
642
+ __extends(MtxSelectComponent, _super);
643
+ function MtxSelectComponent(_changeDetectorRef, _elementRef, _focusMonitor, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl, _parentFormField) {
644
+ var _this = _super.call(this, _defaultErrorStateMatcher, _parentForm, _parentFormGroup, ngControl) || this;
645
+ _this._changeDetectorRef = _changeDetectorRef;
646
+ _this._elementRef = _elementRef;
647
+ _this._focusMonitor = _focusMonitor;
648
+ _this._parentFormField = _parentFormField;
649
+ _this.addTag = false;
650
+ _this.addTagText = 'Add item';
651
+ _this.appearance = 'underline';
652
+ _this.closeOnSelect = true;
653
+ _this.clearAllText = 'Clear all';
654
+ _this.clearable = true;
655
+ _this.clearOnBackspace = true;
656
+ _this.dropdownPosition = 'auto';
657
+ _this.selectableGroup = false;
658
+ _this.selectableGroupAsModel = true;
659
+ _this.hideSelected = false;
660
+ _this.loading = false;
661
+ _this.loadingText = 'Loading...';
662
+ _this.labelForId = null;
663
+ _this.markFirst = true;
664
+ _this.multiple = false;
665
+ _this.notFoundText = 'No items found';
666
+ _this.searchable = true;
667
+ _this.readonly = false;
668
+ _this.searchFn = null;
669
+ _this.searchWhileComposing = true;
670
+ _this.selectOnTab = false;
671
+ _this.trackByFn = null;
672
+ _this.inputAttrs = {};
673
+ _this.minTermLength = 0;
674
+ _this.editableSearchTerm = false;
675
+ _this.keyDownFn = function (_) { return true; };
676
+ _this.virtualScroll = false;
677
+ _this.typeToSearchText = 'Type to search';
678
+ _this.blurEvent = new core.EventEmitter();
679
+ _this.focusEvent = new core.EventEmitter();
680
+ _this.changeEvent = new core.EventEmitter();
681
+ _this.openEvent = new core.EventEmitter();
682
+ _this.closeEvent = new core.EventEmitter();
683
+ _this.searchEvent = new core.EventEmitter();
684
+ _this.clearEvent = new core.EventEmitter();
685
+ _this.addEvent = new core.EventEmitter();
686
+ _this.removeEvent = new core.EventEmitter();
687
+ _this.scroll = new core.EventEmitter();
688
+ _this.scrollToEnd = new core.EventEmitter();
689
+ _this._items = [];
690
+ _this._itemsAreUsed = false;
691
+ /** Emits whenever the component is destroyed. */
692
+ _this._destroy$ = new rxjs.Subject();
693
+ _this._value = null;
694
+ /** Implemented as part of MatFormFieldControl. */
695
+ _this.stateChanges = new rxjs.Subject();
696
+ /** Unique id for this select. */
697
+ _this._uid = "mtx-select-" + nextUniqueId++;
698
+ _this._focused = false;
699
+ _this._required = false;
700
+ _this._disabled = false;
701
+ /** Aria label of the select. */
702
+ _this.ariaLabel = '';
703
+ /** Input that can be used to specify the `aria-labelledby` attribute. */
704
+ _this.ariaLabelledby = null;
705
+ /** The aria-describedby attribute on the select for improved a11y. */
706
+ _this._ariaDescribedby = null;
683
707
  /** A name for this control that can be used by `mat-form-field`. */
684
- this.controlType = 'mtx-select';
708
+ _this.controlType = 'mtx-select';
685
709
  /** `View -> model callback called when value changes` */
686
- this._onChange = function () { };
710
+ _this._onChange = function () { };
687
711
  /** `View -> model callback called when select has been touched` */
688
- this._onTouched = function () { };
689
- _focusMonitor.monitor(_elementRef, true).subscribe(function (origin) {
712
+ _this._onTouched = function () { };
713
+ /** ID for the DOM node containing the select's value. */
714
+ _this._valueId = "mtx-select-value-" + nextUniqueId++;
715
+ _focusMonitor.monitor(_this._elementRef, true).subscribe(function (origin) {
690
716
  if (_this._focused && !origin) {
691
717
  _this._onTouched();
692
718
  }
693
719
  _this._focused = !!origin;
694
720
  _this.stateChanges.next();
695
721
  });
696
- if (this.ngControl != null) {
697
- this.ngControl.valueAccessor = this;
722
+ if (_this.ngControl != null) {
723
+ // Note: we provide the value accessor through here, instead of
724
+ // the `providers` to avoid running into a circular import.
725
+ _this.ngControl.valueAccessor = _this;
698
726
  }
727
+ // Force setter to be called in case id was not specified.
728
+ // eslint-disable-next-line no-self-assign
729
+ _this.id = _this.id;
730
+ return _this;
699
731
  }
700
732
  Object.defineProperty(MtxSelectComponent.prototype, "clearSearchOnAdd", {
701
733
  get: function () {
702
- return isDefined(this._clearSearchOnAdd) ? this._clearSearchOnAdd : this.closeOnSelect;
734
+ var _a;
735
+ return (_a = this._clearSearchOnAdd) !== null && _a !== void 0 ? _a : this.closeOnSelect;
703
736
  },
704
737
  set: function (value) {
705
738
  this._clearSearchOnAdd = value;
@@ -756,7 +789,7 @@
756
789
  configurable: true
757
790
  });
758
791
  Object.defineProperty(MtxSelectComponent.prototype, "focused", {
759
- /** Whether the input is focused. */
792
+ /** Whether the select is focused. */
760
793
  get: function () {
761
794
  return this._focused;
762
795
  },
@@ -764,6 +797,7 @@
764
797
  configurable: true
765
798
  });
766
799
  Object.defineProperty(MtxSelectComponent.prototype, "empty", {
800
+ /** Whether the select has a value. */
767
801
  get: function () {
768
802
  return this.value == null || (Array.isArray(this.value) && this.value.length === 0);
769
803
  },
@@ -771,6 +805,10 @@
771
805
  configurable: true
772
806
  });
773
807
  Object.defineProperty(MtxSelectComponent.prototype, "shouldLabelFloat", {
808
+ /**
809
+ * Implemented as part of MatFormFieldControl.
810
+ * @docs-private
811
+ */
774
812
  get: function () {
775
813
  return this.focused || !this.empty;
776
814
  },
@@ -778,6 +816,7 @@
778
816
  configurable: true
779
817
  });
780
818
  Object.defineProperty(MtxSelectComponent.prototype, "required", {
819
+ /** Whether the component is required. */
781
820
  get: function () {
782
821
  return this._required;
783
822
  },
@@ -789,6 +828,7 @@
789
828
  configurable: true
790
829
  });
791
830
  Object.defineProperty(MtxSelectComponent.prototype, "disabled", {
831
+ /** Whether the select is disabled. */
792
832
  get: function () {
793
833
  return this._disabled;
794
834
  },
@@ -801,6 +841,14 @@
801
841
  enumerable: false,
802
842
  configurable: true
803
843
  });
844
+ Object.defineProperty(MtxSelectComponent.prototype, "panelOpen", {
845
+ /** Whether or not the overlay panel is open. */
846
+ get: function () {
847
+ return !!this.ngSelect.isOpen;
848
+ },
849
+ enumerable: false,
850
+ configurable: true
851
+ });
804
852
  MtxSelectComponent.prototype.ngOnInit = function () {
805
853
  // Fix compareWith warning of undefined value
806
854
  // https://github.com/ng-select/ng-select/issues/1537
@@ -815,8 +863,10 @@
815
863
  };
816
864
  MtxSelectComponent.prototype.ngDoCheck = function () {
817
865
  if (this.ngControl) {
818
- this.errorState = (this.ngControl.invalid && this.ngControl.touched);
819
- this.stateChanges.next();
866
+ // We need to re-evaluate this on every change detection cycle, because there are some
867
+ // error triggers that we can't subscribe to (e.g. parent form submissions). This means
868
+ // that whatever logic is in here has to be super lean or we risk destroying the performance.
869
+ this.updateErrorState();
820
870
  }
821
871
  };
822
872
  MtxSelectComponent.prototype.ngOnDestroy = function () {
@@ -825,9 +875,22 @@
825
875
  this.stateChanges.complete();
826
876
  this._focusMonitor.stopMonitoring(this._elementRef);
827
877
  };
878
+ /** Gets the value for the `aria-labelledby` attribute of the inputs. */
879
+ MtxSelectComponent.prototype._getAriaLabelledby = function () {
880
+ var _a;
881
+ if (this.ariaLabel) {
882
+ return null;
883
+ }
884
+ var labelId = (_a = this._parentFormField) === null || _a === void 0 ? void 0 : _a.getLabelId();
885
+ var value = (labelId ? labelId + ' ' : '') + this._valueId;
886
+ if (this.ariaLabelledby) {
887
+ value += ' ' + this.ariaLabelledby;
888
+ }
889
+ return value;
890
+ };
828
891
  /** Implemented as part of MatFormFieldControl. */
829
892
  MtxSelectComponent.prototype.setDescribedByIds = function (ids) {
830
- this._ariaDescribedby = ids.join(' ');
893
+ this._ariaDescribedby = ids.length ? ids.join(' ') : null;
831
894
  };
832
895
  /**
833
896
  * Disables the select. Part of the ControlValueAccessor interface required
@@ -877,7 +940,7 @@
877
940
  MtxSelectComponent.prototype.registerOnTouched = function (fn) {
878
941
  this._onTouched = fn;
879
942
  };
880
- /** NgSelect: _setItemsFromNgOptions */
943
+ /** NgSelect's `_setItemsFromNgOptions` */
881
944
  MtxSelectComponent.prototype._setItemsFromMtxOptions = function () {
882
945
  var _this = this;
883
946
  var mapMtxOptions = function (options) {
@@ -922,17 +985,29 @@
922
985
  this.ngSelect.blur();
923
986
  };
924
987
  return MtxSelectComponent;
925
- }());
988
+ }(_MtxSelectMixinBase));
926
989
  /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
927
990
  MtxSelectComponent.decorators = [
928
991
  { type: core.Component, args: [{
929
992
  selector: 'mtx-select',
930
993
  exportAs: 'mtxSelect',
931
994
  host: {
995
+ 'role': 'combobox',
996
+ 'aria-autocomplete': 'none',
932
997
  '[attr.id]': 'id',
998
+ '[attr.aria-expanded]': 'panelOpen',
999
+ '[attr.aria-label]': 'ariaLabel || null',
1000
+ '[attr.aria-labelledby]': '_getAriaLabelledby()',
933
1001
  '[attr.aria-describedby]': '_ariaDescribedby || null',
1002
+ '[attr.aria-required]': 'required.toString()',
1003
+ '[attr.aria-disabled]': 'disabled.toString()',
1004
+ '[attr.aria-invalid]': 'errorState',
934
1005
  '[class.mtx-select-floating]': 'shouldLabelFloat',
1006
+ '[class.mtx-select-disabled]': 'disabled',
935
1007
  '[class.mtx-select-invalid]': 'errorState',
1008
+ '[class.mtx-select-required]': 'required',
1009
+ '[class.mtx-select-empty]': 'empty',
1010
+ '[class.mtx-select-multiple]': 'multiple',
936
1011
  'class': 'mtx-select',
937
1012
  },
938
1013
  template: "<ng-select #ngSelect [class.ng-select-invalid]=\"errorState\"\n [(ngModel)]=\"value\"\n [placeholder]=\"placeholder\"\n [items]=\"items\"\n [addTag]=\"addTag\"\n [addTagText]=\"addTagText\"\n [appendTo]=\"appendTo\"\n [appearance]=\"appearance\"\n [bindLabel]=\"bindLabel\"\n [bindValue]=\"bindValue\"\n [closeOnSelect]=\"closeOnSelect\"\n [clearAllText]=\"clearAllText\"\n [clearable]=\"clearable\"\n [clearOnBackspace]=\"clearOnBackspace\"\n [dropdownPosition]=\"dropdownPosition\"\n [groupBy]=\"groupBy\"\n [groupValue]=\"groupValue\"\n [hideSelected]=\"hideSelected\"\n [isOpen]=\"isOpen\"\n [inputAttrs]=\"inputAttrs\"\n [loading]=\"loading\"\n [loadingText]=\"loadingText\"\n [labelForId]=\"labelForId\"\n [markFirst]=\"markFirst\"\n [maxSelectedItems]=\"maxSelectedItems\"\n [multiple]=\"multiple\"\n [notFoundText]=\"notFoundText\"\n [readonly]=\"readonly\"\n [typeahead]=\"typeahead\"\n [typeToSearchText]=\"typeToSearchText\"\n [trackByFn]=\"trackByFn\"\n [searchable]=\"searchable\"\n [searchFn]=\"searchFn\"\n [searchWhileComposing]=\"searchWhileComposing\"\n [clearSearchOnAdd]=\"clearSearchOnAdd\"\n [selectableGroup]=\"selectableGroup\"\n [selectableGroupAsModel]=\"selectableGroupAsModel\"\n [selectOnTab]=\"selectOnTab\"\n [tabIndex]=\"tabIndex\"\n [openOnEnter]=\"openOnEnter\"\n [minTermLength]=\"minTermLength\"\n [editableSearchTerm]=\"editableSearchTerm\"\n [keyDownFn]=\"keyDownFn\"\n [virtualScroll]=\"virtualScroll\"\n (blur)=\"blurEvent.emit($event)\"\n (focus)=\"focusEvent.emit($event)\"\n (change)=\"changeEvent.emit($event)\"\n (open)=\"openEvent.emit($event)\"\n (close)=\"closeEvent.emit($event)\"\n (search)=\"searchEvent.emit($event)\"\n (clear)=\"clearEvent.emit($event)\"\n (add)=\"addEvent.emit($event)\"\n (remove)=\"removeEvent.emit($event)\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit($event)\">\n\n <ng-container *ngIf=\"optionTemplate\">\n <ng-template ng-option-tmp let-item=\"item\" let-item$=\"item$\" let-index=\"index\"\n let-searchTerm=\"searchTerm\">\n <ng-template [ngTemplateOutlet]=\"optionTemplate\"\n [ngTemplateOutletContext]=\"{ item: item, item$: item$, index: index, searchTerm: searchTerm }\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"optgroupTemplate\">\n <ng-template ng-optgroup-tmp let-item=\"item\" let-item$=\"item$\" let-index=\"index\"\n let-searchTerm=\"searchTerm\">\n <ng-template [ngTemplateOutlet]=\"optgroupTemplate\"\n [ngTemplateOutletContext]=\"{ item: item, item$: item$, index: index, searchTerm: searchTerm }\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"labelTemplate\">\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\" let-label=\"label\">\n <ng-template [ngTemplateOutlet]=\"labelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item, clear: clear, label: label }\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"multiLabelTemplate\">\n <ng-template ng-multi-label-tmp let-items=\"items\" let-clear=\"clear\">\n <ng-template [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: items, clear: clear }\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"headerTemplate\">\n <ng-template ng-header-tmp>\n <ng-template [ngTemplateOutlet]=\"headerTemplate\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"footerTemplate\">\n <ng-template ng-footer-tmp>\n <ng-template [ngTemplateOutlet]=\"footerTemplate\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"notFoundTemplate\">\n <ng-template ng-notfound-tmp let-searchTerm=\"searchTerm\">\n <ng-template [ngTemplateOutlet]=\"notFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"typeToSearchTemplate\">\n <ng-template ng-typetosearch-tmp>\n <ng-template [ngTemplateOutlet]=\"typeToSearchTemplate\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"loadingTextTemplate\">\n <ng-template ng-loadingtext-tmp let-searchTerm=\"searchTerm\">\n <ng-template [ngTemplateOutlet]=\"loadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"tagTemplate\">\n <ng-template ng-tag-tmp let-searchTerm=\"searchTerm\">\n <ng-template [ngTemplateOutlet]=\"tagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"loadingSpinnerTemplate\">\n <ng-template ng-loadingspinner-tmp>\n <ng-template [ngTemplateOutlet]=\"loadingSpinnerTemplate\">\n </ng-template>\n </ng-template>\n </ng-container>\n\n</ng-select>\n",
@@ -950,10 +1025,14 @@
950
1025
  * @nocollapse
951
1026
  */
952
1027
  MtxSelectComponent.ctorParameters = function () { return [
953
- { type: a11y.FocusMonitor },
954
- { type: core.ElementRef },
955
1028
  { type: core.ChangeDetectorRef },
956
- { type: forms.NgControl, decorators: [{ type: core.Optional }, { type: core.Self }] }
1029
+ { type: core.ElementRef },
1030
+ { type: a11y.FocusMonitor },
1031
+ { type: core$1.ErrorStateMatcher },
1032
+ { type: forms.NgForm, decorators: [{ type: core.Optional }] },
1033
+ { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] },
1034
+ { type: forms.NgControl, decorators: [{ type: core.Optional }, { type: core.Self }] },
1035
+ { type: formField.MatFormField, decorators: [{ type: core.Optional }, { type: core.Inject, args: [formField.MAT_FORM_FIELD,] }] }
957
1036
  ]; };
958
1037
  /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
959
1038
  MtxSelectComponent.propDecorators = {
@@ -1027,7 +1106,10 @@
1027
1106
  id: [{ type: core.Input }],
1028
1107
  placeholder: [{ type: core.Input }],
1029
1108
  required: [{ type: core.Input }],
1030
- disabled: [{ type: core.Input }]
1109
+ disabled: [{ type: core.Input }],
1110
+ errorStateMatcher: [{ type: core.Input }],
1111
+ ariaLabel: [{ type: core.Input, args: ['aria-label',] }],
1112
+ ariaLabelledby: [{ type: core.Input, args: ['aria-labelledby',] }]
1031
1113
  };
1032
1114
 
1033
1115
  var MtxSelectModule = /** @class */ (function () {
@@ -1090,7 +1172,6 @@
1090
1172
  exports.MtxSelectOptionTemplateDirective = MtxSelectOptionTemplateDirective;
1091
1173
  exports.MtxSelectTagTemplateDirective = MtxSelectTagTemplateDirective;
1092
1174
  exports.MtxSelectTypeToSearchTemplateDirective = MtxSelectTypeToSearchTemplateDirective;
1093
- exports.isDefined = isDefined;
1094
1175
 
1095
1176
  Object.defineProperty(exports, '__esModule', { value: true });
1096
1177