@gipisistemas/ngx-core 1.0.17 → 1.0.18
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/fesm2022/gipisistemas-ngx-core.mjs +179 -112
- package/fesm2022/gipisistemas-ngx-core.mjs.map +1 -1
- package/index.d.ts +12 -6
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ import * as i3 from '@angular/material/input';
|
|
|
41
41
|
import { MatInputModule } from '@angular/material/input';
|
|
42
42
|
import { NgxMaskDirective, provideNgxMask } from 'ngx-mask';
|
|
43
43
|
import * as i1$7 from '@angular/material/paginator';
|
|
44
|
-
import {
|
|
44
|
+
import { MatPaginatorIntl, MatPaginatorModule, MatPaginator } from '@angular/material/paginator';
|
|
45
45
|
import { GlobalWorkerOptions, getDocument, OPS } from 'pdfjs-dist';
|
|
46
46
|
import { EventBus, PDFLinkService, PDFViewer } from 'pdfjs-dist/web/pdf_viewer.mjs';
|
|
47
47
|
import { __decorate } from 'tslib';
|
|
@@ -4007,11 +4007,9 @@ class BaseService {
|
|
|
4007
4007
|
const direction = 'direction' in value
|
|
4008
4008
|
? (value.direction ?? 'ASC')
|
|
4009
4009
|
: 'ASC';
|
|
4010
|
-
|
|
4011
|
-
params.set(key, paramValue);
|
|
4010
|
+
params.set(key, `${value.field},${direction.toUpperCase()}`);
|
|
4012
4011
|
}
|
|
4013
4012
|
else if (Array.isArray(value)) {
|
|
4014
|
-
paramValue = '';
|
|
4015
4013
|
for (const item of value) {
|
|
4016
4014
|
if (typeof item === 'object' && 'field' in item) {
|
|
4017
4015
|
const direction = 'direction' in item
|
|
@@ -4020,15 +4018,22 @@ class BaseService {
|
|
|
4020
4018
|
params.append('sort', `${item.field},${direction.toUpperCase()}`);
|
|
4021
4019
|
}
|
|
4022
4020
|
}
|
|
4021
|
+
continue;
|
|
4023
4022
|
}
|
|
4024
4023
|
}
|
|
4025
|
-
else {
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
paramValue = String(value).trim();
|
|
4024
|
+
else if (Array.isArray(value)) {
|
|
4025
|
+
for (const item of value) {
|
|
4026
|
+
if (item !== null && item !== undefined) {
|
|
4027
|
+
params.append(key, String(item));
|
|
4028
|
+
}
|
|
4031
4029
|
}
|
|
4030
|
+
continue;
|
|
4031
|
+
}
|
|
4032
|
+
else if (typeof value === 'object') {
|
|
4033
|
+
paramValue = JSON.stringify(value);
|
|
4034
|
+
}
|
|
4035
|
+
else {
|
|
4036
|
+
paramValue = String(value).trim();
|
|
4032
4037
|
}
|
|
4033
4038
|
if (key !== 'sort') {
|
|
4034
4039
|
params.set(key, paramValue);
|
|
@@ -5255,6 +5260,12 @@ class BaseListComponent extends BaseComponent {
|
|
|
5255
5260
|
return (!ArrayUtil.isEmpty(this.appliedFilters) &&
|
|
5256
5261
|
this.appliedFilters().findIndex((e) => e.key === key) >= 0);
|
|
5257
5262
|
}
|
|
5263
|
+
hasAnyAvailableAction(actions, canExecuteAction) {
|
|
5264
|
+
if (ArrayUtil.isEmpty(actions)) {
|
|
5265
|
+
return false;
|
|
5266
|
+
}
|
|
5267
|
+
return actions.some((action) => canExecuteAction(action));
|
|
5268
|
+
}
|
|
5258
5269
|
/**
|
|
5259
5270
|
* Método chamado quando o componente é inicializado.
|
|
5260
5271
|
* - Chamado no OnInit
|
|
@@ -10729,6 +10740,20 @@ class DatePickerCalendar {
|
|
|
10729
10740
|
this.yearRangeStart.set(Math.floor(this.currentYear() / YEARS_DISPLAYED) * YEARS_DISPLAYED);
|
|
10730
10741
|
}
|
|
10731
10742
|
}
|
|
10743
|
+
navigatePrevious() {
|
|
10744
|
+
if (this.showMonthYearPicker() && this.monthYearPickerView() === 'year') {
|
|
10745
|
+
this.previousYearRange();
|
|
10746
|
+
return;
|
|
10747
|
+
}
|
|
10748
|
+
this.previousMonth();
|
|
10749
|
+
}
|
|
10750
|
+
navigateNext() {
|
|
10751
|
+
if (this.showMonthYearPicker() && this.monthYearPickerView() === 'year') {
|
|
10752
|
+
this.nextYearRange();
|
|
10753
|
+
return;
|
|
10754
|
+
}
|
|
10755
|
+
this.nextMonth();
|
|
10756
|
+
}
|
|
10732
10757
|
previousMonth() {
|
|
10733
10758
|
if (this.currentMonth() === 0) {
|
|
10734
10759
|
this.currentMonth.set(11);
|
|
@@ -11838,24 +11863,26 @@ class DatePickerCalendar {
|
|
|
11838
11863
|
|
|
11839
11864
|
<div class="g-navigation-buttons">
|
|
11840
11865
|
<button
|
|
11841
|
-
aria-label="
|
|
11866
|
+
[attr.aria-label]="
|
|
11867
|
+
showMonthYearPicker() && monthYearPickerView() === 'year'
|
|
11868
|
+
? 'Anos anteriores'
|
|
11869
|
+
: 'Mês anterior'
|
|
11870
|
+
"
|
|
11842
11871
|
type="button"
|
|
11843
11872
|
class="g-nav-button"
|
|
11844
|
-
(click)="
|
|
11845
|
-
monthYearPickerView() === 'year'
|
|
11846
|
-
? previousYearRange()
|
|
11847
|
-
: previousMonth()
|
|
11848
|
-
"
|
|
11873
|
+
(click)="navigatePrevious()"
|
|
11849
11874
|
>
|
|
11850
11875
|
<span class="material-symbols-rounded">chevron_left</span>
|
|
11851
11876
|
</button>
|
|
11852
11877
|
<button
|
|
11853
|
-
aria-label="
|
|
11878
|
+
[attr.aria-label]="
|
|
11879
|
+
showMonthYearPicker() && monthYearPickerView() === 'year'
|
|
11880
|
+
? 'Próximos anos'
|
|
11881
|
+
: 'Próximo mês'
|
|
11882
|
+
"
|
|
11854
11883
|
type="button"
|
|
11855
11884
|
class="g-nav-button"
|
|
11856
|
-
(click)="
|
|
11857
|
-
monthYearPickerView() === 'year' ? nextYearRange() : nextMonth()
|
|
11858
|
-
"
|
|
11885
|
+
(click)="navigateNext()"
|
|
11859
11886
|
>
|
|
11860
11887
|
<span class="material-symbols-rounded">chevron_right</span>
|
|
11861
11888
|
</button>
|
|
@@ -12438,24 +12465,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
12438
12465
|
|
|
12439
12466
|
<div class="g-navigation-buttons">
|
|
12440
12467
|
<button
|
|
12441
|
-
aria-label="
|
|
12468
|
+
[attr.aria-label]="
|
|
12469
|
+
showMonthYearPicker() && monthYearPickerView() === 'year'
|
|
12470
|
+
? 'Anos anteriores'
|
|
12471
|
+
: 'Mês anterior'
|
|
12472
|
+
"
|
|
12442
12473
|
type="button"
|
|
12443
12474
|
class="g-nav-button"
|
|
12444
|
-
(click)="
|
|
12445
|
-
monthYearPickerView() === 'year'
|
|
12446
|
-
? previousYearRange()
|
|
12447
|
-
: previousMonth()
|
|
12448
|
-
"
|
|
12475
|
+
(click)="navigatePrevious()"
|
|
12449
12476
|
>
|
|
12450
12477
|
<span class="material-symbols-rounded">chevron_left</span>
|
|
12451
12478
|
</button>
|
|
12452
12479
|
<button
|
|
12453
|
-
aria-label="
|
|
12480
|
+
[attr.aria-label]="
|
|
12481
|
+
showMonthYearPicker() && monthYearPickerView() === 'year'
|
|
12482
|
+
? 'Próximos anos'
|
|
12483
|
+
: 'Próximo mês'
|
|
12484
|
+
"
|
|
12454
12485
|
type="button"
|
|
12455
12486
|
class="g-nav-button"
|
|
12456
|
-
(click)="
|
|
12457
|
-
monthYearPickerView() === 'year' ? nextYearRange() : nextMonth()
|
|
12458
|
-
"
|
|
12487
|
+
(click)="navigateNext()"
|
|
12459
12488
|
>
|
|
12460
12489
|
<span class="material-symbols-rounded">chevron_right</span>
|
|
12461
12490
|
</button>
|
|
@@ -17442,9 +17471,12 @@ class InputPhone extends BaseControlValueAccessor {
|
|
|
17442
17471
|
this._uniqueId = inject(_IdGenerator).getId('gipi-input-phone-');
|
|
17443
17472
|
this._controlId = inject(_IdGenerator).getId('gipi-input-phone-control-');
|
|
17444
17473
|
this._inputElementRef = viewChild('inputElement', ...(ngDevMode ? [{ debugName: "_inputElementRef" }] : []));
|
|
17474
|
+
this._syncResetHandle = null;
|
|
17445
17475
|
this.prefixRef = contentChild('prefix', ...(ngDevMode ? [{ debugName: "prefixRef" }] : []));
|
|
17446
17476
|
this.suffixRef = contentChild('suffix', ...(ngDevMode ? [{ debugName: "suffixRef" }] : []));
|
|
17447
17477
|
this.ngControl = viewChild(NgControl, ...(ngDevMode ? [{ debugName: "ngControl" }] : []));
|
|
17478
|
+
this._isSynchronizingViewValue = signal(false, ...(ngDevMode ? [{ debugName: "_isSynchronizingViewValue" }] : []));
|
|
17479
|
+
this.displayValue = signal('', ...(ngDevMode ? [{ debugName: "displayValue" }] : []));
|
|
17448
17480
|
this.isInputFocused = signal(false, ...(ngDevMode ? [{ debugName: "isInputFocused" }] : []));
|
|
17449
17481
|
this.label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
17450
17482
|
this.placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
@@ -17464,21 +17496,43 @@ class InputPhone extends BaseControlValueAccessor {
|
|
|
17464
17496
|
this.phoneMask = signal('0*', ...(ngDevMode ? [{ debugName: "phoneMask" }] : []));
|
|
17465
17497
|
}
|
|
17466
17498
|
writeControlValue(value, setModelValue) {
|
|
17467
|
-
const newValue = value || '';
|
|
17468
|
-
this.
|
|
17469
|
-
|
|
17470
|
-
|
|
17471
|
-
|
|
17472
|
-
|
|
17499
|
+
const newValue = this._normalizeModelValue(value || '');
|
|
17500
|
+
this._synchronizeViewValue(() => {
|
|
17501
|
+
if (setModelValue) {
|
|
17502
|
+
setModelValue(newValue);
|
|
17503
|
+
}
|
|
17504
|
+
else {
|
|
17505
|
+
this.value.set(newValue);
|
|
17506
|
+
}
|
|
17507
|
+
this._applyViewValue(newValue);
|
|
17508
|
+
});
|
|
17473
17509
|
}
|
|
17474
17510
|
onInputChange(value) {
|
|
17475
|
-
if (this.$disabled()) {
|
|
17511
|
+
if (this.$disabled() || this._isSynchronizingViewValue()) {
|
|
17476
17512
|
return;
|
|
17477
17513
|
}
|
|
17478
|
-
this.
|
|
17479
|
-
this.
|
|
17514
|
+
const modelValue = this._normalizeModelValue(value);
|
|
17515
|
+
this.displayValue.set(value || '');
|
|
17516
|
+
this._updatePhoneMask(modelValue);
|
|
17517
|
+
this.notifyValueChange(modelValue);
|
|
17480
17518
|
this.markAsTouched();
|
|
17481
17519
|
}
|
|
17520
|
+
_synchronizeViewValue(syncFn) {
|
|
17521
|
+
// O ngx-mask pode ecoar um ngModelChange apos writeValue/mudancas de mascara.
|
|
17522
|
+
this._isSynchronizingViewValue.set(true);
|
|
17523
|
+
if (this._syncResetHandle !== null) {
|
|
17524
|
+
clearTimeout(this._syncResetHandle);
|
|
17525
|
+
}
|
|
17526
|
+
try {
|
|
17527
|
+
syncFn();
|
|
17528
|
+
}
|
|
17529
|
+
finally {
|
|
17530
|
+
this._syncResetHandle = setTimeout(() => {
|
|
17531
|
+
this._isSynchronizingViewValue.set(false);
|
|
17532
|
+
this._syncResetHandle = null;
|
|
17533
|
+
});
|
|
17534
|
+
}
|
|
17535
|
+
}
|
|
17482
17536
|
_updatePhoneMask(value) {
|
|
17483
17537
|
if (this.foreign()) {
|
|
17484
17538
|
this.phoneMask.set('0*');
|
|
@@ -17494,6 +17548,22 @@ class InputPhone extends BaseControlValueAccessor {
|
|
|
17494
17548
|
this.phoneMask.set(mask);
|
|
17495
17549
|
}
|
|
17496
17550
|
}
|
|
17551
|
+
_applyViewValue(value) {
|
|
17552
|
+
this.displayValue.set(this._formatDisplayValue(value));
|
|
17553
|
+
this._updatePhoneMask(value);
|
|
17554
|
+
}
|
|
17555
|
+
_formatDisplayValue(value) {
|
|
17556
|
+
if (StringUtil.isEmpty(value) || this.foreign() || this.isInputFocused()) {
|
|
17557
|
+
return value;
|
|
17558
|
+
}
|
|
17559
|
+
return PhoneUtil.format(value);
|
|
17560
|
+
}
|
|
17561
|
+
_normalizeModelValue(value) {
|
|
17562
|
+
if (StringUtil.isEmpty(value) || this.foreign()) {
|
|
17563
|
+
return value || '';
|
|
17564
|
+
}
|
|
17565
|
+
return PhoneUtil.removeCharacters(value);
|
|
17566
|
+
}
|
|
17497
17567
|
onInputKeydown(event) {
|
|
17498
17568
|
if (this.readonly() || this.$disabled()) {
|
|
17499
17569
|
return;
|
|
@@ -17507,7 +17577,7 @@ class InputPhone extends BaseControlValueAccessor {
|
|
|
17507
17577
|
this.isInputFocused.set(true);
|
|
17508
17578
|
// Para telefones nacionais, simplifica a máscara durante o foco
|
|
17509
17579
|
if (!this.foreign()) {
|
|
17510
|
-
this.
|
|
17580
|
+
this._synchronizeViewValue(() => this._applyViewValue(this.value()));
|
|
17511
17581
|
}
|
|
17512
17582
|
this.onFocusEvent.emit(event);
|
|
17513
17583
|
}
|
|
@@ -17518,15 +17588,7 @@ class InputPhone extends BaseControlValueAccessor {
|
|
|
17518
17588
|
this.isInputFocused.set(false);
|
|
17519
17589
|
// Para telefones nacionais, formata o número ao sair do campo
|
|
17520
17590
|
if (!this.foreign()) {
|
|
17521
|
-
|
|
17522
|
-
if (!StringUtil.isEmpty(currentValue)) {
|
|
17523
|
-
const formattedValue = PhoneUtil.format(currentValue);
|
|
17524
|
-
if (formattedValue !== currentValue) {
|
|
17525
|
-
this.value.set(formattedValue);
|
|
17526
|
-
this.notifyValueChange(formattedValue);
|
|
17527
|
-
}
|
|
17528
|
-
this._updatePhoneMask(formattedValue);
|
|
17529
|
-
}
|
|
17591
|
+
this._synchronizeViewValue(() => this._applyViewValue(this.value()));
|
|
17530
17592
|
}
|
|
17531
17593
|
this.onBlurEvent.emit(event);
|
|
17532
17594
|
this.markAsTouched();
|
|
@@ -17535,22 +17597,19 @@ class InputPhone extends BaseControlValueAccessor {
|
|
|
17535
17597
|
if (this.$disabled() || !this._inputElementRef()?.nativeElement) {
|
|
17536
17598
|
return;
|
|
17537
17599
|
}
|
|
17538
|
-
setTimeout(() =>
|
|
17539
|
-
this._inputElementRef()?.nativeElement?.focus(options);
|
|
17540
|
-
});
|
|
17600
|
+
setTimeout(() => this._inputElementRef()?.nativeElement?.focus(options));
|
|
17541
17601
|
}
|
|
17542
17602
|
select() {
|
|
17543
17603
|
if (this.$disabled() || !this._inputElementRef()?.nativeElement) {
|
|
17544
17604
|
return;
|
|
17545
17605
|
}
|
|
17546
|
-
setTimeout(() =>
|
|
17547
|
-
this._inputElementRef()?.nativeElement?.select();
|
|
17548
|
-
});
|
|
17606
|
+
setTimeout(() => this._inputElementRef()?.nativeElement?.select());
|
|
17549
17607
|
}
|
|
17550
17608
|
clear() {
|
|
17551
17609
|
if (this.$disabled()) {
|
|
17552
17610
|
return;
|
|
17553
17611
|
}
|
|
17612
|
+
this.displayValue.set('');
|
|
17554
17613
|
this.phoneMask.set('0*');
|
|
17555
17614
|
this.notifyValueChange('');
|
|
17556
17615
|
}
|
|
@@ -17589,7 +17648,7 @@ class InputPhone extends BaseControlValueAccessor {
|
|
|
17589
17648
|
[disabled]="$disabled()"
|
|
17590
17649
|
[readonly]="readonly()"
|
|
17591
17650
|
[required]="required()"
|
|
17592
|
-
[ngModel]="
|
|
17651
|
+
[ngModel]="displayValue()"
|
|
17593
17652
|
(ngModelChange)="onInputChange($event)"
|
|
17594
17653
|
(keydown)="onInputKeydown($event)"
|
|
17595
17654
|
(focus)="onInputFocus($event)"
|
|
@@ -17647,7 +17706,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
17647
17706
|
[disabled]="$disabled()"
|
|
17648
17707
|
[readonly]="readonly()"
|
|
17649
17708
|
[required]="required()"
|
|
17650
|
-
[ngModel]="
|
|
17709
|
+
[ngModel]="displayValue()"
|
|
17651
17710
|
(ngModelChange)="onInputChange($event)"
|
|
17652
17711
|
(keydown)="onInputKeydown($event)"
|
|
17653
17712
|
(focus)="onInputFocus($event)"
|
|
@@ -17767,63 +17826,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
17767
17826
|
}]
|
|
17768
17827
|
}] });
|
|
17769
17828
|
|
|
17829
|
+
const portugueseRangeLabel = (page, pageSize, length) => {
|
|
17830
|
+
if (length === 0 || pageSize === 0) {
|
|
17831
|
+
return `0 de ${length}`;
|
|
17832
|
+
}
|
|
17833
|
+
length = Math.max(length, 0);
|
|
17834
|
+
const startIndex = page * pageSize;
|
|
17835
|
+
// Se o índice inicial exceder o comprimento da lista, não tente fixar o índice final no final.
|
|
17836
|
+
const endIndex = startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize;
|
|
17837
|
+
return `${startIndex + 1} - ${endIndex} de ${length}`;
|
|
17838
|
+
};
|
|
17839
|
+
const PAGINATOR_INTL_PT_BR = () => {
|
|
17840
|
+
const paginatorIntl = new MatPaginatorIntl();
|
|
17841
|
+
paginatorIntl.itemsPerPageLabel = 'Itens por página';
|
|
17842
|
+
paginatorIntl.nextPageLabel = 'Próxima página';
|
|
17843
|
+
paginatorIntl.previousPageLabel = 'Página anterior';
|
|
17844
|
+
paginatorIntl.getRangeLabel = portugueseRangeLabel;
|
|
17845
|
+
paginatorIntl.firstPageLabel = 'Primeira página';
|
|
17846
|
+
paginatorIntl.lastPageLabel = 'Última página';
|
|
17847
|
+
return paginatorIntl;
|
|
17848
|
+
};
|
|
17849
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17850
|
+
const PaginatorIntlToken = new InjectionToken('PAGINATOR_INTL_TOKEN', {
|
|
17851
|
+
factory: () => PAGINATOR_INTL_PT_BR(),
|
|
17852
|
+
});
|
|
17853
|
+
function providePaginatorIntl(config) {
|
|
17854
|
+
return {
|
|
17855
|
+
provide: PaginatorIntlToken,
|
|
17856
|
+
useValue: config ?? PAGINATOR_INTL_PT_BR(),
|
|
17857
|
+
};
|
|
17858
|
+
}
|
|
17859
|
+
|
|
17770
17860
|
class Paginator {
|
|
17771
17861
|
constructor() {
|
|
17772
17862
|
this._uniqueId = inject(_IdGenerator).getId('gipi-paginator-');
|
|
17773
|
-
this.currentPage = signal(0, ...(ngDevMode ? [{ debugName: "currentPage" }] : []));
|
|
17774
|
-
this.currentPageSize = signal(0, ...(ngDevMode ? [{ debugName: "currentPageSize" }] : []));
|
|
17775
17863
|
this.id = input(this._uniqueId, ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
17776
17864
|
this.name = input(this._uniqueId, ...(ngDevMode ? [{ debugName: "name" }] : []));
|
|
17777
17865
|
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
17778
17866
|
this.hidePageSize = input(false, ...(ngDevMode ? [{ debugName: "hidePageSize", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
17779
17867
|
this.length = input(0, ...(ngDevMode ? [{ debugName: "length", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
17780
|
-
this.pageNumber = input(0, ...(ngDevMode ? [{ debugName: "pageNumber", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
17781
|
-
this.pageSize = input(0, ...(ngDevMode ? [{ debugName: "pageSize", transform: numberAttribute }] : [{ transform: numberAttribute }]));
|
|
17782
17868
|
this.pageSizeOptions = input([10, 20, 30], ...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : []));
|
|
17869
|
+
this.pageNumber = model(0, ...(ngDevMode ? [{ debugName: "pageNumber" }] : []));
|
|
17870
|
+
this.pageSize = model(0, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
|
|
17783
17871
|
this.onPage = output();
|
|
17784
|
-
this.currentPage.set(this.pageNumber());
|
|
17785
|
-
this.currentPageSize.set(this.pageSize());
|
|
17786
17872
|
}
|
|
17787
17873
|
onHandlePage(pageEvent) {
|
|
17788
17874
|
if (!pageEvent) {
|
|
17789
17875
|
return;
|
|
17790
17876
|
}
|
|
17791
|
-
this.
|
|
17792
|
-
this.
|
|
17877
|
+
this.pageNumber.set(pageEvent.pageIndex);
|
|
17878
|
+
this.pageSize.set(pageEvent.pageSize);
|
|
17793
17879
|
this.onPage.emit(pageEvent);
|
|
17794
17880
|
}
|
|
17795
17881
|
setPage(pageIndex) {
|
|
17796
|
-
this.
|
|
17882
|
+
this.pageNumber.set(pageIndex);
|
|
17797
17883
|
}
|
|
17798
17884
|
setPageSize(pageSize) {
|
|
17799
|
-
this.
|
|
17885
|
+
this.pageSize.set(pageSize);
|
|
17800
17886
|
}
|
|
17801
17887
|
nextPage() {
|
|
17802
|
-
this.
|
|
17888
|
+
this.pageNumber.update((page) => page + 1);
|
|
17803
17889
|
}
|
|
17804
17890
|
previousPage() {
|
|
17805
|
-
this.
|
|
17891
|
+
this.pageNumber.update((page) => Math.max(0, page - 1));
|
|
17806
17892
|
}
|
|
17807
17893
|
firstPage() {
|
|
17808
|
-
this.
|
|
17894
|
+
this.pageNumber.set(0);
|
|
17809
17895
|
}
|
|
17810
17896
|
lastPage() {
|
|
17811
|
-
const totalPages = Math.ceil(this.length() / this.
|
|
17812
|
-
this.
|
|
17897
|
+
const totalPages = Math.ceil(this.length() / this.pageSize());
|
|
17898
|
+
this.pageNumber.set(Math.max(0, totalPages - 1));
|
|
17813
17899
|
}
|
|
17814
17900
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: Paginator, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
17815
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.16", type: Paginator, isStandalone: true, selector: "gipi-paginator", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hidePageSize: { classPropertyName: "hidePageSize", publicName: "hidePageSize", isSignal: true, isRequired: false, transformFunction: null }, length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: false, transformFunction: null },
|
|
17901
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.16", type: Paginator, isStandalone: true, selector: "gipi-paginator", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hidePageSize: { classPropertyName: "hidePageSize", publicName: "hidePageSize", isSignal: true, isRequired: false, transformFunction: null }, length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: false, transformFunction: null }, pageSizeOptions: { classPropertyName: "pageSizeOptions", publicName: "pageSizeOptions", isSignal: true, isRequired: false, transformFunction: null }, pageNumber: { classPropertyName: "pageNumber", publicName: "pageNumber", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageNumber: "pageNumberChange", pageSize: "pageSizeChange", onPage: "onPage" }, host: { properties: { "attr.id": "id()", "attr.name": "name()" }, classAttribute: "g-paginator" }, providers: [
|
|
17902
|
+
{
|
|
17903
|
+
provide: MatPaginatorIntl,
|
|
17904
|
+
useFactory: () => inject(PaginatorIntlToken),
|
|
17905
|
+
},
|
|
17906
|
+
], exportAs: ["gPaginator"], ngImport: i0, template: `
|
|
17816
17907
|
<mat-paginator
|
|
17817
17908
|
class="g-paginator-control"
|
|
17818
17909
|
[disabled]="disabled()"
|
|
17819
17910
|
[hidePageSize]="hidePageSize()"
|
|
17820
17911
|
[length]="length()"
|
|
17821
|
-
[pageIndex]="
|
|
17822
|
-
[pageSize]="
|
|
17912
|
+
[pageIndex]="pageNumber()"
|
|
17913
|
+
[pageSize]="pageSize()"
|
|
17823
17914
|
[pageSizeOptions]="pageSizeOptions()"
|
|
17824
17915
|
[selectConfig]="{}"
|
|
17825
17916
|
[showFirstLastButtons]="true"
|
|
17826
|
-
(page)="onHandlePage($event)"
|
|
17917
|
+
(page)="onHandlePage($event)"
|
|
17918
|
+
/>
|
|
17827
17919
|
`, isInline: true, styles: [""], dependencies: [{ kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i1$7.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
17828
17920
|
}
|
|
17829
17921
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: Paginator, decorators: [{
|
|
@@ -17834,18 +17926,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
17834
17926
|
[disabled]="disabled()"
|
|
17835
17927
|
[hidePageSize]="hidePageSize()"
|
|
17836
17928
|
[length]="length()"
|
|
17837
|
-
[pageIndex]="
|
|
17838
|
-
[pageSize]="
|
|
17929
|
+
[pageIndex]="pageNumber()"
|
|
17930
|
+
[pageSize]="pageSize()"
|
|
17839
17931
|
[pageSizeOptions]="pageSizeOptions()"
|
|
17840
17932
|
[selectConfig]="{}"
|
|
17841
17933
|
[showFirstLastButtons]="true"
|
|
17842
|
-
(page)="onHandlePage($event)"
|
|
17934
|
+
(page)="onHandlePage($event)"
|
|
17935
|
+
/>
|
|
17843
17936
|
`, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
17844
17937
|
'[attr.id]': 'id()',
|
|
17845
17938
|
'[attr.name]': 'name()',
|
|
17846
17939
|
class: 'g-paginator',
|
|
17847
|
-
},
|
|
17848
|
-
|
|
17940
|
+
}, providers: [
|
|
17941
|
+
{
|
|
17942
|
+
provide: MatPaginatorIntl,
|
|
17943
|
+
useFactory: () => inject(PaginatorIntlToken),
|
|
17944
|
+
},
|
|
17945
|
+
], imports: [MatPaginatorModule] }]
|
|
17946
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], hidePageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidePageSize", required: false }] }], length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: false }] }], pageSizeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizeOptions", required: false }] }], pageNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageNumber", required: false }] }, { type: i0.Output, args: ["pageNumberChange"] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }, { type: i0.Output, args: ["pageSizeChange"] }], onPage: [{ type: i0.Output, args: ["onPage"] }] } });
|
|
17849
17947
|
class PaginatorModule {
|
|
17850
17948
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PaginatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
17851
17949
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: PaginatorModule, imports: [Paginator], exports: [Paginator] }); }
|
|
@@ -20783,37 +20881,6 @@ function Debounce(options = 300) {
|
|
|
20783
20881
|
};
|
|
20784
20882
|
}
|
|
20785
20883
|
|
|
20786
|
-
const portugueseRangeLabel = (page, pageSize, length) => {
|
|
20787
|
-
if (length === 0 || pageSize === 0) {
|
|
20788
|
-
return `0 de ${length}`;
|
|
20789
|
-
}
|
|
20790
|
-
length = Math.max(length, 0);
|
|
20791
|
-
const startIndex = page * pageSize;
|
|
20792
|
-
// Se o índice inicial exceder o comprimento da lista, não tente fixar o índice final no final.
|
|
20793
|
-
const endIndex = startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize;
|
|
20794
|
-
return `${startIndex + 1} - ${endIndex} de ${length}`;
|
|
20795
|
-
};
|
|
20796
|
-
const PAGINATOR_INTL_PT_BR = () => {
|
|
20797
|
-
const paginatorIntl = new MatPaginatorIntl();
|
|
20798
|
-
paginatorIntl.itemsPerPageLabel = 'Itens por página';
|
|
20799
|
-
paginatorIntl.nextPageLabel = 'Próxima página';
|
|
20800
|
-
paginatorIntl.previousPageLabel = 'Página anterior';
|
|
20801
|
-
paginatorIntl.getRangeLabel = portugueseRangeLabel;
|
|
20802
|
-
paginatorIntl.firstPageLabel = 'Primeira página';
|
|
20803
|
-
paginatorIntl.lastPageLabel = 'Última página';
|
|
20804
|
-
return paginatorIntl;
|
|
20805
|
-
};
|
|
20806
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
20807
|
-
const PaginatorIntlToken = new InjectionToken('PAGINATOR_INTL_TOKEN', {
|
|
20808
|
-
factory: () => PAGINATOR_INTL_PT_BR(),
|
|
20809
|
-
});
|
|
20810
|
-
function providePaginatorIntl(config) {
|
|
20811
|
-
return {
|
|
20812
|
-
provide: PaginatorIntlToken,
|
|
20813
|
-
useValue: config ?? PAGINATOR_INTL_PT_BR(),
|
|
20814
|
-
};
|
|
20815
|
-
}
|
|
20816
|
-
|
|
20817
20884
|
class TextEllipsisDirective {
|
|
20818
20885
|
constructor() {
|
|
20819
20886
|
this._elementRef = inject(ElementRef);
|