@webtypen/webframez-core 0.2.46 → 0.2.47

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.
@@ -324,12 +324,29 @@ class Datatable {
324
324
  if (filterEl && filterEl.ignore) {
325
325
  continue;
326
326
  }
327
+ // Handle Boolean
327
328
  if (filterEl.type === "boolean") {
328
329
  if ((typeof valueClean === "boolean" && valueClean) || (valueClean && valueClean.toString() === "true")) {
329
330
  out[filterEl && filterEl.mapping && filterEl.mapping.trim() !== "" ? filterEl.mapping : key] = true;
330
331
  continue;
331
332
  }
332
333
  }
334
+ // Handle integer/float range
335
+ if ((filterEl.type === "integer-range" || filterEl.type === "float-range") && valueClean !== undefined) {
336
+ if (valueClean.indexOf("-") > 0) {
337
+ const range = valueClean.split("-");
338
+ const min = range[0].toString().replace(",", ".");
339
+ const max = range[1].toString().replace(",", ".");
340
+ value = {
341
+ $gte: filterEl.type === "float-range" ? parseFloat(min) : parseInt(min),
342
+ $lte: filterEl.type === "float-range" ? parseFloat(max) : parseInt(max),
343
+ };
344
+ }
345
+ else {
346
+ value = filterEl.type === "float-range" ? parseFloat(valueClean.toString().replace(",", ".")) : parseInt(valueClean);
347
+ }
348
+ continue;
349
+ }
333
350
  switch (operator) {
334
351
  case "empty":
335
352
  value = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.2.46",
3
+ "version": "0.2.47",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",
@@ -337,6 +337,7 @@ export class Datatable {
337
337
  continue;
338
338
  }
339
339
 
340
+ // Handle Boolean
340
341
  if (filterEl.type === "boolean") {
341
342
  if ((typeof valueClean === "boolean" && valueClean) || (valueClean && valueClean.toString() === "true")) {
342
343
  out[filterEl && filterEl.mapping && filterEl.mapping.trim() !== "" ? filterEl.mapping : key] = true;
@@ -344,6 +345,24 @@ export class Datatable {
344
345
  }
345
346
  }
346
347
 
348
+ // Handle integer/float range
349
+ if ((filterEl.type === "integer-range" || filterEl.type === "float-range") && valueClean !== undefined) {
350
+ if (valueClean.indexOf("-") > 0) {
351
+ const range = valueClean.split("-");
352
+ const min = range[0].toString().replace(",", ".");
353
+ const max = range[1].toString().replace(",", ".");
354
+
355
+ value = {
356
+ $gte: filterEl.type === "float-range" ? parseFloat(min) : parseInt(min),
357
+ $lte: filterEl.type === "float-range" ? parseFloat(max) : parseInt(max),
358
+ };
359
+ } else {
360
+ value = filterEl.type === "float-range" ? parseFloat(valueClean.toString().replace(",", ".")) : parseInt(valueClean);
361
+ }
362
+
363
+ continue;
364
+ }
365
+
347
366
  switch (operator) {
348
367
  case "empty":
349
368
  value = null;