@bizy/core 20.6.8 → 20.6.10

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.
@@ -3053,6 +3053,7 @@ class BizyRangeFilterPipe {
3053
3053
  }
3054
3054
  const min = range.min ?? null;
3055
3055
  const max = range.max ?? null;
3056
+ const activatedFilter = min !== null || max !== null;
3056
3057
  let itemsWithoutProperty = [];
3057
3058
  const output = items.filter(_item => {
3058
3059
  let _value = _item;
@@ -3061,12 +3062,12 @@ class BizyRangeFilterPipe {
3061
3062
  const _property = nestedProperty[i];
3062
3063
  if (typeof _value[_property] === 'undefined' || _value[_property] === null) {
3063
3064
  itemsWithoutProperty.push(_item);
3064
- return false;
3065
+ return !activatedFilter;
3065
3066
  }
3066
3067
  _value = _value[_property];
3067
3068
  }
3068
3069
  if (isNaN(_value)) {
3069
- return false;
3070
+ return !activatedFilter;
3070
3071
  }
3071
3072
  return (min === null || _value >= min) && (max === null || _value <= max);
3072
3073
  });
@@ -4802,7 +4803,7 @@ class BizyExportToCSVService {
4802
4803
  break;
4803
4804
  }
4804
4805
  }
4805
- if (typeof value !== undefined && value !== null) {
4806
+ if (typeof value !== 'undefined' && value !== null) {
4806
4807
  csv += `${escapeCommas(String(value).replace(/\n/g, ''))},`;
4807
4808
  }
4808
4809
  else {
@@ -5430,7 +5431,7 @@ class BizyCopyToClipboardService {
5430
5431
  nestedProperty.forEach(_property => {
5431
5432
  value = value[_property];
5432
5433
  });
5433
- if (typeof value !== undefined && value !== null) {
5434
+ if (typeof value !== 'undefined' && value !== null) {
5434
5435
  toCopy += `${String(value).replace(/\n/g, '')},`;
5435
5436
  }
5436
5437
  else {
@@ -7613,28 +7614,41 @@ class BizyToastService {
7613
7614
  disableClose: false,
7614
7615
  panelClass: ['bizy-toast', 'bizy-toast--in']
7615
7616
  });
7616
- setTimeout(() => {
7617
- const container = this.#document.getElementById(id);
7617
+ let container = null;
7618
+ let tries = 3;
7619
+ const interval = setInterval(() => {
7620
+ if (tries <= 0) {
7621
+ _a.toasts.push({ ref: toastRef, element: null });
7622
+ clearInterval(interval);
7623
+ }
7624
+ container = this.#document.getElementById(id);
7618
7625
  if (!container || !container.parentElement) {
7626
+ tries--;
7619
7627
  return;
7620
7628
  }
7621
7629
  const offset = this.#calculateOffset();
7622
7630
  container.parentElement.style.top = `${offset}px`;
7623
7631
  _a.toasts.push({ ref: toastRef, element: container.parentElement });
7624
- }, 100);
7632
+ tries = 0;
7633
+ clearInterval(interval);
7634
+ }, 300);
7625
7635
  }
7626
7636
  #calculateOffset = () => {
7627
7637
  let offset = 10;
7628
7638
  for (const toast of _a.toasts) {
7629
- offset += toast.element.offsetHeight + 10;
7639
+ if (toast.element) {
7640
+ offset += toast.element.offsetHeight + 10;
7641
+ }
7630
7642
  }
7631
7643
  return offset;
7632
7644
  };
7633
7645
  #repositionToasts = () => {
7634
7646
  let offset = 10;
7635
7647
  for (const toast of _a.toasts) {
7636
- toast.element.style.top = `${offset}px`;
7637
- offset += toast.element.offsetHeight + 10;
7648
+ if (toast.element) {
7649
+ toast.element.style.top = `${offset}px`;
7650
+ offset += toast.element.offsetHeight + 10;
7651
+ }
7638
7652
  }
7639
7653
  };
7640
7654
  config(data) {
@@ -7677,10 +7691,13 @@ class BizyToastService {
7677
7691
  this.#open({ type: TOAST.DANGER, data });
7678
7692
  }
7679
7693
  close = (id) => {
7680
- if (!id) {
7694
+ if (!_a.toasts || _a.toasts.length === 0) {
7681
7695
  return;
7682
7696
  }
7683
- const toast = _a.toasts.find(_toastRef => _toastRef.ref.id === id);
7697
+ let toast = _a.toasts.find(_toastRef => _toastRef.ref.id === id);
7698
+ if (!toast) {
7699
+ toast = _a.toasts[_a.toasts.length - 1];
7700
+ }
7684
7701
  if (toast.ref) {
7685
7702
  toast.ref.removePanelClass('bizy-toast--in');
7686
7703
  toast.ref.addPanelClass('bizy-toast--out');
@@ -7700,14 +7717,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImpor
7700
7717
  }] });
7701
7718
 
7702
7719
  class BizyToastWrapperComponent {
7703
- #elementRef = inject(ElementRef);
7704
7720
  #data = inject(DIALOG_DATA);
7705
7721
  #toast = inject(BizyToastService);
7706
7722
  type = TOAST.INFO;
7707
7723
  title = '';
7708
7724
  msg = '';
7709
7725
  id;
7710
- ngOnInit() {
7726
+ constructor() {
7711
7727
  if (!this.#data) {
7712
7728
  this.close();
7713
7729
  return;
@@ -7720,7 +7736,6 @@ class BizyToastWrapperComponent {
7720
7736
  this.close();
7721
7737
  }, this.#data.duration || 3000);
7722
7738
  }
7723
- getNativeElement = () => this.#elementRef?.nativeElement;
7724
7739
  close() {
7725
7740
  this.#toast.close(this.id);
7726
7741
  }
@@ -7730,7 +7745,7 @@ class BizyToastWrapperComponent {
7730
7745
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: BizyToastWrapperComponent, decorators: [{
7731
7746
  type: Component,
7732
7747
  args: [{ selector: 'bizy-toast-wrapper', imports: [CommonModule, DialogModule], providers: [BizyToastService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"bizy-toast-wrapper bizy-toast-wrapper--{{type}}\">\n\n <span class=\"bizy-toast-wrapper__content\">\n\n <h4 class=\"bizy-toast-wrapper__title--{{type}}\" *ngIf=\"title\">{{title}}</h4>\n \n <h6 *ngIf=\"msg\">{{msg}}</h6>\n\n </span>\n\n <button (click)=\"close()\" (keyup.enter)=\"close()\" class=\"bizy-toast-wrapper__close-button\">\n\n <svg \n data-name=\"Cancel button\"\n id=\"bizy-toast-wrapper-close-svg\" \n viewBox=\"0 0 200 200\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path id=\"bizy-toast-wrapper-close-svg-content\" d=\"M114,100l49-49a9.9,9.9,0,0,0-14-14L100,86,51,37A9.9,9.9,0,0,0,37,51l49,49L37,149a9.9,9.9,0,0,0,14,14l49-49,49,49a9.9,9.9,0,0,0,14-14Z\"/>\n </svg>\n\n </button>\n\n <span class=\"bizy-toast__progress bizy-toast__progress--{{type}}\"></span>\n \n</div>", styles: [":host{font-size:1rem}.bizy-toast-wrapper{position:relative;width:100%;min-width:20rem;max-width:min(30rem,80dvw);height:fit-content;min-height:3rem;max-height:95dvh;overflow-y:auto;border-top-width:var(--bizy-toast-border-top-width);border-right-width:var(--bizy-toast-border-right-width);border-bottom-width:var(--bizy-toast-border-bottom-width);border-left-width:var(--bizy-toast-border-left-width);border-top-style:var(--bizy-toast-border-top-style);border-right-style:var(--bizy-toast-border-right-style);border-bottom-style:var(--bizy-toast-border-bottom-style);border-left-style:var(--bizy-toast-border-left-style);border-top-left-radius:var(--bizy-toast-border-top-left-radius);border-top-right-radius:var(--bizy-toast-border-top-right-radius);border-bottom-left-radius:var(--bizy-toast-border-bottom-left-radius);border-bottom-right-radius:var(--bizy-toast-border-bottom-right-radius);display:flex;align-items:center;column-gap:.5rem;padding:.5rem;box-shadow:0 18px 25px #32325d40,0 3px 6px #0000001a}.bizy-toast-wrapper::-webkit-scrollbar{width:.5rem;height:.5rem}.bizy-toast-wrapper::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-toast-scroll-bar-color)}.bizy-toast-wrapper::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-toast-scroll-bar-hover-color)}.bizy-toast-wrapper__content{flex:1;display:flex;flex-direction:column;row-gap:.1rem}.bizy-toast-wrapper--debug{background-color:var(--bizy-toast-debug-background-color, );border-top-color:var(--bizy-toast-debug-color);border-right-color:var(--bizy-toast-debug-color);border-bottom-color:var(--bizy-toast-debug-color);border-left-color:var(--bizy-toast-debug-color)}.bizy-toast-wrapper__title--debug{color:var(--bizy-toast-debug-color)}.bizy-toast-wrapper--info{background-color:var(--bizy-toast-info-background-color, );border-top-color:var(--bizy-toast-info-color);border-right-color:var(--bizy-toast-info-color);border-bottom-color:var(--bizy-toast-info-color);border-left-color:var(--bizy-toast-info-color)}.bizy-toast-wrapper__title--info{color:var(--bizy-toast-info-color)}.bizy-toast-wrapper--success{background-color:var(--bizy-toast-success-background-color);border-top-color:var(--bizy-toast-success-color);border-right-color:var(--bizy-toast-success-color);border-bottom-color:var(--bizy-toast-success-color);border-left-color:var(--bizy-toast-success-color)}.bizy-toast-wrapper__title--success{color:var(--bizy-toast-success-color)}.bizy-toast-wrapper--warning{background-color:var(--bizy-toast-warning-background-color);border-top-color:var(--bizy-toast-warning-color);border-right-color:var(--bizy-toast-warning-color);border-bottom-color:var(--bizy-toast-warning-color);border-left-color:var(--bizy-toast-warning-color)}.bizy-toast-wrapper__title--warning{color:var(--bizy-toast-warning-color)}.bizy-toast-wrapper--danger{background-color:var(--bizy-toast-danger-background-color);border-top-color:var(--bizy-toast-danger-color);border-right-color:var(--bizy-toast-danger-color);border-bottom-color:var(--bizy-toast-danger-color);border-left-color:var(--bizy-toast-danger-color)}.bizy-toast-wrapper__title--danger{color:var(--bizy-toast-danger-color)}.bizy-toast-wrapper__close-button{border:none;cursor:pointer;align-self:flex-start;background-color:transparent;transition:color .2s;justify-self:flex-start}.bizy-toast-wrapper__close-button #bizy-toast-wrapper-close-svg{height:1rem}.bizy-toast-wrapper__close-button #bizy-toast-wrapper-close-svg-content{fill:var(--bizy-toast-close-button-color)}.bizy-toast-wrapper__close-button:hover #bizy-toast-wrapper-close-svg-content{fill:var(--bizy-toast-close-button-hover-color)}.bizy-toast__progress{width:100%;height:var(--bizy-toast-progress-bar-height);display:inline-block;position:fixed;bottom:0;left:0;right:0;overflow:hidden}.bizy-toast__progress--debug{background-color:var(--bizy-toast-debug-color)}.bizy-toast__progress--info{background-color:var(--bizy-toast-info-color)}.bizy-toast__progress--success{background-color:var(--bizy-toast-success-color)}.bizy-toast__progress--warning{background-color:var(--bizy-toast-warning-color)}.bizy-toast__progress--danger{background-color:var(--bizy-toast-danger-color)}.bizy-toast__progress:after{content:\"\";box-sizing:border-box;width:0;height:var(--bizy-toast-progress-bar-height);background-color:#fff;position:absolute;top:0;left:0;animation:progress var(--bizy-toast-duration) linear infinite}@keyframes progress{0%{width:0}to{width:100%}}\n"] }]
7733
- }] });
7748
+ }], ctorParameters: () => [] });
7734
7749
 
7735
7750
  class BizyToastModule {
7736
7751
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: BizyToastModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -8107,11 +8122,8 @@ class BizyReducePipe {
8107
8122
  if (!items || items.length === 0) {
8108
8123
  return 0;
8109
8124
  }
8110
- if (!key) {
8111
- const reduce = items.reduce((acc, value) => acc + value, 0);
8112
- return Number(reduce.toFixed(fixedTo));
8113
- }
8114
- const reduce = items.map(_d => _d[key]).reduce((acc, value) => acc + value, 0);
8125
+ let _items = key ? items.filter(_item => _item[key]).map(_d => _d[key]) : items;
8126
+ const reduce = _items.filter(v => Number.isFinite(Number(v))).reduce((acc, value) => acc + Number(value), 0);
8115
8127
  return Number(reduce.toFixed(fixedTo));
8116
8128
  }
8117
8129
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.5", ngImport: i0, type: BizyReducePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
@@ -9022,8 +9034,8 @@ class BizyTooltipDirective {
9022
9034
  this.#renderer.setStyle(this.#tooltip, 'left', left + 'px');
9023
9035
  }
9024
9036
  #isTextTruncated = (element) => {
9025
- const { scrollHeight, clientHeight } = element;
9026
- return scrollHeight > clientHeight;
9037
+ const { scrollHeight, clientHeight, scrollWidth, clientWidth } = element;
9038
+ return this.#lineClamp === 1 ? scrollWidth > clientWidth : scrollHeight > clientHeight;
9027
9039
  };
9028
9040
  ngOnDestroy() {
9029
9041
  this.#document.querySelectorAll('.bizy-tooltip-identify').forEach(element => {