@esfaenza/es-table 15.2.12 → 15.2.14

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.
@@ -166,7 +166,7 @@ class AppSearch {
166
166
  * Permette di resettare un AppSearch ai valori di default.
167
167
  * Reso statico perché fra una deserializzazione e l'altra si potrebbe perdere il prototype del costruttore
168
168
  *
169
- * @param {AppSearch<any>} aps AppSearch da resettare
169
+ * @param {AppSearch<T>} aps AppSearch da resettare
170
170
  */
171
171
  static reset(aps) {
172
172
  aps.pages = 1;
@@ -182,18 +182,30 @@ class AppSearch {
182
182
  aps.savedstate = false;
183
183
  aps.selfsearch = false;
184
184
  }
185
+ /**
186
+ * Partendo da un appsearch con filtri impostati permette di crearne la stessa versione solo con la ricerca impostata a "tutto"
187
+ *
188
+ * @param {AppSearch<T>} aps AppSearch da cui partire
189
+ */
190
+ static toSelectAll(aps) {
191
+ let niu = this.newref(aps, false);
192
+ niu.pages = 1;
193
+ niu.itemsperpageoverride = 9999999;
194
+ return niu;
195
+ }
185
196
  /**
186
197
  * Permette di ottenere un nuovo riferimento all'AppSearch passata come parametro.
187
198
  * Internamente utilizza il JSON.parse(JSON.stringify(X)) con la differenza che prima stacca il riferimento agli items per evitare di
188
199
  * reserializzare potenzialmente centinaia di elementi. Il riferimento viene poi ricollegato alla nuova appsearch generata
189
200
  *
190
- * @param {AppSearch<any>} aps AppSearch di cui estrarre un nuovo riferimento equivalente
201
+ * @param {AppSearch<T>} aps AppSearch di cui estrarre un nuovo riferimento equivalente
191
202
  */
192
- static newref(aps) {
203
+ static newref(aps, retainItems = true) {
193
204
  var items = aps.items;
194
205
  aps.items = [];
195
206
  var newref = JSON.parse(JSON.stringify(aps));
196
- newref.items = items;
207
+ if (retainItems)
208
+ newref.items = items;
197
209
  newref.page = 1;
198
210
  return newref;
199
211
  }