@bizy/core 19.5.0 → 19.5.2

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.
@@ -793,7 +793,7 @@ class BizyCalendarComponent {
793
793
  _viewDate = new Date();
794
794
  _activeDayIsOpen = false;
795
795
  _refresh = new Subject();
796
- viewDate(viewDate) {
796
+ set viewDate(viewDate) {
797
797
  if (!viewDate) {
798
798
  return;
799
799
  }
@@ -6675,18 +6675,25 @@ class BizySearchPipe {
6675
6675
  }
6676
6676
  const getFn = (item, keys) => {
6677
6677
  const value = keys.reduce((acc, key) => acc && acc[key], item);
6678
- return typeof value === 'string' ? this.#removeAccentsAndDiacritics(value) : value;
6678
+ return typeof value === 'string' ? this.#removeAccentsAndDiacritics(value) : String(value);
6679
+ };
6680
+ const isNumber = (number) => {
6681
+ const regex = /^[0-9]*$/;
6682
+ return regex.test(String(number).toLowerCase());
6683
+ };
6684
+ const isEmail = (email) => {
6685
+ const regex = /^(([^ñ<>()[\]\\.,;:\s@"]+(\.[^ñ<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
6686
+ return regex.test(String(email).toLowerCase());
6679
6687
  };
6680
6688
  // Remove empty items
6681
6689
  search = search.filter(n => n);
6682
6690
  search.forEach(_keyword => {
6683
- // Apply perfect match if "search" is a number or is an email
6684
- const searchIsText = isNaN(Number(_keyword)) && !String(_keyword).includes('@');
6685
- if (searchIsText) {
6691
+ if (!isNumber(_keyword) && !isEmail(_keyword)) {
6686
6692
  this.searchPipeOptions = new BizySearchPipeOptions({ ...options, getFn }, _keys);
6687
6693
  this.fuse = new Fuse(items, this.searchPipeOptions);
6688
6694
  }
6689
6695
  else {
6696
+ // Apply perfect match if "search" is a number or is an email
6690
6697
  this.searchPipeOptions = new BizySearchPipeOptions({ ...options, ...this.perfectMatch, getFn }, _keys);
6691
6698
  this.fuse = new Fuse(items, this.searchPipeOptions);
6692
6699
  }