codexly-ui 0.23.0 → 0.23.1
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/codexly-ui.mjs +3 -25
- package/fesm2022/codexly-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/codexly-ui.d.ts +14 -19
package/fesm2022/codexly-ui.mjs
CHANGED
|
@@ -14075,11 +14075,6 @@ class ClxPaginationComponent {
|
|
|
14075
14075
|
_destroyRef = inject(DestroyRef);
|
|
14076
14076
|
// ── FormControl interno para el select de pageSize ─────────────────────────
|
|
14077
14077
|
_pageSizeCtrl = new FormControl(null);
|
|
14078
|
-
/** True once the user has explicitly picked a pageSize from the select — after that, their
|
|
14079
|
-
* choice is respected even if a later filter shrinks totalItems below it. Until then, a
|
|
14080
|
-
* caller-provided default (e.g. 20) that exceeds a small totalItems is auto-corrected down
|
|
14081
|
-
* to the smallest available option, so the select never opens pre-selected on the largest value. */
|
|
14082
|
-
_userTouchedPageSize = false;
|
|
14083
14078
|
constructor() {
|
|
14084
14079
|
// Sincroniza el pageSize model → FormControl cada vez que cambia desde afuera
|
|
14085
14080
|
effect(() => {
|
|
@@ -14088,31 +14083,14 @@ class ClxPaginationComponent {
|
|
|
14088
14083
|
this._pageSizeCtrl.setValue(ps, { emitEvent: false });
|
|
14089
14084
|
}
|
|
14090
14085
|
});
|
|
14091
|
-
//
|
|
14092
|
-
//
|
|
14093
|
-
//
|
|
14094
|
-
// selección manual — si no, el consumidor (ej. clx-table → su padre real) nunca se entera
|
|
14095
|
-
// del nuevo tamaño y sigue pidiendo datos al backend con el size viejo.
|
|
14096
|
-
effect(() => {
|
|
14097
|
-
if (this._userTouchedPageSize)
|
|
14098
|
-
return;
|
|
14099
|
-
const total = this.totalItems();
|
|
14100
|
-
if (!total || total <= 0)
|
|
14101
|
-
return;
|
|
14102
|
-
const smallest = this._pageSizeOptions()[0]?.value;
|
|
14103
|
-
if (smallest != null && this.pageSize() > total && smallest !== this.pageSize()) {
|
|
14104
|
-
this.pageSize.set(smallest);
|
|
14105
|
-
this.currentPage.set(1);
|
|
14106
|
-
this.sizeChange.emit({ pageSize: smallest });
|
|
14107
|
-
this.pageChange.emit({ page: 1, pageSize: smallest });
|
|
14108
|
-
}
|
|
14109
|
-
});
|
|
14086
|
+
// El pageSize solo cambia cuando el usuario lo elige: nunca se ajusta solo según totalItems.
|
|
14087
|
+
// Antes se reducía a la opción más pequeña cuando había menos registros que el pageSize, lo
|
|
14088
|
+
// que mostraba 5 por página donde cabían todos y obligaba al consumidor a pedir los datos de nuevo.
|
|
14110
14089
|
// Sincroniza el FormControl → pageSize model cuando el usuario elige
|
|
14111
14090
|
this._pageSizeCtrl.valueChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(val => {
|
|
14112
14091
|
const newSize = Number(val);
|
|
14113
14092
|
if (!val || !Number.isFinite(newSize) || newSize <= 0 || newSize === this.pageSize())
|
|
14114
14093
|
return;
|
|
14115
|
-
this._userTouchedPageSize = true;
|
|
14116
14094
|
this.pageSize.set(newSize);
|
|
14117
14095
|
this.currentPage.set(1);
|
|
14118
14096
|
this.sizeChange.emit({ pageSize: newSize });
|