@main-class/componentes 1.19.8 → 1.19.9

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.
@@ -1707,6 +1707,231 @@
1707
1707
  },] }
1708
1708
  ];
1709
1709
 
1710
+ var SelectChipsAutocompleteComponent = /** @class */ (function () {
1711
+ function SelectChipsAutocompleteComponent(errorStateMatcher, ngControl, parentForm, parentFormGroup) {
1712
+ var _this = this;
1713
+ this.errorStateMatcher = errorStateMatcher;
1714
+ this.ngControl = ngControl;
1715
+ this.parentForm = parentForm;
1716
+ this.parentFormGroup = parentFormGroup;
1717
+ this.$disabled = false;
1718
+ this.$required = false;
1719
+ this.focused = false;
1720
+ this.filterCtrl = new forms.FormControl();
1721
+ this.stateChanges = new rxjs.Subject();
1722
+ this.id = "select-chips-autocomplete-" + SelectChipsAutocompleteComponent.nextId++;
1723
+ this.describedBy = '';
1724
+ this.search = new core.EventEmitter();
1725
+ this.onChange = function (val) {
1726
+ };
1727
+ this.onTouched = function () {
1728
+ };
1729
+ if (this.ngControl != null) {
1730
+ this.ngControl.valueAccessor = this;
1731
+ }
1732
+ this.filterCtrl.valueChanges.pipe(operators.startWith(null), operators.map(function (filtro) { return _this._filter(filtro); }));
1733
+ }
1734
+ SelectChipsAutocompleteComponent.prototype.ngAfterViewInit = function () {
1735
+ var _this = this;
1736
+ this.opcoesFiltradas = this.opcoes.changes
1737
+ .pipe(operators.map(function () { return _this.opcoes.toArray(); }));
1738
+ };
1739
+ Object.defineProperty(SelectChipsAutocompleteComponent.prototype, "value", {
1740
+ get: function () {
1741
+ return this.$value;
1742
+ },
1743
+ set: function (value) {
1744
+ this.$value = value;
1745
+ this.stateChanges.next();
1746
+ },
1747
+ enumerable: false,
1748
+ configurable: true
1749
+ });
1750
+ Object.defineProperty(SelectChipsAutocompleteComponent.prototype, "empty", {
1751
+ get: function () {
1752
+ return !this.value;
1753
+ },
1754
+ enumerable: false,
1755
+ configurable: true
1756
+ });
1757
+ SelectChipsAutocompleteComponent.prototype.onContainerClick = function (event) {
1758
+ };
1759
+ Object.defineProperty(SelectChipsAutocompleteComponent.prototype, "shouldLabelFloat", {
1760
+ get: function () {
1761
+ return !this.empty || (this.input && this.input.nativeElement.value) || this.focused;
1762
+ },
1763
+ enumerable: false,
1764
+ configurable: true
1765
+ });
1766
+ Object.defineProperty(SelectChipsAutocompleteComponent.prototype, "placeholder", {
1767
+ get: function () {
1768
+ return this.$placeholder;
1769
+ },
1770
+ set: function (plh) {
1771
+ this.$placeholder = plh;
1772
+ this.stateChanges.next();
1773
+ },
1774
+ enumerable: false,
1775
+ configurable: true
1776
+ });
1777
+ Object.defineProperty(SelectChipsAutocompleteComponent.prototype, "required", {
1778
+ get: function () {
1779
+ return this.$required;
1780
+ },
1781
+ set: function (value) {
1782
+ this.$required = coercion.coerceBooleanProperty(value);
1783
+ this.stateChanges.next();
1784
+ },
1785
+ enumerable: false,
1786
+ configurable: true
1787
+ });
1788
+ Object.defineProperty(SelectChipsAutocompleteComponent.prototype, "disabled", {
1789
+ get: function () {
1790
+ return this.$disabled;
1791
+ },
1792
+ set: function (value) {
1793
+ this.$disabled = coercion.coerceBooleanProperty(value);
1794
+ this.stateChanges.next();
1795
+ },
1796
+ enumerable: false,
1797
+ configurable: true
1798
+ });
1799
+ Object.defineProperty(SelectChipsAutocompleteComponent.prototype, "errorState", {
1800
+ get: function () {
1801
+ return this.errorStateMatcher.isErrorState(this.ngControl.control, this.parentFormGroup || this.parentForm);
1802
+ },
1803
+ enumerable: false,
1804
+ configurable: true
1805
+ });
1806
+ Object.defineProperty(SelectChipsAutocompleteComponent.prototype, "controlType", {
1807
+ get: function () {
1808
+ return 'select-chips-autocomplete';
1809
+ },
1810
+ enumerable: false,
1811
+ configurable: true
1812
+ });
1813
+ SelectChipsAutocompleteComponent.prototype.setDescribedByIds = function (ids) {
1814
+ this.describedBy = ids.join(' ');
1815
+ };
1816
+ SelectChipsAutocompleteComponent.prototype.ngOnDestroy = function () {
1817
+ this.stateChanges.complete();
1818
+ };
1819
+ SelectChipsAutocompleteComponent.prototype.registerOnTouched = function (fn) {
1820
+ this.onTouched = fn;
1821
+ };
1822
+ SelectChipsAutocompleteComponent.prototype.registerOnChange = function (fn) {
1823
+ this.onChange = fn;
1824
+ };
1825
+ SelectChipsAutocompleteComponent.prototype.setDisabledState = function (isDisabled) {
1826
+ this.disabled = isDisabled;
1827
+ };
1828
+ SelectChipsAutocompleteComponent.prototype.writeValue = function (value) {
1829
+ this.value = value;
1830
+ this.filterCtrl.setValue(this.filterCtrl.value);
1831
+ };
1832
+ SelectChipsAutocompleteComponent.prototype.add = function (event) {
1833
+ this.onTouched();
1834
+ var input = event.input;
1835
+ var value = event.value;
1836
+ var selected = util.StringUtil.normalize((value || ''));
1837
+ var opcao = this.opcoes.toArray()
1838
+ .find(function (op) { return util.StringUtil.normalize(op.label) === selected; });
1839
+ if (opcao) {
1840
+ if (!this.value || !this.value.find(function (v) { return v === opcao.value; })) {
1841
+ this.value = __spread((this.value || []), [
1842
+ opcao.value
1843
+ ]);
1844
+ this.onChange(this.value);
1845
+ }
1846
+ if (input) {
1847
+ input.value = '';
1848
+ }
1849
+ this.filterCtrl.setValue(null);
1850
+ }
1851
+ };
1852
+ SelectChipsAutocompleteComponent.prototype.remove = function (item) {
1853
+ this.onTouched();
1854
+ if (this.value) {
1855
+ var index = this.value.indexOf(item);
1856
+ if (index >= 0) {
1857
+ this.value.splice(index, 1);
1858
+ }
1859
+ if (!this.value.length) {
1860
+ this.value = undefined;
1861
+ }
1862
+ this.onChange(this.value);
1863
+ }
1864
+ };
1865
+ SelectChipsAutocompleteComponent.prototype.selected = function (event) {
1866
+ this.onTouched();
1867
+ if (!this.value || !this.value.find(function (v) { return v === event.option.value; })) {
1868
+ this.value = __spread((this.value || []), [
1869
+ event.option.value
1870
+ ]);
1871
+ this.onChange(this.value);
1872
+ }
1873
+ this.filterInput.nativeElement.value = '';
1874
+ this.filterCtrl.setValue(null);
1875
+ };
1876
+ SelectChipsAutocompleteComponent.prototype._filter = function (filtro) {
1877
+ this.search.emit(filtro);
1878
+ };
1879
+ return SelectChipsAutocompleteComponent;
1880
+ }());
1881
+ SelectChipsAutocompleteComponent.nextId = 0;
1882
+ SelectChipsAutocompleteComponent.decorators = [
1883
+ { type: core.Component, args: [{
1884
+ selector: 'mcl-select-chips-autocomplete',
1885
+ template: "<mat-chip-list #chipList >\n <mat-chip\n *ngFor=\"let item of value\"\n [removable]=\"!disabled\"\n (removed)=\"remove(item)\">\n {{item}}\n <mat-icon matChipRemove *ngIf=\"!disabled\" >cancel</mat-icon>\n </mat-chip>\n <input\n [placeholder]=\"placeholder\"\n #filterInput required\n (focusin)=\"focused = true\"\n (focusout)=\"focused = false\"\n [formControl]=\"filterCtrl\"\n [matAutocomplete]=\"filterAutocomplete\"\n [matChipInputFor]=\"chipList\"\n (matChipInputTokenEnd)=\"add($event)\">\n</mat-chip-list>\n<mat-autocomplete #filterAutocomplete=\"matAutocomplete\" (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let opcao of opcoesFiltradas | async\" [value]=\"opcao.value\">\n {{opcao.label}}\n </mat-option>\n</mat-autocomplete>\n",
1886
+ providers: [
1887
+ {
1888
+ provide: formField.MatFormFieldControl,
1889
+ useExisting: SelectChipsAutocompleteComponent
1890
+ }
1891
+ ],
1892
+ styles: [""]
1893
+ },] }
1894
+ ];
1895
+ SelectChipsAutocompleteComponent.ctorParameters = function () { return [
1896
+ { type: core$1.ErrorStateMatcher },
1897
+ { type: forms.NgControl, decorators: [{ type: core.Optional }, { type: core.Self }] },
1898
+ { type: forms.NgForm, decorators: [{ type: core.Optional }] },
1899
+ { type: forms.FormGroupDirective, decorators: [{ type: core.Optional }] }
1900
+ ]; };
1901
+ SelectChipsAutocompleteComponent.propDecorators = {
1902
+ input: [{ type: core.ViewChild, args: ['input',] }],
1903
+ id: [{ type: core.HostBinding }],
1904
+ describedBy: [{ type: core.HostBinding, args: ['attr.aria-describedby',] }],
1905
+ opcoes: [{ type: core.ContentChildren, args: [SelectItemComponent,] }],
1906
+ filterInput: [{ type: core.ViewChild, args: ['filterInput',] }],
1907
+ filterAutocomplete: [{ type: core.ViewChild, args: ['filterAutocomplete',] }],
1908
+ search: [{ type: core.Output }],
1909
+ shouldLabelFloat: [{ type: core.HostBinding, args: ['class.floating',] }],
1910
+ placeholder: [{ type: core.Input }],
1911
+ required: [{ type: core.Input }],
1912
+ disabled: [{ type: core.Input }]
1913
+ };
1914
+
1915
+ var SelectChipsAutocompleteModule = /** @class */ (function () {
1916
+ function SelectChipsAutocompleteModule() {
1917
+ }
1918
+ return SelectChipsAutocompleteModule;
1919
+ }());
1920
+ SelectChipsAutocompleteModule.decorators = [
1921
+ { type: core.NgModule, args: [{
1922
+ declarations: [SelectChipsAutocompleteComponent],
1923
+ exports: [SelectChipsAutocompleteComponent, SelectItemModule],
1924
+ imports: [
1925
+ common.CommonModule,
1926
+ icon.MatIconModule,
1927
+ forms.ReactiveFormsModule,
1928
+ autocomplete.MatAutocompleteModule,
1929
+ SelectItemModule,
1930
+ chips.MatChipsModule,
1931
+ ],
1932
+ },] }
1933
+ ];
1934
+
1710
1935
  var SelectManyCheckboxComponent = /** @class */ (function () {
1711
1936
  function SelectManyCheckboxComponent(errorStateMatcher, ngControl, parentForm, parentFormGroup) {
1712
1937
  this.errorStateMatcher = errorStateMatcher;
@@ -2234,6 +2459,8 @@
2234
2459
  exports.OptionCheckboxComponent = OptionCheckboxComponent;
2235
2460
  exports.OptionCheckboxGroupComponent = OptionCheckboxGroupComponent;
2236
2461
  exports.OptionCheckboxModule = OptionCheckboxModule;
2462
+ exports.SelectChipsAutocompleteComponent = SelectChipsAutocompleteComponent;
2463
+ exports.SelectChipsAutocompleteModule = SelectChipsAutocompleteModule;
2237
2464
  exports.SelectChipsComponent = SelectChipsComponent;
2238
2465
  exports.SelectChipsModule = SelectChipsModule;
2239
2466
  exports.SelectItemComponent = SelectItemComponent;