ngx-sp-infra 5.19.6 → 5.19.8
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.
|
@@ -7969,6 +7969,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
7969
7969
|
}] } });
|
|
7970
7970
|
|
|
7971
7971
|
class LibComboboxReworkComponent {
|
|
7972
|
+
// Getter/Setter para o valor
|
|
7973
|
+
get value() { return this._value; }
|
|
7974
|
+
set value(val) {
|
|
7975
|
+
if (val !== this._value) {
|
|
7976
|
+
this._value = val;
|
|
7977
|
+
this._onChange(val); // Notifica o FormControl sobre a mudança
|
|
7978
|
+
}
|
|
7979
|
+
}
|
|
7972
7980
|
displayValue() {
|
|
7973
7981
|
if (!this.value)
|
|
7974
7982
|
return this.placeholder;
|
|
@@ -7976,27 +7984,28 @@ class LibComboboxReworkComponent {
|
|
|
7976
7984
|
if (this.value.length === 0)
|
|
7977
7985
|
return this.placeholder;
|
|
7978
7986
|
let extraSelected = 0;
|
|
7979
|
-
let formattedValue = "";
|
|
7980
7987
|
this.value.forEach((e, index) => {
|
|
7981
7988
|
if (index >= 2)
|
|
7982
7989
|
extraSelected++;
|
|
7983
7990
|
});
|
|
7991
|
+
// Filtra o valor para exibir até dois valores selecionados, se passar disso mostra "e +{n} selecionado(s)"
|
|
7984
7992
|
return this.value.map((e, index) => {
|
|
7985
7993
|
if (index < 2)
|
|
7986
7994
|
return this.displayWith(e);
|
|
7987
7995
|
return null;
|
|
7988
7996
|
})
|
|
7989
7997
|
.filter(e => e !== null)
|
|
7990
|
-
.join(', ') + (extraSelected > 0 ? ` e +${extraSelected}
|
|
7998
|
+
.join(', ') + (extraSelected > 0 ? ` e +${extraSelected} selecionado(s)` : '');
|
|
7991
7999
|
}
|
|
7992
8000
|
return this.displayWith(this.value);
|
|
7993
8001
|
}
|
|
7994
8002
|
// #endregion PUBLIC
|
|
7995
8003
|
// #endregion ==========> PROPERTIES <==========
|
|
7996
|
-
constructor(_cdr) {
|
|
8004
|
+
constructor(_cdr, _elementRef) {
|
|
7997
8005
|
this._cdr = _cdr;
|
|
7998
|
-
|
|
7999
|
-
|
|
8006
|
+
this._elementRef = _elementRef;
|
|
8007
|
+
/** Valor interno do componente */
|
|
8008
|
+
this._value = null;
|
|
8000
8009
|
this._search$ = new BehaviorSubject("");
|
|
8001
8010
|
this._onTouched = () => { };
|
|
8002
8011
|
this._onChange = (_) => { };
|
|
@@ -8015,12 +8024,23 @@ class LibComboboxReworkComponent {
|
|
|
8015
8024
|
this.selectionChange = new EventEmitter();
|
|
8016
8025
|
this.filterChange = new EventEmitter();
|
|
8017
8026
|
this.filterButtonClick = new EventEmitter();
|
|
8018
|
-
this.value = null;
|
|
8019
8027
|
this.selectedValues = null;
|
|
8028
|
+
this.invalid = false;
|
|
8020
8029
|
this.isOpen = false;
|
|
8021
8030
|
this.searchControl = new FormControl("");
|
|
8022
8031
|
this.filteredItems$ = this._search$.pipe(debounceTime(150), distinctUntilChanged(), map((term) => this.filterItems(term)));
|
|
8023
|
-
this.
|
|
8032
|
+
this.compare = (a, b) => {
|
|
8033
|
+
if (!a || !b)
|
|
8034
|
+
return false;
|
|
8035
|
+
const recA = a;
|
|
8036
|
+
const recB = b;
|
|
8037
|
+
if (a === b)
|
|
8038
|
+
return true;
|
|
8039
|
+
else if ((recA[this.customValue] === recB[this.customValue]) || (recA[this.customLabel] === recB[this.customLabel]))
|
|
8040
|
+
return true;
|
|
8041
|
+
return false;
|
|
8042
|
+
};
|
|
8043
|
+
// public compareWith: (a: T, b: T) => boolean = (a, b) => a === b;
|
|
8024
8044
|
this.displayWith = (item) => {
|
|
8025
8045
|
if (!item)
|
|
8026
8046
|
return '';
|
|
@@ -8040,20 +8060,23 @@ class LibComboboxReworkComponent {
|
|
|
8040
8060
|
else
|
|
8041
8061
|
this.filterChange.emit(v);
|
|
8042
8062
|
});
|
|
8063
|
+
this.registerObserver();
|
|
8043
8064
|
}
|
|
8044
8065
|
ngAfterViewInit() {
|
|
8045
|
-
//
|
|
8066
|
+
// [...]
|
|
8046
8067
|
}
|
|
8047
8068
|
ngAfterContentInit() {
|
|
8048
8069
|
this.setMaxWidth();
|
|
8049
8070
|
}
|
|
8050
8071
|
ngOnChanges(changes) {
|
|
8072
|
+
// [...]
|
|
8051
8073
|
}
|
|
8052
8074
|
ngOnDestroy() {
|
|
8053
8075
|
this._destroy$.next();
|
|
8054
8076
|
this._destroy$.complete();
|
|
8077
|
+
this.mutationObserver.disconnect();
|
|
8055
8078
|
}
|
|
8056
|
-
// O que fazer quando o evento de redimensionamento ocorrer
|
|
8079
|
+
// O que fazer quando o evento de redimensionamento da tela ocorrer
|
|
8057
8080
|
onResize() { this.setMaxWidth(); }
|
|
8058
8081
|
// #region ==========> UTILS <==========
|
|
8059
8082
|
filterItems(term) {
|
|
@@ -8071,7 +8094,7 @@ class LibComboboxReworkComponent {
|
|
|
8071
8094
|
select(item) {
|
|
8072
8095
|
if (this.multiple) {
|
|
8073
8096
|
this.selectedValues = Array.isArray(this.value) ? [...this.value] : [];
|
|
8074
|
-
const index = this.selectedValues.findIndex(v => this.
|
|
8097
|
+
const index = this.selectedValues.findIndex(v => this.compare(v, item));
|
|
8075
8098
|
if (index > -1)
|
|
8076
8099
|
this.selectedValues.splice(index, 1);
|
|
8077
8100
|
else
|
|
@@ -8094,32 +8117,39 @@ class LibComboboxReworkComponent {
|
|
|
8094
8117
|
if (!item || !this.value)
|
|
8095
8118
|
return false;
|
|
8096
8119
|
if (this.multiple && Array.isArray(this.value)) {
|
|
8097
|
-
return this.value.some(v => this.
|
|
8120
|
+
return this.value.some(v => this.compare(v, item));
|
|
8098
8121
|
}
|
|
8099
|
-
return this.
|
|
8122
|
+
return this.compare(item, this.value);
|
|
8100
8123
|
}
|
|
8101
8124
|
// #endregion Seleção
|
|
8102
8125
|
// #region VALUE_ACCESSOR do Angular
|
|
8103
8126
|
writeValue(obj) {
|
|
8104
8127
|
if (!obj)
|
|
8105
8128
|
this.selectedValues = null;
|
|
8106
|
-
this.value = obj;
|
|
8107
8129
|
this._onTouched();
|
|
8108
|
-
this.
|
|
8130
|
+
if (this.multiple && obj) {
|
|
8131
|
+
this.selectedValues = Array.isArray(obj) ? [...obj] : [];
|
|
8132
|
+
if (this.selectedValues.length === 0)
|
|
8133
|
+
this.selectedValues = null;
|
|
8134
|
+
this.value = this.selectedValues;
|
|
8135
|
+
this._onChange(this.selectedValues);
|
|
8136
|
+
this.selectionChange.emit(this.selectedValues);
|
|
8137
|
+
}
|
|
8138
|
+
else {
|
|
8139
|
+
this.value = obj;
|
|
8140
|
+
this._onChange(obj);
|
|
8141
|
+
this.selectionChange.emit(obj);
|
|
8142
|
+
}
|
|
8109
8143
|
this._cdr.markForCheck();
|
|
8110
8144
|
}
|
|
8111
|
-
registerOnChange(fn) {
|
|
8112
|
-
|
|
8113
|
-
}
|
|
8114
|
-
registerOnTouched(fn) {
|
|
8115
|
-
this._onTouched = fn;
|
|
8116
|
-
}
|
|
8117
|
-
// #endregion VALUE_ACCESSOR do Angular
|
|
8118
|
-
// #region UI
|
|
8145
|
+
registerOnChange(fn) { this._onChange = fn; }
|
|
8146
|
+
registerOnTouched(fn) { this._onTouched = fn; }
|
|
8119
8147
|
setDisabledState(isDisabled) {
|
|
8120
8148
|
this.disabled = isDisabled;
|
|
8121
8149
|
this._cdr.markForCheck();
|
|
8122
8150
|
}
|
|
8151
|
+
// #endregion VALUE_ACCESSOR do Angular
|
|
8152
|
+
// #region UI
|
|
8123
8153
|
toggleDropdown() {
|
|
8124
8154
|
if (this.disabled)
|
|
8125
8155
|
return;
|
|
@@ -8133,6 +8163,19 @@ class LibComboboxReworkComponent {
|
|
|
8133
8163
|
}
|
|
8134
8164
|
this._cdr.markForCheck();
|
|
8135
8165
|
}
|
|
8166
|
+
openDropdown() {
|
|
8167
|
+
if (this.disabled)
|
|
8168
|
+
return;
|
|
8169
|
+
this.isOpen = true;
|
|
8170
|
+
if (this.isOpen) {
|
|
8171
|
+
this.searchControl.setValue("", { emitEvent: true });
|
|
8172
|
+
setTimeout(() => {
|
|
8173
|
+
const inputEl = document.querySelector('.reusable-combobox .dropdown-search input');
|
|
8174
|
+
inputEl?.focus();
|
|
8175
|
+
}, 0);
|
|
8176
|
+
}
|
|
8177
|
+
this._cdr.markForCheck();
|
|
8178
|
+
}
|
|
8136
8179
|
closeDropdown() {
|
|
8137
8180
|
this.isOpen = false;
|
|
8138
8181
|
this._cdr.markForCheck();
|
|
@@ -8143,26 +8186,48 @@ class LibComboboxReworkComponent {
|
|
|
8143
8186
|
this.closeDropdown();
|
|
8144
8187
|
}
|
|
8145
8188
|
}
|
|
8146
|
-
|
|
8189
|
+
/** Define a largura máxima em pixels com base na largura do container pai
|
|
8190
|
+
*
|
|
8191
|
+
* Esta abordagem foi necessária pois o elemento em questão constantemente aumentava sua largura para acomodar o seu valor interno, independente das regras CSS impostas.
|
|
8192
|
+
*
|
|
8193
|
+
* A solução mais rápida era definir uma largura em pixels fixa na inicialização, o que não é o ideal por questões de responsividade, portanto este método é chamado em caso de resize da tela também
|
|
8194
|
+
*/
|
|
8147
8195
|
setMaxWidth() {
|
|
8148
8196
|
if (this.toggleButton) {
|
|
8149
8197
|
const container = this.toggleButton?.nativeElement;
|
|
8150
|
-
const parent = this.toggleButton?.nativeElement.parentElement;
|
|
8151
|
-
console.log("parent?.scrollWidth", parent?.scrollWidth);
|
|
8152
|
-
console.log("parent?.clientWidth", parent?.clientWidth);
|
|
8198
|
+
const parent = this.toggleButton?.nativeElement.parentElement;
|
|
8153
8199
|
container.style.minWidth = '100%';
|
|
8154
8200
|
container.style.width = `${parent.scrollWidth}px`;
|
|
8155
|
-
console.log("parent?.scrollWidth", parent?.scrollWidth);
|
|
8156
8201
|
}
|
|
8157
8202
|
}
|
|
8158
|
-
|
|
8203
|
+
// #endregion UI
|
|
8204
|
+
// #region Mutation Observer
|
|
8205
|
+
registerObserver() {
|
|
8206
|
+
this.mutationObserver = new MutationObserver(mutations => {
|
|
8207
|
+
mutations.forEach(mut => {
|
|
8208
|
+
if (mut.type === 'attributes' && mut.attributeName === 'class')
|
|
8209
|
+
this.checkInvalidClass();
|
|
8210
|
+
});
|
|
8211
|
+
});
|
|
8212
|
+
this.mutationObserver.observe(this._elementRef.nativeElement, {
|
|
8213
|
+
attributes: true,
|
|
8214
|
+
attributeFilter: ['class', 'disabled']
|
|
8215
|
+
});
|
|
8216
|
+
setTimeout(() => this.checkInvalidClass());
|
|
8217
|
+
}
|
|
8218
|
+
checkInvalidClass() {
|
|
8219
|
+
const hasInvalid = this._elementRef.nativeElement.classList.contains('is-invalid');
|
|
8220
|
+
this.invalid = hasInvalid;
|
|
8221
|
+
this._cdr.markForCheck();
|
|
8222
|
+
}
|
|
8223
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibComboboxReworkComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8159
8224
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: LibComboboxReworkComponent, isStandalone: true, selector: "lib-combobox-rework", inputs: { list: "list", placeholder: "placeholder", searchPlaceholder: "searchPlaceholder", noResultsText: "noResultsText", disabled: "disabled", multiple: "multiple", innerFilter: "innerFilter", customLabel: "customLabel", customValue: "customValue" }, outputs: { selectionChange: "selectionChange", filterChange: "filterChange", filterButtonClick: "filterButtonClick" }, host: { listeners: { "window:resize": "onResize($event)" } }, providers: [
|
|
8160
8225
|
{
|
|
8161
8226
|
provide: NG_VALUE_ACCESSOR,
|
|
8162
8227
|
useExisting: forwardRef(() => LibComboboxReworkComponent),
|
|
8163
8228
|
multi: true
|
|
8164
8229
|
}
|
|
8165
|
-
], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["optionTemplate"], descendants: true, read: TemplateRef }, { propertyName: "leftButtonTemplate", first: true, predicate: ["leftButtonTemplate"], descendants: true, read: TemplateRef }, { propertyName: "rightButtonTemplate", first: true, predicate: ["rightButtonTemplate"], descendants: true, read: TemplateRef }], viewQueries: [{ propertyName: "toggleButton", first: true, predicate: ["toggleButton"], descendants: true, static: true }
|
|
8230
|
+
], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["optionTemplate"], descendants: true, read: TemplateRef }, { propertyName: "leftButtonTemplate", first: true, predicate: ["leftButtonTemplate"], descendants: true, read: TemplateRef }, { propertyName: "rightButtonTemplate", first: true, predicate: ["rightButtonTemplate"], descendants: true, read: TemplateRef }], viewQueries: [{ propertyName: "toggleButton", first: true, predicate: ["toggleButton"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"reusable-combobox input-group\" [class.show]=\"isOpen\" (focusout)=\"onBlurOutside($event)\" >\n @if (leftButtonTemplate) { <ng-container *ngTemplateOutlet=\"leftButtonTemplate\"></ng-container> }\n\n <div class=\"dropdown w-100\">\n <div #toggleButton id=\"toggle-button\" class=\"form-select d-flex align-items-center text-start\" type=\"button\" data-bs-toggle=\"dropdown\"\n data-bs-auto-close=\"outside\" [attr.aria-expanded]=\"isOpen\" [attr.aria-haspopup]=\"true\" [attr.aria-label]=\"placeholder\" [class.disabled]=\"disabled\"\n [class.is-invalid]=\"invalid\" (click)=\"toggleDropdown()\" readonly\n [ngClass]=\"{\n 'rounded-start-0': leftButtonTemplate,\n 'rounded-end-0': rightButtonTemplate,\n }\" >\n <span class=\"w-100 overflow-hidden text-truncate\"> {{ displayValue() }} </span> \n </div>\n\n <div class=\"dropdown-menu p-2 w-100\" [class.show]=\"isOpen\" style=\"max-height: 320px; overflow-y: auto;\" >\n <div class=\"dropdown-search input-group mb-2\">\n <input class=\"form-control form-control-sm\" type=\"search\" [placeholder]=\"searchPlaceholder\" [formControl]=\"searchControl\" aria-label=\"Pesquisar op\u00E7\u00F5es\" (keyup.enter)=\"filterButtonClick.emit(searchControl.value)\" />\n <button class=\"btn btn-sm btn-primary\" type=\"button\" (click)=\"filterButtonClick.emit(searchControl.value)\"> <lib-icon iconName=\"lupa\" iconSize=\"medium-small\" /> </button>\n </div>\n\n @if (multiple && selectedValues?.length) {\n <div class=\"d-flex flex-row gap-2 flex-wrap my-2\">\n <span *ngFor=\"let value of selectedValues; trackBy: trackByFn\" class=\"px-3 badge rounded-pill text-primary bg-primary-subtle\">\n {{ value[customLabel] }} <lib-icon class=\"glb-cursor-pointer\" iconName=\"fechar\" iconSize=\"small\" (click)=\"select(value)\" />\n </span>\n </div>\n }\n\n <!-- Se utilizar o filtro interno utiliza a propriedade de lista filteredItems$, caso contr\u00E1rio usa a pr\u00F3pria list pois ela ser\u00E1 filtrada pelo componente pai -->\n <ng-container *ngIf=\"(innerFilter ? (filteredItems$ | async) : list) as items\">\n @if (items.length === 0) { <div class=\"py-2 px-3 text-muted small\">{{ noResultsText }}</div> }\n\n @if (value !== '' && value !== null) {\n <button type=\"button\" class=\"dropdown-item d-flex align-items-center\" (click)=\"writeValue(null)\">\n <span class=\"fw-bold\">Limpar {{ multiple ? 'op\u00E7\u00F5es selecionadas' : 'op\u00E7\u00E3o selecionada' }}</span>\n </button>\n }\n\n <button *ngFor=\"let item of items; trackBy: trackByFn\" class=\"dropdown-item d-flex align-items-center\" type=\"button\"\n (click)=\"select(item)\" [attr.aria-selected]=\"isSelected(item)\" >\n\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { $implicit: item, selected: isSelected(item) }\"></ng-container>\n }\n @else {\n <div class=\"w-100 original\">\n <div class=\"d-flex justify-content-between\">\n <div>{{ (item[customLabel] ?? item[customValue]) }}</div>\n <small class=\"text-muted\" *ngIf=\"isSelected(item)\">\u2713</small>\n </div>\n </div>\n }\n </button>\n </ng-container>\n </div>\n </div>\n\n @if (rightButtonTemplate) { <ng-container *ngTemplateOutlet=\"rightButtonTemplate\"></ng-container> }\n</div>\n", styles: [".reusable-combobox{position:relative;display:flex;flex-wrap:nowrap;width:100%;max-width:100%}.reusable-combobox #toggle-button{box-sizing:border-box}.reusable-combobox .dropdown-menu{width:100%;box-shadow:0 6px 18px #00000014;border-radius:.5rem}.reusable-combobox .dropdown-item{cursor:pointer;border-radius:6px;transition:all .3s ease}.reusable-combobox .dropdown-item:hover:not(:focus){background-color:#f1f5f9}.reusable-combobox.compact .dropdown-menu{max-height:200px}.bg-primary-subtle{background-color:#d1dfe7!important}::-webkit-scrollbar{width:4px;background:transparent}::-webkit-scrollbar-thumb{background:#bbb;border-radius:16px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$5.AsyncPipe, name: "async" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
8166
8231
|
}
|
|
8167
8232
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LibComboboxReworkComponent, decorators: [{
|
|
8168
8233
|
type: Component,
|
|
@@ -8170,16 +8235,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
8170
8235
|
CommonModule,
|
|
8171
8236
|
FormsModule,
|
|
8172
8237
|
ReactiveFormsModule,
|
|
8173
|
-
LibIconsComponent
|
|
8174
|
-
TextTruncateDirective
|
|
8238
|
+
LibIconsComponent
|
|
8175
8239
|
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
8176
8240
|
{
|
|
8177
8241
|
provide: NG_VALUE_ACCESSOR,
|
|
8178
8242
|
useExisting: forwardRef(() => LibComboboxReworkComponent),
|
|
8179
8243
|
multi: true
|
|
8180
8244
|
}
|
|
8181
|
-
], template: "<div class=\"reusable-combobox input-group\" [class.show]=\"isOpen\" (focusout)=\"onBlurOutside($event)\"
|
|
8182
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { list: [{
|
|
8245
|
+
], template: "<div class=\"reusable-combobox input-group\" [class.show]=\"isOpen\" (focusout)=\"onBlurOutside($event)\" >\n @if (leftButtonTemplate) { <ng-container *ngTemplateOutlet=\"leftButtonTemplate\"></ng-container> }\n\n <div class=\"dropdown w-100\">\n <div #toggleButton id=\"toggle-button\" class=\"form-select d-flex align-items-center text-start\" type=\"button\" data-bs-toggle=\"dropdown\"\n data-bs-auto-close=\"outside\" [attr.aria-expanded]=\"isOpen\" [attr.aria-haspopup]=\"true\" [attr.aria-label]=\"placeholder\" [class.disabled]=\"disabled\"\n [class.is-invalid]=\"invalid\" (click)=\"toggleDropdown()\" readonly\n [ngClass]=\"{\n 'rounded-start-0': leftButtonTemplate,\n 'rounded-end-0': rightButtonTemplate,\n }\" >\n <span class=\"w-100 overflow-hidden text-truncate\"> {{ displayValue() }} </span> \n </div>\n\n <div class=\"dropdown-menu p-2 w-100\" [class.show]=\"isOpen\" style=\"max-height: 320px; overflow-y: auto;\" >\n <div class=\"dropdown-search input-group mb-2\">\n <input class=\"form-control form-control-sm\" type=\"search\" [placeholder]=\"searchPlaceholder\" [formControl]=\"searchControl\" aria-label=\"Pesquisar op\u00E7\u00F5es\" (keyup.enter)=\"filterButtonClick.emit(searchControl.value)\" />\n <button class=\"btn btn-sm btn-primary\" type=\"button\" (click)=\"filterButtonClick.emit(searchControl.value)\"> <lib-icon iconName=\"lupa\" iconSize=\"medium-small\" /> </button>\n </div>\n\n @if (multiple && selectedValues?.length) {\n <div class=\"d-flex flex-row gap-2 flex-wrap my-2\">\n <span *ngFor=\"let value of selectedValues; trackBy: trackByFn\" class=\"px-3 badge rounded-pill text-primary bg-primary-subtle\">\n {{ value[customLabel] }} <lib-icon class=\"glb-cursor-pointer\" iconName=\"fechar\" iconSize=\"small\" (click)=\"select(value)\" />\n </span>\n </div>\n }\n\n <!-- Se utilizar o filtro interno utiliza a propriedade de lista filteredItems$, caso contr\u00E1rio usa a pr\u00F3pria list pois ela ser\u00E1 filtrada pelo componente pai -->\n <ng-container *ngIf=\"(innerFilter ? (filteredItems$ | async) : list) as items\">\n @if (items.length === 0) { <div class=\"py-2 px-3 text-muted small\">{{ noResultsText }}</div> }\n\n @if (value !== '' && value !== null) {\n <button type=\"button\" class=\"dropdown-item d-flex align-items-center\" (click)=\"writeValue(null)\">\n <span class=\"fw-bold\">Limpar {{ multiple ? 'op\u00E7\u00F5es selecionadas' : 'op\u00E7\u00E3o selecionada' }}</span>\n </button>\n }\n\n <button *ngFor=\"let item of items; trackBy: trackByFn\" class=\"dropdown-item d-flex align-items-center\" type=\"button\"\n (click)=\"select(item)\" [attr.aria-selected]=\"isSelected(item)\" >\n\n @if (optionTemplate) {\n <ng-container *ngTemplateOutlet=\"optionTemplate; context: { $implicit: item, selected: isSelected(item) }\"></ng-container>\n }\n @else {\n <div class=\"w-100 original\">\n <div class=\"d-flex justify-content-between\">\n <div>{{ (item[customLabel] ?? item[customValue]) }}</div>\n <small class=\"text-muted\" *ngIf=\"isSelected(item)\">\u2713</small>\n </div>\n </div>\n }\n </button>\n </ng-container>\n </div>\n </div>\n\n @if (rightButtonTemplate) { <ng-container *ngTemplateOutlet=\"rightButtonTemplate\"></ng-container> }\n</div>\n", styles: [".reusable-combobox{position:relative;display:flex;flex-wrap:nowrap;width:100%;max-width:100%}.reusable-combobox #toggle-button{box-sizing:border-box}.reusable-combobox .dropdown-menu{width:100%;box-shadow:0 6px 18px #00000014;border-radius:.5rem}.reusable-combobox .dropdown-item{cursor:pointer;border-radius:6px;transition:all .3s ease}.reusable-combobox .dropdown-item:hover:not(:focus){background-color:#f1f5f9}.reusable-combobox.compact .dropdown-menu{max-height:200px}.bg-primary-subtle{background-color:#d1dfe7!important}::-webkit-scrollbar{width:4px;background:transparent}::-webkit-scrollbar-thumb{background:#bbb;border-radius:16px}\n"] }]
|
|
8246
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }], propDecorators: { list: [{
|
|
8183
8247
|
type: Input
|
|
8184
8248
|
}], placeholder: [{
|
|
8185
8249
|
type: Input
|
|
@@ -8209,9 +8273,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
8209
8273
|
}], toggleButton: [{
|
|
8210
8274
|
type: ViewChild,
|
|
8211
8275
|
args: ["toggleButton", { static: true }]
|
|
8212
|
-
}], reusableComboboxContainer: [{
|
|
8213
|
-
type: ViewChild,
|
|
8214
|
-
args: ["reusableComboboxContainer", { static: true }]
|
|
8215
8276
|
}], selectionChange: [{
|
|
8216
8277
|
type: Output
|
|
8217
8278
|
}], filterChange: [{
|
|
@@ -10815,25 +10876,17 @@ class TreeComponent {
|
|
|
10815
10876
|
this.onSelect.emit(false);
|
|
10816
10877
|
}
|
|
10817
10878
|
}
|
|
10818
|
-
onCheckEvent(items) {
|
|
10819
|
-
if (this.indeterminateCheck(items)) {
|
|
10820
|
-
this.onEvent.emit(true);
|
|
10821
|
-
}
|
|
10822
|
-
else {
|
|
10823
|
-
this.onEvent.emit(false);
|
|
10824
|
-
}
|
|
10825
|
-
}
|
|
10826
10879
|
// #endregion ==========> PUBLIC METHODS <==========
|
|
10827
10880
|
// #region ==========> PRIVATE METHODS <==========
|
|
10828
10881
|
indeterminateCheck(list) {
|
|
10829
10882
|
return list.some(this.checked);
|
|
10830
10883
|
}
|
|
10831
10884
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
10832
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: TreeComponent, isStandalone: true, selector: "app-tree, lib-tree", inputs: { items: "items", openAll: "openAll", checkbox: "checkbox", filter: "filter" }, outputs: { onSelect: "onSelect", onEvent: "onEvent" }, ngImport: i0, template: "<!-- FILTER -->\n<ng-template [ngIf]=\"filter\">\n <!-- <app-search-filters></app-search-filters> -->\n\n <div class=\"input-group glb-search-input my-3\">\n <span class=\"input-group-text search px-2 glb-bg-color-white\">\n <lib-icon iconName=\"lupa\" iconColor=\"gray\" iconSize=\"medium-small\"\n class=\"d-flex align-items-center\"></lib-icon>\n </span>\n <input type=\"text\" class=\"form-control border-left-none ps-0\" [(ngModel)]=\"search\">\n </div>\n \n</ng-template>\n<!-- TREE -->\n<ul class=\"tree-view\">\n <ng-container *ngFor=\"let item of items | TreeFilter : search; index as i\">\n <div class=\"container py-1\" [class]=\"!item.has_children ? 'children' : null \">\n <lib-icon\n class=\"chevron\"\n *ngIf=\"item.has_children\"\n [class]=\"item.aplicClass ? 'rotate' : null\"\n (click)=\"\n onExpand(item);\n item.aplicClass ? (item.aplicClass = false) : (item.aplicClass = true)\n \"\n iconSize=\"medium-small\"\n iconName=\"seta-direita\"\n ></lib-icon>\n <!-- CHECKBOX -->\n <ng-template [ngIf]=\"checkbox\">\n <input\n type=\"checkbox\"\n class=\"form-check-input m-0 position-relative\"\n
|
|
10885
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: TreeComponent, isStandalone: true, selector: "app-tree, lib-tree", inputs: { items: "items", openAll: "openAll", checkbox: "checkbox", filter: "filter" }, outputs: { onSelect: "onSelect", onEvent: "onEvent" }, ngImport: i0, template: "<!-- FILTER -->\n<ng-template [ngIf]=\"filter\">\n <!-- <app-search-filters></app-search-filters> -->\n\n <div class=\"input-group glb-search-input my-3\">\n <span class=\"input-group-text search px-2 glb-bg-color-white\">\n <lib-icon iconName=\"lupa\" iconColor=\"gray\" iconSize=\"medium-small\"\n class=\"d-flex align-items-center\"></lib-icon>\n </span>\n <input type=\"text\" class=\"form-control border-left-none ps-0\" [(ngModel)]=\"search\">\n </div>\n \n</ng-template>\n<!-- TREE -->\n<ul class=\"tree-view\">\n <ng-container *ngFor=\"let item of items | TreeFilter : search; index as i\">\n <div class=\"container py-1\" [class]=\"!item.has_children ? 'children' : null \">\n <lib-icon\n class=\"chevron\"\n *ngIf=\"item.has_children\"\n [class]=\"item.aplicClass ? 'rotate' : null\"\n (click)=\"\n onExpand(item);\n item.aplicClass ? (item.aplicClass = false) : (item.aplicClass = true)\n \"\n iconSize=\"medium-small\"\n iconName=\"seta-direita\"\n ></lib-icon>\n <!-- CHECKBOX -->\n <ng-template [ngIf]=\"checkbox\">\n <input\n type=\"checkbox\"\n class=\"form-check-input m-0 position-relative\"\n (change)=\"onCheck(items, item)\"\n [(ngModel)]=\"item.is_selected\"\n />\n </ng-template>\n\n <lib-icon *ngIf=\"item.icon\" [iconName]=\"item.icon\" iconSize=\"medium-small\" class=\"ms-2\" />\n\n <label class=\"label mb-0 ms-2\">{{ item.label }}</label>\n </div>\n <!-- NODES -->\n <ul *ngIf=\"item.expanded\">\n <app-tree\n (onSelect)=\"item.is_selected = $event\"\n (onEvent)=\"item.is_selected = $event\"\n [items]=\"item.children ?? []\"\n [checkbox]=\"checkbox\"\n ></app-tree>\n </ul>\n </ng-container>\n</ul>", styles: ["*{font-family:Open Sans,Arial,Helvetica,sans-serif;color:#000;box-sizing:border-box;list-style:none;font-size:1rem}.tree-view{margin:0;padding:0;list-style-type:none;transition:all .3s ease-in-out}.container{margin:0;padding:0;display:flex;align-items:center}.chevron{position:relative;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.3s ease-in-out;-moz-transition:.3s ease-in-out;-o-transition:.3s ease-in-out;transition:.3s ease-in-out;color:#000;cursor:pointer}.chevron:hover{color:#0d6efd;transform:rotate(30deg)}.chevron.rotate{transform:rotate(90deg);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);-moz-transform:rotate(90deg);-o-transform:rotate(90deg);transition:.3s}.form-check-input{cursor:pointer}.children{padding-left:20px}\n"], dependencies: [{ kind: "component", type: TreeComponent, selector: "app-tree, lib-tree", inputs: ["items", "openAll", "checkbox", "filter"], outputs: ["onSelect", "onEvent"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: SearchTreePipe, name: "TreeFilter" }] }); }
|
|
10833
10886
|
}
|
|
10834
10887
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TreeComponent, decorators: [{
|
|
10835
10888
|
type: Component,
|
|
10836
|
-
args: [{ selector: "app-tree, lib-tree", imports: [NgIf, LibIconsComponent, FormsModule, NgFor, SearchTreePipe], template: "<!-- FILTER -->\n<ng-template [ngIf]=\"filter\">\n <!-- <app-search-filters></app-search-filters> -->\n\n <div class=\"input-group glb-search-input my-3\">\n <span class=\"input-group-text search px-2 glb-bg-color-white\">\n <lib-icon iconName=\"lupa\" iconColor=\"gray\" iconSize=\"medium-small\"\n class=\"d-flex align-items-center\"></lib-icon>\n </span>\n <input type=\"text\" class=\"form-control border-left-none ps-0\" [(ngModel)]=\"search\">\n </div>\n \n</ng-template>\n<!-- TREE -->\n<ul class=\"tree-view\">\n <ng-container *ngFor=\"let item of items | TreeFilter : search; index as i\">\n <div class=\"container py-1\" [class]=\"!item.has_children ? 'children' : null \">\n <lib-icon\n class=\"chevron\"\n *ngIf=\"item.has_children\"\n [class]=\"item.aplicClass ? 'rotate' : null\"\n (click)=\"\n onExpand(item);\n item.aplicClass ? (item.aplicClass = false) : (item.aplicClass = true)\n \"\n iconSize=\"medium-small\"\n iconName=\"seta-direita\"\n ></lib-icon>\n <!-- CHECKBOX -->\n <ng-template [ngIf]=\"checkbox\">\n <input\n type=\"checkbox\"\n class=\"form-check-input m-0 position-relative\"\n
|
|
10889
|
+
args: [{ selector: "app-tree, lib-tree", imports: [NgIf, LibIconsComponent, FormsModule, NgFor, SearchTreePipe], template: "<!-- FILTER -->\n<ng-template [ngIf]=\"filter\">\n <!-- <app-search-filters></app-search-filters> -->\n\n <div class=\"input-group glb-search-input my-3\">\n <span class=\"input-group-text search px-2 glb-bg-color-white\">\n <lib-icon iconName=\"lupa\" iconColor=\"gray\" iconSize=\"medium-small\"\n class=\"d-flex align-items-center\"></lib-icon>\n </span>\n <input type=\"text\" class=\"form-control border-left-none ps-0\" [(ngModel)]=\"search\">\n </div>\n \n</ng-template>\n<!-- TREE -->\n<ul class=\"tree-view\">\n <ng-container *ngFor=\"let item of items | TreeFilter : search; index as i\">\n <div class=\"container py-1\" [class]=\"!item.has_children ? 'children' : null \">\n <lib-icon\n class=\"chevron\"\n *ngIf=\"item.has_children\"\n [class]=\"item.aplicClass ? 'rotate' : null\"\n (click)=\"\n onExpand(item);\n item.aplicClass ? (item.aplicClass = false) : (item.aplicClass = true)\n \"\n iconSize=\"medium-small\"\n iconName=\"seta-direita\"\n ></lib-icon>\n <!-- CHECKBOX -->\n <ng-template [ngIf]=\"checkbox\">\n <input\n type=\"checkbox\"\n class=\"form-check-input m-0 position-relative\"\n (change)=\"onCheck(items, item)\"\n [(ngModel)]=\"item.is_selected\"\n />\n </ng-template>\n\n <lib-icon *ngIf=\"item.icon\" [iconName]=\"item.icon\" iconSize=\"medium-small\" class=\"ms-2\" />\n\n <label class=\"label mb-0 ms-2\">{{ item.label }}</label>\n </div>\n <!-- NODES -->\n <ul *ngIf=\"item.expanded\">\n <app-tree\n (onSelect)=\"item.is_selected = $event\"\n (onEvent)=\"item.is_selected = $event\"\n [items]=\"item.children ?? []\"\n [checkbox]=\"checkbox\"\n ></app-tree>\n </ul>\n </ng-container>\n</ul>", styles: ["*{font-family:Open Sans,Arial,Helvetica,sans-serif;color:#000;box-sizing:border-box;list-style:none;font-size:1rem}.tree-view{margin:0;padding:0;list-style-type:none;transition:all .3s ease-in-out}.container{margin:0;padding:0;display:flex;align-items:center}.chevron{position:relative;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.3s ease-in-out;-moz-transition:.3s ease-in-out;-o-transition:.3s ease-in-out;transition:.3s ease-in-out;color:#000;cursor:pointer}.chevron:hover{color:#0d6efd;transform:rotate(30deg)}.chevron.rotate{transform:rotate(90deg);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);-moz-transform:rotate(90deg);-o-transform:rotate(90deg);transition:.3s}.form-check-input{cursor:pointer}.children{padding-left:20px}\n"] }]
|
|
10837
10890
|
}], ctorParameters: () => [], propDecorators: { items: [{
|
|
10838
10891
|
type: Input
|
|
10839
10892
|
}], openAll: [{
|