tailjng 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/interfaces/crud/filter.interface.d.ts +6 -0
- package/package.json +1 -1
- package/src/lib/components/filter/filter-complete/complete-filter.component.html +62 -57
- package/src/lib/components/filter/filter-complete/complete-filter.component.ts +2 -1
- package/src/lib/components/select/select-dropdown/dropdown-select.component.html +20 -6
- package/src/lib/components/select/select-dropdown/dropdown-select.component.ts +371 -64
- package/src/lib/components/select/select-dropdown/dropdown-select.util.ts +154 -3
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.html +20 -5
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.ts +357 -59
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.util.ts +7 -0
|
@@ -67,6 +67,8 @@ export interface DropdownFilterSelect {
|
|
|
67
67
|
optionLabel?: string | string[];
|
|
68
68
|
optionValue?: string;
|
|
69
69
|
labelSeparator?: string;
|
|
70
|
+
optionLabelTemplate?: string;
|
|
71
|
+
optionLabelFn?: (option: Record<string, unknown>) => string;
|
|
70
72
|
placeholder?: string;
|
|
71
73
|
showClear?: boolean;
|
|
72
74
|
options: any[];
|
|
@@ -85,6 +87,10 @@ export interface SearchableFilterSelect {
|
|
|
85
87
|
optionLabel: string | string[];
|
|
86
88
|
optionValue: string;
|
|
87
89
|
labelSeparator?: string;
|
|
90
|
+
optionLabelTemplate?: string;
|
|
91
|
+
optionLabelFn?: (option: Record<string, unknown>) => string;
|
|
92
|
+
responseKey?: string;
|
|
93
|
+
dataPath?: string;
|
|
88
94
|
placeholder?: string;
|
|
89
95
|
showClear?: boolean;
|
|
90
96
|
loadOnInit?: boolean;
|
package/package.json
CHANGED
|
@@ -139,63 +139,68 @@
|
|
|
139
139
|
<div class="flex flex-col gap-2">
|
|
140
140
|
@for (filter of filtersSelect; track $index) {
|
|
141
141
|
@if (filter.isVisible ?? true) {
|
|
142
|
-
@
|
|
143
|
-
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
142
|
+
@switch (filter.type) {
|
|
143
|
+
@case ("dropdown") {
|
|
144
|
+
<div class="relative">
|
|
145
|
+
<JDropdownSelect
|
|
146
|
+
[type]="'dropdown'"
|
|
147
|
+
[(ngModel)]="filter.selected"
|
|
148
|
+
(selectionChange)="
|
|
149
|
+
filter.onSelected ? filter.onSelected($event) : null
|
|
150
|
+
"
|
|
151
|
+
[optionLabel]="filter.optionLabel ?? ''"
|
|
152
|
+
[optionValue]="filter.optionValue ?? ''"
|
|
153
|
+
[labelSeparator]="filter.labelSeparator ?? ''"
|
|
154
|
+
[optionLabelTemplate]="filter.optionLabelTemplate ?? ''"
|
|
155
|
+
[optionLabelFn]="filter.optionLabelFn"
|
|
156
|
+
[placeholder]="filter.placeholder ?? ''"
|
|
157
|
+
[showClear]="filter.showClear ?? false"
|
|
158
|
+
[options]="filter.options"
|
|
159
|
+
[sort]="filter.sort ?? 'ASC'"
|
|
160
|
+
[showAllOption]="filter.showAllOption ?? false"
|
|
161
|
+
[isFilterSelect]="true"
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
164
|
+
}
|
|
165
|
+
@case ("searchable") {
|
|
166
|
+
<div class="relative">
|
|
167
|
+
<JDropdownSelect
|
|
168
|
+
[type]="'searchable'"
|
|
169
|
+
[(ngModel)]="filter.selected"
|
|
170
|
+
(selectionChange)="filter.onSelected?.($event)"
|
|
171
|
+
[endpoint]="filter.endpoint"
|
|
172
|
+
[optionLabel]="filter.optionLabel"
|
|
173
|
+
[optionValue]="filter.optionValue"
|
|
174
|
+
[labelSeparator]="filter.labelSeparator ?? ''"
|
|
175
|
+
[optionLabelTemplate]="filter.optionLabelTemplate ?? ''"
|
|
176
|
+
[optionLabelFn]="filter.optionLabelFn"
|
|
177
|
+
[responseKey]="filter.responseKey ?? ''"
|
|
178
|
+
[dataPath]="filter.dataPath ?? ''"
|
|
179
|
+
[placeholder]="filter.placeholder ?? ''"
|
|
180
|
+
[showClear]="filter.showClear ?? false"
|
|
181
|
+
[loadOnInit]="filter.loadOnInit ?? false"
|
|
182
|
+
[isSearch]="filter.isSearch ?? true"
|
|
183
|
+
[searchFields]="filter.searchFields || []"
|
|
184
|
+
[defaultFilters]="filter.defaultFilters || {}"
|
|
185
|
+
[sort]="filter.sort ?? 'ASC'"
|
|
186
|
+
[showAllOption]="filter.showAllOption ?? false"
|
|
187
|
+
[isFilterSelect]="true"
|
|
188
|
+
/>
|
|
189
|
+
</div>
|
|
190
|
+
}
|
|
191
|
+
@case ("multi-table") {
|
|
192
|
+
<div class="relative">
|
|
193
|
+
<JMultiTableSelect
|
|
194
|
+
[(ngModel)]="filter.selected"
|
|
195
|
+
(selectionChange)="
|
|
196
|
+
filter.onSelected ? filter.onSelected($event) : null
|
|
197
|
+
"
|
|
198
|
+
[columns]="filter.columns"
|
|
199
|
+
[btnText]="filter.btnText ?? ''"
|
|
200
|
+
[isFilterSelect]="true"
|
|
201
|
+
/>
|
|
202
|
+
</div>
|
|
203
|
+
}
|
|
199
204
|
}
|
|
200
205
|
}
|
|
201
206
|
}
|
|
@@ -2,7 +2,8 @@ import { Component, EventEmitter, Input, Output, OnDestroy, OnInit, ViewChild, E
|
|
|
2
2
|
import { NgClass } from '@angular/common';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
4
|
import { Subject, Subscription, debounceTime, filter, forkJoin } from 'rxjs';
|
|
5
|
-
import { TableColumn, FilterButton,
|
|
5
|
+
import { TableColumn, FilterButton, JUploadFilterService, JAlertDialogService, JAlertToastService, JGenericCrudService, LoadingState, JExcelService, JExcelFilterService } from 'tailjng';
|
|
6
|
+
import type { FilterSelect } from '../../../interfaces/crud/filter.interface';
|
|
6
7
|
import { JDropdownSelectComponent } from '../../select/select-dropdown/dropdown-select.component';
|
|
7
8
|
import { JMultiTableSelectComponent } from '../../select/select-multi-table/multi-table-select.component';
|
|
8
9
|
import { JSwitchCheckboxComponent } from '../../checkbox/checkbox-switch/switch-checkbox.component';
|
|
@@ -115,9 +115,11 @@
|
|
|
115
115
|
|
|
116
116
|
<!-- Option list -->
|
|
117
117
|
<div
|
|
118
|
+
#optionsList
|
|
118
119
|
class="jdropdown-options-list max-h-45 max-[400px]:max-h-38 overflow-x-hidden overflow-y-auto flex flex-col gap-1 scroll-element"
|
|
120
|
+
(scroll)="onOptionsListScroll($event)"
|
|
119
121
|
>
|
|
120
|
-
@if (isLoading) {
|
|
122
|
+
@if (isLoading && filteredOptions.length === 0) {
|
|
121
123
|
<div
|
|
122
124
|
class="flex gap-3 text-black/50 dark:text-white/50 items-center justify-center py-4"
|
|
123
125
|
>
|
|
@@ -136,12 +138,11 @@
|
|
|
136
138
|
(click)="selectOption(option)"
|
|
137
139
|
class="flex gap-2 items-center border border-accent dark:border-dark-accent/50 px-3 py-2 rounded text-sm max-[400px]:h-[35px] max-[400px]:text-[12px] cursor-pointer text-black! dark:text-white! hover:bg-accent/50 hover:dark:bg-dark-accent/40"
|
|
138
140
|
[ngClass]="{
|
|
139
|
-
'bg-accent! dark:bg-dark-accent/80!':
|
|
140
|
-
|
|
141
|
-
'text-black': selectedValue === option.value,
|
|
141
|
+
'bg-accent! dark:bg-dark-accent/80!': isOptionSelected(option.value),
|
|
142
|
+
'text-black': isOptionSelected(option.value),
|
|
142
143
|
}"
|
|
143
144
|
>
|
|
144
|
-
@if (
|
|
145
|
+
@if (isOptionSelected(option.value)) {
|
|
145
146
|
<JIcon
|
|
146
147
|
[icon]="Icons.Check"
|
|
147
148
|
[size]="15"
|
|
@@ -164,11 +165,24 @@
|
|
|
164
165
|
</div>
|
|
165
166
|
</div>
|
|
166
167
|
}
|
|
167
|
-
@if (filteredOptions.length === 0) {
|
|
168
|
+
@if (filteredOptions.length === 0 && !isLoading) {
|
|
168
169
|
<div class="px-3 py-2 text-sm text-gray-500">
|
|
169
170
|
No hay opciones disponibles
|
|
170
171
|
</div>
|
|
171
172
|
}
|
|
173
|
+
@if (isLoadingMore) {
|
|
174
|
+
<div
|
|
175
|
+
class="flex gap-2 text-black/50 dark:text-white/50 items-center justify-center py-2"
|
|
176
|
+
>
|
|
177
|
+
<JIcon
|
|
178
|
+
[icon]="Icons.Loader2"
|
|
179
|
+
[size]="16"
|
|
180
|
+
iconClass="animate-spin"
|
|
181
|
+
[ariaHidden]="true"
|
|
182
|
+
/>
|
|
183
|
+
Cargando más...
|
|
184
|
+
</div>
|
|
185
|
+
}
|
|
172
186
|
}
|
|
173
187
|
</div>
|
|
174
188
|
</div>
|