@bizy/core 19.14.2 → 19.14.4

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, ChangeDetectorRef, Output, Input, Inject, ChangeDetectionStrategy, Component, NgModule, inject, Renderer2, ElementRef, Injectable, Directive, ViewChild, ContentChildren, ContentChild, RendererFactory2, Pipe, ViewContainerRef, TemplateRef, HostListener, Host } from '@angular/core';
2
+ import { EventEmitter, ChangeDetectorRef, Output, Input, Inject, ChangeDetectionStrategy, Component, NgModule, inject, Renderer2, ElementRef, Injectable, Directive, ViewChild, ContentChildren, ContentChild, Pipe, ViewContainerRef, TemplateRef, RendererFactory2, HostListener, Host } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule, DOCUMENT, registerLocaleData, DatePipe } from '@angular/common';
5
5
  import { Subject, Subscription, BehaviorSubject, filter, take, skip, auditTime, throttleTime, debounceTime as debounceTime$1, interval, fromEvent, merge, timer, of } from 'rxjs';
@@ -12,7 +12,7 @@ import { isSameMonth, isSameDay } from 'date-fns';
12
12
  import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
13
13
  import localeEs from '@angular/common/locales/es';
14
14
  import * as i2$1 from '@angular/forms';
15
- import { FormsModule, Validators, FormBuilder } from '@angular/forms';
15
+ import { FormsModule, FormBuilder, Validators } from '@angular/forms';
16
16
  import flatpickr from 'flatpickr';
17
17
  import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect/index.js';
18
18
  import { Spanish } from 'flatpickr/dist/l10n/es.js';
@@ -24,11 +24,6 @@ import es_ES from '@uppy/locales/lib/es_ES';
24
24
  import en_US from '@uppy/locales/lib/en_US';
25
25
  import Dashboard from '@uppy/dashboard';
26
26
  import XHRUpload from '@uppy/xhr-upload';
27
- import * as i1$1 from '@angular/router';
28
- import { NavigationEnd, NavigationStart, Router } from '@angular/router';
29
- import validator from 'validator';
30
- import { Clipboard } from '@angular/cdk/clipboard';
31
- import { DeviceDetectorService } from 'ngx-device-detector';
32
27
  import * as i3 from '@angular/cdk/portal';
33
28
  import { TemplatePortal, PortalModule } from '@angular/cdk/portal';
34
29
  import { ScrollingModule, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
@@ -36,6 +31,11 @@ import * as i1$2 from '@angular/cdk/dialog';
36
31
  import { DIALOG_DATA, DialogRef, DialogModule, Dialog } from '@angular/cdk/dialog';
37
32
  import * as i2$3 from '@angular/cdk/drag-drop';
38
33
  import { DragDropModule } from '@angular/cdk/drag-drop';
34
+ import * as i1$1 from '@angular/router';
35
+ import { NavigationEnd, NavigationStart, Router } from '@angular/router';
36
+ import validator from 'validator';
37
+ import { Clipboard } from '@angular/cdk/clipboard';
38
+ import { DeviceDetectorService } from 'ngx-device-detector';
39
39
  import { TranslateService, TranslateModule } from '@ngx-translate/core';
40
40
  import * as i1$3 from '@angular/platform-browser';
41
41
  import { DomSanitizer } from '@angular/platform-browser';
@@ -2028,8 +2028,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
2028
2028
  }] });
2029
2029
 
2030
2030
  class BizyFilterSectionRangeOptionComponent {
2031
- fb;
2032
- ref;
2031
+ #fb = inject(FormBuilder);
2032
+ #ref = inject(ChangeDetectorRef);
2033
2033
  id = `bizy-filter-section-range-option-${Math.random()}`;
2034
2034
  disabled = false;
2035
2035
  customClass = '';
@@ -2040,16 +2040,20 @@ class BizyFilterSectionRangeOptionComponent {
2040
2040
  get activated$() {
2041
2041
  return this.#activated.asObservable();
2042
2042
  }
2043
- form;
2043
+ #form = this.#fb.group({
2044
+ minValue: [null],
2045
+ maxValue: [null]
2046
+ });
2047
+ ;
2044
2048
  set min(min) {
2045
2049
  if (typeof min === 'undefined' || min === null) {
2046
2050
  this.minValue.setValue(null);
2047
2051
  }
2048
2052
  else {
2049
- this.minValue.setValue(min);
2053
+ this.minValue.setValue(Number(min));
2050
2054
  }
2051
- this.#activated.next(Boolean(min));
2052
- this.ref.detectChanges();
2055
+ this.#activated.next(Boolean(min) || min === 0 || Boolean(this.maxValue.value) || this.maxValue.value === 0);
2056
+ this.#ref.detectChanges();
2053
2057
  }
2054
2058
  ;
2055
2059
  set max(max) {
@@ -2057,10 +2061,10 @@ class BizyFilterSectionRangeOptionComponent {
2057
2061
  this.maxValue.setValue(null);
2058
2062
  }
2059
2063
  else {
2060
- this.maxValue.setValue(max);
2064
+ this.maxValue.setValue(Number(max));
2061
2065
  }
2062
- this.#activated.next(Boolean(max));
2063
- this.ref.detectChanges();
2066
+ this.#activated.next(Boolean(max) || max === 0 || Boolean(this.minValue.value) || this.minValue.value === 0);
2067
+ this.#ref.detectChanges();
2064
2068
  }
2065
2069
  ;
2066
2070
  set minLimit(min) {
@@ -2089,14 +2093,6 @@ class BizyFilterSectionRangeOptionComponent {
2089
2093
  }
2090
2094
  }
2091
2095
  ;
2092
- constructor(fb, ref) {
2093
- this.fb = fb;
2094
- this.ref = ref;
2095
- this.form = this.fb.group({
2096
- minValue: [null],
2097
- maxValue: [null]
2098
- });
2099
- }
2100
2096
  setMinValue(value) {
2101
2097
  let min = value === '' ? null : Number(value);
2102
2098
  const max = this.maxValue.value === null || this.maxValue.value === '' ? null : Number(this.maxValue.value);
@@ -2107,8 +2103,8 @@ class BizyFilterSectionRangeOptionComponent {
2107
2103
  min = this._minLimit;
2108
2104
  }
2109
2105
  this.onChange.emit({ min, max });
2110
- this.#activated.next(Boolean(min) || Boolean(max));
2111
- this.ref.detectChanges();
2106
+ this.#activated.next(Boolean(min) || Boolean(max) || min === 0 || max === 0);
2107
+ this.#ref.detectChanges();
2112
2108
  }
2113
2109
  setMaxValue(value) {
2114
2110
  let max = !Boolean(value) && value !== 0 ? null : Number(value);
@@ -2120,21 +2116,21 @@ class BizyFilterSectionRangeOptionComponent {
2120
2116
  max = this._maxLimit;
2121
2117
  }
2122
2118
  this.onChange.emit({ min, max });
2123
- this.#activated.next(Boolean(min) || Boolean(max));
2124
- this.ref.detectChanges();
2119
+ this.#activated.next(Boolean(min) || Boolean(max) || min === 0 || max === 0);
2120
+ this.#ref.detectChanges();
2125
2121
  }
2126
2122
  get minValue() {
2127
- return this.form.get('minValue');
2123
+ return this.#form.get('minValue');
2128
2124
  }
2129
2125
  get maxValue() {
2130
- return this.form.get('maxValue');
2126
+ return this.#form.get('maxValue');
2131
2127
  }
2132
2128
  onClean = () => {
2133
2129
  this.minValue.setValue(null);
2134
2130
  this.maxValue.setValue(null);
2135
2131
  this.onChange.emit({ min: null, max: null });
2136
2132
  this.#activated.next(false);
2137
- this.ref.detectChanges();
2133
+ this.#ref.detectChanges();
2138
2134
  };
2139
2135
  getId = () => {
2140
2136
  return this.id;
@@ -2142,19 +2138,13 @@ class BizyFilterSectionRangeOptionComponent {
2142
2138
  isActivated = () => {
2143
2139
  return this.#activated.value;
2144
2140
  };
2145
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterSectionRangeOptionComponent, deps: [{ token: FormBuilder }, { token: ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2141
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterSectionRangeOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2146
2142
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyFilterSectionRangeOptionComponent, isStandalone: true, selector: "bizy-filter-section-range-option", inputs: { id: "id", disabled: "disabled", customClass: "customClass", min: "min", max: "max", minLimit: "minLimit", maxLimit: "maxLimit" }, outputs: { onChange: "onChange" }, ngImport: i0, template: "<div \n class=\"bizy-filter-section-range-option {{customClass}}\"\n [id]=\"id\">\n\n <span class=\"bizy-filter-section-range-option__inputs\">\n\n <bizy-input\n class=\"bizy-filter-section-range-option__input\"\n type=\"number\"\n [value]=\"minValue.value\"\n (onChange)=\"setMinValue($event)\">\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=min-header]\"></ng-content>\n </ng-container>\n\n </bizy-input>\n\n <bizy-input\n class=\"bizy-filter-section-range-option__input\"\n type=\"number\"\n [value]=\"maxValue.value\"\n (onChange)=\"setMaxValue($event)\">\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=max-header]\"></ng-content>\n </ng-container>\n\n </bizy-input>\n\n </span>\n \n</div>", styles: [":host{font-size:1rem}.bizy-filter-section-range-option{display:flex;flex-direction:column;row-gap:1rem}.bizy-filter-section-range-option__inputs{display:flex;align-items:center;column-gap:.5rem}.bizy-filter-section-range-option__input{--bizy-input-background-color: #f3f3f3 !important}\n"], dependencies: [{ kind: "component", type: BizyInputComponent, selector: "bizy-input", inputs: ["id", "name", "type", "customClass", "placeholder", "debounceTime", "rows", "disabled", "readonly", "autofocus", "value"], outputs: ["valueChange", "onChange", "onEnter", "onBackspace", "onSelect", "onBlur", "onFocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2147
2143
  }
2148
2144
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterSectionRangeOptionComponent, decorators: [{
2149
2145
  type: Component,
2150
2146
  args: [{ selector: 'bizy-filter-section-range-option', imports: [BizyInputComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div \n class=\"bizy-filter-section-range-option {{customClass}}\"\n [id]=\"id\">\n\n <span class=\"bizy-filter-section-range-option__inputs\">\n\n <bizy-input\n class=\"bizy-filter-section-range-option__input\"\n type=\"number\"\n [value]=\"minValue.value\"\n (onChange)=\"setMinValue($event)\">\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=min-header]\"></ng-content>\n </ng-container>\n\n </bizy-input>\n\n <bizy-input\n class=\"bizy-filter-section-range-option__input\"\n type=\"number\"\n [value]=\"maxValue.value\"\n (onChange)=\"setMaxValue($event)\">\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=max-header]\"></ng-content>\n </ng-container>\n\n </bizy-input>\n\n </span>\n \n</div>", styles: [":host{font-size:1rem}.bizy-filter-section-range-option{display:flex;flex-direction:column;row-gap:1rem}.bizy-filter-section-range-option__inputs{display:flex;align-items:center;column-gap:.5rem}.bizy-filter-section-range-option__input{--bizy-input-background-color: #f3f3f3 !important}\n"] }]
2151
- }], ctorParameters: () => [{ type: i2$1.FormBuilder, decorators: [{
2152
- type: Inject,
2153
- args: [FormBuilder]
2154
- }] }, { type: i0.ChangeDetectorRef, decorators: [{
2155
- type: Inject,
2156
- args: [ChangeDetectorRef]
2157
- }] }], propDecorators: { id: [{
2147
+ }], propDecorators: { id: [{
2158
2148
  type: Input
2159
2149
  }], disabled: [{
2160
2150
  type: Input
@@ -2529,2320 +2519,2347 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
2529
2519
  args: [{ selector: 'bizy-filter-content', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>", styles: [":host{font-size:1rem}\n"] }]
2530
2520
  }] });
2531
2521
 
2532
- var BIZY_ANIMATION;
2533
- (function (BIZY_ANIMATION) {
2534
- BIZY_ANIMATION["FADE_IN"] = "fade-in";
2535
- BIZY_ANIMATION["FADE_OUT"] = "fade-out";
2536
- BIZY_ANIMATION["FADE_IN_UP"] = "fade-in-up";
2537
- BIZY_ANIMATION["FADE_IN_RIGHT"] = "fade-in-right";
2538
- BIZY_ANIMATION["FADE_IN_DOWN"] = "fade-in-down";
2539
- BIZY_ANIMATION["FADE_IN_LEFT"] = "fade-in-left";
2540
- BIZY_ANIMATION["SLIDE_IN_UP"] = "slide-in-up";
2541
- BIZY_ANIMATION["SLIDE_IN_RIGHT"] = "slide-in-right";
2542
- BIZY_ANIMATION["SLIDE_IN_DOWN"] = "slide-in-down";
2543
- BIZY_ANIMATION["SLIDE_IN_LEFT"] = "slide-in-left";
2544
- BIZY_ANIMATION["SLIDE_OUT_UP"] = "slide-out-up";
2545
- BIZY_ANIMATION["SLIDE_OUT_DOWN"] = "slide-out-down";
2546
- BIZY_ANIMATION["SLIDE_OUT_RIGHT"] = "slide-out-right";
2547
- BIZY_ANIMATION["SLIDE_OUT_LEFT"] = "slide-out-left";
2548
- })(BIZY_ANIMATION || (BIZY_ANIMATION = {}));
2549
- class BizyAnimationService {
2550
- rendererFactory;
2551
- #renderer;
2552
- constructor(rendererFactory) {
2553
- this.rendererFactory = rendererFactory;
2554
- this.#renderer = this.rendererFactory.createRenderer(null, null);
2555
- }
2556
- setAnimation(element, animation) {
2557
- return new Promise(resolve => {
2558
- if (!element || !animation || !this.#renderer) {
2522
+ class BizyFilterPipe {
2523
+ transform(items, property, states) {
2524
+ if (!items || items.length === 0) {
2525
+ return [];
2526
+ }
2527
+ if (!property || typeof states === 'undefined' || states === null) {
2528
+ return items;
2529
+ }
2530
+ if (!Array.isArray(states)) {
2531
+ return items.filter(_item => _item[property] === states);
2532
+ }
2533
+ if (states.length === 0) {
2534
+ return items;
2535
+ }
2536
+ const _selected = states.filter(_state => _state.selected);
2537
+ if (_selected.length === states.length) {
2538
+ return items;
2539
+ }
2540
+ let output = [];
2541
+ states.forEach(state => {
2542
+ if (!state.selected) {
2559
2543
  return;
2560
2544
  }
2561
- const root = this.#renderer.selectRootElement(':root', true);
2562
- const animationTimeout = getComputedStyle(root).getPropertyValue('--bizy-animation-timeout').trim();
2563
- this.#renderer.addClass(element, 'animated');
2564
- this.#renderer.addClass(element, animation);
2565
- setTimeout(() => {
2566
- this.#renderer.removeClass(element, 'animated');
2567
- this.#renderer.removeClass(element, animation);
2568
- resolve();
2569
- }, Number(animationTimeout.match(/\d/g).join('')));
2570
- });
2571
- }
2572
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyAnimationService, deps: [{ token: RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
2573
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyAnimationService, providedIn: 'root' });
2574
- }
2575
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyAnimationService, decorators: [{
2576
- type: Injectable,
2577
- args: [{
2578
- providedIn: 'root'
2579
- }]
2580
- }], ctorParameters: () => [{ type: i0.RendererFactory2, decorators: [{
2581
- type: Inject,
2582
- args: [RendererFactory2]
2583
- }] }] });
2584
-
2585
- class BizyViewportService {
2586
- window;
2587
- #viewportSizeChanged;
2588
- get sizeChange$() {
2589
- return this.#viewportSizeChanged.asObservable();
2590
- }
2591
- constructor(window) {
2592
- this.window = window;
2593
- this.#viewportSizeChanged = new BehaviorSubject({
2594
- width: this.window.innerWidth,
2595
- height: this.window.innerHeight
2596
- });
2597
- fromEvent(window, 'resize')
2598
- .pipe(debounceTime(200), map((event) => ({
2599
- width: event.currentTarget.innerWidth,
2600
- height: event.currentTarget.innerHeight
2601
- })))
2602
- .subscribe(windowSize => {
2603
- this.#viewportSizeChanged.next(windowSize);
2545
+ const res = items.filter(_item => {
2546
+ let _state = _item;
2547
+ const nestedProperty = property.split('.');
2548
+ nestedProperty.forEach(_property => {
2549
+ _state = _state[_property];
2550
+ });
2551
+ if (typeof state.id === 'boolean') {
2552
+ return Boolean(_state) === state.id;
2553
+ }
2554
+ if (Array.isArray(_state)) {
2555
+ return _state.includes(state.id);
2556
+ }
2557
+ return _state === state.id;
2558
+ });
2559
+ output = output.concat(res);
2604
2560
  });
2561
+ function safeStringify(obj) {
2562
+ const seen = new WeakSet();
2563
+ function replacer(_key, value) {
2564
+ // Handle circular references
2565
+ if (typeof value === 'object' && value !== null) {
2566
+ if (seen.has(value))
2567
+ return '[Circular]';
2568
+ seen.add(value);
2569
+ }
2570
+ // Handle BigInt
2571
+ if (typeof value === 'bigint')
2572
+ return value.toString() + 'n';
2573
+ // Handle Symbol and Function
2574
+ if (typeof value === 'symbol')
2575
+ return value.toString();
2576
+ if (typeof value === 'function')
2577
+ return `[Function: ${value.name || 'anonymous'}]`;
2578
+ // Preserve Dates
2579
+ if (value instanceof Date)
2580
+ return `__DATE__:${value.toISOString()}`;
2581
+ return value;
2582
+ }
2583
+ // Sort keys consistently
2584
+ const ordered = sortKeys(obj);
2585
+ return JSON.stringify(ordered, replacer);
2586
+ }
2587
+ function sortKeys(obj) {
2588
+ if (Array.isArray(obj)) {
2589
+ return obj.map(sortKeys);
2590
+ }
2591
+ else if (obj && typeof obj === 'object' && !(obj instanceof Date)) {
2592
+ return Object.keys(obj)
2593
+ .sort()
2594
+ .reduce((acc, key) => {
2595
+ acc[key] = sortKeys(obj[key]);
2596
+ return acc;
2597
+ }, {});
2598
+ }
2599
+ return obj;
2600
+ }
2601
+ function uniqueObjects(items) {
2602
+ const seen = new Set();
2603
+ const result = [];
2604
+ for (const item of items) {
2605
+ const str = safeStringify(item);
2606
+ if (!seen.has(str)) {
2607
+ seen.add(str);
2608
+ result.push(item);
2609
+ }
2610
+ }
2611
+ return result;
2612
+ }
2613
+ return uniqueObjects(output);
2605
2614
  }
2606
- width() {
2607
- return this.window.screen.availWidth;
2608
- }
2609
- height() {
2610
- return this.window.screen.availHeight;
2611
- }
2612
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyViewportService, deps: [{ token: Window }], target: i0.ɵɵFactoryTarget.Injectable });
2613
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyViewportService, providedIn: 'root' });
2615
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2616
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterPipe, isStandalone: true, name: "bizyFilter" });
2614
2617
  }
2615
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyViewportService, decorators: [{
2616
- type: Injectable,
2618
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterPipe, decorators: [{
2619
+ type: Pipe,
2617
2620
  args: [{
2618
- providedIn: 'root'
2621
+ name: 'bizyFilter'
2619
2622
  }]
2620
- }], ctorParameters: () => [{ type: Window, decorators: [{
2621
- type: Inject,
2622
- args: [Window]
2623
- }] }] });
2623
+ }] });
2624
2624
 
2625
- class BizyKeyboardService {
2626
- document;
2627
- #shiftHolding = new BehaviorSubject(false);
2628
- #controlHolding = new BehaviorSubject(false);
2629
- get shiftHolding$() {
2630
- return this.#shiftHolding.asObservable();
2631
- }
2632
- get controlHolding$() {
2633
- return this.#controlHolding.asObservable();
2634
- }
2635
- constructor(document) {
2636
- this.document = document;
2637
- this.document.addEventListener('visibilitychange', () => {
2638
- this.#shiftHolding.next(false);
2639
- this.#controlHolding.next(false);
2640
- });
2641
- this.document.addEventListener('keydown', (event) => {
2642
- if (event.key === 'Shift') {
2643
- this.#shiftHolding.next(true);
2644
- }
2645
- if (event.key === 'Meta' || event.key === 'Control') {
2646
- this.#controlHolding.next(true);
2647
- }
2648
- });
2649
- this.document.addEventListener('keyup', (event) => {
2650
- if (event.key === 'Shift') {
2651
- this.#shiftHolding.next(false);
2625
+ class BizyRangeFilterPipe {
2626
+ transform(items, property, range) {
2627
+ if (!items || items.length === 0) {
2628
+ return [];
2629
+ }
2630
+ if (!property || !range) {
2631
+ return items;
2632
+ }
2633
+ const min = range.min ?? null;
2634
+ const max = range.max ?? null;
2635
+ let itemsWithoutProperty = [];
2636
+ const output = items.filter(_item => {
2637
+ let _value = _item;
2638
+ const nestedProperty = property.split('.');
2639
+ for (let i = 0; i < nestedProperty.length; i++) {
2640
+ const _property = nestedProperty[i];
2641
+ if (typeof _value[_property] === 'undefined' || _value[_property] === null) {
2642
+ itemsWithoutProperty.push(_item);
2643
+ return false;
2644
+ }
2645
+ _value = _value[_property];
2652
2646
  }
2653
- if (event.key === 'Meta' || event.key === 'Control') {
2654
- this.#controlHolding.next(false);
2647
+ if (isNaN(_value)) {
2648
+ return false;
2655
2649
  }
2650
+ return (min === null || _value >= min) && (max === null || _value <= max);
2656
2651
  });
2652
+ return itemsWithoutProperty.length === items.length ? items : output;
2657
2653
  }
2658
- isShiftHolding() {
2659
- return this.#shiftHolding.value;
2660
- }
2661
- isControlHolding() {
2662
- return this.#controlHolding.value;
2663
- }
2664
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyKeyboardService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
2665
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyKeyboardService, providedIn: 'root' });
2654
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRangeFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2655
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyRangeFilterPipe, isStandalone: true, name: "bizyRangeFilter" });
2666
2656
  }
2667
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyKeyboardService, decorators: [{
2668
- type: Injectable,
2657
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRangeFilterPipe, decorators: [{
2658
+ type: Pipe,
2669
2659
  args: [{
2670
- providedIn: 'root'
2660
+ name: 'bizyRangeFilter'
2671
2661
  }]
2672
- }], ctorParameters: () => [{ type: Document, decorators: [{
2673
- type: Inject,
2674
- args: [DOCUMENT]
2675
- }] }] });
2662
+ }] });
2676
2663
 
2677
- class BizyExportToCSVService {
2678
- document;
2679
- rendererFactory;
2680
- #loading = false;
2681
- #renderer;
2682
- constructor(document, rendererFactory) {
2683
- this.document = document;
2684
- this.rendererFactory = rendererFactory;
2685
- this.#renderer = this.rendererFactory.createRenderer(null, null);
2686
- }
2687
- download(data) {
2688
- if (this.#loading || !data.items || !Array.isArray(data.items) || !data.model) {
2689
- return;
2690
- }
2691
- try {
2692
- this.#loading = true;
2693
- const csv = this.getCSV(data);
2694
- if (!data.fileName) {
2695
- data.fileName = 'bizy-csv';
2696
- }
2697
- this.#downloadCSV({ csv, fileName: data.fileName });
2698
- }
2699
- finally {
2700
- this.#loading = false;
2701
- }
2702
- }
2703
- getCSV(data) {
2704
- let csv = '';
2705
- function escapeCommas(str) {
2706
- return str.includes(',') ? `"${str}"` : str;
2707
- }
2708
- for (const key in data.model) {
2709
- if (key) {
2710
- csv += `${data.model[key]},`;
2711
- }
2712
- }
2713
- data.items.forEach(_item => {
2714
- // Remove the last character (',')
2715
- csv = csv.slice(0, -1);
2716
- csv += '\n';
2717
- for (const key in data.model) {
2718
- let value = _item;
2719
- const nestedProperty = key.split('.');
2720
- for (let i = 0; i < nestedProperty.length; i++) {
2721
- const _property = nestedProperty[i];
2722
- if (value) {
2723
- value = value[_property];
2724
- }
2725
- else {
2726
- break;
2727
- }
2728
- }
2729
- if (typeof value !== undefined && value !== null) {
2730
- csv += `${escapeCommas(String(value).replace(/\n/g, ''))},`;
2731
- }
2732
- else {
2733
- csv += ',';
2734
- }
2735
- }
2736
- });
2737
- if (csv && csv[csv.length - 1] === ',') {
2738
- // Remove the last character (',')
2739
- csv = csv.slice(0, -1);
2740
- }
2741
- return csv;
2742
- }
2743
- #downloadCSV(data) {
2744
- const blob = new Blob([data.csv], { type: 'text/csv;charset=utf-8;' });
2745
- const url = URL.createObjectURL(blob);
2746
- const downloadButton = this.#renderer.createElement('a');
2747
- downloadButton.setAttribute('download', data.fileName);
2748
- downloadButton.href = url;
2749
- this.#renderer.appendChild(this.document.body, downloadButton);
2750
- downloadButton.click();
2751
- this.#renderer.removeChild(this.document.body, downloadButton);
2752
- }
2753
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyExportToCSVService, deps: [{ token: DOCUMENT }, { token: RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
2754
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyExportToCSVService, providedIn: 'root' });
2664
+ const COMPONENTS$i = [
2665
+ BizyFilterComponent,
2666
+ BizyFilterSectionComponent,
2667
+ BizyFilterContentComponent,
2668
+ BizyFilterSectionCheckboxOptionComponent,
2669
+ BizyFilterSectionRangeOptionComponent,
2670
+ BizyFilterSectionSearchOptionComponent,
2671
+ BizyFilterSectionsComponent
2672
+ ];
2673
+ const PIPES$1 = [
2674
+ BizyFilterPipe,
2675
+ BizyRangeFilterPipe
2676
+ ];
2677
+ class BizyFilterModule {
2678
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2679
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterModule, imports: [BizyFilterComponent,
2680
+ BizyFilterSectionComponent,
2681
+ BizyFilterContentComponent,
2682
+ BizyFilterSectionCheckboxOptionComponent,
2683
+ BizyFilterSectionRangeOptionComponent,
2684
+ BizyFilterSectionSearchOptionComponent,
2685
+ BizyFilterSectionsComponent, BizyFilterPipe,
2686
+ BizyRangeFilterPipe], exports: [BizyFilterComponent,
2687
+ BizyFilterSectionComponent,
2688
+ BizyFilterContentComponent,
2689
+ BizyFilterSectionCheckboxOptionComponent,
2690
+ BizyFilterSectionRangeOptionComponent,
2691
+ BizyFilterSectionSearchOptionComponent,
2692
+ BizyFilterSectionsComponent, BizyFilterPipe,
2693
+ BizyRangeFilterPipe] });
2694
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterModule, providers: PIPES$1, imports: [BizyFilterComponent,
2695
+ BizyFilterSectionComponent,
2696
+ BizyFilterSectionCheckboxOptionComponent,
2697
+ BizyFilterSectionRangeOptionComponent,
2698
+ BizyFilterSectionSearchOptionComponent] });
2755
2699
  }
2756
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyExportToCSVService, decorators: [{
2757
- type: Injectable,
2700
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterModule, decorators: [{
2701
+ type: NgModule,
2758
2702
  args: [{
2759
- providedIn: 'root'
2703
+ imports: COMPONENTS$i.concat(PIPES$1),
2704
+ exports: COMPONENTS$i.concat(PIPES$1),
2705
+ providers: PIPES$1
2760
2706
  }]
2761
- }], ctorParameters: () => [{ type: Document, decorators: [{
2762
- type: Inject,
2763
- args: [DOCUMENT]
2764
- }] }, { type: i0.RendererFactory2, decorators: [{
2765
- type: Inject,
2766
- args: [RendererFactory2]
2767
- }] }] });
2707
+ }] });
2768
2708
 
2769
- class BizyRouterService {
2770
- router;
2771
- static backPath = '';
2772
- transitionsEnd$;
2773
- transitionsStart$;
2774
- popStateEvent$;
2775
- routeChange$;
2776
- constructor(router) {
2777
- this.router = router;
2778
- this.transitionsEnd$ = this.router.events.pipe(filter$1(event => event instanceof NavigationEnd), map((event) => event.id), distinctUntilChanged(), map(() => this.router.routerState.snapshot.root));
2779
- this.transitionsStart$ = this.router.events.pipe(filter$1(event => event instanceof NavigationStart), map((event) => event.id), distinctUntilChanged(), map(() => this.router.routerState.snapshot.root));
2780
- this.popStateEvent$ = fromEvent(window, 'popstate');
2781
- this.routeChange$ = merge(this.transitionsEnd$, this.popStateEvent$).pipe(map(() => void 0));
2782
- }
2783
- getURL() {
2784
- return window.location.pathname;
2785
- }
2786
- getBackPath() {
2787
- return BizyRouterService.backPath;
2788
- }
2789
- getId(activatedRoute, param) {
2790
- return activatedRoute.snapshot.paramMap.get(param);
2791
- }
2792
- getQueryParam(activatedRoute, param) {
2793
- return activatedRoute.snapshot.queryParamMap.get(param);
2794
- }
2795
- getAllQueryParam() {
2796
- const params = new URL(window.location.href).searchParams;
2797
- const queryParams = {};
2798
- for (const [key, value] of params.entries()) {
2799
- queryParams[key] = value;
2800
- }
2801
- return queryParams;
2802
- }
2803
- goTo(data) {
2804
- if (data.replace) {
2805
- BizyRouterService.backPath = '';
2806
- }
2807
- else {
2808
- BizyRouterService.backPath = this.getURL();
2809
- }
2810
- if (data.path[0] === '/') {
2811
- this.router.navigateByUrl(`${data.path}${this._serialize(data.params)}`, { replaceUrl: data.replace ?? false, skipLocationChange: data.skip ?? false });
2709
+ class BizySelectOptionComponent {
2710
+ elementRef;
2711
+ ref;
2712
+ id = `bizy-select-option-${Math.random()}`;
2713
+ disabled = false;
2714
+ customClass = '';
2715
+ onSelect = new EventEmitter();
2716
+ set selected(selected) {
2717
+ if (typeof selected === 'undefined' || selected === null) {
2812
2718
  return;
2813
2719
  }
2814
- const path = this.getURL();
2815
- const index = path.indexOf('?');
2816
- const url = index !== -1 ? path.substring(0, index) : path;
2817
- this.router.navigateByUrl(`${url}/${data.path}${this._serialize(data.params)}`, { replaceUrl: data.replace ?? false, skipLocationChange: data.skip ?? false });
2720
+ this.#selected.next(selected);
2818
2721
  }
2819
- goBack(data) {
2820
- if (BizyRouterService.backPath) {
2821
- history.back();
2822
- BizyRouterService.backPath = '';
2823
- }
2824
- else if (data && data.path) {
2825
- this.router.navigateByUrl(data.path, { replaceUrl: true });
2826
- }
2827
- else {
2828
- const index = this.getURL().lastIndexOf('/');
2829
- const backURL = this.getURL().substring(0, index);
2830
- this.router.navigateByUrl(backURL, { replaceUrl: true });
2831
- }
2722
+ #selected = new BehaviorSubject(false);
2723
+ get selected$() {
2724
+ return this.#selected.asObservable();
2832
2725
  }
2833
- reload(force) {
2834
- if (force) {
2835
- window.location.reload();
2836
- }
2837
- else {
2838
- setTimeout(() => {
2839
- this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
2840
- this.goTo({ path: this.getURL(), params: this.getAllQueryParam() });
2841
- });
2842
- }, 1);
2843
- }
2726
+ constructor(elementRef, ref) {
2727
+ this.elementRef = elementRef;
2728
+ this.ref = ref;
2844
2729
  }
2845
- _serialize(params) {
2846
- if (!params) {
2847
- return '';
2848
- }
2849
- const str = [];
2850
- for (const param in params) {
2851
- if (params[param]) {
2852
- str.push(encodeURIComponent(param) + '=' + encodeURIComponent(params[param]));
2853
- }
2730
+ _onSelect() {
2731
+ if (this.disabled) {
2732
+ return;
2854
2733
  }
2855
- const queryParams = str.length > 0 ? `?${str.join('&')}` : '';
2856
- return queryParams;
2734
+ this.onSelect.emit();
2735
+ this.ref.detectChanges();
2857
2736
  }
2858
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRouterService, deps: [{ token: Router }], target: i0.ɵɵFactoryTarget.Injectable });
2859
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRouterService, providedIn: 'root' });
2737
+ getId = () => {
2738
+ return this.id;
2739
+ };
2740
+ getSelected = () => {
2741
+ return this.#selected.value;
2742
+ };
2743
+ getValue = () => {
2744
+ const value = this.elementRef?.nativeElement?.firstChild?.children[0]?.innerText;
2745
+ return value ?? '';
2746
+ };
2747
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizySelectOptionComponent, deps: [{ token: ElementRef }, { token: ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2748
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizySelectOptionComponent, isStandalone: true, selector: "bizy-select-option", inputs: { id: "id", disabled: "disabled", customClass: "customClass", selected: "selected" }, outputs: { onSelect: "onSelect" }, ngImport: i0, template: "<button \n type=\"button\"\n [id]=\"id\"\n (click)=\"_onSelect()\"\n (keyup.enter)=\"_onSelect()\"\n [ngClass]=\"{'bizy-select-option--selected': (selected$ | async), 'bizy-select-option--disabled': disabled}\"\n class=\"bizy-select-option {{customClass}}\">\n\n <span class=\"bizy-select-option__content\">\n <ng-content></ng-content>\n </span>\n \n</button>", styles: [":host{font-size:1rem}.bizy-select-option{font-size:1rem;width:100%;border:none;background-color:var(--bizy-select-background-color);display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:.5rem;color:var(--bizy-select-option-color);cursor:pointer}.bizy-select-option:hover{background-color:var(--bizy-select-option-hover-background-color)}.bizy-select-option--selected{background-color:var(--bizy-select-option-selected-background-color)!important}.bizy-select-option--selected ::ng-deep .bizy-select-option__content *{color:var(--bizy-select-option-selected-color)}.bizy-select-option--disabled{opacity:.5;pointer-events:none;cursor:not-allowed!important}.bizy-select-option__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;text-align:start}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2860
2749
  }
2861
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRouterService, decorators: [{
2862
- type: Injectable,
2863
- args: [{
2864
- providedIn: 'root'
2865
- }]
2866
- }], ctorParameters: () => [{ type: i1$1.Router, decorators: [{
2750
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizySelectOptionComponent, decorators: [{
2751
+ type: Component,
2752
+ args: [{ selector: 'bizy-select-option', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n type=\"button\"\n [id]=\"id\"\n (click)=\"_onSelect()\"\n (keyup.enter)=\"_onSelect()\"\n [ngClass]=\"{'bizy-select-option--selected': (selected$ | async), 'bizy-select-option--disabled': disabled}\"\n class=\"bizy-select-option {{customClass}}\">\n\n <span class=\"bizy-select-option__content\">\n <ng-content></ng-content>\n </span>\n \n</button>", styles: [":host{font-size:1rem}.bizy-select-option{font-size:1rem;width:100%;border:none;background-color:var(--bizy-select-background-color);display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:.5rem;color:var(--bizy-select-option-color);cursor:pointer}.bizy-select-option:hover{background-color:var(--bizy-select-option-hover-background-color)}.bizy-select-option--selected{background-color:var(--bizy-select-option-selected-background-color)!important}.bizy-select-option--selected ::ng-deep .bizy-select-option__content *{color:var(--bizy-select-option-selected-color)}.bizy-select-option--disabled{opacity:.5;pointer-events:none;cursor:not-allowed!important}.bizy-select-option__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;text-align:start}\n"] }]
2753
+ }], ctorParameters: () => [{ type: i0.ElementRef, decorators: [{
2867
2754
  type: Inject,
2868
- args: [Router]
2869
- }] }] });
2870
-
2871
- class BizyCacheService {
2872
- router;
2873
- CACHE_PREFIX = 'BIZY-CACHE';
2874
- constructor(router) {
2875
- this.router = router;
2876
- }
2877
- getData(key) {
2878
- if (!key) {
2879
- key = this.router.getURL();
2880
- }
2881
- const data = sessionStorage.getItem(`${this.CACHE_PREFIX}-${key}`);
2882
- if (data) {
2883
- const _data = JSON.parse(data);
2884
- return Date.now() < _data.expiresAt ? _data.value : {};
2755
+ args: [ElementRef]
2756
+ }] }, { type: i0.ChangeDetectorRef, decorators: [{
2757
+ type: Inject,
2758
+ args: [ChangeDetectorRef]
2759
+ }] }], propDecorators: { id: [{
2760
+ type: Input
2761
+ }], disabled: [{
2762
+ type: Input
2763
+ }], customClass: [{
2764
+ type: Input
2765
+ }], onSelect: [{
2766
+ type: Output
2767
+ }], selected: [{
2768
+ type: Input
2769
+ }] } });
2770
+
2771
+ class BizySelectComponent {
2772
+ ref;
2773
+ #viewContainerRef = inject(ViewContainerRef);
2774
+ templatePortalContent;
2775
+ options;
2776
+ bizyInput;
2777
+ id = `bizy-select-${Math.random()}`;
2778
+ disabled = false;
2779
+ readonly = false;
2780
+ placeholder = '';
2781
+ customClass = '';
2782
+ opened = false;
2783
+ openedChange = new EventEmitter();
2784
+ onSelect = new EventEmitter();
2785
+ onOpen = new EventEmitter();
2786
+ _optionValue = '';
2787
+ optionPortal;
2788
+ templatePortal = null;
2789
+ #subscription = new Subscription();
2790
+ #contentChildrenSubscription = new Subscription();
2791
+ constructor(ref) {
2792
+ this.ref = ref;
2793
+ }
2794
+ get touched() {
2795
+ return this.bizyInput ? this.bizyInput.touched : false;
2796
+ }
2797
+ ngAfterViewInit() {
2798
+ this.templatePortal = new TemplatePortal(this.templatePortalContent, this.#viewContainerRef);
2799
+ this._optionValue = '';
2800
+ const option = this.options.find(_option => _option.getSelected());
2801
+ if (option) {
2802
+ this._optionValue = option.getValue();
2885
2803
  }
2886
- return {};
2804
+ this.options.forEach(_option => {
2805
+ this.#subscription.add(_option.onSelect.subscribe(() => {
2806
+ this.close();
2807
+ this.ref.detectChanges();
2808
+ }));
2809
+ this.#subscription.add(_option.selected$.pipe(filter(_value => _value === true)).subscribe(() => {
2810
+ this._optionValue = _option.getValue();
2811
+ this.ref.detectChanges();
2812
+ }));
2813
+ });
2814
+ this.#contentChildrenSubscription.add(this.options.changes.subscribe(() => {
2815
+ this.#subscription.unsubscribe();
2816
+ this.#subscription = new Subscription();
2817
+ this.options.forEach(_option => {
2818
+ this.#subscription.add(_option.onSelect.subscribe(() => {
2819
+ this.close();
2820
+ this.ref.detectChanges();
2821
+ }));
2822
+ this.#subscription.add(_option.selected$.pipe(filter(_value => _value === true)).subscribe(() => {
2823
+ this._optionValue = _option.getValue();
2824
+ this.ref.detectChanges();
2825
+ }));
2826
+ });
2827
+ }));
2828
+ this.ref.detectChanges();
2887
2829
  }
2888
- setData(value, key, expiresAt) {
2889
- if (typeof value === 'undefined' || value === null) {
2830
+ _onOpen(event) {
2831
+ if (this.disabled || this.readonly) {
2890
2832
  return;
2891
2833
  }
2892
- if (!key) {
2893
- key = this.router.getURL();
2894
- }
2895
- if (!expiresAt) {
2896
- const date = new Date();
2897
- date.setHours(23, 59, 59);
2898
- expiresAt = date.getTime();
2834
+ this.opened = !this.opened;
2835
+ this.onSelect.emit(event);
2836
+ this.openedChange.emit(this.opened);
2837
+ this.onOpen.emit(this.opened);
2838
+ if (this.bizyInput) {
2839
+ this.bizyInput.setFocus(true);
2899
2840
  }
2900
- const data = {
2901
- expiresAt,
2902
- value
2903
- };
2904
- sessionStorage.setItem(`${this.CACHE_PREFIX}-${key}`, JSON.stringify(data));
2841
+ this.ref.detectChanges();
2905
2842
  }
2906
- remove(key) {
2907
- if (!key) {
2908
- key = this.router.getURL();
2843
+ close = (event, select) => {
2844
+ if (select && event && event.target && event.target === select.bizyInputWrapper.nativeElement) {
2845
+ return;
2846
+ }
2847
+ this.opened = false;
2848
+ this.openedChange.emit(this.opened);
2849
+ this.onOpen.emit(this.opened);
2850
+ this.ref.detectChanges();
2851
+ };
2852
+ setTouched(touched) {
2853
+ if (this.bizyInput) {
2854
+ this.bizyInput.setTouched(touched);
2855
+ this.ref.detectChanges();
2909
2856
  }
2910
- sessionStorage.removeItem(`${this.CACHE_PREFIX}-${key}`);
2911
2857
  }
2912
- removeAll() {
2913
- const cacheKeys = Object.keys(sessionStorage).filter(key => {
2914
- return key.includes(this.CACHE_PREFIX);
2915
- });
2916
- cacheKeys.forEach(value => {
2917
- sessionStorage.removeItem(value);
2918
- });
2858
+ ngOnDestroy() {
2859
+ this.#subscription.unsubscribe();
2860
+ this.#contentChildrenSubscription.unsubscribe();
2919
2861
  }
2920
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCacheService, deps: [{ token: BizyRouterService }], target: i0.ɵɵFactoryTarget.Injectable });
2921
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCacheService, providedIn: 'root' });
2862
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizySelectComponent, deps: [{ token: ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2863
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizySelectComponent, isStandalone: true, selector: "bizy-select", inputs: { id: "id", disabled: "disabled", readonly: "readonly", placeholder: "placeholder", customClass: "customClass", opened: "opened" }, outputs: { openedChange: "openedChange", onSelect: "onSelect", onOpen: "onOpen" }, queries: [{ propertyName: "options", predicate: BizySelectOptionComponent }], viewQueries: [{ propertyName: "templatePortalContent", first: true, predicate: ["templatePortalContent"], descendants: true }, { propertyName: "bizyInput", first: true, predicate: ["bizyInput"], descendants: true }], ngImport: i0, template: "<bizy-input\n #bizyInput\n [readonly]=\"true\"\n [disabled]=\"disabled\"\n [id]=\"id\"\n [placeholder]=\"placeholder\"\n [value]=\"_optionValue\"\n [ngClass]=\"{'bizy-select--readonly': readonly}\"\n (onSelect)=\"_onOpen($event); bizyInput?.setTouched(true)\"\n (onEnter)=\"_onOpen($event); bizyInput?.setTouched(true)\"\n class=\"bizy-select {{customClass}}\"\n cdkOverlayOrigin\n #bizySelectTrigger=\"cdkOverlayOrigin\">\n\n <svg \n slot=\"suffix\"\n id=\"bizy-select-arrow\"\n *ngIf=\"!readonly\"\n class=\"bizy-select__arrow\"\n [ngClass]=\"{'bizy-select__arrow--opened': opened}\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 320 512\">\n <path d=\"M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z\"/>\n </svg>\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=header]\"></ng-content>\n </ng-container>\n\n <ng-container slot=\"prefix\">\n <ng-content select=\"[slot=prefix]\"></ng-content>\n </ng-container>\n\n</bizy-input>\n\n<span class=\"bizy-select__errors\" *ngIf=\"touched\">\n <ng-content select=\"[slot=error]\"></ng-content>\n</span>\n\n<ng-template #templatePortalContent>\n <ng-content select=\"bizy-select-option\"></ng-content>\n</ng-template>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayMinWidth]=\"bizyInput.getWidth()\"\n [cdkConnectedOverlayOrigin]=\"bizySelectTrigger\"\n (overlayOutsideClick)=\"close($event, bizyInput)\"\n [cdkConnectedOverlayOpen]=\"opened\">\n\n <span class=\"bizy-select__options\">\n\n <span class=\"bizy-select__options__search\">\n <ng-content select=\"bizy-input\"></ng-content>\n </span>\n\n <ng-template [cdkPortalOutlet]=\"templatePortal\"></ng-template>\n \n </span>\n\n</ng-template>\n", styles: [":host{font-size:1rem;width:var(--bizy-select-width);min-width:var(--bizy-select-min-width);max-width:var(--bizy-select-max-width);display:flex;flex-direction:column;row-gap:.3rem;--bizy-input-focus-color: transparent}:host:has(>.bizy-select__errors:not(:empty)) ::ng-deep .bizy-input__bottom-line{background-color:var(--bizy-input-invalid-color)!important;visibility:visible!important}:host:has(>.bizy-select__errors:not(:empty)) ::ng-deep .bizy-input__content__input{color:var(--bizy-input-invalid-color)!important}.bizy-select{--bizy-input-cursor: pointer;--bizy-input-background-color: var(--bizy-select-background-color);--bizy-input-color: var(--bizy-select-color)}.bizy-select--readonly{--bizy-input-cursor: default}.bizy-select__arrow{height:var(--bizy-select-arrow-height);pointer-events:none;display:block;transition:transform .2s ease;fill:var(--bizy-select-color)}.bizy-select__arrow--opened{transform:rotate(180deg)}.bizy-select__options{background-color:var(--bizy-select-background-color);display:flex;min-width:fit-content;width:100%;flex-direction:column;box-shadow:0 7px 14px #32325d1a,0 3px 6px #00000014;max-height:var(--bizy-select-height);overflow-y:auto;overflow-x:hidden;position:relative}.bizy-select__options::-webkit-scrollbar{width:.5rem;height:.5rem}.bizy-select__options::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-select-scroll-bar-color)}.bizy-select__options::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-select-scroll-bar-hover-color)}.bizy-select__options::-webkit-scrollbar-button{height:1rem}.bizy-select__options__search{position:sticky;z-index:1;top:0}::ng-deep .bizy-select__options__search{--bizy-input-width: auto;--bizy-input-background-color: #fff;--bizy-input-min-width: var(--bizy-select-min-width);--bizy-input-max-width: auto;margin-bottom:.3rem}.bizy-select__errors:empty{display:none!important}::ng-deep .bizy-select__errors *{color:var(--bizy-input-invalid-color)!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: BizyInputComponent, selector: "bizy-input", inputs: ["id", "name", "type", "customClass", "placeholder", "debounceTime", "rows", "disabled", "readonly", "autofocus", "value"], outputs: ["valueChange", "onChange", "onEnter", "onBackspace", "onSelect", "onBlur", "onFocus"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i2$2.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i2$2.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i3.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2922
2864
  }
2923
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCacheService, decorators: [{
2924
- type: Injectable,
2925
- args: [{
2926
- providedIn: 'root'
2927
- }]
2928
- }], ctorParameters: () => [{ type: BizyRouterService, decorators: [{
2865
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizySelectComponent, decorators: [{
2866
+ type: Component,
2867
+ args: [{ selector: 'bizy-select', imports: [CommonModule, BizyInputComponent, OverlayModule, PortalModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<bizy-input\n #bizyInput\n [readonly]=\"true\"\n [disabled]=\"disabled\"\n [id]=\"id\"\n [placeholder]=\"placeholder\"\n [value]=\"_optionValue\"\n [ngClass]=\"{'bizy-select--readonly': readonly}\"\n (onSelect)=\"_onOpen($event); bizyInput?.setTouched(true)\"\n (onEnter)=\"_onOpen($event); bizyInput?.setTouched(true)\"\n class=\"bizy-select {{customClass}}\"\n cdkOverlayOrigin\n #bizySelectTrigger=\"cdkOverlayOrigin\">\n\n <svg \n slot=\"suffix\"\n id=\"bizy-select-arrow\"\n *ngIf=\"!readonly\"\n class=\"bizy-select__arrow\"\n [ngClass]=\"{'bizy-select__arrow--opened': opened}\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 320 512\">\n <path d=\"M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z\"/>\n </svg>\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=header]\"></ng-content>\n </ng-container>\n\n <ng-container slot=\"prefix\">\n <ng-content select=\"[slot=prefix]\"></ng-content>\n </ng-container>\n\n</bizy-input>\n\n<span class=\"bizy-select__errors\" *ngIf=\"touched\">\n <ng-content select=\"[slot=error]\"></ng-content>\n</span>\n\n<ng-template #templatePortalContent>\n <ng-content select=\"bizy-select-option\"></ng-content>\n</ng-template>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayMinWidth]=\"bizyInput.getWidth()\"\n [cdkConnectedOverlayOrigin]=\"bizySelectTrigger\"\n (overlayOutsideClick)=\"close($event, bizyInput)\"\n [cdkConnectedOverlayOpen]=\"opened\">\n\n <span class=\"bizy-select__options\">\n\n <span class=\"bizy-select__options__search\">\n <ng-content select=\"bizy-input\"></ng-content>\n </span>\n\n <ng-template [cdkPortalOutlet]=\"templatePortal\"></ng-template>\n \n </span>\n\n</ng-template>\n", styles: [":host{font-size:1rem;width:var(--bizy-select-width);min-width:var(--bizy-select-min-width);max-width:var(--bizy-select-max-width);display:flex;flex-direction:column;row-gap:.3rem;--bizy-input-focus-color: transparent}:host:has(>.bizy-select__errors:not(:empty)) ::ng-deep .bizy-input__bottom-line{background-color:var(--bizy-input-invalid-color)!important;visibility:visible!important}:host:has(>.bizy-select__errors:not(:empty)) ::ng-deep .bizy-input__content__input{color:var(--bizy-input-invalid-color)!important}.bizy-select{--bizy-input-cursor: pointer;--bizy-input-background-color: var(--bizy-select-background-color);--bizy-input-color: var(--bizy-select-color)}.bizy-select--readonly{--bizy-input-cursor: default}.bizy-select__arrow{height:var(--bizy-select-arrow-height);pointer-events:none;display:block;transition:transform .2s ease;fill:var(--bizy-select-color)}.bizy-select__arrow--opened{transform:rotate(180deg)}.bizy-select__options{background-color:var(--bizy-select-background-color);display:flex;min-width:fit-content;width:100%;flex-direction:column;box-shadow:0 7px 14px #32325d1a,0 3px 6px #00000014;max-height:var(--bizy-select-height);overflow-y:auto;overflow-x:hidden;position:relative}.bizy-select__options::-webkit-scrollbar{width:.5rem;height:.5rem}.bizy-select__options::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-select-scroll-bar-color)}.bizy-select__options::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-select-scroll-bar-hover-color)}.bizy-select__options::-webkit-scrollbar-button{height:1rem}.bizy-select__options__search{position:sticky;z-index:1;top:0}::ng-deep .bizy-select__options__search{--bizy-input-width: auto;--bizy-input-background-color: #fff;--bizy-input-min-width: var(--bizy-select-min-width);--bizy-input-max-width: auto;margin-bottom:.3rem}.bizy-select__errors:empty{display:none!important}::ng-deep .bizy-select__errors *{color:var(--bizy-input-invalid-color)!important}\n"] }]
2868
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef, decorators: [{
2929
2869
  type: Inject,
2930
- args: [BizyRouterService]
2931
- }] }] });
2870
+ args: [ChangeDetectorRef]
2871
+ }] }], propDecorators: { templatePortalContent: [{
2872
+ type: ViewChild,
2873
+ args: ['templatePortalContent']
2874
+ }], options: [{
2875
+ type: ContentChildren,
2876
+ args: [BizySelectOptionComponent]
2877
+ }], bizyInput: [{
2878
+ type: ViewChild,
2879
+ args: ['bizyInput']
2880
+ }], id: [{
2881
+ type: Input
2882
+ }], disabled: [{
2883
+ type: Input
2884
+ }], readonly: [{
2885
+ type: Input
2886
+ }], placeholder: [{
2887
+ type: Input
2888
+ }], customClass: [{
2889
+ type: Input
2890
+ }], opened: [{
2891
+ type: Input
2892
+ }], openedChange: [{
2893
+ type: Output
2894
+ }], onSelect: [{
2895
+ type: Output
2896
+ }], onOpen: [{
2897
+ type: Output
2898
+ }] } });
2932
2899
 
2933
- class BizyValidatorService {
2934
- isEmail = (value) => validator.isEmail(value, { allow_utf8_local_part: false });
2935
- dateIsAfter = (data) => {
2936
- if (!data || !data.date || !data.comparisonDate) {
2937
- return false;
2938
- }
2939
- const date = new Date(data.date);
2940
- const comparisonDate = new Date(data.comparisonDate);
2941
- return validator.isAfter(date.toString(), comparisonDate.toString());
2942
- };
2943
- dateIsBefore = (data) => {
2944
- if (!data || !data.date || !data.comparisonDate) {
2945
- return false;
2946
- }
2947
- const date = new Date(data.date);
2948
- const comparisonDate = new Date(data.comparisonDate);
2949
- return validator.isBefore(date.toString(), comparisonDate.toString());
2950
- };
2951
- isAlpha = (value) => validator.isAlpha(value);
2952
- isAlphanumeric = (value) => validator.isAlphanumeric(value);
2953
- isNumeric = (value) => validator.isNumeric(value);
2954
- isNumber(number) {
2955
- const regex = /^-?\d+(\.\d+)?$/;
2956
- return regex.test(String(number).toLowerCase());
2957
- }
2958
- isString(string) {
2959
- return typeof string === 'string' || string instanceof String;
2900
+ class BizyFormComponent {
2901
+ inputs;
2902
+ selects;
2903
+ datePickers;
2904
+ id = `bizy-form-${Math.random()}`;
2905
+ customClass = '';
2906
+ onSubmit(event) {
2907
+ this.setTouched();
2908
+ event.preventDefault();
2960
2909
  }
2961
- isInteger = (value) => validator.isInt(value);
2962
- isBoolean = (value) => validator.isBoolean(value);
2963
- isCreditCard = (value) => validator.isCreditCard(value);
2964
- isDataURI = (value) => validator.isDataURI(value);
2965
- isURL = (value) => validator.isURL(value);
2966
- isDate = (value) => validator.isDate(value);
2967
- isJSON = (value) => validator.isJSON(value);
2968
- isIP = (value, version) => validator.isIP(value, { version });
2969
- isJWT = (value) => validator.isJWT(value);
2970
- isLowercase = (value) => validator.isLowercase(value);
2971
- isUppercase = (value) => validator.isUppercase(value);
2972
- isMobilePhone = (data) => validator.isMobilePhone(data.value, data.locale);
2973
- isCUIT(cuit) {
2974
- const regex = /(^[0-9]{2}-[0-9]{8}-[0-9]$)/i;
2975
- const isCUIT = regex.test(String(cuit).toLowerCase());
2976
- if (!isCUIT) {
2977
- return false;
2910
+ setTouched = () => {
2911
+ if (this.inputs.length > 0) {
2912
+ this.inputs.forEach(component => {
2913
+ component.setTouched(true);
2914
+ });
2978
2915
  }
2979
- cuit = String(cuit).replace(/[-_]/g, '');
2980
- if (cuit.length == 11) {
2981
- const mult = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2];
2982
- let total = 0;
2983
- for (let i = 0; i < mult.length; i++) {
2984
- total += parseInt(cuit[i]) * mult[i];
2985
- }
2986
- const mod = total % 11;
2987
- const digit = mod === 0 ? 0 : mod === 1 ? 9 : 11 - mod;
2988
- return digit === parseInt(cuit[10]);
2916
+ if (this.selects.length > 0) {
2917
+ this.selects.forEach(component => {
2918
+ component.setTouched(true);
2919
+ });
2989
2920
  }
2990
- return false;
2991
- }
2992
- isDNI(dni) {
2993
- const regex = /(^[1-9]{1}[0-9]{7}$)/i;
2994
- return regex.test(String(dni).toLowerCase());
2995
- }
2996
- isCBU(cbu) {
2997
- const _isLengthOk = (cbu) => {
2998
- return cbu.length === 22;
2999
- };
3000
- const _isValidAccount = (account) => {
3001
- if (account.length !== 14) {
3002
- return false;
3003
- }
3004
- const sum = Number(account[0]) * 3 +
3005
- Number(account[1]) * 9 +
3006
- Number(account[2]) * 7 +
3007
- Number(account[3]) * 1 +
3008
- Number(account[4]) * 3 +
3009
- Number(account[5]) * 9 +
3010
- Number(account[6]) * 7 +
3011
- Number(account[7]) * 1 +
3012
- Number(account[8]) * 3 +
3013
- Number(account[9]) * 9 +
3014
- Number(account[10]) * 7 +
3015
- Number(account[11]) * 1 +
3016
- Number(account[12]) * 3;
3017
- const diff = (10 - (sum % 10)) % 10; // The result of this should be only 1 digit
3018
- const checksum = Number(account[13]);
3019
- return diff === checksum;
3020
- };
3021
- const _isValidBankCode = (code) => {
3022
- if (code.length !== 8) {
3023
- return false;
3024
- }
3025
- const bank = code.substring(0, 3);
3026
- const checksumOne = code[3];
3027
- const branch = code.substring(4, 4 + 3);
3028
- const checksumTwo = code[7];
3029
- const sum = (Number(bank[0]) * 7) +
3030
- (Number(bank[1]) * 1) +
3031
- (Number(bank[2]) * 3) +
3032
- (Number(checksumOne) * 9) +
3033
- (Number(branch[0]) * 7) +
3034
- (Number(branch[1]) * 1) +
3035
- (Number(branch[2]) * 3);
3036
- const diff = (10 - (sum % 10)) % 10; // The result of this should be only 1 digit
3037
- return diff === Number(checksumTwo);
3038
- };
3039
- const bankCode = cbu.substring(0, 8);
3040
- const accountCode = cbu.substring(8, 8 + 14);
3041
- return (_isLengthOk(cbu) &&
3042
- _isValidBankCode(bankCode) &&
3043
- _isValidAccount(accountCode));
3044
- }
3045
- emailValidator() {
3046
- return (control) => {
3047
- return !control.value || (control.value && this.isEmail(control.value))
3048
- ? null
3049
- : { anuraEmail: true };
3050
- };
3051
- }
3052
- mobilePhoneValidator(locale) {
3053
- return (control) => {
3054
- return !control.value || !locale ||
3055
- (control.value && locale && this.isMobilePhone({ value: control.value, locale }))
3056
- ? null
3057
- : { anuraMobilePhone: true };
3058
- };
3059
- }
3060
- numberValidator() {
3061
- return (control) => {
3062
- return !control.value || (control.value && this.isNumber(control.value))
3063
- ? null
3064
- : { anuraNumber: true };
3065
- };
3066
- }
3067
- numericValidator() {
3068
- return (control) => {
3069
- return !control.value || (control.value && this.isNumeric(control.value))
3070
- ? null
3071
- : { anuraNumeric: true };
3072
- };
3073
- }
3074
- dateIsAfterValidator(comparisonDate) {
3075
- return (control) => {
3076
- return !control.value || !comparisonDate || (control.value && comparisonDate && !this.dateIsAfter({ date: control.value, comparisonDate }))
3077
- ? null
3078
- : { anuraDateIsAfter: true };
3079
- };
3080
- }
3081
- dateIsBeforeValidator(comparisonDate) {
3082
- return (control) => {
3083
- return !control.value || !comparisonDate || (control.value && comparisonDate && !this.dateIsBefore({ date: control.value, comparisonDate }))
3084
- ? null
3085
- : { anuraDateIsBefore: true };
3086
- };
3087
- }
3088
- alphaValidator() {
3089
- return (control) => {
3090
- return !control.value || (control.value && this.isAlpha(control.value))
3091
- ? null
3092
- : { anuraAlpha: true };
3093
- };
3094
- }
3095
- alphanumericValidator() {
3096
- return (control) => {
3097
- return !control.value || (control.value && this.isAlphanumeric(control.value))
3098
- ? null
3099
- : { anuraAlphanumeric: true };
3100
- };
3101
- }
3102
- integerValidator() {
3103
- return (control) => {
3104
- return !control.value || (control.value && this.isInteger(control.value))
3105
- ? null
3106
- : { anuraInteger: true };
3107
- };
3108
- }
3109
- dataURIValidator() {
3110
- return (control) => {
3111
- return !control.value || (control.value && this.isDataURI(control.value))
3112
- ? null
3113
- : { anuraDataURI: true };
3114
- };
3115
- }
3116
- urlValidator() {
3117
- return (control) => {
3118
- return !control.value || (control.value && this.isURL(control.value))
3119
- ? null
3120
- : { anuraURL: true };
3121
- };
3122
- }
3123
- jsonValidator() {
3124
- return (control) => {
3125
- return !control.value || (control.value && this.isJSON(control.value))
3126
- ? null
3127
- : { anuraJSON: true };
3128
- };
3129
- }
3130
- jwtValidator() {
3131
- return (control) => {
3132
- return !control.value || (control.value && this.isJWT(control.value))
3133
- ? null
3134
- : { anuraJWT: true };
3135
- };
3136
- }
3137
- lowerCaseValidator() {
3138
- return (control) => {
3139
- return !control.value || (control.value && this.isLowercase(control.value))
3140
- ? null
3141
- : { anuraLowerCase: true };
3142
- };
3143
- }
3144
- upperCaseValidator() {
3145
- return (control) => {
3146
- return !control.value || (control.value && this.isUppercase(control.value))
3147
- ? null
3148
- : { anuraUpperCase: true };
3149
- };
3150
- }
3151
- cuitValidator() {
3152
- return (control) => {
3153
- return !control.value || (control.value && this.isCUIT(control.value))
3154
- ? null
3155
- : { anuraCUIT: true };
3156
- };
3157
- }
3158
- dniValidator() {
3159
- return (control) => {
3160
- return !control.value || (control.value && this.isDNI(control.value))
3161
- ? null
3162
- : { anuraDNI: true };
3163
- };
3164
- }
3165
- cbuValidator() {
3166
- return (control) => {
3167
- return !control.value || (control.value && this.isCBU(control.value))
3168
- ? null
3169
- : { anuraCBU: true };
3170
- };
3171
- }
3172
- creditCardValidator() {
3173
- return (control) => {
3174
- return !control.value || (control.value && this.isCreditCard(control.value))
3175
- ? null
3176
- : { anuraCreditCard: true };
3177
- };
3178
- }
3179
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyValidatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3180
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyValidatorService, providedIn: 'root' });
2921
+ if (this.datePickers.length > 0) {
2922
+ this.datePickers.forEach(component => {
2923
+ component.setTouched(true);
2924
+ });
2925
+ }
2926
+ };
2927
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2928
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyFormComponent, isStandalone: true, selector: "bizy-form", inputs: { id: "id", customClass: "customClass" }, queries: [{ propertyName: "inputs", predicate: BizyInputComponent, descendants: true }, { propertyName: "selects", predicate: BizySelectComponent, descendants: true }, { propertyName: "datePickers", predicate: BizyDatePickerComponent, descendants: true }], ngImport: i0, template: "<form class=\"bizy-form {{customClass}}\" [id]=\"id\" (ngSubmit)=\"onSubmit($event)\">\n <ng-content></ng-content>\n</form>", styles: [":host{font-size:1rem;max-width:var(--bizy-form-max-width)}.bizy-form{max-width:inherit;display:flex;flex-direction:column;row-gap:var(--bizy-form-row-gap);--bizy-input-max-width: 100%;--bizy-select-max-width: 100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3181
2929
  }
3182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyValidatorService, decorators: [{
3183
- type: Injectable,
2930
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormComponent, decorators: [{
2931
+ type: Component,
2932
+ args: [{ selector: 'bizy-form', imports: [CommonModule, FormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<form class=\"bizy-form {{customClass}}\" [id]=\"id\" (ngSubmit)=\"onSubmit($event)\">\n <ng-content></ng-content>\n</form>", styles: [":host{font-size:1rem;max-width:var(--bizy-form-max-width)}.bizy-form{max-width:inherit;display:flex;flex-direction:column;row-gap:var(--bizy-form-row-gap);--bizy-input-max-width: 100%;--bizy-select-max-width: 100%}\n"] }]
2933
+ }], propDecorators: { inputs: [{
2934
+ type: ContentChildren,
2935
+ args: [BizyInputComponent, { descendants: true }]
2936
+ }], selects: [{
2937
+ type: ContentChildren,
2938
+ args: [BizySelectComponent, { descendants: true }]
2939
+ }], datePickers: [{
2940
+ type: ContentChildren,
2941
+ args: [BizyDatePickerComponent, { descendants: true }]
2942
+ }], id: [{
2943
+ type: Input
2944
+ }], customClass: [{
2945
+ type: Input
2946
+ }] } });
2947
+
2948
+ const COMPONENTS$h = [
2949
+ BizyFormComponent,
2950
+ ];
2951
+ class BizyFormModule {
2952
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2953
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyFormModule, imports: [BizyFormComponent], exports: [BizyFormComponent] });
2954
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormModule, imports: [COMPONENTS$h] });
2955
+ }
2956
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormModule, decorators: [{
2957
+ type: NgModule,
3184
2958
  args: [{
3185
- providedIn: 'root'
2959
+ imports: COMPONENTS$h,
2960
+ exports: COMPONENTS$h,
3186
2961
  }]
3187
2962
  }] });
3188
2963
 
3189
- class BizyStorageService {
3190
- get(key) {
3191
- const item = localStorage.getItem(key);
3192
- try {
3193
- return JSON.parse(item);
3194
- }
3195
- catch (e) {
3196
- return item;
3197
- }
3198
- }
3199
- set(key, value) {
3200
- if (typeof value === 'object') {
3201
- localStorage.setItem(key, JSON.stringify(value));
3202
- }
3203
- else if (typeof value === 'string') {
3204
- localStorage.setItem(key, value);
3205
- }
3206
- else {
3207
- localStorage.setItem(key, String(value));
3208
- }
3209
- }
3210
- remove(key) {
3211
- localStorage.removeItem(key);
2964
+ class BizyGridForDirective {
2965
+ viewContainerRef = inject(ViewContainerRef);
2966
+ templateRef = inject(TemplateRef);
2967
+ #items = new BehaviorSubject([]);
2968
+ get items$() {
2969
+ return this.#items.asObservable();
3212
2970
  }
3213
- clear() {
3214
- localStorage.clear();
2971
+ set gridForOf(items) {
2972
+ this.#items.next(items);
3215
2973
  }
3216
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3217
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyStorageService, providedIn: 'root' });
2974
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridForDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2975
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: BizyGridForDirective, isStandalone: true, selector: "[gridFor]", inputs: { gridForOf: "gridForOf" }, ngImport: i0 });
3218
2976
  }
3219
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyStorageService, decorators: [{
3220
- type: Injectable,
2977
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridForDirective, decorators: [{
2978
+ type: Directive,
3221
2979
  args: [{
3222
- providedIn: 'root'
2980
+ selector: '[gridFor]',
3223
2981
  }]
3224
- }] });
2982
+ }], propDecorators: { gridForOf: [{
2983
+ type: Input,
2984
+ args: ['gridForOf']
2985
+ }] } });
3225
2986
 
3226
- var COLOR;
3227
- (function (COLOR) {
3228
- COLOR["DEFAULT"] = "#666666";
3229
- COLOR["INFO"] = "#2484C6";
3230
- COLOR["SUCCESS"] = "#65BF6C";
3231
- COLOR["WARNING"] = "#F7A64C";
3232
- COLOR["ERROR"] = "#EF4C59";
3233
- })(COLOR || (COLOR = {}));
3234
- class BizyLogService {
3235
- #lastLogTimestamp = 0;
3236
- #log(log, color, param) {
3237
- const difference = this.#lastLogTimestamp ? Date.now() - this.#lastLogTimestamp : 0;
3238
- this.#lastLogTimestamp = Date.now();
3239
- const timestampStyles = 'color: #EE5DFF';
3240
- const logStyles = `color: ${color}; font-size: 12px;`;
3241
- const date = new Date();
3242
- if (param) {
3243
- console.log(`%c${date.toLocaleString()}: %c${log} %c(+${difference}ms)`, timestampStyles, logStyles, timestampStyles, param);
2987
+ class BizyGridRowComponent {
2988
+ #elementRef = inject(ElementRef);
2989
+ #ref = inject(ChangeDetectorRef);
2990
+ #renderer = inject(Renderer2);
2991
+ rowHeight = 100; // Px
2992
+ set itemsPerRow(itemsPerRow) {
2993
+ if (!this.#elementRef.nativeElement) {
2994
+ return;
3244
2995
  }
3245
- else {
3246
- console.log(`%c${date.toLocaleString()}: %c${log} %c(+${difference}ms)`, timestampStyles, logStyles, timestampStyles);
2996
+ if (!itemsPerRow) {
2997
+ itemsPerRow = 1;
3247
2998
  }
2999
+ this.#renderer.setStyle(this.#elementRef.nativeElement, 'gridTemplateRows', `${this.rowHeight}px`);
3000
+ this.#renderer.setStyle(this.#elementRef.nativeElement, 'gridTemplateColumns', `repeat(${itemsPerRow}, minmax(0, 1fr)`);
3001
+ this.#ref.detectChanges();
3248
3002
  }
3249
- debug(data, param) {
3250
- if (typeof data === 'string') {
3251
- this.#log(data, COLOR.DEFAULT, param);
3003
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3004
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyGridRowComponent, isStandalone: true, selector: "bizy-grid-row", inputs: { rowHeight: "rowHeight", itemsPerRow: "itemsPerRow" }, ngImport: i0, template: "<ng-content></ng-content>", styles: [":host{font-size:1rem;display:grid;column-gap:var(--bizy-grid-gap);margin-bottom:var(--bizy-grid-gap)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3005
+ }
3006
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridRowComponent, decorators: [{
3007
+ type: Component,
3008
+ args: [{ selector: 'bizy-grid-row', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>", styles: [":host{font-size:1rem;display:grid;column-gap:var(--bizy-grid-gap);margin-bottom:var(--bizy-grid-gap)}\n"] }]
3009
+ }], propDecorators: { rowHeight: [{
3010
+ type: Input
3011
+ }], itemsPerRow: [{
3012
+ type: Input
3013
+ }] } });
3014
+
3015
+ class BizyGridComponent {
3016
+ ref;
3017
+ document;
3018
+ renderer;
3019
+ elementRef;
3020
+ content;
3021
+ gridDirective;
3022
+ resizeRef = null;
3023
+ #rowScrollingMutationObserver;
3024
+ #resizeObserver;
3025
+ #subscription = new Subscription();
3026
+ #view;
3027
+ notifier$ = new Subject();
3028
+ rowHeight = 100;
3029
+ itemRows = [];
3030
+ items = [];
3031
+ itemTemplate;
3032
+ itemsPerRow = 1;
3033
+ constructor(ref, document, renderer, elementRef) {
3034
+ this.ref = ref;
3035
+ this.document = document;
3036
+ this.renderer = renderer;
3037
+ this.elementRef = elementRef;
3038
+ }
3039
+ ngAfterContentInit() {
3040
+ if (this.gridDirective) {
3041
+ this.#initView();
3252
3042
  }
3253
3043
  else {
3254
- this.#template({ ...data, param: data.param, title: 'Debug', color: COLOR.DEFAULT });
3044
+ this.#rowScrollingMutationObserver = new MutationObserver(() => {
3045
+ if (!this.gridDirective) {
3046
+ return;
3047
+ }
3048
+ this.#initView();
3049
+ this.#rowScrollingMutationObserver.disconnect();
3050
+ this.ref.detectChanges();
3051
+ });
3052
+ this.#rowScrollingMutationObserver.observe(this.document.body, { childList: true, subtree: true });
3255
3053
  }
3256
3054
  }
3257
- info(data, param) {
3258
- if (typeof data === 'string') {
3259
- this.#log(data, COLOR.INFO, param);
3055
+ #initView = () => {
3056
+ this.#subscription.add(this.gridDirective.items$.subscribe(items => {
3057
+ if (this.items.length === 0 && items.length === 0) {
3058
+ return;
3059
+ }
3060
+ this.items = items;
3061
+ this.#updateView();
3062
+ }));
3063
+ if (!this.#view) {
3064
+ this.#view = this.gridDirective.viewContainerRef;
3065
+ this.#view.createEmbeddedView(this.content);
3260
3066
  }
3261
- else {
3262
- this.#template({ ...data, param: data.param, title: 'Info', color: COLOR.INFO });
3067
+ this.#resizeObserver = new ResizeObserver(() => this.notifier$.next());
3068
+ const resizeRef = this.resizeRef ? this.resizeRef : this.renderer.parentNode(this.elementRef.nativeElement) ? this.renderer.parentNode(this.elementRef.nativeElement) : this.elementRef.nativeElement;
3069
+ this.#resizeObserver.observe(resizeRef);
3070
+ this.#subscription.add(this.notifier$.pipe(debounceTime$1(50)).subscribe(() => {
3071
+ this.#updateView();
3072
+ }));
3073
+ };
3074
+ #updateView = () => {
3075
+ this.itemTemplate = this.gridDirective.templateRef;
3076
+ const rowWidth = this.elementRef.nativeElement.offsetWidth || this.elementRef.nativeElement.firstChild.offsetWidth;
3077
+ let columnWidth = 100;
3078
+ const fontSize = Number(getComputedStyle(this.elementRef.nativeElement).getPropertyValue('font-size').split('px')[0]);
3079
+ const rowHeightParameter = getComputedStyle(this.elementRef.nativeElement).getPropertyValue('--bizy-grid-row-height');
3080
+ if (rowHeightParameter && rowHeightParameter.includes('rem')) {
3081
+ this.rowHeight = fontSize * Number(rowHeightParameter.split('rem')[0]);
3263
3082
  }
3264
- }
3265
- success(data, param) {
3266
- if (typeof data === 'string') {
3267
- this.#log(data, COLOR.SUCCESS, param);
3083
+ else if (rowHeightParameter && rowHeightParameter.includes('px')) {
3084
+ this.rowHeight = Number(rowHeightParameter.split('px')[0]);
3268
3085
  }
3269
- else {
3270
- this.#template({ ...data, param: data.param, title: 'Success', color: COLOR.SUCCESS });
3086
+ let gap = 10;
3087
+ const gapParameter = getComputedStyle(this.elementRef.nativeElement).getPropertyValue('--bizy-grid-gap');
3088
+ if (gapParameter && gapParameter.includes('rem')) {
3089
+ gap = fontSize * Number(gapParameter.split('rem')[0]);
3271
3090
  }
3272
- }
3273
- warning(data, param) {
3274
- if (typeof data === 'string') {
3275
- this.#log(data, COLOR.WARNING, param);
3091
+ else if (gapParameter && gapParameter.includes('px')) {
3092
+ gap = Number(gapParameter.split('px')[0]);
3276
3093
  }
3277
- else {
3278
- this.#template({ ...data, param: data.param, title: 'Warning', color: COLOR.WARNING });
3094
+ const columnWidthParameter = getComputedStyle(this.elementRef.nativeElement).getPropertyValue('--bizy-grid-column-width');
3095
+ if (columnWidthParameter && columnWidthParameter.includes('rem')) {
3096
+ columnWidth = fontSize * Number(columnWidthParameter.split('rem')[0]);
3279
3097
  }
3280
- }
3281
- error(data, param) {
3282
- if (typeof data === 'string') {
3283
- this.#log(data, COLOR.ERROR, param);
3098
+ else if (columnWidthParameter && columnWidthParameter.includes('px')) {
3099
+ columnWidth = Number(columnWidthParameter.split('px')[0]);
3100
+ }
3101
+ columnWidth += gap;
3102
+ const count = Math.trunc(rowWidth / (columnWidth));
3103
+ if (Math.round((gap * (count - 1)) + (columnWidth * count)) <= (rowWidth)) {
3104
+ this.itemsPerRow = count <= 0 ? 1 : count;
3284
3105
  }
3285
3106
  else {
3286
- this.#template({ ...data, param: data.param, title: 'Error', color: COLOR.ERROR });
3107
+ this.itemsPerRow = (count - 1) <= 0 ? 1 : count - 1;
3287
3108
  }
3109
+ const itemRows = [];
3110
+ for (let i = 0; i < this.items.length; i += this.itemsPerRow) {
3111
+ const row = this.items.slice(i, i + this.itemsPerRow);
3112
+ itemRows.push(row);
3113
+ }
3114
+ this.itemRows = itemRows;
3115
+ this.ref.detectChanges();
3116
+ };
3117
+ trackById(index, item) {
3118
+ return item?.id ?? index;
3288
3119
  }
3289
- /** DEPRECATED */
3290
- templateDebug(data) {
3291
- this.#template({ ...data, title: 'Debug', color: COLOR.DEFAULT });
3292
- }
3293
- /** DEPRECATED */
3294
- templateSucc(data) {
3295
- this.#template({ ...data, title: 'Success', color: COLOR.SUCCESS });
3296
- }
3297
- /** DEPRECATED */
3298
- templateInfo(data) {
3299
- this.#template({ ...data, title: 'Info', color: COLOR.INFO });
3300
- }
3301
- /** DEPRECATED */
3302
- templateWarn(data) {
3303
- this.#template({ ...data, title: 'Warning', color: COLOR.WARNING });
3304
- }
3305
- /** DEPRECATED */
3306
- templateError(data) {
3307
- this.#template({ ...data, title: 'Error', color: COLOR.ERROR });
3308
- }
3309
- #template(data) {
3310
- const log = `(${data.title}) ${data.fileName} - ${data.functionName}`;
3311
- this.#log(log, data.color, data.param);
3120
+ ngOnDestroy() {
3121
+ this.#subscription.unsubscribe();
3122
+ if (this.#rowScrollingMutationObserver) {
3123
+ this.#rowScrollingMutationObserver.disconnect();
3124
+ }
3125
+ if (this.#resizeObserver) {
3126
+ this.#resizeObserver.disconnect();
3127
+ }
3312
3128
  }
3313
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyLogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3314
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyLogService, providedIn: 'root' });
3129
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridComponent, deps: [{ token: ChangeDetectorRef }, { token: DOCUMENT }, { token: Renderer2 }, { token: ElementRef }], target: i0.ɵɵFactoryTarget.Component });
3130
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyGridComponent, isStandalone: true, selector: "bizy-grid", inputs: { resizeRef: "resizeRef" }, queries: [{ propertyName: "gridDirective", first: true, predicate: BizyGridForDirective, descendants: true }], viewQueries: [{ propertyName: "content", first: true, predicate: ["gridScrollingContent"], descendants: true }], ngImport: i0, template: "<div class=\"bizy-grid\" [ngClass]=\"{'bizy-grid--empty': items && items.length === 0}\">\n\n <cdk-virtual-scroll-viewport\n class=\"bizy-grid__rows\"\n [itemSize]=\"rowHeight\"\n [minBufferPx]=\"rowHeight + (rowHeight * 5)\"\n [maxBufferPx]=\"rowHeight + (rowHeight * 10)\">\n\n <ng-content></ng-content>\n \n <ng-template #gridScrollingContent>\n <ng-template let-item cdkVirtualFor [cdkVirtualForOf]=\"itemRows\">\n <bizy-grid-row [rowHeight]=\"rowHeight\" [itemsPerRow]=\"itemsPerRow\">\n <ng-container *ngFor=\"let it of item; trackBy: trackById\">\n <ng-template *ngTemplateOutlet=\"itemTemplate; context: { $implicit: it }\"></ng-template>\n </ng-container>\n </bizy-grid-row>\n </ng-template>\n </ng-template>\n </cdk-virtual-scroll-viewport>\n\n</div>\n", styles: [":host{display:inline-block!important;min-height:var(--bizy-grid-min-height);max-height:var(--bizy-grid-max-height);height:var(--bizy-grid-height);width:var(--bizy-grid-width);flex:1;overflow-x:auto;overflow-y:hidden;font-size:1rem}:host:has(.bizy-grid--empty){height:0!important;min-height:0!important;max-height:0!important}.bizy-grid{width:inherit;height:inherit;min-width:fit-content;display:flex;flex-direction:column;row-gap:.3rem;overflow-x:clip;background-color:var(--bizy-grid-background-color)}.bizy-grid__rows{width:100%;display:flex;flex-direction:column;min-width:fit-content;overflow-x:hidden}::ng-deep .cdk-virtual-scrollable{height:100%;width:100%;overflow-y:auto!important;overflow-x:hidden!important;contain:inline-size!important}::ng-deep .cdk-virtual-scroll-content-wrapper{min-width:100%;max-width:100%}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar{width:.5rem;height:.5rem}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-grid-scroll-bar-color)}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-grid-scroll-bar-hover-color)}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-button{height:1rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i2$2.ɵɵCdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i2$2.ɵɵCdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i2$2.ɵɵCdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: BizyGridRowComponent, selector: "bizy-grid-row", inputs: ["rowHeight", "itemsPerRow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3315
3131
  }
3316
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyLogService, decorators: [{
3317
- type: Injectable,
3132
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridComponent, decorators: [{
3133
+ type: Component,
3134
+ args: [{ selector: 'bizy-grid', imports: [CommonModule, ScrollingModule, BizyGridRowComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"bizy-grid\" [ngClass]=\"{'bizy-grid--empty': items && items.length === 0}\">\n\n <cdk-virtual-scroll-viewport\n class=\"bizy-grid__rows\"\n [itemSize]=\"rowHeight\"\n [minBufferPx]=\"rowHeight + (rowHeight * 5)\"\n [maxBufferPx]=\"rowHeight + (rowHeight * 10)\">\n\n <ng-content></ng-content>\n \n <ng-template #gridScrollingContent>\n <ng-template let-item cdkVirtualFor [cdkVirtualForOf]=\"itemRows\">\n <bizy-grid-row [rowHeight]=\"rowHeight\" [itemsPerRow]=\"itemsPerRow\">\n <ng-container *ngFor=\"let it of item; trackBy: trackById\">\n <ng-template *ngTemplateOutlet=\"itemTemplate; context: { $implicit: it }\"></ng-template>\n </ng-container>\n </bizy-grid-row>\n </ng-template>\n </ng-template>\n </cdk-virtual-scroll-viewport>\n\n</div>\n", styles: [":host{display:inline-block!important;min-height:var(--bizy-grid-min-height);max-height:var(--bizy-grid-max-height);height:var(--bizy-grid-height);width:var(--bizy-grid-width);flex:1;overflow-x:auto;overflow-y:hidden;font-size:1rem}:host:has(.bizy-grid--empty){height:0!important;min-height:0!important;max-height:0!important}.bizy-grid{width:inherit;height:inherit;min-width:fit-content;display:flex;flex-direction:column;row-gap:.3rem;overflow-x:clip;background-color:var(--bizy-grid-background-color)}.bizy-grid__rows{width:100%;display:flex;flex-direction:column;min-width:fit-content;overflow-x:hidden}::ng-deep .cdk-virtual-scrollable{height:100%;width:100%;overflow-y:auto!important;overflow-x:hidden!important;contain:inline-size!important}::ng-deep .cdk-virtual-scroll-content-wrapper{min-width:100%;max-width:100%}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar{width:.5rem;height:.5rem}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-grid-scroll-bar-color)}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-grid-scroll-bar-hover-color)}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-button{height:1rem}\n"] }]
3135
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef, decorators: [{
3136
+ type: Inject,
3137
+ args: [ChangeDetectorRef]
3138
+ }] }, { type: Document, decorators: [{
3139
+ type: Inject,
3140
+ args: [DOCUMENT]
3141
+ }] }, { type: i0.Renderer2, decorators: [{
3142
+ type: Inject,
3143
+ args: [Renderer2]
3144
+ }] }, { type: i0.ElementRef, decorators: [{
3145
+ type: Inject,
3146
+ args: [ElementRef]
3147
+ }] }], propDecorators: { content: [{
3148
+ type: ViewChild,
3149
+ args: ['gridScrollingContent']
3150
+ }], gridDirective: [{
3151
+ type: ContentChild,
3152
+ args: [BizyGridForDirective]
3153
+ }], resizeRef: [{
3154
+ type: Input
3155
+ }] } });
3156
+
3157
+ const COMPONENTS$g = [
3158
+ BizyGridComponent,
3159
+ BizyGridRowComponent
3160
+ ];
3161
+ const DIRECTIVES$2 = [
3162
+ BizyGridForDirective,
3163
+ ];
3164
+ class BizyGridModule {
3165
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3166
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyGridModule, imports: [BizyGridComponent,
3167
+ BizyGridRowComponent, BizyGridForDirective], exports: [BizyGridComponent,
3168
+ BizyGridRowComponent, BizyGridForDirective] });
3169
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridModule, imports: [BizyGridComponent,
3170
+ BizyGridRowComponent] });
3171
+ }
3172
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridModule, decorators: [{
3173
+ type: NgModule,
3318
3174
  args: [{
3319
- providedIn: 'root'
3175
+ imports: COMPONENTS$g.concat(DIRECTIVES$2),
3176
+ exports: COMPONENTS$g.concat(DIRECTIVES$2),
3320
3177
  }]
3321
3178
  }] });
3322
3179
 
3323
- class BizyCopyToClipboardService {
3324
- #clipboard = inject(Clipboard);
3325
- copy(data) {
3326
- return new Promise((resolve, reject) => {
3327
- try {
3328
- if (!data) {
3329
- resolve();
3330
- return;
3331
- }
3332
- setTimeout(() => {
3333
- let toCopy = '';
3334
- if (typeof data === 'string' || data instanceof String) {
3335
- toCopy = data;
3336
- }
3337
- else if (data.items && data.items.length > 0 && data.model) {
3338
- for (const key in data.model) {
3339
- if (key) {
3340
- toCopy += `${data.model[key]},`;
3341
- }
3342
- }
3343
- data.items.forEach(_item => {
3344
- // Remove the last character (',')
3345
- toCopy = toCopy.slice(0, -2);
3346
- toCopy += '\n';
3347
- for (const key in data.model) {
3348
- let value = _item;
3349
- const nestedProperty = key.split('.');
3350
- nestedProperty.forEach(_property => {
3351
- value = value[_property];
3352
- });
3353
- if (typeof value !== undefined && value !== null) {
3354
- toCopy += `${String(value).replace(/\n/g, '')},`;
3355
- }
3356
- else {
3357
- toCopy += ',';
3358
- }
3359
- }
3360
- });
3361
- }
3362
- const pending = this.#clipboard.beginCopy(toCopy);
3363
- let remainingAttempts = 3;
3364
- const attempt = () => {
3365
- const result = pending.copy();
3366
- if (!result && --remainingAttempts) {
3367
- setTimeout(attempt);
3368
- }
3369
- else {
3370
- // Remember to destroy when you're done!
3371
- pending.destroy();
3372
- resolve();
3373
- }
3374
- };
3375
- attempt();
3376
- }, 100);
3377
- }
3378
- catch (error) {
3379
- reject(error);
3380
- }
3381
- });
3382
- }
3383
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCopyToClipboardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3384
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCopyToClipboardService, providedIn: 'root' });
3180
+ const COMPONENTS$f = [
3181
+ BizyInputComponent,
3182
+ BizyInputOptionComponent
3183
+ ];
3184
+ class BizyInputModule {
3185
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3186
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyInputModule, imports: [BizyInputComponent,
3187
+ BizyInputOptionComponent], exports: [BizyInputComponent,
3188
+ BizyInputOptionComponent] });
3189
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyInputModule, imports: [COMPONENTS$f] });
3385
3190
  }
3386
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCopyToClipboardService, decorators: [{
3387
- type: Injectable,
3191
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyInputModule, decorators: [{
3192
+ type: NgModule,
3388
3193
  args: [{
3389
- providedIn: 'root'
3194
+ imports: COMPONENTS$f,
3195
+ exports: COMPONENTS$f,
3390
3196
  }]
3391
3197
  }] });
3392
3198
 
3393
- var BIZY_FORMAT_SECONDS_LANGUAGE;
3394
- (function (BIZY_FORMAT_SECONDS_LANGUAGE) {
3395
- BIZY_FORMAT_SECONDS_LANGUAGE["SPANISH"] = "es";
3396
- BIZY_FORMAT_SECONDS_LANGUAGE["ENGLISH"] = "en";
3397
- })(BIZY_FORMAT_SECONDS_LANGUAGE || (BIZY_FORMAT_SECONDS_LANGUAGE = {}));
3398
- var BIZY_FORMAT_SECONDS_FORMAT;
3399
- (function (BIZY_FORMAT_SECONDS_FORMAT) {
3400
- BIZY_FORMAT_SECONDS_FORMAT["DATE_TIME"] = "date-time";
3401
- BIZY_FORMAT_SECONDS_FORMAT["TIME"] = "time";
3402
- })(BIZY_FORMAT_SECONDS_FORMAT || (BIZY_FORMAT_SECONDS_FORMAT = {}));
3403
- class BizyFormatSecondsService {
3404
- #options = {
3405
- language: BIZY_FORMAT_SECONDS_LANGUAGE.SPANISH,
3406
- format: BIZY_FORMAT_SECONDS_FORMAT.TIME
3407
- };
3408
- getOptions() {
3409
- return this.#options;
3410
- }
3411
- setOptions(options) {
3412
- if (options && options.language) {
3413
- this.#options.language = options.language;
3414
- }
3415
- if (options && options.format) {
3416
- this.#options.format = options.format;
3417
- }
3418
- }
3419
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormatSecondsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3420
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormatSecondsService, providedIn: 'root' });
3199
+ class BizyListComponent {
3200
+ id = `bizy-list-${Math.random()}`;
3201
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3202
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyListComponent, isStandalone: true, selector: "bizy-list", inputs: { id: "id" }, host: { properties: { "id": "id" } }, ngImport: i0, template: "<ng-content></ng-content>", styles: [":host{font-size:1rem;height:var(--bizy-list-height);overflow:auto;width:var(--bizy-list-width);display:flex;flex-direction:var(--bizy-list-flex-direction);column-gap:var(--bizy-list-column-gap);row-gap:var(--bizy-list-row-gap);justify-content:var(--bizy-list-justify-content);align-items:var(--bizy-list-align-items)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3421
3203
  }
3422
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormatSecondsService, decorators: [{
3423
- type: Injectable,
3204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListComponent, decorators: [{
3205
+ type: Component,
3206
+ args: [{ selector: 'bizy-list', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, host: {
3207
+ '[id]': 'id'
3208
+ }, template: "<ng-content></ng-content>", styles: [":host{font-size:1rem;height:var(--bizy-list-height);overflow:auto;width:var(--bizy-list-width);display:flex;flex-direction:var(--bizy-list-flex-direction);column-gap:var(--bizy-list-column-gap);row-gap:var(--bizy-list-row-gap);justify-content:var(--bizy-list-justify-content);align-items:var(--bizy-list-align-items)}\n"] }]
3209
+ }], propDecorators: { id: [{
3210
+ type: Input
3211
+ }] } });
3212
+
3213
+ const COMPONENTS$e = [
3214
+ BizyListComponent,
3215
+ ];
3216
+ class BizyListModule {
3217
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3218
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyListModule, imports: [BizyListComponent], exports: [BizyListComponent] });
3219
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListModule, imports: [COMPONENTS$e] });
3220
+ }
3221
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListModule, decorators: [{
3222
+ type: NgModule,
3424
3223
  args: [{
3425
- providedIn: 'root'
3224
+ imports: COMPONENTS$e,
3225
+ exports: COMPONENTS$e,
3426
3226
  }]
3427
3227
  }] });
3428
3228
 
3429
- /**
3430
- * Copyright 2020 Google LLC
3431
- *
3432
- * Licensed under the Apache License, Version 2.0 (the 'License');
3433
- * you may not use this file except in compliance with the License.
3434
- * You may obtain a copy of the License at
3435
- *
3436
- * http://www.apache.org/licenses/LICENSE-2.0
3437
- *
3438
- * Unless required by applicable law or agreed to in writing, software
3439
- * distributed under the License is distributed on an 'AS IS' BASIS,
3440
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3441
- * See the License for the specific language governing permissions and
3442
- * limitations under the License.
3443
- */
3444
- // This function's role is to enable smooth transition to the brave new world of
3445
- // User-Agent Client Hints. If you have legacy code that relies on
3446
- // `navigator.userAgent` and which relies on entropy that will go away by
3447
- // default, you *need* to refactor it to use UA-CH. This function is to be used
3448
- // as a stop gap, to enable smooth transition during that period.
3449
- /**
3450
- * @param {string[]} hints
3451
- * @return {Promise<string|undefined>} A Promise that resolves to a string if a
3452
- * UA could be synthesized from client hints, otherwise undefined.
3453
- */
3454
- async function getUserAgentUsingClientHints(hints) {
3455
- // Helper functions for platform specific strings
3456
- const GetCrosSpecificString = (values) => {
3457
- let osCPUFragment = '';
3458
- if (values.bitness == '64') {
3459
- if (values.architecture == 'x86') {
3460
- osCPUFragment = 'x86_64';
3461
- }
3462
- else if (values.architecture == 'arm') {
3463
- osCPUFragment = 'aarch64';
3464
- }
3229
+ class BizyMenuOptionComponent {
3230
+ id = `bizy-menu-option-${Math.random()}`;
3231
+ disabled = false;
3232
+ customClass = '';
3233
+ selected = false;
3234
+ onSelect = new EventEmitter();
3235
+ _onSelect(event) {
3236
+ if (this.disabled) {
3237
+ return;
3465
3238
  }
3466
- else if (values.architecture == 'arm' && values.bitness == '32') {
3467
- osCPUFragment = 'armv7l';
3239
+ this.onSelect.emit(event);
3240
+ }
3241
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3242
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyMenuOptionComponent, isStandalone: true, selector: "bizy-menu-option", inputs: { id: "id", disabled: "disabled", customClass: "customClass", selected: "selected" }, outputs: { onSelect: "onSelect" }, ngImport: i0, template: "<button \n type=\"button\"\n [id]=\"id\"\n (click)=\"_onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\"\n [ngClass]=\"{'bizy-menu-option--selected': selected, 'bizy-menu-option--disabled': disabled}\"\n class=\"bizy-menu-option {{customClass}}\">\n\n <span class=\"bizy-menu-option__content\">\n <ng-content></ng-content>\n </span>\n \n</button>\n\n<span class=\"bizy-menu-option__menu\">\n <ng-content select=\"bizy-menu\"></ng-content>\n</span>\n", styles: [":host{font-size:1rem}:host:has(>.bizy-menu-option__menu:not(:empty)) .bizy-menu-option{display:none!important}.bizy-menu-option{font-size:1rem;width:100%;border:none;background-color:var(--bizy-menu-option-background-color);display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:.5rem;color:var(--bizy-menu-option-color);cursor:pointer}.bizy-menu-option:hover{background-color:var(--bizy-menu-option-hover-background-color)}.bizy-menu-option--selected{color:var(--bizy-menu-option-selected-color)!important;background-color:var(--bizy-menu-option-selected-background-color)!important}::ng-deep .bizy-menu-option--selected *{color:var(--bizy-menu-option-selected-color)!important}.bizy-menu-option--disabled{opacity:.5;pointer-events:none;cursor:not-allowed!important}.bizy-menu-option__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;width:100%}::ng-deep .bizy-menu-option__menu *{color:var(--bizy-menu-option-color);fill:var(--bizy-menu-option-color)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3243
+ }
3244
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuOptionComponent, decorators: [{
3245
+ type: Component,
3246
+ args: [{ selector: 'bizy-menu-option', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n type=\"button\"\n [id]=\"id\"\n (click)=\"_onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\"\n [ngClass]=\"{'bizy-menu-option--selected': selected, 'bizy-menu-option--disabled': disabled}\"\n class=\"bizy-menu-option {{customClass}}\">\n\n <span class=\"bizy-menu-option__content\">\n <ng-content></ng-content>\n </span>\n \n</button>\n\n<span class=\"bizy-menu-option__menu\">\n <ng-content select=\"bizy-menu\"></ng-content>\n</span>\n", styles: [":host{font-size:1rem}:host:has(>.bizy-menu-option__menu:not(:empty)) .bizy-menu-option{display:none!important}.bizy-menu-option{font-size:1rem;width:100%;border:none;background-color:var(--bizy-menu-option-background-color);display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:.5rem;color:var(--bizy-menu-option-color);cursor:pointer}.bizy-menu-option:hover{background-color:var(--bizy-menu-option-hover-background-color)}.bizy-menu-option--selected{color:var(--bizy-menu-option-selected-color)!important;background-color:var(--bizy-menu-option-selected-background-color)!important}::ng-deep .bizy-menu-option--selected *{color:var(--bizy-menu-option-selected-color)!important}.bizy-menu-option--disabled{opacity:.5;pointer-events:none;cursor:not-allowed!important}.bizy-menu-option__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;width:100%}::ng-deep .bizy-menu-option__menu *{color:var(--bizy-menu-option-color);fill:var(--bizy-menu-option-color)}\n"] }]
3247
+ }], propDecorators: { id: [{
3248
+ type: Input
3249
+ }], disabled: [{
3250
+ type: Input
3251
+ }], customClass: [{
3252
+ type: Input
3253
+ }], selected: [{
3254
+ type: Input
3255
+ }], onSelect: [{
3256
+ type: Output
3257
+ }] } });
3258
+
3259
+ class BizyMenuComponent {
3260
+ #ref = inject(ChangeDetectorRef);
3261
+ options;
3262
+ id = `bizy-menu-${Math.random()}`;
3263
+ disabled = false;
3264
+ offsetX = 0;
3265
+ offsetY = 0;
3266
+ customClass = '';
3267
+ hideArrow = false;
3268
+ opened = false;
3269
+ onSelect = new EventEmitter();
3270
+ _menuWidth;
3271
+ #subscription = new Subscription();
3272
+ bizyMenuOptionsId = 'bizyMenuOptionsId';
3273
+ _onSelect(event) {
3274
+ if (this.disabled) {
3275
+ return;
3468
3276
  }
3469
- if (osCPUFragment == '') {
3470
- return `X11; CrOS ${values.platformVersion}`;
3277
+ this.onSelect.emit(event);
3278
+ if (this.options && this.options.length > 0) {
3279
+ this.selectButton(event);
3471
3280
  }
3472
- return `X11; CrOS ${osCPUFragment} ${values.platformVersion}`;
3473
- };
3474
- const GetWindowsSpecificString = (values) => {
3475
- let osCPUFragment = '';
3476
- if (values.architecture == 'x86' && values.bitness == '64') {
3477
- osCPUFragment = '; Win64; x64';
3281
+ }
3282
+ selectButton(event) {
3283
+ this.opened = !this.opened;
3284
+ if (event && event.srcElement && event.srcElement.offsetWidth) {
3285
+ this._menuWidth = event.srcElement.offsetWidth;
3478
3286
  }
3479
- else if (values.architecture == 'arm') {
3480
- osCPUFragment = '; ARM';
3287
+ if (this.opened) {
3288
+ this.#subscription = new Subscription();
3289
+ this.#subscription.add(fromEvent(window, 'scroll', { capture: true }).subscribe(() => {
3290
+ if (event && event.target && event.target.id && (event.target.id === this.id || event.target.id === this.bizyMenuOptionsId)) {
3291
+ return;
3292
+ }
3293
+ this.opened = false;
3294
+ this.#ref.detectChanges();
3295
+ this.#subscription.unsubscribe();
3296
+ }));
3297
+ if (this.options) {
3298
+ this.options.forEach((option) => {
3299
+ this.#subscription.add(option.onSelect.subscribe(event => {
3300
+ this.close(event);
3301
+ }));
3302
+ });
3303
+ }
3481
3304
  }
3482
- else if (values.wow64 === true) {
3483
- osCPUFragment = '; WOW64';
3305
+ else {
3306
+ this.#subscription.unsubscribe();
3484
3307
  }
3485
- return `Windows NT ${getWindowsPlatformVersion(values.platformVersion)}${osCPUFragment}`;
3486
- };
3487
- const GetMacSpecificString = (values) => {
3488
- let newUA = 'Macintosh;';
3489
- newUA += values.architecture === 'arm' ? ' ARM ' : ' Intel ';
3490
- newUA += 'Mac OS X ';
3491
- let macVersion = values.platformVersion;
3492
- if (macVersion.indexOf('.') > -1) {
3493
- macVersion = macVersion.split('.').join('_');
3308
+ }
3309
+ close = (event) => {
3310
+ if (event && event.target && event.target.id && event.target.id === this.id) {
3311
+ return;
3494
3312
  }
3495
- newUA += macVersion;
3496
- return newUA;
3497
- };
3498
- const GetAndroidSpecificString = (values) => {
3499
- let newUA = 'Linux; Android ';
3500
- newUA += values.platformVersion;
3501
- if (values.model) {
3502
- newUA += '; ';
3503
- newUA += values.model;
3504
- }
3505
- return newUA;
3506
- };
3507
- const Initialize = (values) => {
3508
- if (!values.architecture) {
3509
- values.architecture = 'x86';
3510
- }
3511
- if (!values.bitness) {
3512
- values.bitness = '64';
3513
- }
3514
- if (!values.model) {
3515
- values.model = '';
3516
- }
3517
- if (!values.platform) {
3518
- values.platform = 'Windows';
3519
- }
3520
- if (!values.platformVersion) {
3521
- values.platformVersion = '10.0';
3522
- }
3523
- if (!values.wow64) {
3524
- values.wow64 = false;
3525
- }
3526
- return values;
3313
+ this.opened = false;
3314
+ this.#subscription.unsubscribe();
3315
+ this.#ref.detectChanges();
3527
3316
  };
3528
- // @ts-ignore-error
3529
- if (!navigator.userAgentData) {
3530
- return Promise.resolve('');
3531
- }
3532
- // Verify that this is a Chromium-based browser
3533
- let isChromium = false;
3534
- let chromiumVersion;
3535
- // eslint-disable-next-line prefer-regex-literals
3536
- const isChromeUAPattern = new RegExp('AppleWebKit/537.36 \\(KHTML, like Gecko\\) Chrome/\\d+.\\d+.\\d+.\\d+ (Mobile )?Safari/537.36$');
3537
- // @ts-ignore-error
3538
- navigator.userAgentData.brands.forEach(value => {
3539
- if (value.brand == 'Chromium') {
3540
- // Let's double check the UA string as well, so we don't accidentally
3541
- // capture a headless browser or friendly bot (which should report as
3542
- // HeadlessChrome or something entirely different).
3543
- isChromium = isChromeUAPattern.test(navigator.userAgent);
3544
- chromiumVersion = value.version;
3545
- }
3546
- });
3547
- // @ts-ignore
3548
- if (!isChromium || chromiumVersion < 100) {
3549
- // If this is not a Chromium-based browser, the UA string should be very
3550
- // different. Or, if this is a Chromium lower than 100, it doesn't have
3551
- // all the hints we rely on. So let's bail.
3552
- return Promise.resolve('');
3553
- }
3554
- // Main logic
3555
- return new Promise(resolve => {
3556
- // @ts-ignore-error
3557
- navigator.userAgentData.getHighEntropyValues(hints).then(values => {
3558
- let initialValues = {
3559
- // @ts-ignore-error
3560
- platform: navigator.userAgentData?.platform,
3561
- version: chromiumVersion
3562
- };
3563
- values = Object.assign(initialValues, values);
3564
- values = Initialize(values);
3565
- let newUA = 'Mozilla/5.0 (';
3566
- if (['Chrome OS', 'Chromium OS'].includes(values.platform)) {
3567
- newUA += GetCrosSpecificString(values);
3568
- }
3569
- else if (values.platform == 'Windows') {
3570
- newUA += GetWindowsSpecificString(values);
3571
- }
3572
- else if (values.platform == 'macOS') {
3573
- newUA += GetMacSpecificString(values);
3574
- }
3575
- else if (values.platform == 'Android') {
3576
- newUA += GetAndroidSpecificString(values);
3577
- }
3578
- else {
3579
- newUA += 'X11; Linux x86_64';
3580
- }
3581
- newUA += ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/';
3582
- newUA += getVersion(values?.fullVersionList, initialValues.version);
3583
- // @ts-ignore-error
3584
- if (navigator.userAgentData.mobile) {
3585
- newUA += ' Mobile';
3586
- }
3587
- newUA += ' Safari/537.36';
3588
- resolve(newUA);
3589
- });
3590
- });
3591
- }
3592
- function getVersion(fullVersionList, majorVersion) {
3593
- // If we don't get a fullVersionList, or it's somehow undefined, return
3594
- // the reduced version number.
3595
- return (fullVersionList?.find((item) => item.brand == 'Google Chrome')?.version ||
3596
- `${majorVersion}.0.0.0`);
3597
- }
3598
- function getWindowsPlatformVersion(platformVersion) {
3599
- // https://wicg.github.io/ua-client-hints/#get-the-legacy-windows-version-number
3600
- const versionMap = new Map([
3601
- ['0.3.0', '6.3'], // Windows 8.1
3602
- ['0.2.0', '6.2'], // Windows 8
3603
- ['0.1.0', '6.1'] // Windows 7
3604
- ]);
3605
- if (versionMap.has(platformVersion)) {
3606
- return versionMap.get(platformVersion);
3317
+ ngOnDestroy() {
3318
+ this.#subscription.unsubscribe();
3607
3319
  }
3608
- // Windows 10 and above send "Windows NT 10.0"
3609
- return '10.0';
3610
- }
3611
- /**
3612
- * @param {string[]} hints
3613
- * @return {Promise<string|undefined>} A Promise that resolves on overriding the
3614
- * navigator.userAgent string.
3615
- */
3616
- async function overrideUserAgentUsingClientHints(hints) {
3617
- return new Promise(resolve => {
3618
- getUserAgentUsingClientHints(hints).then(newUA => {
3619
- if (newUA) {
3620
- // Got a new UA value. Now override `navigator.userAgent`.
3621
- Object.defineProperty(navigator, 'userAgent', {
3622
- value: newUA,
3623
- writable: false,
3624
- configurable: true
3625
- });
3626
- }
3627
- else {
3628
- newUA = navigator.userAgent;
3629
- }
3630
- resolve(newUA);
3631
- });
3632
- });
3320
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3321
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyMenuComponent, isStandalone: true, selector: "bizy-menu", inputs: { id: "id", disabled: "disabled", offsetX: "offsetX", offsetY: "offsetY", customClass: "customClass", hideArrow: "hideArrow", opened: "opened" }, outputs: { onSelect: "onSelect" }, queries: [{ propertyName: "options", predicate: BizyMenuOptionComponent }], ngImport: i0, template: "<button \n type=\"button\"\n class=\"bizy-menu {{customClass}}\"\n [ngClass]=\"{'bizy-menu--disabled': disabled}\"\n [id]=\"id\"\n (click)=\"_onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\"\n cdkOverlayOrigin \n #bizyMenuTrigger=\"cdkOverlayOrigin\">\n\n <span class=\"bizy-menu__content\">\n <ng-content></ng-content>\n </span>\n \n <svg \n class=\"bizy-menu__arrow\"\n *ngIf=\"!hideArrow\" \n viewBox=\"0 0 96 96\" \n [ngClass]=\"{'bizy-menu__arrow--opened': opened}\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M81.8457,25.3876a6.0239,6.0239,0,0,0-8.45.7676L48,56.6257l-25.396-30.47a5.999,5.999,0,1,0-9.2114,7.6879L43.3943,69.8452a5.9969,5.9969,0,0,0,9.2114,0L82.6074,33.8431A6.0076,6.0076,0,0,0,81.8457,25.3876Z\"/>\n </svg>\n</button>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOffsetX]=\"offsetX\"\n [cdkConnectedOverlayOffsetY]=\"offsetY\"\n [cdkConnectedOverlayMinWidth]=\"_menuWidth\"\n [cdkConnectedOverlayOrigin]=\"bizyMenuTrigger\"\n (overlayOutsideClick)=\"close($event)\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayOpen]=\"opened\">\n\n <span class=\"bizy-menu__options\" [id]=\"bizyMenuOptionsId\">\n\n <span class=\"bizy-menu__options__header\">\n <ng-content select=\"bizy-menu-title\"></ng-content>\n <ng-content select=\"bizy-input\"></ng-content>\n </span>\n\n <ng-content select=\"bizy-menu-option\"></ng-content>\n\n </span>\n\n</ng-template>\n", styles: [":host{font-size:1rem}:host:has(>.bizy-menu__options:empty) .bizy-menu>.bizy-menu__arrow{display:none!important}.bizy-menu{font-size:1rem;width:100%;border:none;background-color:transparent;display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:var(--bizy-menu-padding);color:var(--bizy-menu-color);cursor:pointer}.bizy-menu--disabled{pointer-events:none;opacity:.5;cursor:not-allowed!important}.bizy-menu__arrow{height:var(--bizy-menu-arrow-height);pointer-events:none;display:block;transition:transform .2s ease;fill:var(--bizy-menu-color)}.bizy-menu__arrow--opened{transform:rotate(180deg)}.bizy-menu__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;pointer-events:none}.bizy-menu__options{background-color:var(--bizy-menu-background-color);min-width:var(--bizy-menu-min-width);max-width:var(--bizy-menu-max-width);max-height:var(--bizy-menu-max-height);overflow-y:auto;overflow-x:hidden;width:100%;display:flex;flex-direction:column;position:relative;box-shadow:0 7px 14px #32325d1a,0 3px 6px #00000014}.bizy-menu__options::-webkit-scrollbar{width:.5rem;height:.5rem}.bizy-menu__options::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-menu-scroll-bar-color)}.bizy-menu__options::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-menu-scroll-bar-hover-color)}.bizy-menu__options::-webkit-scrollbar-button{height:1rem}.bizy-menu__options__header{position:sticky;z-index:1;top:0;display:flex;flex-direction:column;row-gap:.3rem;background-color:#fff}::ng-deep .bizy-menu__options__header{--bizy-input-width: auto;--bizy-input-background-color: #fff;--bizy-input-min-width: var(--bizy-select-min-width);--bizy-input-max-width: auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i2$2.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i2$2.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3633
3322
  }
3634
- const exportedForTests = { getVersion, getWindowsPlatformVersion };
3323
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuComponent, decorators: [{
3324
+ type: Component,
3325
+ args: [{ selector: 'bizy-menu', imports: [CommonModule, FormsModule, OverlayModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n type=\"button\"\n class=\"bizy-menu {{customClass}}\"\n [ngClass]=\"{'bizy-menu--disabled': disabled}\"\n [id]=\"id\"\n (click)=\"_onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\"\n cdkOverlayOrigin \n #bizyMenuTrigger=\"cdkOverlayOrigin\">\n\n <span class=\"bizy-menu__content\">\n <ng-content></ng-content>\n </span>\n \n <svg \n class=\"bizy-menu__arrow\"\n *ngIf=\"!hideArrow\" \n viewBox=\"0 0 96 96\" \n [ngClass]=\"{'bizy-menu__arrow--opened': opened}\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M81.8457,25.3876a6.0239,6.0239,0,0,0-8.45.7676L48,56.6257l-25.396-30.47a5.999,5.999,0,1,0-9.2114,7.6879L43.3943,69.8452a5.9969,5.9969,0,0,0,9.2114,0L82.6074,33.8431A6.0076,6.0076,0,0,0,81.8457,25.3876Z\"/>\n </svg>\n</button>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOffsetX]=\"offsetX\"\n [cdkConnectedOverlayOffsetY]=\"offsetY\"\n [cdkConnectedOverlayMinWidth]=\"_menuWidth\"\n [cdkConnectedOverlayOrigin]=\"bizyMenuTrigger\"\n (overlayOutsideClick)=\"close($event)\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayOpen]=\"opened\">\n\n <span class=\"bizy-menu__options\" [id]=\"bizyMenuOptionsId\">\n\n <span class=\"bizy-menu__options__header\">\n <ng-content select=\"bizy-menu-title\"></ng-content>\n <ng-content select=\"bizy-input\"></ng-content>\n </span>\n\n <ng-content select=\"bizy-menu-option\"></ng-content>\n\n </span>\n\n</ng-template>\n", styles: [":host{font-size:1rem}:host:has(>.bizy-menu__options:empty) .bizy-menu>.bizy-menu__arrow{display:none!important}.bizy-menu{font-size:1rem;width:100%;border:none;background-color:transparent;display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:var(--bizy-menu-padding);color:var(--bizy-menu-color);cursor:pointer}.bizy-menu--disabled{pointer-events:none;opacity:.5;cursor:not-allowed!important}.bizy-menu__arrow{height:var(--bizy-menu-arrow-height);pointer-events:none;display:block;transition:transform .2s ease;fill:var(--bizy-menu-color)}.bizy-menu__arrow--opened{transform:rotate(180deg)}.bizy-menu__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;pointer-events:none}.bizy-menu__options{background-color:var(--bizy-menu-background-color);min-width:var(--bizy-menu-min-width);max-width:var(--bizy-menu-max-width);max-height:var(--bizy-menu-max-height);overflow-y:auto;overflow-x:hidden;width:100%;display:flex;flex-direction:column;position:relative;box-shadow:0 7px 14px #32325d1a,0 3px 6px #00000014}.bizy-menu__options::-webkit-scrollbar{width:.5rem;height:.5rem}.bizy-menu__options::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-menu-scroll-bar-color)}.bizy-menu__options::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-menu-scroll-bar-hover-color)}.bizy-menu__options::-webkit-scrollbar-button{height:1rem}.bizy-menu__options__header{position:sticky;z-index:1;top:0;display:flex;flex-direction:column;row-gap:.3rem;background-color:#fff}::ng-deep .bizy-menu__options__header{--bizy-input-width: auto;--bizy-input-background-color: #fff;--bizy-input-min-width: var(--bizy-select-min-width);--bizy-input-max-width: auto}\n"] }]
3326
+ }], propDecorators: { options: [{
3327
+ type: ContentChildren,
3328
+ args: [BizyMenuOptionComponent]
3329
+ }], id: [{
3330
+ type: Input
3331
+ }], disabled: [{
3332
+ type: Input
3333
+ }], offsetX: [{
3334
+ type: Input
3335
+ }], offsetY: [{
3336
+ type: Input
3337
+ }], customClass: [{
3338
+ type: Input
3339
+ }], hideArrow: [{
3340
+ type: Input
3341
+ }], opened: [{
3342
+ type: Input
3343
+ }], onSelect: [{
3344
+ type: Output
3345
+ }] } });
3635
3346
 
3636
- class BizyDeviceService {
3637
- #device = inject(DeviceDetectorService);
3638
- async getUserAgent() {
3639
- try {
3640
- const userAgent = await overrideUserAgentUsingClientHints([
3641
- 'architecture',
3642
- 'bitness',
3643
- 'model',
3644
- 'platformVersion',
3645
- 'uaFullVersion',
3646
- 'fullVersionList'
3647
- ]);
3648
- return userAgent;
3649
- }
3650
- catch {
3651
- return window.navigator.userAgent;
3652
- }
3653
- }
3654
- isMobile = () => this.#device.isMobile();
3655
- isTablet = () => this.#device.isTablet();
3656
- isDesktop = () => this.#device.isDesktop();
3657
- isPortrait = () => this.#device.orientation === 'portrait';
3658
- isLandscape = () => this.#device.orientation === 'landscape';
3659
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyDeviceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3660
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyDeviceService, providedIn: 'root' });
3347
+ class BizyMenuTitleComponent {
3348
+ customClass = '';
3349
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3350
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyMenuTitleComponent, isStandalone: true, selector: "bizy-menu-title", inputs: { customClass: "customClass" }, ngImport: i0, template: "<span class=\"bizy-menu-title {{customClass}}\">\n <ng-content></ng-content>\n</span>\n", styles: [":host{font-size:1rem}.bizy-menu-title{background-color:var(--bizy-menu-title-background-color);color:var(--bizy-menu-title-color);padding:.5rem;cursor:default;text-decoration:underline .1rem var(--bizy-menu-title-underline-color);text-underline-offset:.3rem;display:flex;align-items:center}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3661
3351
  }
3662
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyDeviceService, decorators: [{
3663
- type: Injectable,
3664
- args: [{ providedIn: 'root' }]
3665
- }] });
3352
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuTitleComponent, decorators: [{
3353
+ type: Component,
3354
+ args: [{ selector: 'bizy-menu-title', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span class=\"bizy-menu-title {{customClass}}\">\n <ng-content></ng-content>\n</span>\n", styles: [":host{font-size:1rem}.bizy-menu-title{background-color:var(--bizy-menu-title-background-color);color:var(--bizy-menu-title-color);padding:.5rem;cursor:default;text-decoration:underline .1rem var(--bizy-menu-title-underline-color);text-underline-offset:.3rem;display:flex;align-items:center}\n"] }]
3355
+ }], propDecorators: { customClass: [{
3356
+ type: Input
3357
+ }] } });
3666
3358
 
3667
- const SERVICES = [
3668
- BizyAnimationService,
3669
- BizyDeviceService,
3670
- BizyCacheService,
3671
- BizyCopyToClipboardService,
3672
- BizyExportToCSVService,
3673
- BizyFormatSecondsService,
3674
- BizyKeyboardService,
3675
- BizyLogService,
3676
- BizyRouterService,
3677
- BizyStorageService,
3678
- BizyValidatorService,
3679
- BizyViewportService
3359
+ const COMPONENTS$d = [
3360
+ BizyMenuComponent,
3361
+ BizyMenuOptionComponent,
3362
+ BizyMenuTitleComponent
3680
3363
  ];
3681
- class BizyServicesModule {
3682
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyServicesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3683
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyServicesModule });
3684
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyServicesModule, providers: SERVICES });
3364
+ class BizyMenuModule {
3365
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3366
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuModule, imports: [BizyMenuComponent,
3367
+ BizyMenuOptionComponent,
3368
+ BizyMenuTitleComponent], exports: [BizyMenuComponent,
3369
+ BizyMenuOptionComponent,
3370
+ BizyMenuTitleComponent] });
3371
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuModule, imports: [BizyMenuComponent,
3372
+ BizyMenuOptionComponent] });
3685
3373
  }
3686
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyServicesModule, decorators: [{
3374
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuModule, decorators: [{
3687
3375
  type: NgModule,
3688
3376
  args: [{
3689
- providers: SERVICES
3377
+ imports: COMPONENTS$d,
3378
+ exports: COMPONENTS$d,
3690
3379
  }]
3691
3380
  }] });
3692
3381
 
3693
- class BizyFilterPipe {
3694
- validator = inject(BizyValidatorService);
3695
- transform(items, property, states) {
3696
- if (!items || items.length === 0) {
3697
- return [];
3698
- }
3699
- if (!property || typeof states === 'undefined' || states === null) {
3700
- return items;
3701
- }
3702
- if (!Array.isArray(states)) {
3703
- return items.filter(_item => _item[property] === states);
3704
- }
3705
- if (states.length === 0) {
3706
- return items;
3707
- }
3708
- const _selected = states.filter(_state => _state.selected);
3709
- if (_selected.length === states.length) {
3710
- return items;
3382
+ const EMPTY_CHART = [0];
3383
+ const MIN_CHART_SIZE = 350; // px;
3384
+ class BizyPieChartComponent {
3385
+ elementRef;
3386
+ document;
3387
+ ref;
3388
+ renderer;
3389
+ resizeRef = null;
3390
+ tooltip = true;
3391
+ type = 'pie';
3392
+ download = { hide: false, label: 'Descargar', name: 'Bizy' };
3393
+ onLabelFormatter;
3394
+ onTooltipFormatter;
3395
+ onSelect = new EventEmitter();
3396
+ onDownload = new EventEmitter();
3397
+ #echarts = null;
3398
+ #mutationObserver = null;
3399
+ #resizeObserver = null;
3400
+ #subscription = new Subscription();
3401
+ #chartContainer = null;
3402
+ #afterViewInit = new BehaviorSubject(false);
3403
+ #resize$ = new Subject();
3404
+ #data = EMPTY_CHART;
3405
+ constructor(elementRef, document, ref, renderer) {
3406
+ this.elementRef = elementRef;
3407
+ this.document = document;
3408
+ this.ref = ref;
3409
+ this.renderer = renderer;
3410
+ }
3411
+ ngAfterViewInit() {
3412
+ this.#mutationObserver = new MutationObserver(() => {
3413
+ if (this.elementRef && this.elementRef.nativeElement && (this.elementRef.nativeElement.offsetWidth || this.elementRef.nativeElement.offsetHeight)) {
3414
+ this.#afterViewInit.next(true);
3415
+ this.#mutationObserver.disconnect();
3416
+ }
3417
+ });
3418
+ this.#mutationObserver.observe(this.document.body, { childList: true, subtree: true });
3419
+ }
3420
+ set data(data) {
3421
+ if (!data) {
3422
+ return;
3711
3423
  }
3712
- let output = [];
3713
- states.forEach(state => {
3714
- if (!state.selected) {
3424
+ if (data.length > 0) {
3425
+ this.#setChartData(data);
3426
+ }
3427
+ else {
3428
+ this.#deleteChartContainer();
3429
+ this.#setChartData(EMPTY_CHART);
3430
+ }
3431
+ }
3432
+ async #setChartData(data) {
3433
+ this.#subscription.add(this.#afterViewInit.pipe(filter(value => value === true), take(1)).subscribe(() => {
3434
+ this.#createChartContainer();
3435
+ if (!this.#chartContainer) {
3715
3436
  return;
3716
3437
  }
3717
- const res = items.filter(_item => {
3718
- let _state = _item;
3719
- const nestedProperty = property.split('.');
3720
- nestedProperty.forEach(_property => {
3721
- _state = _state[_property];
3438
+ if (data && data.length > 0 && data[0] !== 0) {
3439
+ this.#data = [];
3440
+ data.forEach(_d => {
3441
+ if (!_d.value) {
3442
+ _d.value = 0;
3443
+ }
3444
+ if (!_d.name) {
3445
+ _d.name = '---';
3446
+ }
3447
+ const itemStyle = _d.color ? { color: _d.color } : {};
3448
+ this.#data.push({
3449
+ name: _d.name,
3450
+ value: _d.value,
3451
+ itemStyle
3452
+ });
3722
3453
  });
3723
- if (typeof state.id === 'boolean') {
3724
- return Boolean(_state) === state.id;
3454
+ }
3455
+ else {
3456
+ this.#data = EMPTY_CHART;
3457
+ }
3458
+ const itemStyle = this.type === 'pie' ? {
3459
+ emphasis: {
3460
+ label: {
3461
+ show: true
3462
+ }
3463
+ },
3464
+ normal: {
3465
+ label: {
3466
+ position: 'outer',
3467
+ formatter: this.onLabelFormatter
3468
+ },
3469
+ labelLine: {
3470
+ show: true
3471
+ }
3725
3472
  }
3726
- if (Array.isArray(_state)) {
3727
- return _state.includes(state.id);
3473
+ } :
3474
+ {
3475
+ borderRadius: 10,
3476
+ borderColor: '#fff',
3477
+ borderWidth: 2
3478
+ };
3479
+ const label = this.type === 'pie' ? undefined : { show: false, position: 'center' };
3480
+ const series = [{
3481
+ type: 'pie',
3482
+ radius: this.type === 'pie' ? '50%' : ['40%', '55%'],
3483
+ center: ['50%', '50%'],
3484
+ data: this.#data,
3485
+ itemStyle,
3486
+ label
3487
+ }];
3488
+ const textColor = getComputedStyle(this.document.documentElement).getPropertyValue('--bizy-tooltip-color') ?? '#000';
3489
+ const textBackgroundColor = getComputedStyle(this.document.documentElement).getPropertyValue('--bizy-tooltip-background-color') ?? '#fff';
3490
+ const borderColor = getComputedStyle(this.document.documentElement).getPropertyValue('--bizy-tooltip-border-color') ?? '#fff';
3491
+ const toolbox = {
3492
+ show: true,
3493
+ feature: {
3494
+ mySaveAsImage: {
3495
+ show: !this.download.hide,
3496
+ icon: 'path://M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z',
3497
+ title: this.download.label,
3498
+ onclick: () => {
3499
+ setTimeout(() => {
3500
+ html2canvas(this.#chartContainer).then(canvas => {
3501
+ var link = document.createElement('a');
3502
+ link.href = canvas.toDataURL('image/png');
3503
+ link.download = `${this.download.name}.png`;
3504
+ this.renderer.appendChild(this.document.body, link);
3505
+ link.click();
3506
+ this.renderer.removeChild(this.document.body, link);
3507
+ this.onDownload.emit();
3508
+ });
3509
+ }, 500);
3510
+ }
3511
+ }
3512
+ },
3513
+ emphasis: {
3514
+ iconStyle: {
3515
+ color: textColor,
3516
+ borderColor,
3517
+ borderWidth: 1,
3518
+ textBackgroundColor,
3519
+ textPadding: 5,
3520
+ }
3728
3521
  }
3729
- return _state === state.id;
3522
+ };
3523
+ const tooltip = {
3524
+ show: this.tooltip,
3525
+ trigger: 'item',
3526
+ appendToBody: true,
3527
+ formatter: this.onTooltipFormatter
3528
+ };
3529
+ const legend = this.type === 'pie' ? { show: false } : { show: true, orient: 'vertical', left: 'left' };
3530
+ const option = {
3531
+ tooltip,
3532
+ toolbox,
3533
+ legend,
3534
+ series
3535
+ };
3536
+ this.#echarts = echarts.init(this.#chartContainer);
3537
+ this.#echarts.setOption(option);
3538
+ this.#echarts.on('click', params => {
3539
+ this.onSelect.emit(params.name);
3730
3540
  });
3731
- output = output.concat(res);
3732
- });
3733
- function deepEqual(a, b, seen = new WeakMap()) {
3734
- if (a === b)
3735
- return true;
3736
- if (typeof a !== "object" || typeof b !== "object" || a === null || b === null)
3737
- return false;
3738
- // Circular reference check
3739
- if (seen.has(a))
3740
- return seen.get(a) === b;
3741
- seen.set(a, b);
3742
- const aKeys = Object.keys(a);
3743
- const bKeys = Object.keys(b);
3744
- if (aKeys.length !== bKeys.length)
3745
- return false;
3746
- for (let key of aKeys) {
3747
- if (!bKeys.includes(key))
3748
- return false;
3749
- if (!deepEqual(a[key], b[key], seen))
3750
- return false;
3751
- }
3752
- return true;
3541
+ this.#resizeObserver = new ResizeObserver(() => this.#resize$.next());
3542
+ const resizeRef = this.resizeRef ? this.resizeRef : this.renderer.parentNode(this.elementRef.nativeElement) ? this.renderer.parentNode(this.elementRef.nativeElement) : this.elementRef.nativeElement;
3543
+ this.#resizeObserver.observe(resizeRef);
3544
+ this.#subscription.add(this.#resize$.pipe(skip(1), auditTime(300), throttleTime(500)).subscribe(() => {
3545
+ this.#deleteChartContainer();
3546
+ this.#createChartContainer();
3547
+ if (!this.#chartContainer) {
3548
+ return;
3549
+ }
3550
+ this.#echarts = echarts.init(this.#chartContainer);
3551
+ this.#echarts.setOption({ ...option, series: option.series.map(_serie => { return { ..._serie, data: this.#data }; }) });
3552
+ this.#echarts.on('click', params => {
3553
+ this.onSelect.emit(params.name);
3554
+ });
3555
+ }));
3556
+ }));
3557
+ }
3558
+ #createChartContainer = () => {
3559
+ if (this.#chartContainer || !this.elementRef || !this.elementRef.nativeElement) {
3560
+ return;
3753
3561
  }
3754
- function uniqueObjects(items) {
3755
- return items.filter((obj, index, self) => index === self.findIndex(other => deepEqual(obj, other)));
3562
+ let elementWidth = this.elementRef.nativeElement.offsetWidth || MIN_CHART_SIZE;
3563
+ let elementHeight = this.elementRef.nativeElement.offsetHeight || MIN_CHART_SIZE;
3564
+ let minWidth = MIN_CHART_SIZE;
3565
+ let minHeight = MIN_CHART_SIZE;
3566
+ const chartMinWidth = getComputedStyle(this.document.body).getPropertyValue('--bizy-chart-min-width');
3567
+ const pieChartMinHeight = getComputedStyle(this.document.body).getPropertyValue('--bizy-chart-min-height');
3568
+ if (Number(chartMinWidth)) {
3569
+ minWidth = Number(chartMinWidth);
3570
+ }
3571
+ if (Number(pieChartMinHeight)) {
3572
+ minHeight = Number(pieChartMinHeight);
3573
+ }
3574
+ const width = Math.max(elementWidth, minWidth);
3575
+ const height = Math.max(elementHeight, minHeight);
3576
+ this.#chartContainer = this.renderer.createElement('div');
3577
+ this.renderer.setStyle(this.#chartContainer, 'width', `${width}px`);
3578
+ this.renderer.setStyle(this.#chartContainer, 'height', `${height}px`);
3579
+ this.renderer.appendChild(this.elementRef.nativeElement, this.#chartContainer);
3580
+ this.ref.detectChanges();
3581
+ };
3582
+ #deleteChartContainer = () => {
3583
+ if (!this.#chartContainer || !this.elementRef || !this.elementRef.nativeElement) {
3584
+ return;
3585
+ }
3586
+ this.#echarts.clear();
3587
+ this.renderer.removeChild(this.elementRef.nativeElement, this.#chartContainer);
3588
+ this.#chartContainer = null;
3589
+ this.ref.detectChanges();
3590
+ };
3591
+ ngOnDestroy() {
3592
+ this.#subscription.unsubscribe();
3593
+ if (this.#mutationObserver) {
3594
+ this.#mutationObserver.disconnect();
3595
+ }
3596
+ if (this.#resizeObserver) {
3597
+ this.#resizeObserver.disconnect();
3598
+ }
3599
+ if (this.#echarts) {
3600
+ this.#echarts.clear();
3756
3601
  }
3757
- return uniqueObjects(output);
3758
3602
  }
3759
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
3760
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterPipe, isStandalone: true, name: "bizyFilter" });
3603
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartComponent, deps: [{ token: ElementRef }, { token: DOCUMENT }, { token: ChangeDetectorRef }, { token: Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
3604
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyPieChartComponent, isStandalone: true, selector: "bizy-pie-chart", inputs: { resizeRef: "resizeRef", tooltip: "tooltip", type: "type", download: "download", onLabelFormatter: "onLabelFormatter", onTooltipFormatter: "onTooltipFormatter", data: "data" }, outputs: { onSelect: "onSelect", onDownload: "onDownload" }, ngImport: i0, template: '', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3761
3605
  }
3762
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterPipe, decorators: [{
3763
- type: Pipe,
3606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartComponent, decorators: [{
3607
+ type: Component,
3764
3608
  args: [{
3765
- name: 'bizyFilter'
3609
+ selector: 'bizy-pie-chart',
3610
+ template: '',
3611
+ imports: [CommonModule],
3612
+ changeDetection: ChangeDetectionStrategy.OnPush
3766
3613
  }]
3767
- }] });
3768
-
3769
- class BizyRangeFilterPipe {
3770
- transform(items, property, range) {
3771
- if (!items || items.length === 0) {
3772
- return [];
3773
- }
3774
- if (!property || !range) {
3775
- return items;
3776
- }
3777
- const min = range.min ?? null;
3778
- const max = range.max ?? null;
3779
- let itemsWithoutProperty = [];
3780
- const output = items.filter(_item => {
3781
- let _value = _item;
3782
- const nestedProperty = property.split('.');
3783
- for (let i = 0; i < nestedProperty.length; i++) {
3784
- const _property = nestedProperty[i];
3785
- if (typeof _value[_property] === 'undefined' || _value[_property] === null) {
3786
- itemsWithoutProperty.push(_item);
3787
- return false;
3788
- }
3789
- _value = _value[_property];
3790
- }
3791
- if (isNaN(_value)) {
3792
- return false;
3793
- }
3794
- return (min === null || _value >= min) && (max === null || _value <= max);
3795
- });
3796
- return itemsWithoutProperty.length === items.length ? items : output;
3797
- }
3798
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRangeFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
3799
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyRangeFilterPipe, isStandalone: true, name: "bizyRangeFilter" });
3800
- }
3801
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRangeFilterPipe, decorators: [{
3802
- type: Pipe,
3803
- args: [{
3804
- name: 'bizyRangeFilter'
3805
- }]
3806
- }] });
3807
-
3808
- const COMPONENTS$i = [
3809
- BizyFilterComponent,
3810
- BizyFilterSectionComponent,
3811
- BizyFilterContentComponent,
3812
- BizyFilterSectionCheckboxOptionComponent,
3813
- BizyFilterSectionRangeOptionComponent,
3814
- BizyFilterSectionSearchOptionComponent,
3815
- BizyFilterSectionsComponent
3816
- ];
3817
- const PIPES$1 = [
3818
- BizyFilterPipe,
3819
- BizyRangeFilterPipe
3820
- ];
3821
- class BizyFilterModule {
3822
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3823
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterModule, imports: [BizyFilterComponent,
3824
- BizyFilterSectionComponent,
3825
- BizyFilterContentComponent,
3826
- BizyFilterSectionCheckboxOptionComponent,
3827
- BizyFilterSectionRangeOptionComponent,
3828
- BizyFilterSectionSearchOptionComponent,
3829
- BizyFilterSectionsComponent, BizyFilterPipe,
3830
- BizyRangeFilterPipe], exports: [BizyFilterComponent,
3831
- BizyFilterSectionComponent,
3832
- BizyFilterContentComponent,
3833
- BizyFilterSectionCheckboxOptionComponent,
3834
- BizyFilterSectionRangeOptionComponent,
3835
- BizyFilterSectionSearchOptionComponent,
3836
- BizyFilterSectionsComponent, BizyFilterPipe,
3837
- BizyRangeFilterPipe] });
3838
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterModule, providers: PIPES$1, imports: [BizyFilterComponent,
3839
- BizyFilterSectionComponent,
3840
- BizyFilterSectionCheckboxOptionComponent,
3841
- BizyFilterSectionRangeOptionComponent,
3842
- BizyFilterSectionSearchOptionComponent] });
3843
- }
3844
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFilterModule, decorators: [{
3845
- type: NgModule,
3846
- args: [{
3847
- imports: COMPONENTS$i.concat(PIPES$1),
3848
- exports: COMPONENTS$i.concat(PIPES$1),
3849
- providers: PIPES$1
3850
- }]
3851
- }] });
3852
-
3853
- class BizySelectOptionComponent {
3854
- elementRef;
3855
- ref;
3856
- id = `bizy-select-option-${Math.random()}`;
3857
- disabled = false;
3858
- customClass = '';
3859
- onSelect = new EventEmitter();
3860
- set selected(selected) {
3861
- if (typeof selected === 'undefined' || selected === null) {
3862
- return;
3863
- }
3864
- this.#selected.next(selected);
3865
- }
3866
- #selected = new BehaviorSubject(false);
3867
- get selected$() {
3868
- return this.#selected.asObservable();
3869
- }
3870
- constructor(elementRef, ref) {
3871
- this.elementRef = elementRef;
3872
- this.ref = ref;
3873
- }
3874
- _onSelect() {
3875
- if (this.disabled) {
3876
- return;
3877
- }
3878
- this.onSelect.emit();
3879
- this.ref.detectChanges();
3880
- }
3881
- getId = () => {
3882
- return this.id;
3883
- };
3884
- getSelected = () => {
3885
- return this.#selected.value;
3886
- };
3887
- getValue = () => {
3888
- const value = this.elementRef?.nativeElement?.firstChild?.children[0]?.innerText;
3889
- return value ?? '';
3890
- };
3891
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizySelectOptionComponent, deps: [{ token: ElementRef }, { token: ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3892
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizySelectOptionComponent, isStandalone: true, selector: "bizy-select-option", inputs: { id: "id", disabled: "disabled", customClass: "customClass", selected: "selected" }, outputs: { onSelect: "onSelect" }, ngImport: i0, template: "<button \n type=\"button\"\n [id]=\"id\"\n (click)=\"_onSelect()\"\n (keyup.enter)=\"_onSelect()\"\n [ngClass]=\"{'bizy-select-option--selected': (selected$ | async), 'bizy-select-option--disabled': disabled}\"\n class=\"bizy-select-option {{customClass}}\">\n\n <span class=\"bizy-select-option__content\">\n <ng-content></ng-content>\n </span>\n \n</button>", styles: [":host{font-size:1rem}.bizy-select-option{font-size:1rem;width:100%;border:none;background-color:var(--bizy-select-background-color);display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:.5rem;color:var(--bizy-select-option-color);cursor:pointer}.bizy-select-option:hover{background-color:var(--bizy-select-option-hover-background-color)}.bizy-select-option--selected{background-color:var(--bizy-select-option-selected-background-color)!important}.bizy-select-option--selected ::ng-deep .bizy-select-option__content *{color:var(--bizy-select-option-selected-color)}.bizy-select-option--disabled{opacity:.5;pointer-events:none;cursor:not-allowed!important}.bizy-select-option__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;text-align:start}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3893
- }
3894
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizySelectOptionComponent, decorators: [{
3895
- type: Component,
3896
- args: [{ selector: 'bizy-select-option', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n type=\"button\"\n [id]=\"id\"\n (click)=\"_onSelect()\"\n (keyup.enter)=\"_onSelect()\"\n [ngClass]=\"{'bizy-select-option--selected': (selected$ | async), 'bizy-select-option--disabled': disabled}\"\n class=\"bizy-select-option {{customClass}}\">\n\n <span class=\"bizy-select-option__content\">\n <ng-content></ng-content>\n </span>\n \n</button>", styles: [":host{font-size:1rem}.bizy-select-option{font-size:1rem;width:100%;border:none;background-color:var(--bizy-select-background-color);display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:.5rem;color:var(--bizy-select-option-color);cursor:pointer}.bizy-select-option:hover{background-color:var(--bizy-select-option-hover-background-color)}.bizy-select-option--selected{background-color:var(--bizy-select-option-selected-background-color)!important}.bizy-select-option--selected ::ng-deep .bizy-select-option__content *{color:var(--bizy-select-option-selected-color)}.bizy-select-option--disabled{opacity:.5;pointer-events:none;cursor:not-allowed!important}.bizy-select-option__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;text-align:start}\n"] }]
3897
3614
  }], ctorParameters: () => [{ type: i0.ElementRef, decorators: [{
3898
3615
  type: Inject,
3899
3616
  args: [ElementRef]
3617
+ }] }, { type: Document, decorators: [{
3618
+ type: Inject,
3619
+ args: [DOCUMENT]
3900
3620
  }] }, { type: i0.ChangeDetectorRef, decorators: [{
3901
3621
  type: Inject,
3902
3622
  args: [ChangeDetectorRef]
3903
- }] }], propDecorators: { id: [{
3623
+ }] }, { type: i0.Renderer2, decorators: [{
3624
+ type: Inject,
3625
+ args: [Renderer2]
3626
+ }] }], propDecorators: { resizeRef: [{
3904
3627
  type: Input
3905
- }], disabled: [{
3628
+ }], tooltip: [{
3906
3629
  type: Input
3907
- }], customClass: [{
3630
+ }], type: [{
3631
+ type: Input
3632
+ }], download: [{
3633
+ type: Input
3634
+ }], onLabelFormatter: [{
3635
+ type: Input
3636
+ }], onTooltipFormatter: [{
3908
3637
  type: Input
3909
3638
  }], onSelect: [{
3910
3639
  type: Output
3911
- }], selected: [{
3640
+ }], onDownload: [{
3641
+ type: Output
3642
+ }], data: [{
3912
3643
  type: Input
3913
3644
  }] } });
3914
3645
 
3915
- class BizySelectComponent {
3916
- ref;
3917
- #viewContainerRef = inject(ViewContainerRef);
3918
- templatePortalContent;
3919
- options;
3920
- bizyInput;
3921
- id = `bizy-select-${Math.random()}`;
3646
+ const COMPONENTS$c = [
3647
+ BizyPieChartComponent,
3648
+ ];
3649
+ class BizyPieChartModule {
3650
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3651
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartModule, imports: [BizyPieChartComponent], exports: [BizyPieChartComponent] });
3652
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartModule, imports: [COMPONENTS$c] });
3653
+ }
3654
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartModule, decorators: [{
3655
+ type: NgModule,
3656
+ args: [{
3657
+ imports: COMPONENTS$c,
3658
+ exports: COMPONENTS$c,
3659
+ }]
3660
+ }] });
3661
+
3662
+ class BizyPopupWrapperComponent {
3663
+ dynamicComponentContainer;
3664
+ #data = inject(DIALOG_DATA);
3665
+ #dialogRef = inject(DialogRef);
3666
+ #popup = inject(BizyPopupService);
3667
+ #ref = inject(ChangeDetectorRef);
3922
3668
  disabled = false;
3923
- readonly = false;
3924
- placeholder = '';
3925
- customClass = '';
3926
- opened = false;
3927
- openedChange = new EventEmitter();
3928
- onSelect = new EventEmitter();
3929
- onOpen = new EventEmitter();
3930
- _optionValue = '';
3931
- optionPortal;
3932
- templatePortal = null;
3933
- #subscription = new Subscription();
3934
- #contentChildrenSubscription = new Subscription();
3935
- constructor(ref) {
3936
- this.ref = ref;
3937
- }
3938
- get touched() {
3939
- return this.bizyInput ? this.bizyInput.touched : false;
3940
- }
3669
+ disableClose = false;
3670
+ disableDrag = false;
3941
3671
  ngAfterViewInit() {
3942
- this.templatePortal = new TemplatePortal(this.templatePortalContent, this.#viewContainerRef);
3943
- this._optionValue = '';
3944
- const option = this.options.find(_option => _option.getSelected());
3945
- if (option) {
3946
- this._optionValue = option.getValue();
3947
- }
3948
- this.options.forEach(_option => {
3949
- this.#subscription.add(_option.onSelect.subscribe(() => {
3950
- this.close();
3951
- this.ref.detectChanges();
3952
- }));
3953
- this.#subscription.add(_option.selected$.pipe(filter(_value => _value === true)).subscribe(() => {
3954
- this._optionValue = _option.getValue();
3955
- this.ref.detectChanges();
3956
- }));
3957
- });
3958
- this.#contentChildrenSubscription.add(this.options.changes.subscribe(() => {
3959
- this.#subscription.unsubscribe();
3960
- this.#subscription = new Subscription();
3961
- this.options.forEach(_option => {
3962
- this.#subscription.add(_option.onSelect.subscribe(() => {
3963
- this.close();
3964
- this.ref.detectChanges();
3965
- }));
3966
- this.#subscription.add(_option.selected$.pipe(filter(_value => _value === true)).subscribe(() => {
3967
- this._optionValue = _option.getValue();
3968
- this.ref.detectChanges();
3969
- }));
3970
- });
3971
- }));
3972
- this.ref.detectChanges();
3973
- }
3974
- _onOpen(event) {
3975
- if (this.disabled || this.readonly) {
3976
- return;
3672
+ this.loadDynamicComponent();
3673
+ if (this.#data && this.#data.disableClose) {
3674
+ this.disableClose = this.#data.disableClose;
3977
3675
  }
3978
- this.opened = !this.opened;
3979
- this.onSelect.emit(event);
3980
- this.openedChange.emit(this.opened);
3981
- this.onOpen.emit(this.opened);
3982
- if (this.bizyInput) {
3983
- this.bizyInput.setFocus(true);
3676
+ if (this.#data && this.#data.disableDrag) {
3677
+ this.disableDrag = this.#data.disableDrag;
3984
3678
  }
3985
- this.ref.detectChanges();
3986
3679
  }
3987
- close = (event, select) => {
3988
- if (select && event && event.target && event.target === select.bizyInputWrapper.nativeElement) {
3989
- return;
3680
+ loadDynamicComponent = () => {
3681
+ if (this.#data && this.#data.component) {
3682
+ this.dynamicComponentContainer.clear();
3683
+ this.dynamicComponentContainer.createComponent(this.#data.component);
3684
+ this.#ref.detectChanges();
3990
3685
  }
3991
- this.opened = false;
3992
- this.openedChange.emit(this.opened);
3993
- this.onOpen.emit(this.opened);
3994
- this.ref.detectChanges();
3995
3686
  };
3996
- setTouched(touched) {
3997
- if (this.bizyInput) {
3998
- this.bizyInput.setTouched(touched);
3999
- this.ref.detectChanges();
4000
- }
4001
- }
4002
- ngOnDestroy() {
4003
- this.#subscription.unsubscribe();
4004
- this.#contentChildrenSubscription.unsubscribe();
3687
+ async close() {
3688
+ this.disabled = true;
3689
+ this.#popup.close({ id: this.#dialogRef.id });
4005
3690
  }
4006
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizySelectComponent, deps: [{ token: ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
4007
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizySelectComponent, isStandalone: true, selector: "bizy-select", inputs: { id: "id", disabled: "disabled", readonly: "readonly", placeholder: "placeholder", customClass: "customClass", opened: "opened" }, outputs: { openedChange: "openedChange", onSelect: "onSelect", onOpen: "onOpen" }, queries: [{ propertyName: "options", predicate: BizySelectOptionComponent }], viewQueries: [{ propertyName: "templatePortalContent", first: true, predicate: ["templatePortalContent"], descendants: true }, { propertyName: "bizyInput", first: true, predicate: ["bizyInput"], descendants: true }], ngImport: i0, template: "<bizy-input\n #bizyInput\n [readonly]=\"true\"\n [disabled]=\"disabled\"\n [id]=\"id\"\n [placeholder]=\"placeholder\"\n [value]=\"_optionValue\"\n [ngClass]=\"{'bizy-select--readonly': readonly}\"\n (onSelect)=\"_onOpen($event); bizyInput?.setTouched(true)\"\n (onEnter)=\"_onOpen($event); bizyInput?.setTouched(true)\"\n class=\"bizy-select {{customClass}}\"\n cdkOverlayOrigin\n #bizySelectTrigger=\"cdkOverlayOrigin\">\n\n <svg \n slot=\"suffix\"\n id=\"bizy-select-arrow\"\n *ngIf=\"!readonly\"\n class=\"bizy-select__arrow\"\n [ngClass]=\"{'bizy-select__arrow--opened': opened}\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 320 512\">\n <path d=\"M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z\"/>\n </svg>\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=header]\"></ng-content>\n </ng-container>\n\n <ng-container slot=\"prefix\">\n <ng-content select=\"[slot=prefix]\"></ng-content>\n </ng-container>\n\n</bizy-input>\n\n<span class=\"bizy-select__errors\" *ngIf=\"touched\">\n <ng-content select=\"[slot=error]\"></ng-content>\n</span>\n\n<ng-template #templatePortalContent>\n <ng-content select=\"bizy-select-option\"></ng-content>\n</ng-template>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayMinWidth]=\"bizyInput.getWidth()\"\n [cdkConnectedOverlayOrigin]=\"bizySelectTrigger\"\n (overlayOutsideClick)=\"close($event, bizyInput)\"\n [cdkConnectedOverlayOpen]=\"opened\">\n\n <span class=\"bizy-select__options\">\n\n <span class=\"bizy-select__options__search\">\n <ng-content select=\"bizy-input\"></ng-content>\n </span>\n\n <ng-template [cdkPortalOutlet]=\"templatePortal\"></ng-template>\n \n </span>\n\n</ng-template>\n", styles: [":host{font-size:1rem;width:var(--bizy-select-width);min-width:var(--bizy-select-min-width);max-width:var(--bizy-select-max-width);display:flex;flex-direction:column;row-gap:.3rem;--bizy-input-focus-color: transparent}:host:has(>.bizy-select__errors:not(:empty)) ::ng-deep .bizy-input__bottom-line{background-color:var(--bizy-input-invalid-color)!important;visibility:visible!important}:host:has(>.bizy-select__errors:not(:empty)) ::ng-deep .bizy-input__content__input{color:var(--bizy-input-invalid-color)!important}.bizy-select{--bizy-input-cursor: pointer;--bizy-input-background-color: var(--bizy-select-background-color);--bizy-input-color: var(--bizy-select-color)}.bizy-select--readonly{--bizy-input-cursor: default}.bizy-select__arrow{height:var(--bizy-select-arrow-height);pointer-events:none;display:block;transition:transform .2s ease;fill:var(--bizy-select-color)}.bizy-select__arrow--opened{transform:rotate(180deg)}.bizy-select__options{background-color:var(--bizy-select-background-color);display:flex;min-width:fit-content;width:100%;flex-direction:column;box-shadow:0 7px 14px #32325d1a,0 3px 6px #00000014;max-height:var(--bizy-select-height);overflow-y:auto;overflow-x:hidden;position:relative}.bizy-select__options::-webkit-scrollbar{width:.5rem;height:.5rem}.bizy-select__options::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-select-scroll-bar-color)}.bizy-select__options::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-select-scroll-bar-hover-color)}.bizy-select__options::-webkit-scrollbar-button{height:1rem}.bizy-select__options__search{position:sticky;z-index:1;top:0}::ng-deep .bizy-select__options__search{--bizy-input-width: auto;--bizy-input-background-color: #fff;--bizy-input-min-width: var(--bizy-select-min-width);--bizy-input-max-width: auto;margin-bottom:.3rem}.bizy-select__errors:empty{display:none!important}::ng-deep .bizy-select__errors *{color:var(--bizy-input-invalid-color)!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: BizyInputComponent, selector: "bizy-input", inputs: ["id", "name", "type", "customClass", "placeholder", "debounceTime", "rows", "disabled", "readonly", "autofocus", "value"], outputs: ["valueChange", "onChange", "onEnter", "onBackspace", "onSelect", "onBlur", "onFocus"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i2$2.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i2$2.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i3.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3691
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPopupWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3692
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyPopupWrapperComponent, isStandalone: true, selector: "bizy-popup-wrapper", viewQueries: [{ propertyName: "dynamicComponentContainer", first: true, predicate: ["dynamicComponentContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div class=\"bizy-popup-wrapper\" cdkDrag>\n\n <button *ngIf=\"!disableDrag\" class=\"bizy-popup-wrapper__drag-button\" cdkDragHandle>\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"bizy-popup-wrapper__drag-button__icon\">\n <path d=\"M278.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-64 64c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l9.4-9.4V224H109.3l9.4-9.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-64 64c-12.5 12.5-12.5 32.8 0 45.3l64 64c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-9.4-9.4H224V402.7l-9.4-9.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l64 64c12.5 12.5 32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-9.4 9.4V288H402.7l-9.4 9.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3l-64-64c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l9.4 9.4H288V109.3l9.4 9.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-64-64z\"/>\n </svg>\n\n </button>\n\n <button *ngIf=\"!disableClose\" class=\"bizy-popup-wrapper__close-button\" (click)=\"close()\" (keyup.enter)=\"close()\">\n\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\" class=\"bizy-popup-wrapper__close-button__icon\">\n <path d=\"M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z\"/>\n </svg>\n\n </button>\n\n <ng-container #dynamicComponentContainer></ng-container>\n\n</div>", styles: [":host{font-size:1rem;position:fixed!important;inset:50%;transform:translate(-50%,-50%);min-height:150px;min-width:150px;width:fit-content;height:fit-content;z-index:10}.bizy-popup-wrapper{position:relative;padding:var(--bizy-popup-padding);background-color:var(--bizy-popup-background-color);min-width:var(--bizy-popup-min-width);width:var(--bizy-popup-width);max-width:var(--bizy-popup-max-width)}.bizy-popup-wrapper__drag-button{position:absolute;left:-.9rem;top:-.9rem;border:var(--bizy-popup-drag-button-border);border-radius:50%;padding:.2rem;place-items:center;display:grid;background-color:var(--bizy-popup-drag-button-background-color);cursor:pointer;transition:transform .2s;z-index:1}.bizy-popup-wrapper__drag-button:hover{transform:scale(1.1)}.bizy-popup-wrapper__drag-button__icon{height:1rem}.bizy-popup-wrapper__drag-button__icon{fill:var(--bizy-popup-drag-button-color)}.bizy-popup-wrapper__close-button{position:absolute;right:-.9rem;top:-.9rem;border:var(--bizy-popup-close-button-border);border-radius:50%;padding:.25rem .35rem;place-items:center;display:grid;background-color:var(--bizy-popup-close-button-background-color);cursor:pointer;transition:transform .2s;z-index:1}.bizy-popup-wrapper__close-button:hover .bizy-popup-wrapper__close-button__icon{transform:scale(1.1)}.bizy-popup-wrapper__close-button:hover .bizy-popup-wrapper__close-button__icon{fill:var(--bizy-popup-close-button-hover-color)}.bizy-popup-wrapper__close-button__icon{height:1rem;transition:fill .2s ease,}.bizy-popup-wrapper__close-button__icon{fill:var(--bizy-popup-close-button-color)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: DialogModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2$3.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2$3.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4008
3693
  }
4009
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizySelectComponent, decorators: [{
3694
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPopupWrapperComponent, decorators: [{
4010
3695
  type: Component,
4011
- args: [{ selector: 'bizy-select', imports: [CommonModule, BizyInputComponent, OverlayModule, PortalModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<bizy-input\n #bizyInput\n [readonly]=\"true\"\n [disabled]=\"disabled\"\n [id]=\"id\"\n [placeholder]=\"placeholder\"\n [value]=\"_optionValue\"\n [ngClass]=\"{'bizy-select--readonly': readonly}\"\n (onSelect)=\"_onOpen($event); bizyInput?.setTouched(true)\"\n (onEnter)=\"_onOpen($event); bizyInput?.setTouched(true)\"\n class=\"bizy-select {{customClass}}\"\n cdkOverlayOrigin\n #bizySelectTrigger=\"cdkOverlayOrigin\">\n\n <svg \n slot=\"suffix\"\n id=\"bizy-select-arrow\"\n *ngIf=\"!readonly\"\n class=\"bizy-select__arrow\"\n [ngClass]=\"{'bizy-select__arrow--opened': opened}\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 320 512\">\n <path d=\"M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z\"/>\n </svg>\n\n <ng-container slot=\"header\">\n <ng-content select=\"[slot=header]\"></ng-content>\n </ng-container>\n\n <ng-container slot=\"prefix\">\n <ng-content select=\"[slot=prefix]\"></ng-content>\n </ng-container>\n\n</bizy-input>\n\n<span class=\"bizy-select__errors\" *ngIf=\"touched\">\n <ng-content select=\"[slot=error]\"></ng-content>\n</span>\n\n<ng-template #templatePortalContent>\n <ng-content select=\"bizy-select-option\"></ng-content>\n</ng-template>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayMinWidth]=\"bizyInput.getWidth()\"\n [cdkConnectedOverlayOrigin]=\"bizySelectTrigger\"\n (overlayOutsideClick)=\"close($event, bizyInput)\"\n [cdkConnectedOverlayOpen]=\"opened\">\n\n <span class=\"bizy-select__options\">\n\n <span class=\"bizy-select__options__search\">\n <ng-content select=\"bizy-input\"></ng-content>\n </span>\n\n <ng-template [cdkPortalOutlet]=\"templatePortal\"></ng-template>\n \n </span>\n\n</ng-template>\n", styles: [":host{font-size:1rem;width:var(--bizy-select-width);min-width:var(--bizy-select-min-width);max-width:var(--bizy-select-max-width);display:flex;flex-direction:column;row-gap:.3rem;--bizy-input-focus-color: transparent}:host:has(>.bizy-select__errors:not(:empty)) ::ng-deep .bizy-input__bottom-line{background-color:var(--bizy-input-invalid-color)!important;visibility:visible!important}:host:has(>.bizy-select__errors:not(:empty)) ::ng-deep .bizy-input__content__input{color:var(--bizy-input-invalid-color)!important}.bizy-select{--bizy-input-cursor: pointer;--bizy-input-background-color: var(--bizy-select-background-color);--bizy-input-color: var(--bizy-select-color)}.bizy-select--readonly{--bizy-input-cursor: default}.bizy-select__arrow{height:var(--bizy-select-arrow-height);pointer-events:none;display:block;transition:transform .2s ease;fill:var(--bizy-select-color)}.bizy-select__arrow--opened{transform:rotate(180deg)}.bizy-select__options{background-color:var(--bizy-select-background-color);display:flex;min-width:fit-content;width:100%;flex-direction:column;box-shadow:0 7px 14px #32325d1a,0 3px 6px #00000014;max-height:var(--bizy-select-height);overflow-y:auto;overflow-x:hidden;position:relative}.bizy-select__options::-webkit-scrollbar{width:.5rem;height:.5rem}.bizy-select__options::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-select-scroll-bar-color)}.bizy-select__options::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-select-scroll-bar-hover-color)}.bizy-select__options::-webkit-scrollbar-button{height:1rem}.bizy-select__options__search{position:sticky;z-index:1;top:0}::ng-deep .bizy-select__options__search{--bizy-input-width: auto;--bizy-input-background-color: #fff;--bizy-input-min-width: var(--bizy-select-min-width);--bizy-input-max-width: auto;margin-bottom:.3rem}.bizy-select__errors:empty{display:none!important}::ng-deep .bizy-select__errors *{color:var(--bizy-input-invalid-color)!important}\n"] }]
4012
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef, decorators: [{
4013
- type: Inject,
4014
- args: [ChangeDetectorRef]
4015
- }] }], propDecorators: { templatePortalContent: [{
4016
- type: ViewChild,
4017
- args: ['templatePortalContent']
4018
- }], options: [{
4019
- type: ContentChildren,
4020
- args: [BizySelectOptionComponent]
4021
- }], bizyInput: [{
3696
+ args: [{ selector: 'bizy-popup-wrapper', imports: [CommonModule, DialogModule, DragDropModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"bizy-popup-wrapper\" cdkDrag>\n\n <button *ngIf=\"!disableDrag\" class=\"bizy-popup-wrapper__drag-button\" cdkDragHandle>\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"bizy-popup-wrapper__drag-button__icon\">\n <path d=\"M278.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-64 64c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l9.4-9.4V224H109.3l9.4-9.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-64 64c-12.5 12.5-12.5 32.8 0 45.3l64 64c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-9.4-9.4H224V402.7l-9.4-9.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l64 64c12.5 12.5 32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-9.4 9.4V288H402.7l-9.4 9.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3l-64-64c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l9.4 9.4H288V109.3l9.4 9.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-64-64z\"/>\n </svg>\n\n </button>\n\n <button *ngIf=\"!disableClose\" class=\"bizy-popup-wrapper__close-button\" (click)=\"close()\" (keyup.enter)=\"close()\">\n\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\" class=\"bizy-popup-wrapper__close-button__icon\">\n <path d=\"M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z\"/>\n </svg>\n\n </button>\n\n <ng-container #dynamicComponentContainer></ng-container>\n\n</div>", styles: [":host{font-size:1rem;position:fixed!important;inset:50%;transform:translate(-50%,-50%);min-height:150px;min-width:150px;width:fit-content;height:fit-content;z-index:10}.bizy-popup-wrapper{position:relative;padding:var(--bizy-popup-padding);background-color:var(--bizy-popup-background-color);min-width:var(--bizy-popup-min-width);width:var(--bizy-popup-width);max-width:var(--bizy-popup-max-width)}.bizy-popup-wrapper__drag-button{position:absolute;left:-.9rem;top:-.9rem;border:var(--bizy-popup-drag-button-border);border-radius:50%;padding:.2rem;place-items:center;display:grid;background-color:var(--bizy-popup-drag-button-background-color);cursor:pointer;transition:transform .2s;z-index:1}.bizy-popup-wrapper__drag-button:hover{transform:scale(1.1)}.bizy-popup-wrapper__drag-button__icon{height:1rem}.bizy-popup-wrapper__drag-button__icon{fill:var(--bizy-popup-drag-button-color)}.bizy-popup-wrapper__close-button{position:absolute;right:-.9rem;top:-.9rem;border:var(--bizy-popup-close-button-border);border-radius:50%;padding:.25rem .35rem;place-items:center;display:grid;background-color:var(--bizy-popup-close-button-background-color);cursor:pointer;transition:transform .2s;z-index:1}.bizy-popup-wrapper__close-button:hover .bizy-popup-wrapper__close-button__icon{transform:scale(1.1)}.bizy-popup-wrapper__close-button:hover .bizy-popup-wrapper__close-button__icon{fill:var(--bizy-popup-close-button-hover-color)}.bizy-popup-wrapper__close-button__icon{height:1rem;transition:fill .2s ease,}.bizy-popup-wrapper__close-button__icon{fill:var(--bizy-popup-close-button-color)}\n"] }]
3697
+ }], propDecorators: { dynamicComponentContainer: [{
4022
3698
  type: ViewChild,
4023
- args: ['bizyInput']
4024
- }], id: [{
4025
- type: Input
4026
- }], disabled: [{
4027
- type: Input
4028
- }], readonly: [{
4029
- type: Input
4030
- }], placeholder: [{
4031
- type: Input
4032
- }], customClass: [{
4033
- type: Input
4034
- }], opened: [{
4035
- type: Input
4036
- }], openedChange: [{
4037
- type: Output
4038
- }], onSelect: [{
4039
- type: Output
4040
- }], onOpen: [{
4041
- type: Output
3699
+ args: ['dynamicComponentContainer', { read: ViewContainerRef }]
4042
3700
  }] } });
4043
3701
 
4044
- class BizyFormComponent {
4045
- inputs;
4046
- selects;
4047
- datePickers;
4048
- id = `bizy-form-${Math.random()}`;
4049
- customClass = '';
4050
- onSubmit(event) {
4051
- this.setTouched();
4052
- event.preventDefault();
3702
+ var BIZY_ANIMATION;
3703
+ (function (BIZY_ANIMATION) {
3704
+ BIZY_ANIMATION["FADE_IN"] = "fade-in";
3705
+ BIZY_ANIMATION["FADE_OUT"] = "fade-out";
3706
+ BIZY_ANIMATION["FADE_IN_UP"] = "fade-in-up";
3707
+ BIZY_ANIMATION["FADE_IN_RIGHT"] = "fade-in-right";
3708
+ BIZY_ANIMATION["FADE_IN_DOWN"] = "fade-in-down";
3709
+ BIZY_ANIMATION["FADE_IN_LEFT"] = "fade-in-left";
3710
+ BIZY_ANIMATION["SLIDE_IN_UP"] = "slide-in-up";
3711
+ BIZY_ANIMATION["SLIDE_IN_RIGHT"] = "slide-in-right";
3712
+ BIZY_ANIMATION["SLIDE_IN_DOWN"] = "slide-in-down";
3713
+ BIZY_ANIMATION["SLIDE_IN_LEFT"] = "slide-in-left";
3714
+ BIZY_ANIMATION["SLIDE_OUT_UP"] = "slide-out-up";
3715
+ BIZY_ANIMATION["SLIDE_OUT_DOWN"] = "slide-out-down";
3716
+ BIZY_ANIMATION["SLIDE_OUT_RIGHT"] = "slide-out-right";
3717
+ BIZY_ANIMATION["SLIDE_OUT_LEFT"] = "slide-out-left";
3718
+ })(BIZY_ANIMATION || (BIZY_ANIMATION = {}));
3719
+ class BizyAnimationService {
3720
+ rendererFactory;
3721
+ #renderer;
3722
+ constructor(rendererFactory) {
3723
+ this.rendererFactory = rendererFactory;
3724
+ this.#renderer = this.rendererFactory.createRenderer(null, null);
4053
3725
  }
4054
- setTouched = () => {
4055
- if (this.inputs.length > 0) {
4056
- this.inputs.forEach(component => {
4057
- component.setTouched(true);
4058
- });
4059
- }
4060
- if (this.selects.length > 0) {
4061
- this.selects.forEach(component => {
4062
- component.setTouched(true);
4063
- });
4064
- }
4065
- if (this.datePickers.length > 0) {
4066
- this.datePickers.forEach(component => {
4067
- component.setTouched(true);
4068
- });
4069
- }
4070
- };
4071
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4072
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyFormComponent, isStandalone: true, selector: "bizy-form", inputs: { id: "id", customClass: "customClass" }, queries: [{ propertyName: "inputs", predicate: BizyInputComponent, descendants: true }, { propertyName: "selects", predicate: BizySelectComponent, descendants: true }, { propertyName: "datePickers", predicate: BizyDatePickerComponent, descendants: true }], ngImport: i0, template: "<form class=\"bizy-form {{customClass}}\" [id]=\"id\" (ngSubmit)=\"onSubmit($event)\">\n <ng-content></ng-content>\n</form>", styles: [":host{font-size:1rem;max-width:var(--bizy-form-max-width)}.bizy-form{max-width:inherit;display:flex;flex-direction:column;row-gap:var(--bizy-form-row-gap);--bizy-input-max-width: 100%;--bizy-select-max-width: 100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3726
+ setAnimation(element, animation) {
3727
+ return new Promise(resolve => {
3728
+ if (!element || !animation || !this.#renderer) {
3729
+ return;
3730
+ }
3731
+ const root = this.#renderer.selectRootElement(':root', true);
3732
+ const animationTimeout = getComputedStyle(root).getPropertyValue('--bizy-animation-timeout').trim();
3733
+ this.#renderer.addClass(element, 'animated');
3734
+ this.#renderer.addClass(element, animation);
3735
+ setTimeout(() => {
3736
+ this.#renderer.removeClass(element, 'animated');
3737
+ this.#renderer.removeClass(element, animation);
3738
+ resolve();
3739
+ }, Number(animationTimeout.match(/\d/g).join('')));
3740
+ });
3741
+ }
3742
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyAnimationService, deps: [{ token: RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
3743
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyAnimationService, providedIn: 'root' });
4073
3744
  }
4074
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormComponent, decorators: [{
4075
- type: Component,
4076
- args: [{ selector: 'bizy-form', imports: [CommonModule, FormsModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<form class=\"bizy-form {{customClass}}\" [id]=\"id\" (ngSubmit)=\"onSubmit($event)\">\n <ng-content></ng-content>\n</form>", styles: [":host{font-size:1rem;max-width:var(--bizy-form-max-width)}.bizy-form{max-width:inherit;display:flex;flex-direction:column;row-gap:var(--bizy-form-row-gap);--bizy-input-max-width: 100%;--bizy-select-max-width: 100%}\n"] }]
4077
- }], propDecorators: { inputs: [{
4078
- type: ContentChildren,
4079
- args: [BizyInputComponent, { descendants: true }]
4080
- }], selects: [{
4081
- type: ContentChildren,
4082
- args: [BizySelectComponent, { descendants: true }]
4083
- }], datePickers: [{
4084
- type: ContentChildren,
4085
- args: [BizyDatePickerComponent, { descendants: true }]
4086
- }], id: [{
4087
- type: Input
4088
- }], customClass: [{
4089
- type: Input
4090
- }] } });
3745
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyAnimationService, decorators: [{
3746
+ type: Injectable,
3747
+ args: [{
3748
+ providedIn: 'root'
3749
+ }]
3750
+ }], ctorParameters: () => [{ type: i0.RendererFactory2, decorators: [{
3751
+ type: Inject,
3752
+ args: [RendererFactory2]
3753
+ }] }] });
4091
3754
 
4092
- const COMPONENTS$h = [
4093
- BizyFormComponent,
4094
- ];
4095
- class BizyFormModule {
4096
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4097
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyFormModule, imports: [BizyFormComponent], exports: [BizyFormComponent] });
4098
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormModule, imports: [COMPONENTS$h] });
3755
+ class BizyViewportService {
3756
+ window;
3757
+ #viewportSizeChanged;
3758
+ get sizeChange$() {
3759
+ return this.#viewportSizeChanged.asObservable();
3760
+ }
3761
+ constructor(window) {
3762
+ this.window = window;
3763
+ this.#viewportSizeChanged = new BehaviorSubject({
3764
+ width: this.window.innerWidth,
3765
+ height: this.window.innerHeight
3766
+ });
3767
+ fromEvent(window, 'resize')
3768
+ .pipe(debounceTime(200), map((event) => ({
3769
+ width: event.currentTarget.innerWidth,
3770
+ height: event.currentTarget.innerHeight
3771
+ })))
3772
+ .subscribe(windowSize => {
3773
+ this.#viewportSizeChanged.next(windowSize);
3774
+ });
3775
+ }
3776
+ width() {
3777
+ return this.window.screen.availWidth;
3778
+ }
3779
+ height() {
3780
+ return this.window.screen.availHeight;
3781
+ }
3782
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyViewportService, deps: [{ token: Window }], target: i0.ɵɵFactoryTarget.Injectable });
3783
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyViewportService, providedIn: 'root' });
4099
3784
  }
4100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormModule, decorators: [{
4101
- type: NgModule,
3785
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyViewportService, decorators: [{
3786
+ type: Injectable,
4102
3787
  args: [{
4103
- imports: COMPONENTS$h,
4104
- exports: COMPONENTS$h,
3788
+ providedIn: 'root'
4105
3789
  }]
4106
- }] });
3790
+ }], ctorParameters: () => [{ type: Window, decorators: [{
3791
+ type: Inject,
3792
+ args: [Window]
3793
+ }] }] });
4107
3794
 
4108
- class BizyGridForDirective {
4109
- viewContainerRef = inject(ViewContainerRef);
4110
- templateRef = inject(TemplateRef);
4111
- #items = new BehaviorSubject([]);
4112
- get items$() {
4113
- return this.#items.asObservable();
3795
+ class BizyKeyboardService {
3796
+ document;
3797
+ #shiftHolding = new BehaviorSubject(false);
3798
+ #controlHolding = new BehaviorSubject(false);
3799
+ get shiftHolding$() {
3800
+ return this.#shiftHolding.asObservable();
4114
3801
  }
4115
- set gridForOf(items) {
4116
- this.#items.next(items);
3802
+ get controlHolding$() {
3803
+ return this.#controlHolding.asObservable();
4117
3804
  }
4118
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridForDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4119
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: BizyGridForDirective, isStandalone: true, selector: "[gridFor]", inputs: { gridForOf: "gridForOf" }, ngImport: i0 });
3805
+ constructor(document) {
3806
+ this.document = document;
3807
+ this.document.addEventListener('visibilitychange', () => {
3808
+ this.#shiftHolding.next(false);
3809
+ this.#controlHolding.next(false);
3810
+ });
3811
+ this.document.addEventListener('keydown', (event) => {
3812
+ if (event.key === 'Shift') {
3813
+ this.#shiftHolding.next(true);
3814
+ }
3815
+ if (event.key === 'Meta' || event.key === 'Control') {
3816
+ this.#controlHolding.next(true);
3817
+ }
3818
+ });
3819
+ this.document.addEventListener('keyup', (event) => {
3820
+ if (event.key === 'Shift') {
3821
+ this.#shiftHolding.next(false);
3822
+ }
3823
+ if (event.key === 'Meta' || event.key === 'Control') {
3824
+ this.#controlHolding.next(false);
3825
+ }
3826
+ });
3827
+ }
3828
+ isShiftHolding() {
3829
+ return this.#shiftHolding.value;
3830
+ }
3831
+ isControlHolding() {
3832
+ return this.#controlHolding.value;
3833
+ }
3834
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyKeyboardService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
3835
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyKeyboardService, providedIn: 'root' });
4120
3836
  }
4121
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridForDirective, decorators: [{
4122
- type: Directive,
3837
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyKeyboardService, decorators: [{
3838
+ type: Injectable,
4123
3839
  args: [{
4124
- selector: '[gridFor]',
3840
+ providedIn: 'root'
4125
3841
  }]
4126
- }], propDecorators: { gridForOf: [{
4127
- type: Input,
4128
- args: ['gridForOf']
4129
- }] } });
3842
+ }], ctorParameters: () => [{ type: Document, decorators: [{
3843
+ type: Inject,
3844
+ args: [DOCUMENT]
3845
+ }] }] });
4130
3846
 
4131
- class BizyGridRowComponent {
4132
- #elementRef = inject(ElementRef);
4133
- #ref = inject(ChangeDetectorRef);
4134
- #renderer = inject(Renderer2);
4135
- rowHeight = 100; // Px
4136
- set itemsPerRow(itemsPerRow) {
4137
- if (!this.#elementRef.nativeElement) {
4138
- return;
4139
- }
4140
- if (!itemsPerRow) {
4141
- itemsPerRow = 1;
4142
- }
4143
- this.#renderer.setStyle(this.#elementRef.nativeElement, 'gridTemplateRows', `${this.rowHeight}px`);
4144
- this.#renderer.setStyle(this.#elementRef.nativeElement, 'gridTemplateColumns', `repeat(${itemsPerRow}, minmax(0, 1fr)`);
4145
- this.#ref.detectChanges();
4146
- }
4147
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4148
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyGridRowComponent, isStandalone: true, selector: "bizy-grid-row", inputs: { rowHeight: "rowHeight", itemsPerRow: "itemsPerRow" }, ngImport: i0, template: "<ng-content></ng-content>", styles: [":host{font-size:1rem;display:grid;column-gap:var(--bizy-grid-gap);margin-bottom:var(--bizy-grid-gap)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4149
- }
4150
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridRowComponent, decorators: [{
4151
- type: Component,
4152
- args: [{ selector: 'bizy-grid-row', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>", styles: [":host{font-size:1rem;display:grid;column-gap:var(--bizy-grid-gap);margin-bottom:var(--bizy-grid-gap)}\n"] }]
4153
- }], propDecorators: { rowHeight: [{
4154
- type: Input
4155
- }], itemsPerRow: [{
4156
- type: Input
4157
- }] } });
4158
-
4159
- class BizyGridComponent {
4160
- ref;
3847
+ class BizyExportToCSVService {
4161
3848
  document;
4162
- renderer;
4163
- elementRef;
4164
- content;
4165
- gridDirective;
4166
- resizeRef = null;
4167
- #rowScrollingMutationObserver;
4168
- #resizeObserver;
4169
- #subscription = new Subscription();
4170
- #view;
4171
- notifier$ = new Subject();
4172
- rowHeight = 100;
4173
- itemRows = [];
4174
- items = [];
4175
- itemTemplate;
4176
- itemsPerRow = 1;
4177
- constructor(ref, document, renderer, elementRef) {
4178
- this.ref = ref;
3849
+ rendererFactory;
3850
+ #loading = false;
3851
+ #renderer;
3852
+ constructor(document, rendererFactory) {
4179
3853
  this.document = document;
4180
- this.renderer = renderer;
4181
- this.elementRef = elementRef;
3854
+ this.rendererFactory = rendererFactory;
3855
+ this.#renderer = this.rendererFactory.createRenderer(null, null);
4182
3856
  }
4183
- ngAfterContentInit() {
4184
- if (this.gridDirective) {
4185
- this.#initView();
4186
- }
4187
- else {
4188
- this.#rowScrollingMutationObserver = new MutationObserver(() => {
4189
- if (!this.gridDirective) {
4190
- return;
4191
- }
4192
- this.#initView();
4193
- this.#rowScrollingMutationObserver.disconnect();
4194
- this.ref.detectChanges();
4195
- });
4196
- this.#rowScrollingMutationObserver.observe(this.document.body, { childList: true, subtree: true });
3857
+ download(data) {
3858
+ if (this.#loading || !data.items || !Array.isArray(data.items) || !data.model) {
3859
+ return;
4197
3860
  }
4198
- }
4199
- #initView = () => {
4200
- this.#subscription.add(this.gridDirective.items$.subscribe(items => {
4201
- if (this.items.length === 0 && items.length === 0) {
4202
- return;
3861
+ try {
3862
+ this.#loading = true;
3863
+ const csv = this.getCSV(data);
3864
+ if (!data.fileName) {
3865
+ data.fileName = 'bizy-csv';
4203
3866
  }
4204
- this.items = items;
4205
- this.#updateView();
4206
- }));
4207
- if (!this.#view) {
4208
- this.#view = this.gridDirective.viewContainerRef;
4209
- this.#view.createEmbeddedView(this.content);
4210
- }
4211
- this.#resizeObserver = new ResizeObserver(() => this.notifier$.next());
4212
- const resizeRef = this.resizeRef ? this.resizeRef : this.renderer.parentNode(this.elementRef.nativeElement) ? this.renderer.parentNode(this.elementRef.nativeElement) : this.elementRef.nativeElement;
4213
- this.#resizeObserver.observe(resizeRef);
4214
- this.#subscription.add(this.notifier$.pipe(debounceTime$1(50)).subscribe(() => {
4215
- this.#updateView();
4216
- }));
4217
- };
4218
- #updateView = () => {
4219
- this.itemTemplate = this.gridDirective.templateRef;
4220
- const rowWidth = this.elementRef.nativeElement.offsetWidth || this.elementRef.nativeElement.firstChild.offsetWidth;
4221
- let columnWidth = 100;
4222
- const fontSize = Number(getComputedStyle(this.elementRef.nativeElement).getPropertyValue('font-size').split('px')[0]);
4223
- const rowHeightParameter = getComputedStyle(this.elementRef.nativeElement).getPropertyValue('--bizy-grid-row-height');
4224
- if (rowHeightParameter && rowHeightParameter.includes('rem')) {
4225
- this.rowHeight = fontSize * Number(rowHeightParameter.split('rem')[0]);
3867
+ this.#downloadCSV({ csv, fileName: data.fileName });
4226
3868
  }
4227
- else if (rowHeightParameter && rowHeightParameter.includes('px')) {
4228
- this.rowHeight = Number(rowHeightParameter.split('px')[0]);
3869
+ finally {
3870
+ this.#loading = false;
4229
3871
  }
4230
- let gap = 10;
4231
- const gapParameter = getComputedStyle(this.elementRef.nativeElement).getPropertyValue('--bizy-grid-gap');
4232
- if (gapParameter && gapParameter.includes('rem')) {
4233
- gap = fontSize * Number(gapParameter.split('rem')[0]);
3872
+ }
3873
+ getCSV(data) {
3874
+ let csv = '';
3875
+ function escapeCommas(str) {
3876
+ return str.includes(',') ? `"${str}"` : str;
4234
3877
  }
4235
- else if (gapParameter && gapParameter.includes('px')) {
4236
- gap = Number(gapParameter.split('px')[0]);
3878
+ for (const key in data.model) {
3879
+ if (key) {
3880
+ csv += `${data.model[key]},`;
3881
+ }
4237
3882
  }
4238
- const columnWidthParameter = getComputedStyle(this.elementRef.nativeElement).getPropertyValue('--bizy-grid-column-width');
4239
- if (columnWidthParameter && columnWidthParameter.includes('rem')) {
4240
- columnWidth = fontSize * Number(columnWidthParameter.split('rem')[0]);
3883
+ data.items.forEach(_item => {
3884
+ // Remove the last character (',')
3885
+ csv = csv.slice(0, -1);
3886
+ csv += '\n';
3887
+ for (const key in data.model) {
3888
+ let value = _item;
3889
+ const nestedProperty = key.split('.');
3890
+ for (let i = 0; i < nestedProperty.length; i++) {
3891
+ const _property = nestedProperty[i];
3892
+ if (value) {
3893
+ value = value[_property];
3894
+ }
3895
+ else {
3896
+ break;
3897
+ }
3898
+ }
3899
+ if (typeof value !== undefined && value !== null) {
3900
+ csv += `${escapeCommas(String(value).replace(/\n/g, ''))},`;
3901
+ }
3902
+ else {
3903
+ csv += ',';
3904
+ }
3905
+ }
3906
+ });
3907
+ if (csv && csv[csv.length - 1] === ',') {
3908
+ // Remove the last character (',')
3909
+ csv = csv.slice(0, -1);
4241
3910
  }
4242
- else if (columnWidthParameter && columnWidthParameter.includes('px')) {
4243
- columnWidth = Number(columnWidthParameter.split('px')[0]);
3911
+ return csv;
3912
+ }
3913
+ #downloadCSV(data) {
3914
+ const blob = new Blob([data.csv], { type: 'text/csv;charset=utf-8;' });
3915
+ const url = URL.createObjectURL(blob);
3916
+ const downloadButton = this.#renderer.createElement('a');
3917
+ downloadButton.setAttribute('download', data.fileName);
3918
+ downloadButton.href = url;
3919
+ this.#renderer.appendChild(this.document.body, downloadButton);
3920
+ downloadButton.click();
3921
+ this.#renderer.removeChild(this.document.body, downloadButton);
3922
+ }
3923
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyExportToCSVService, deps: [{ token: DOCUMENT }, { token: RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
3924
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyExportToCSVService, providedIn: 'root' });
3925
+ }
3926
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyExportToCSVService, decorators: [{
3927
+ type: Injectable,
3928
+ args: [{
3929
+ providedIn: 'root'
3930
+ }]
3931
+ }], ctorParameters: () => [{ type: Document, decorators: [{
3932
+ type: Inject,
3933
+ args: [DOCUMENT]
3934
+ }] }, { type: i0.RendererFactory2, decorators: [{
3935
+ type: Inject,
3936
+ args: [RendererFactory2]
3937
+ }] }] });
3938
+
3939
+ class BizyRouterService {
3940
+ router;
3941
+ static backPath = '';
3942
+ transitionsEnd$;
3943
+ transitionsStart$;
3944
+ popStateEvent$;
3945
+ routeChange$;
3946
+ constructor(router) {
3947
+ this.router = router;
3948
+ this.transitionsEnd$ = this.router.events.pipe(filter$1(event => event instanceof NavigationEnd), map((event) => event.id), distinctUntilChanged(), map(() => this.router.routerState.snapshot.root));
3949
+ this.transitionsStart$ = this.router.events.pipe(filter$1(event => event instanceof NavigationStart), map((event) => event.id), distinctUntilChanged(), map(() => this.router.routerState.snapshot.root));
3950
+ this.popStateEvent$ = fromEvent(window, 'popstate');
3951
+ this.routeChange$ = merge(this.transitionsEnd$, this.popStateEvent$).pipe(map(() => void 0));
3952
+ }
3953
+ getURL() {
3954
+ return window.location.pathname;
3955
+ }
3956
+ getBackPath() {
3957
+ return BizyRouterService.backPath;
3958
+ }
3959
+ getId(activatedRoute, param) {
3960
+ return activatedRoute.snapshot.paramMap.get(param);
3961
+ }
3962
+ getQueryParam(activatedRoute, param) {
3963
+ return activatedRoute.snapshot.queryParamMap.get(param);
3964
+ }
3965
+ getAllQueryParam() {
3966
+ const params = new URL(window.location.href).searchParams;
3967
+ const queryParams = {};
3968
+ for (const [key, value] of params.entries()) {
3969
+ queryParams[key] = value;
4244
3970
  }
4245
- columnWidth += gap;
4246
- const count = Math.trunc(rowWidth / (columnWidth));
4247
- if (Math.round((gap * (count - 1)) + (columnWidth * count)) <= (rowWidth)) {
4248
- this.itemsPerRow = count <= 0 ? 1 : count;
3971
+ return queryParams;
3972
+ }
3973
+ goTo(data) {
3974
+ if (data.replace) {
3975
+ BizyRouterService.backPath = '';
4249
3976
  }
4250
3977
  else {
4251
- this.itemsPerRow = (count - 1) <= 0 ? 1 : count - 1;
3978
+ BizyRouterService.backPath = this.getURL();
4252
3979
  }
4253
- const itemRows = [];
4254
- for (let i = 0; i < this.items.length; i += this.itemsPerRow) {
4255
- const row = this.items.slice(i, i + this.itemsPerRow);
4256
- itemRows.push(row);
3980
+ if (data.path[0] === '/') {
3981
+ this.router.navigateByUrl(`${data.path}${this._serialize(data.params)}`, { replaceUrl: data.replace ?? false, skipLocationChange: data.skip ?? false });
3982
+ return;
4257
3983
  }
4258
- this.itemRows = itemRows;
4259
- this.ref.detectChanges();
4260
- };
4261
- trackById(index, item) {
4262
- return item?.id ?? index;
3984
+ const path = this.getURL();
3985
+ const index = path.indexOf('?');
3986
+ const url = index !== -1 ? path.substring(0, index) : path;
3987
+ this.router.navigateByUrl(`${url}/${data.path}${this._serialize(data.params)}`, { replaceUrl: data.replace ?? false, skipLocationChange: data.skip ?? false });
4263
3988
  }
4264
- ngOnDestroy() {
4265
- this.#subscription.unsubscribe();
4266
- if (this.#rowScrollingMutationObserver) {
4267
- this.#rowScrollingMutationObserver.disconnect();
3989
+ goBack(data) {
3990
+ if (BizyRouterService.backPath) {
3991
+ history.back();
3992
+ BizyRouterService.backPath = '';
4268
3993
  }
4269
- if (this.#resizeObserver) {
4270
- this.#resizeObserver.disconnect();
3994
+ else if (data && data.path) {
3995
+ this.router.navigateByUrl(data.path, { replaceUrl: true });
4271
3996
  }
4272
- }
4273
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridComponent, deps: [{ token: ChangeDetectorRef }, { token: DOCUMENT }, { token: Renderer2 }, { token: ElementRef }], target: i0.ɵɵFactoryTarget.Component });
4274
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyGridComponent, isStandalone: true, selector: "bizy-grid", inputs: { resizeRef: "resizeRef" }, queries: [{ propertyName: "gridDirective", first: true, predicate: BizyGridForDirective, descendants: true }], viewQueries: [{ propertyName: "content", first: true, predicate: ["gridScrollingContent"], descendants: true }], ngImport: i0, template: "<div class=\"bizy-grid\" [ngClass]=\"{'bizy-grid--empty': items && items.length === 0}\">\n\n <cdk-virtual-scroll-viewport\n class=\"bizy-grid__rows\"\n [itemSize]=\"rowHeight\"\n [minBufferPx]=\"rowHeight + (rowHeight * 5)\"\n [maxBufferPx]=\"rowHeight + (rowHeight * 10)\">\n\n <ng-content></ng-content>\n \n <ng-template #gridScrollingContent>\n <ng-template let-item cdkVirtualFor [cdkVirtualForOf]=\"itemRows\">\n <bizy-grid-row [rowHeight]=\"rowHeight\" [itemsPerRow]=\"itemsPerRow\">\n <ng-container *ngFor=\"let it of item; trackBy: trackById\">\n <ng-template *ngTemplateOutlet=\"itemTemplate; context: { $implicit: it }\"></ng-template>\n </ng-container>\n </bizy-grid-row>\n </ng-template>\n </ng-template>\n </cdk-virtual-scroll-viewport>\n\n</div>\n", styles: [":host{display:inline-block!important;min-height:var(--bizy-grid-min-height);max-height:var(--bizy-grid-max-height);height:var(--bizy-grid-height);width:var(--bizy-grid-width);flex:1;overflow-x:auto;overflow-y:hidden;font-size:1rem}:host:has(.bizy-grid--empty){height:0!important;min-height:0!important;max-height:0!important}.bizy-grid{width:inherit;height:inherit;min-width:fit-content;display:flex;flex-direction:column;row-gap:.3rem;overflow-x:clip;background-color:var(--bizy-grid-background-color)}.bizy-grid__rows{width:100%;display:flex;flex-direction:column;min-width:fit-content;overflow-x:hidden}::ng-deep .cdk-virtual-scrollable{height:100%;width:100%;overflow-y:auto!important;overflow-x:hidden!important;contain:inline-size!important}::ng-deep .cdk-virtual-scroll-content-wrapper{min-width:100%;max-width:100%}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar{width:.5rem;height:.5rem}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-grid-scroll-bar-color)}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-grid-scroll-bar-hover-color)}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-button{height:1rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i2$2.ɵɵCdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i2$2.ɵɵCdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i2$2.ɵɵCdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "component", type: BizyGridRowComponent, selector: "bizy-grid-row", inputs: ["rowHeight", "itemsPerRow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4275
- }
4276
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridComponent, decorators: [{
4277
- type: Component,
4278
- args: [{ selector: 'bizy-grid', imports: [CommonModule, ScrollingModule, BizyGridRowComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"bizy-grid\" [ngClass]=\"{'bizy-grid--empty': items && items.length === 0}\">\n\n <cdk-virtual-scroll-viewport\n class=\"bizy-grid__rows\"\n [itemSize]=\"rowHeight\"\n [minBufferPx]=\"rowHeight + (rowHeight * 5)\"\n [maxBufferPx]=\"rowHeight + (rowHeight * 10)\">\n\n <ng-content></ng-content>\n \n <ng-template #gridScrollingContent>\n <ng-template let-item cdkVirtualFor [cdkVirtualForOf]=\"itemRows\">\n <bizy-grid-row [rowHeight]=\"rowHeight\" [itemsPerRow]=\"itemsPerRow\">\n <ng-container *ngFor=\"let it of item; trackBy: trackById\">\n <ng-template *ngTemplateOutlet=\"itemTemplate; context: { $implicit: it }\"></ng-template>\n </ng-container>\n </bizy-grid-row>\n </ng-template>\n </ng-template>\n </cdk-virtual-scroll-viewport>\n\n</div>\n", styles: [":host{display:inline-block!important;min-height:var(--bizy-grid-min-height);max-height:var(--bizy-grid-max-height);height:var(--bizy-grid-height);width:var(--bizy-grid-width);flex:1;overflow-x:auto;overflow-y:hidden;font-size:1rem}:host:has(.bizy-grid--empty){height:0!important;min-height:0!important;max-height:0!important}.bizy-grid{width:inherit;height:inherit;min-width:fit-content;display:flex;flex-direction:column;row-gap:.3rem;overflow-x:clip;background-color:var(--bizy-grid-background-color)}.bizy-grid__rows{width:100%;display:flex;flex-direction:column;min-width:fit-content;overflow-x:hidden}::ng-deep .cdk-virtual-scrollable{height:100%;width:100%;overflow-y:auto!important;overflow-x:hidden!important;contain:inline-size!important}::ng-deep .cdk-virtual-scroll-content-wrapper{min-width:100%;max-width:100%}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar{width:.5rem;height:.5rem}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-grid-scroll-bar-color)}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-grid-scroll-bar-hover-color)}::ng-deep .cdk-virtual-scrollable::-webkit-scrollbar-button{height:1rem}\n"] }]
4279
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef, decorators: [{
4280
- type: Inject,
4281
- args: [ChangeDetectorRef]
4282
- }] }, { type: Document, decorators: [{
4283
- type: Inject,
4284
- args: [DOCUMENT]
4285
- }] }, { type: i0.Renderer2, decorators: [{
4286
- type: Inject,
4287
- args: [Renderer2]
4288
- }] }, { type: i0.ElementRef, decorators: [{
4289
- type: Inject,
4290
- args: [ElementRef]
4291
- }] }], propDecorators: { content: [{
4292
- type: ViewChild,
4293
- args: ['gridScrollingContent']
4294
- }], gridDirective: [{
4295
- type: ContentChild,
4296
- args: [BizyGridForDirective]
4297
- }], resizeRef: [{
4298
- type: Input
4299
- }] } });
4300
-
4301
- const COMPONENTS$g = [
4302
- BizyGridComponent,
4303
- BizyGridRowComponent
4304
- ];
4305
- const DIRECTIVES$2 = [
4306
- BizyGridForDirective,
4307
- ];
4308
- class BizyGridModule {
4309
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4310
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyGridModule, imports: [BizyGridComponent,
4311
- BizyGridRowComponent, BizyGridForDirective], exports: [BizyGridComponent,
4312
- BizyGridRowComponent, BizyGridForDirective] });
4313
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridModule, imports: [BizyGridComponent,
4314
- BizyGridRowComponent] });
4315
- }
4316
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyGridModule, decorators: [{
4317
- type: NgModule,
4318
- args: [{
4319
- imports: COMPONENTS$g.concat(DIRECTIVES$2),
4320
- exports: COMPONENTS$g.concat(DIRECTIVES$2),
4321
- }]
4322
- }] });
4323
-
4324
- const COMPONENTS$f = [
4325
- BizyInputComponent,
4326
- BizyInputOptionComponent
4327
- ];
4328
- class BizyInputModule {
4329
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4330
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyInputModule, imports: [BizyInputComponent,
4331
- BizyInputOptionComponent], exports: [BizyInputComponent,
4332
- BizyInputOptionComponent] });
4333
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyInputModule, imports: [COMPONENTS$f] });
4334
- }
4335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyInputModule, decorators: [{
4336
- type: NgModule,
4337
- args: [{
4338
- imports: COMPONENTS$f,
4339
- exports: COMPONENTS$f,
4340
- }]
4341
- }] });
4342
-
4343
- class BizyListComponent {
4344
- id = `bizy-list-${Math.random()}`;
4345
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4346
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyListComponent, isStandalone: true, selector: "bizy-list", inputs: { id: "id" }, host: { properties: { "id": "id" } }, ngImport: i0, template: "<ng-content></ng-content>", styles: [":host{font-size:1rem;height:var(--bizy-list-height);overflow:auto;width:var(--bizy-list-width);display:flex;flex-direction:var(--bizy-list-flex-direction);column-gap:var(--bizy-list-column-gap);row-gap:var(--bizy-list-row-gap);justify-content:var(--bizy-list-justify-content);align-items:var(--bizy-list-align-items)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4347
- }
4348
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListComponent, decorators: [{
4349
- type: Component,
4350
- args: [{ selector: 'bizy-list', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, host: {
4351
- '[id]': 'id'
4352
- }, template: "<ng-content></ng-content>", styles: [":host{font-size:1rem;height:var(--bizy-list-height);overflow:auto;width:var(--bizy-list-width);display:flex;flex-direction:var(--bizy-list-flex-direction);column-gap:var(--bizy-list-column-gap);row-gap:var(--bizy-list-row-gap);justify-content:var(--bizy-list-justify-content);align-items:var(--bizy-list-align-items)}\n"] }]
4353
- }], propDecorators: { id: [{
4354
- type: Input
4355
- }] } });
4356
-
4357
- const COMPONENTS$e = [
4358
- BizyListComponent,
4359
- ];
4360
- class BizyListModule {
4361
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4362
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyListModule, imports: [BizyListComponent], exports: [BizyListComponent] });
4363
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListModule, imports: [COMPONENTS$e] });
3997
+ else {
3998
+ const index = this.getURL().lastIndexOf('/');
3999
+ const backURL = this.getURL().substring(0, index);
4000
+ this.router.navigateByUrl(backURL, { replaceUrl: true });
4001
+ }
4002
+ }
4003
+ reload(force) {
4004
+ if (force) {
4005
+ window.location.reload();
4006
+ }
4007
+ else {
4008
+ setTimeout(() => {
4009
+ this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
4010
+ this.goTo({ path: this.getURL(), params: this.getAllQueryParam() });
4011
+ });
4012
+ }, 1);
4013
+ }
4014
+ }
4015
+ _serialize(params) {
4016
+ if (!params) {
4017
+ return '';
4018
+ }
4019
+ const str = [];
4020
+ for (const param in params) {
4021
+ if (params[param]) {
4022
+ str.push(encodeURIComponent(param) + '=' + encodeURIComponent(params[param]));
4023
+ }
4024
+ }
4025
+ const queryParams = str.length > 0 ? `?${str.join('&')}` : '';
4026
+ return queryParams;
4027
+ }
4028
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRouterService, deps: [{ token: Router }], target: i0.ɵɵFactoryTarget.Injectable });
4029
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRouterService, providedIn: 'root' });
4364
4030
  }
4365
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyListModule, decorators: [{
4366
- type: NgModule,
4031
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyRouterService, decorators: [{
4032
+ type: Injectable,
4367
4033
  args: [{
4368
- imports: COMPONENTS$e,
4369
- exports: COMPONENTS$e,
4034
+ providedIn: 'root'
4370
4035
  }]
4371
- }] });
4036
+ }], ctorParameters: () => [{ type: i1$1.Router, decorators: [{
4037
+ type: Inject,
4038
+ args: [Router]
4039
+ }] }] });
4372
4040
 
4373
- class BizyMenuOptionComponent {
4374
- id = `bizy-menu-option-${Math.random()}`;
4375
- disabled = false;
4376
- customClass = '';
4377
- selected = false;
4378
- onSelect = new EventEmitter();
4379
- _onSelect(event) {
4380
- if (this.disabled) {
4381
- return;
4382
- }
4383
- this.onSelect.emit(event);
4041
+ class BizyCacheService {
4042
+ router;
4043
+ CACHE_PREFIX = 'BIZY-CACHE';
4044
+ constructor(router) {
4045
+ this.router = router;
4384
4046
  }
4385
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4386
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyMenuOptionComponent, isStandalone: true, selector: "bizy-menu-option", inputs: { id: "id", disabled: "disabled", customClass: "customClass", selected: "selected" }, outputs: { onSelect: "onSelect" }, ngImport: i0, template: "<button \n type=\"button\"\n [id]=\"id\"\n (click)=\"_onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\"\n [ngClass]=\"{'bizy-menu-option--selected': selected, 'bizy-menu-option--disabled': disabled}\"\n class=\"bizy-menu-option {{customClass}}\">\n\n <span class=\"bizy-menu-option__content\">\n <ng-content></ng-content>\n </span>\n \n</button>\n\n<span class=\"bizy-menu-option__menu\">\n <ng-content select=\"bizy-menu\"></ng-content>\n</span>\n", styles: [":host{font-size:1rem}:host:has(>.bizy-menu-option__menu:not(:empty)) .bizy-menu-option{display:none!important}.bizy-menu-option{font-size:1rem;width:100%;border:none;background-color:var(--bizy-menu-option-background-color);display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:.5rem;color:var(--bizy-menu-option-color);cursor:pointer}.bizy-menu-option:hover{background-color:var(--bizy-menu-option-hover-background-color)}.bizy-menu-option--selected{color:var(--bizy-menu-option-selected-color)!important;background-color:var(--bizy-menu-option-selected-background-color)!important}::ng-deep .bizy-menu-option--selected *{color:var(--bizy-menu-option-selected-color)!important}.bizy-menu-option--disabled{opacity:.5;pointer-events:none;cursor:not-allowed!important}.bizy-menu-option__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;width:100%}::ng-deep .bizy-menu-option__menu *{color:var(--bizy-menu-option-color);fill:var(--bizy-menu-option-color)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4387
- }
4388
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuOptionComponent, decorators: [{
4389
- type: Component,
4390
- args: [{ selector: 'bizy-menu-option', imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n type=\"button\"\n [id]=\"id\"\n (click)=\"_onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\"\n [ngClass]=\"{'bizy-menu-option--selected': selected, 'bizy-menu-option--disabled': disabled}\"\n class=\"bizy-menu-option {{customClass}}\">\n\n <span class=\"bizy-menu-option__content\">\n <ng-content></ng-content>\n </span>\n \n</button>\n\n<span class=\"bizy-menu-option__menu\">\n <ng-content select=\"bizy-menu\"></ng-content>\n</span>\n", styles: [":host{font-size:1rem}:host:has(>.bizy-menu-option__menu:not(:empty)) .bizy-menu-option{display:none!important}.bizy-menu-option{font-size:1rem;width:100%;border:none;background-color:var(--bizy-menu-option-background-color);display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:.5rem;color:var(--bizy-menu-option-color);cursor:pointer}.bizy-menu-option:hover{background-color:var(--bizy-menu-option-hover-background-color)}.bizy-menu-option--selected{color:var(--bizy-menu-option-selected-color)!important;background-color:var(--bizy-menu-option-selected-background-color)!important}::ng-deep .bizy-menu-option--selected *{color:var(--bizy-menu-option-selected-color)!important}.bizy-menu-option--disabled{opacity:.5;pointer-events:none;cursor:not-allowed!important}.bizy-menu-option__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;width:100%}::ng-deep .bizy-menu-option__menu *{color:var(--bizy-menu-option-color);fill:var(--bizy-menu-option-color)}\n"] }]
4391
- }], propDecorators: { id: [{
4392
- type: Input
4393
- }], disabled: [{
4394
- type: Input
4395
- }], customClass: [{
4396
- type: Input
4397
- }], selected: [{
4398
- type: Input
4399
- }], onSelect: [{
4400
- type: Output
4401
- }] } });
4402
-
4403
- class BizyMenuComponent {
4404
- #ref = inject(ChangeDetectorRef);
4405
- options;
4406
- id = `bizy-menu-${Math.random()}`;
4407
- disabled = false;
4408
- offsetX = 0;
4409
- offsetY = 0;
4410
- customClass = '';
4411
- hideArrow = false;
4412
- opened = false;
4413
- onSelect = new EventEmitter();
4414
- _menuWidth;
4415
- #subscription = new Subscription();
4416
- bizyMenuOptionsId = 'bizyMenuOptionsId';
4417
- _onSelect(event) {
4418
- if (this.disabled) {
4419
- return;
4047
+ getData(key) {
4048
+ if (!key) {
4049
+ key = this.router.getURL();
4420
4050
  }
4421
- this.onSelect.emit(event);
4422
- if (this.options && this.options.length > 0) {
4423
- this.selectButton(event);
4051
+ const data = sessionStorage.getItem(`${this.CACHE_PREFIX}-${key}`);
4052
+ if (data) {
4053
+ const _data = JSON.parse(data);
4054
+ return Date.now() < _data.expiresAt ? _data.value : {};
4424
4055
  }
4056
+ return {};
4425
4057
  }
4426
- selectButton(event) {
4427
- this.opened = !this.opened;
4428
- if (event && event.srcElement && event.srcElement.offsetWidth) {
4429
- this._menuWidth = event.srcElement.offsetWidth;
4058
+ setData(value, key, expiresAt) {
4059
+ if (typeof value === 'undefined' || value === null) {
4060
+ return;
4430
4061
  }
4431
- if (this.opened) {
4432
- this.#subscription = new Subscription();
4433
- this.#subscription.add(fromEvent(window, 'scroll', { capture: true }).subscribe(() => {
4434
- if (event && event.target && event.target.id && (event.target.id === this.id || event.target.id === this.bizyMenuOptionsId)) {
4435
- return;
4436
- }
4437
- this.opened = false;
4438
- this.#ref.detectChanges();
4439
- this.#subscription.unsubscribe();
4440
- }));
4441
- if (this.options) {
4442
- this.options.forEach((option) => {
4443
- this.#subscription.add(option.onSelect.subscribe(event => {
4444
- this.close(event);
4445
- }));
4446
- });
4447
- }
4062
+ if (!key) {
4063
+ key = this.router.getURL();
4448
4064
  }
4449
- else {
4450
- this.#subscription.unsubscribe();
4065
+ if (!expiresAt) {
4066
+ const date = new Date();
4067
+ date.setHours(23, 59, 59);
4068
+ expiresAt = date.getTime();
4451
4069
  }
4070
+ const data = {
4071
+ expiresAt,
4072
+ value
4073
+ };
4074
+ sessionStorage.setItem(`${this.CACHE_PREFIX}-${key}`, JSON.stringify(data));
4452
4075
  }
4453
- close = (event) => {
4454
- if (event && event.target && event.target.id && event.target.id === this.id) {
4455
- return;
4076
+ remove(key) {
4077
+ if (!key) {
4078
+ key = this.router.getURL();
4456
4079
  }
4457
- this.opened = false;
4458
- this.#subscription.unsubscribe();
4459
- this.#ref.detectChanges();
4460
- };
4461
- ngOnDestroy() {
4462
- this.#subscription.unsubscribe();
4080
+ sessionStorage.removeItem(`${this.CACHE_PREFIX}-${key}`);
4463
4081
  }
4464
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4465
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyMenuComponent, isStandalone: true, selector: "bizy-menu", inputs: { id: "id", disabled: "disabled", offsetX: "offsetX", offsetY: "offsetY", customClass: "customClass", hideArrow: "hideArrow", opened: "opened" }, outputs: { onSelect: "onSelect" }, queries: [{ propertyName: "options", predicate: BizyMenuOptionComponent }], ngImport: i0, template: "<button \n type=\"button\"\n class=\"bizy-menu {{customClass}}\"\n [ngClass]=\"{'bizy-menu--disabled': disabled}\"\n [id]=\"id\"\n (click)=\"_onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\"\n cdkOverlayOrigin \n #bizyMenuTrigger=\"cdkOverlayOrigin\">\n\n <span class=\"bizy-menu__content\">\n <ng-content></ng-content>\n </span>\n \n <svg \n class=\"bizy-menu__arrow\"\n *ngIf=\"!hideArrow\" \n viewBox=\"0 0 96 96\" \n [ngClass]=\"{'bizy-menu__arrow--opened': opened}\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M81.8457,25.3876a6.0239,6.0239,0,0,0-8.45.7676L48,56.6257l-25.396-30.47a5.999,5.999,0,1,0-9.2114,7.6879L43.3943,69.8452a5.9969,5.9969,0,0,0,9.2114,0L82.6074,33.8431A6.0076,6.0076,0,0,0,81.8457,25.3876Z\"/>\n </svg>\n</button>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOffsetX]=\"offsetX\"\n [cdkConnectedOverlayOffsetY]=\"offsetY\"\n [cdkConnectedOverlayMinWidth]=\"_menuWidth\"\n [cdkConnectedOverlayOrigin]=\"bizyMenuTrigger\"\n (overlayOutsideClick)=\"close($event)\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayOpen]=\"opened\">\n\n <span class=\"bizy-menu__options\" [id]=\"bizyMenuOptionsId\">\n\n <span class=\"bizy-menu__options__header\">\n <ng-content select=\"bizy-menu-title\"></ng-content>\n <ng-content select=\"bizy-input\"></ng-content>\n </span>\n\n <ng-content select=\"bizy-menu-option\"></ng-content>\n\n </span>\n\n</ng-template>\n", styles: [":host{font-size:1rem}:host:has(>.bizy-menu__options:empty) .bizy-menu>.bizy-menu__arrow{display:none!important}.bizy-menu{font-size:1rem;width:100%;border:none;background-color:transparent;display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:var(--bizy-menu-padding);color:var(--bizy-menu-color);cursor:pointer}.bizy-menu--disabled{pointer-events:none;opacity:.5;cursor:not-allowed!important}.bizy-menu__arrow{height:var(--bizy-menu-arrow-height);pointer-events:none;display:block;transition:transform .2s ease;fill:var(--bizy-menu-color)}.bizy-menu__arrow--opened{transform:rotate(180deg)}.bizy-menu__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;pointer-events:none}.bizy-menu__options{background-color:var(--bizy-menu-background-color);min-width:var(--bizy-menu-min-width);max-width:var(--bizy-menu-max-width);max-height:var(--bizy-menu-max-height);overflow-y:auto;overflow-x:hidden;width:100%;display:flex;flex-direction:column;position:relative;box-shadow:0 7px 14px #32325d1a,0 3px 6px #00000014}.bizy-menu__options::-webkit-scrollbar{width:.5rem;height:.5rem}.bizy-menu__options::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-menu-scroll-bar-color)}.bizy-menu__options::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-menu-scroll-bar-hover-color)}.bizy-menu__options::-webkit-scrollbar-button{height:1rem}.bizy-menu__options__header{position:sticky;z-index:1;top:0;display:flex;flex-direction:column;row-gap:.3rem;background-color:#fff}::ng-deep .bizy-menu__options__header{--bizy-input-width: auto;--bizy-input-background-color: #fff;--bizy-input-min-width: var(--bizy-select-min-width);--bizy-input-max-width: auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i2$2.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i2$2.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4466
- }
4467
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuComponent, decorators: [{
4468
- type: Component,
4469
- args: [{ selector: 'bizy-menu', imports: [CommonModule, FormsModule, OverlayModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button \n type=\"button\"\n class=\"bizy-menu {{customClass}}\"\n [ngClass]=\"{'bizy-menu--disabled': disabled}\"\n [id]=\"id\"\n (click)=\"_onSelect($event)\"\n (keyup.enter)=\"_onSelect($event)\"\n cdkOverlayOrigin \n #bizyMenuTrigger=\"cdkOverlayOrigin\">\n\n <span class=\"bizy-menu__content\">\n <ng-content></ng-content>\n </span>\n \n <svg \n class=\"bizy-menu__arrow\"\n *ngIf=\"!hideArrow\" \n viewBox=\"0 0 96 96\" \n [ngClass]=\"{'bizy-menu__arrow--opened': opened}\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M81.8457,25.3876a6.0239,6.0239,0,0,0-8.45.7676L48,56.6257l-25.396-30.47a5.999,5.999,0,1,0-9.2114,7.6879L43.3943,69.8452a5.9969,5.9969,0,0,0,9.2114,0L82.6074,33.8431A6.0076,6.0076,0,0,0,81.8457,25.3876Z\"/>\n </svg>\n</button>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOffsetX]=\"offsetX\"\n [cdkConnectedOverlayOffsetY]=\"offsetY\"\n [cdkConnectedOverlayMinWidth]=\"_menuWidth\"\n [cdkConnectedOverlayOrigin]=\"bizyMenuTrigger\"\n (overlayOutsideClick)=\"close($event)\"\n [cdkConnectedOverlayPush]=\"true\"\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\n [cdkConnectedOverlayViewportMargin]=\"8\"\n [cdkConnectedOverlayOpen]=\"opened\">\n\n <span class=\"bizy-menu__options\" [id]=\"bizyMenuOptionsId\">\n\n <span class=\"bizy-menu__options__header\">\n <ng-content select=\"bizy-menu-title\"></ng-content>\n <ng-content select=\"bizy-input\"></ng-content>\n </span>\n\n <ng-content select=\"bizy-menu-option\"></ng-content>\n\n </span>\n\n</ng-template>\n", styles: [":host{font-size:1rem}:host:has(>.bizy-menu__options:empty) .bizy-menu>.bizy-menu__arrow{display:none!important}.bizy-menu{font-size:1rem;width:100%;border:none;background-color:transparent;display:flex;align-items:center;justify-content:space-between;column-gap:.5rem;padding:var(--bizy-menu-padding);color:var(--bizy-menu-color);cursor:pointer}.bizy-menu--disabled{pointer-events:none;opacity:.5;cursor:not-allowed!important}.bizy-menu__arrow{height:var(--bizy-menu-arrow-height);pointer-events:none;display:block;transition:transform .2s ease;fill:var(--bizy-menu-color)}.bizy-menu__arrow--opened{transform:rotate(180deg)}.bizy-menu__content{font-size:1rem;display:flex;align-items:center;column-gap:.3rem;pointer-events:none}.bizy-menu__options{background-color:var(--bizy-menu-background-color);min-width:var(--bizy-menu-min-width);max-width:var(--bizy-menu-max-width);max-height:var(--bizy-menu-max-height);overflow-y:auto;overflow-x:hidden;width:100%;display:flex;flex-direction:column;position:relative;box-shadow:0 7px 14px #32325d1a,0 3px 6px #00000014}.bizy-menu__options::-webkit-scrollbar{width:.5rem;height:.5rem}.bizy-menu__options::-webkit-scrollbar-thumb{border-radius:1rem;background-color:var(--bizy-menu-scroll-bar-color)}.bizy-menu__options::-webkit-scrollbar-thumb:hover{background-color:var(--bizy-menu-scroll-bar-hover-color)}.bizy-menu__options::-webkit-scrollbar-button{height:1rem}.bizy-menu__options__header{position:sticky;z-index:1;top:0;display:flex;flex-direction:column;row-gap:.3rem;background-color:#fff}::ng-deep .bizy-menu__options__header{--bizy-input-width: auto;--bizy-input-background-color: #fff;--bizy-input-min-width: var(--bizy-select-min-width);--bizy-input-max-width: auto}\n"] }]
4470
- }], propDecorators: { options: [{
4471
- type: ContentChildren,
4472
- args: [BizyMenuOptionComponent]
4473
- }], id: [{
4474
- type: Input
4475
- }], disabled: [{
4476
- type: Input
4477
- }], offsetX: [{
4478
- type: Input
4479
- }], offsetY: [{
4480
- type: Input
4481
- }], customClass: [{
4482
- type: Input
4483
- }], hideArrow: [{
4484
- type: Input
4485
- }], opened: [{
4486
- type: Input
4487
- }], onSelect: [{
4488
- type: Output
4489
- }] } });
4490
-
4491
- class BizyMenuTitleComponent {
4492
- customClass = '';
4493
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4494
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyMenuTitleComponent, isStandalone: true, selector: "bizy-menu-title", inputs: { customClass: "customClass" }, ngImport: i0, template: "<span class=\"bizy-menu-title {{customClass}}\">\n <ng-content></ng-content>\n</span>\n", styles: [":host{font-size:1rem}.bizy-menu-title{background-color:var(--bizy-menu-title-background-color);color:var(--bizy-menu-title-color);padding:.5rem;cursor:default;text-decoration:underline .1rem var(--bizy-menu-title-underline-color);text-underline-offset:.3rem;display:flex;align-items:center}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4495
- }
4496
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuTitleComponent, decorators: [{
4497
- type: Component,
4498
- args: [{ selector: 'bizy-menu-title', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span class=\"bizy-menu-title {{customClass}}\">\n <ng-content></ng-content>\n</span>\n", styles: [":host{font-size:1rem}.bizy-menu-title{background-color:var(--bizy-menu-title-background-color);color:var(--bizy-menu-title-color);padding:.5rem;cursor:default;text-decoration:underline .1rem var(--bizy-menu-title-underline-color);text-underline-offset:.3rem;display:flex;align-items:center}\n"] }]
4499
- }], propDecorators: { customClass: [{
4500
- type: Input
4501
- }] } });
4502
-
4503
- const COMPONENTS$d = [
4504
- BizyMenuComponent,
4505
- BizyMenuOptionComponent,
4506
- BizyMenuTitleComponent
4507
- ];
4508
- class BizyMenuModule {
4509
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4510
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuModule, imports: [BizyMenuComponent,
4511
- BizyMenuOptionComponent,
4512
- BizyMenuTitleComponent], exports: [BizyMenuComponent,
4513
- BizyMenuOptionComponent,
4514
- BizyMenuTitleComponent] });
4515
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuModule, imports: [BizyMenuComponent,
4516
- BizyMenuOptionComponent] });
4082
+ removeAll() {
4083
+ const cacheKeys = Object.keys(sessionStorage).filter(key => {
4084
+ return key.includes(this.CACHE_PREFIX);
4085
+ });
4086
+ cacheKeys.forEach(value => {
4087
+ sessionStorage.removeItem(value);
4088
+ });
4089
+ }
4090
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCacheService, deps: [{ token: BizyRouterService }], target: i0.ɵɵFactoryTarget.Injectable });
4091
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCacheService, providedIn: 'root' });
4517
4092
  }
4518
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyMenuModule, decorators: [{
4519
- type: NgModule,
4093
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCacheService, decorators: [{
4094
+ type: Injectable,
4520
4095
  args: [{
4521
- imports: COMPONENTS$d,
4522
- exports: COMPONENTS$d,
4096
+ providedIn: 'root'
4523
4097
  }]
4524
- }] });
4098
+ }], ctorParameters: () => [{ type: BizyRouterService, decorators: [{
4099
+ type: Inject,
4100
+ args: [BizyRouterService]
4101
+ }] }] });
4525
4102
 
4526
- const EMPTY_CHART = [0];
4527
- const MIN_CHART_SIZE = 350; // px;
4528
- class BizyPieChartComponent {
4529
- elementRef;
4530
- document;
4531
- ref;
4532
- renderer;
4533
- resizeRef = null;
4534
- tooltip = true;
4535
- type = 'pie';
4536
- download = { hide: false, label: 'Descargar', name: 'Bizy' };
4537
- onLabelFormatter;
4538
- onTooltipFormatter;
4539
- onSelect = new EventEmitter();
4540
- onDownload = new EventEmitter();
4541
- #echarts = null;
4542
- #mutationObserver = null;
4543
- #resizeObserver = null;
4544
- #subscription = new Subscription();
4545
- #chartContainer = null;
4546
- #afterViewInit = new BehaviorSubject(false);
4547
- #resize$ = new Subject();
4548
- #data = EMPTY_CHART;
4549
- constructor(elementRef, document, ref, renderer) {
4550
- this.elementRef = elementRef;
4551
- this.document = document;
4552
- this.ref = ref;
4553
- this.renderer = renderer;
4103
+ class BizyValidatorService {
4104
+ isEmail = (value) => validator.isEmail(value, { allow_utf8_local_part: false });
4105
+ dateIsAfter = (data) => {
4106
+ if (!data || !data.date || !data.comparisonDate) {
4107
+ return false;
4108
+ }
4109
+ const date = new Date(data.date);
4110
+ const comparisonDate = new Date(data.comparisonDate);
4111
+ return validator.isAfter(date.toString(), comparisonDate.toString());
4112
+ };
4113
+ dateIsBefore = (data) => {
4114
+ if (!data || !data.date || !data.comparisonDate) {
4115
+ return false;
4116
+ }
4117
+ const date = new Date(data.date);
4118
+ const comparisonDate = new Date(data.comparisonDate);
4119
+ return validator.isBefore(date.toString(), comparisonDate.toString());
4120
+ };
4121
+ isAlpha = (value) => validator.isAlpha(value);
4122
+ isAlphanumeric = (value) => validator.isAlphanumeric(value);
4123
+ isNumeric = (value) => validator.isNumeric(value);
4124
+ isNumber(number) {
4125
+ const regex = /^-?\d+(\.\d+)?$/;
4126
+ return regex.test(String(number).toLowerCase());
4554
4127
  }
4555
- ngAfterViewInit() {
4556
- this.#mutationObserver = new MutationObserver(() => {
4557
- if (this.elementRef && this.elementRef.nativeElement && (this.elementRef.nativeElement.offsetWidth || this.elementRef.nativeElement.offsetHeight)) {
4558
- this.#afterViewInit.next(true);
4559
- this.#mutationObserver.disconnect();
4560
- }
4561
- });
4562
- this.#mutationObserver.observe(this.document.body, { childList: true, subtree: true });
4128
+ isString(string) {
4129
+ return typeof string === 'string' || string instanceof String;
4563
4130
  }
4564
- set data(data) {
4565
- if (!data) {
4566
- return;
4567
- }
4568
- if (data.length > 0) {
4569
- this.#setChartData(data);
4131
+ isInteger = (value) => validator.isInt(value);
4132
+ isBoolean = (value) => validator.isBoolean(value);
4133
+ isCreditCard = (value) => validator.isCreditCard(value);
4134
+ isDataURI = (value) => validator.isDataURI(value);
4135
+ isURL = (value) => validator.isURL(value);
4136
+ isDate = (value) => validator.isDate(value);
4137
+ isJSON = (value) => validator.isJSON(value);
4138
+ isIP = (value, version) => validator.isIP(value, { version });
4139
+ isJWT = (value) => validator.isJWT(value);
4140
+ isLowercase = (value) => validator.isLowercase(value);
4141
+ isUppercase = (value) => validator.isUppercase(value);
4142
+ isMobilePhone = (data) => validator.isMobilePhone(data.value, data.locale);
4143
+ isCUIT(cuit) {
4144
+ const regex = /(^[0-9]{2}-[0-9]{8}-[0-9]$)/i;
4145
+ const isCUIT = regex.test(String(cuit).toLowerCase());
4146
+ if (!isCUIT) {
4147
+ return false;
4570
4148
  }
4571
- else {
4572
- this.#deleteChartContainer();
4573
- this.#setChartData(EMPTY_CHART);
4149
+ cuit = String(cuit).replace(/[-_]/g, '');
4150
+ if (cuit.length == 11) {
4151
+ const mult = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2];
4152
+ let total = 0;
4153
+ for (let i = 0; i < mult.length; i++) {
4154
+ total += parseInt(cuit[i]) * mult[i];
4155
+ }
4156
+ const mod = total % 11;
4157
+ const digit = mod === 0 ? 0 : mod === 1 ? 9 : 11 - mod;
4158
+ return digit === parseInt(cuit[10]);
4574
4159
  }
4160
+ return false;
4575
4161
  }
4576
- async #setChartData(data) {
4577
- this.#subscription.add(this.#afterViewInit.pipe(filter(value => value === true), take(1)).subscribe(() => {
4578
- this.#createChartContainer();
4579
- if (!this.#chartContainer) {
4580
- return;
4581
- }
4582
- if (data && data.length > 0 && data[0] !== 0) {
4583
- this.#data = [];
4584
- data.forEach(_d => {
4585
- if (!_d.value) {
4586
- _d.value = 0;
4587
- }
4588
- if (!_d.name) {
4589
- _d.name = '---';
4590
- }
4591
- const itemStyle = _d.color ? { color: _d.color } : {};
4592
- this.#data.push({
4593
- name: _d.name,
4594
- value: _d.value,
4595
- itemStyle
4596
- });
4597
- });
4162
+ isDNI(dni) {
4163
+ const regex = /(^[1-9]{1}[0-9]{7}$)/i;
4164
+ return regex.test(String(dni).toLowerCase());
4165
+ }
4166
+ isCBU(cbu) {
4167
+ const _isLengthOk = (cbu) => {
4168
+ return cbu.length === 22;
4169
+ };
4170
+ const _isValidAccount = (account) => {
4171
+ if (account.length !== 14) {
4172
+ return false;
4598
4173
  }
4599
- else {
4600
- this.#data = EMPTY_CHART;
4174
+ const sum = Number(account[0]) * 3 +
4175
+ Number(account[1]) * 9 +
4176
+ Number(account[2]) * 7 +
4177
+ Number(account[3]) * 1 +
4178
+ Number(account[4]) * 3 +
4179
+ Number(account[5]) * 9 +
4180
+ Number(account[6]) * 7 +
4181
+ Number(account[7]) * 1 +
4182
+ Number(account[8]) * 3 +
4183
+ Number(account[9]) * 9 +
4184
+ Number(account[10]) * 7 +
4185
+ Number(account[11]) * 1 +
4186
+ Number(account[12]) * 3;
4187
+ const diff = (10 - (sum % 10)) % 10; // The result of this should be only 1 digit
4188
+ const checksum = Number(account[13]);
4189
+ return diff === checksum;
4190
+ };
4191
+ const _isValidBankCode = (code) => {
4192
+ if (code.length !== 8) {
4193
+ return false;
4601
4194
  }
4602
- const itemStyle = this.type === 'pie' ? {
4603
- emphasis: {
4604
- label: {
4605
- show: true
4606
- }
4607
- },
4608
- normal: {
4609
- label: {
4610
- position: 'outer',
4611
- formatter: this.onLabelFormatter
4612
- },
4613
- labelLine: {
4614
- show: true
4615
- }
4616
- }
4617
- } :
4618
- {
4619
- borderRadius: 10,
4620
- borderColor: '#fff',
4621
- borderWidth: 2
4622
- };
4623
- const label = this.type === 'pie' ? undefined : { show: false, position: 'center' };
4624
- const series = [{
4625
- type: 'pie',
4626
- radius: this.type === 'pie' ? '50%' : ['40%', '55%'],
4627
- center: ['50%', '50%'],
4628
- data: this.#data,
4629
- itemStyle,
4630
- label
4631
- }];
4632
- const textColor = getComputedStyle(this.document.documentElement).getPropertyValue('--bizy-tooltip-color') ?? '#000';
4633
- const textBackgroundColor = getComputedStyle(this.document.documentElement).getPropertyValue('--bizy-tooltip-background-color') ?? '#fff';
4634
- const borderColor = getComputedStyle(this.document.documentElement).getPropertyValue('--bizy-tooltip-border-color') ?? '#fff';
4635
- const toolbox = {
4636
- show: true,
4637
- feature: {
4638
- mySaveAsImage: {
4639
- show: !this.download.hide,
4640
- icon: 'path://M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z',
4641
- title: this.download.label,
4642
- onclick: () => {
4643
- setTimeout(() => {
4644
- html2canvas(this.#chartContainer).then(canvas => {
4645
- var link = document.createElement('a');
4646
- link.href = canvas.toDataURL('image/png');
4647
- link.download = `${this.download.name}.png`;
4648
- this.renderer.appendChild(this.document.body, link);
4649
- link.click();
4650
- this.renderer.removeChild(this.document.body, link);
4651
- this.onDownload.emit();
4652
- });
4653
- }, 500);
4654
- }
4655
- }
4656
- },
4657
- emphasis: {
4658
- iconStyle: {
4659
- color: textColor,
4660
- borderColor,
4661
- borderWidth: 1,
4662
- textBackgroundColor,
4663
- textPadding: 5,
4664
- }
4665
- }
4666
- };
4667
- const tooltip = {
4668
- show: this.tooltip,
4669
- trigger: 'item',
4670
- appendToBody: true,
4671
- formatter: this.onTooltipFormatter
4672
- };
4673
- const legend = this.type === 'pie' ? { show: false } : { show: true, orient: 'vertical', left: 'left' };
4674
- const option = {
4675
- tooltip,
4676
- toolbox,
4677
- legend,
4678
- series
4679
- };
4680
- this.#echarts = echarts.init(this.#chartContainer);
4681
- this.#echarts.setOption(option);
4682
- this.#echarts.on('click', params => {
4683
- this.onSelect.emit(params.name);
4684
- });
4685
- this.#resizeObserver = new ResizeObserver(() => this.#resize$.next());
4686
- const resizeRef = this.resizeRef ? this.resizeRef : this.renderer.parentNode(this.elementRef.nativeElement) ? this.renderer.parentNode(this.elementRef.nativeElement) : this.elementRef.nativeElement;
4687
- this.#resizeObserver.observe(resizeRef);
4688
- this.#subscription.add(this.#resize$.pipe(skip(1), auditTime(300), throttleTime(500)).subscribe(() => {
4689
- this.#deleteChartContainer();
4690
- this.#createChartContainer();
4691
- if (!this.#chartContainer) {
4195
+ const bank = code.substring(0, 3);
4196
+ const checksumOne = code[3];
4197
+ const branch = code.substring(4, 4 + 3);
4198
+ const checksumTwo = code[7];
4199
+ const sum = (Number(bank[0]) * 7) +
4200
+ (Number(bank[1]) * 1) +
4201
+ (Number(bank[2]) * 3) +
4202
+ (Number(checksumOne) * 9) +
4203
+ (Number(branch[0]) * 7) +
4204
+ (Number(branch[1]) * 1) +
4205
+ (Number(branch[2]) * 3);
4206
+ const diff = (10 - (sum % 10)) % 10; // The result of this should be only 1 digit
4207
+ return diff === Number(checksumTwo);
4208
+ };
4209
+ const bankCode = cbu.substring(0, 8);
4210
+ const accountCode = cbu.substring(8, 8 + 14);
4211
+ return (_isLengthOk(cbu) &&
4212
+ _isValidBankCode(bankCode) &&
4213
+ _isValidAccount(accountCode));
4214
+ }
4215
+ emailValidator() {
4216
+ return (control) => {
4217
+ return !control.value || (control.value && this.isEmail(control.value))
4218
+ ? null
4219
+ : { bizyEmail: true };
4220
+ };
4221
+ }
4222
+ mobilePhoneValidator(locale) {
4223
+ return (control) => {
4224
+ return !control.value || !locale ||
4225
+ (control.value && locale && this.isMobilePhone({ value: control.value, locale }))
4226
+ ? null
4227
+ : { bizyMobilePhone: true };
4228
+ };
4229
+ }
4230
+ numberValidator() {
4231
+ return (control) => {
4232
+ return !control.value || (control.value && this.isNumber(control.value))
4233
+ ? null
4234
+ : { bizyNumber: true };
4235
+ };
4236
+ }
4237
+ numericValidator() {
4238
+ return (control) => {
4239
+ return !control.value || (control.value && this.isNumeric(control.value))
4240
+ ? null
4241
+ : { bizyNumeric: true };
4242
+ };
4243
+ }
4244
+ dateIsAfterValidator(comparisonDate) {
4245
+ return (control) => {
4246
+ return !control.value || !comparisonDate || (control.value && comparisonDate && !this.dateIsAfter({ date: control.value, comparisonDate }))
4247
+ ? null
4248
+ : { bizyDateIsAfter: true };
4249
+ };
4250
+ }
4251
+ dateIsBeforeValidator(comparisonDate) {
4252
+ return (control) => {
4253
+ return !control.value || !comparisonDate || (control.value && comparisonDate && !this.dateIsBefore({ date: control.value, comparisonDate }))
4254
+ ? null
4255
+ : { bizyDateIsBefore: true };
4256
+ };
4257
+ }
4258
+ alphaValidator() {
4259
+ return (control) => {
4260
+ return !control.value || (control.value && this.isAlpha(control.value))
4261
+ ? null
4262
+ : { bizyAlpha: true };
4263
+ };
4264
+ }
4265
+ alphanumericValidator() {
4266
+ return (control) => {
4267
+ return !control.value || (control.value && this.isAlphanumeric(control.value))
4268
+ ? null
4269
+ : { bizyAlphanumeric: true };
4270
+ };
4271
+ }
4272
+ integerValidator() {
4273
+ return (control) => {
4274
+ return !control.value || (control.value && this.isInteger(control.value))
4275
+ ? null
4276
+ : { bizyInteger: true };
4277
+ };
4278
+ }
4279
+ dataURIValidator() {
4280
+ return (control) => {
4281
+ return !control.value || (control.value && this.isDataURI(control.value))
4282
+ ? null
4283
+ : { bizyDataURI: true };
4284
+ };
4285
+ }
4286
+ urlValidator() {
4287
+ return (control) => {
4288
+ return !control.value || (control.value && this.isURL(control.value))
4289
+ ? null
4290
+ : { bizyURL: true };
4291
+ };
4292
+ }
4293
+ jsonValidator() {
4294
+ return (control) => {
4295
+ return !control.value || (control.value && this.isJSON(control.value))
4296
+ ? null
4297
+ : { bizyJSON: true };
4298
+ };
4299
+ }
4300
+ jwtValidator() {
4301
+ return (control) => {
4302
+ return !control.value || (control.value && this.isJWT(control.value))
4303
+ ? null
4304
+ : { bizyJWT: true };
4305
+ };
4306
+ }
4307
+ lowerCaseValidator() {
4308
+ return (control) => {
4309
+ return !control.value || (control.value && this.isLowercase(control.value))
4310
+ ? null
4311
+ : { bizyLowerCase: true };
4312
+ };
4313
+ }
4314
+ upperCaseValidator() {
4315
+ return (control) => {
4316
+ return !control.value || (control.value && this.isUppercase(control.value))
4317
+ ? null
4318
+ : { bizyUpperCase: true };
4319
+ };
4320
+ }
4321
+ cuitValidator() {
4322
+ return (control) => {
4323
+ return !control.value || (control.value && this.isCUIT(control.value))
4324
+ ? null
4325
+ : { bizyCUIT: true };
4326
+ };
4327
+ }
4328
+ dniValidator() {
4329
+ return (control) => {
4330
+ return !control.value || (control.value && this.isDNI(control.value))
4331
+ ? null
4332
+ : { bizyDNI: true };
4333
+ };
4334
+ }
4335
+ cbuValidator() {
4336
+ return (control) => {
4337
+ return !control.value || (control.value && this.isCBU(control.value))
4338
+ ? null
4339
+ : { bizyCBU: true };
4340
+ };
4341
+ }
4342
+ creditCardValidator() {
4343
+ return (control) => {
4344
+ return !control.value || (control.value && this.isCreditCard(control.value))
4345
+ ? null
4346
+ : { bizyCreditCard: true };
4347
+ };
4348
+ }
4349
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyValidatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4350
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyValidatorService, providedIn: 'root' });
4351
+ }
4352
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyValidatorService, decorators: [{
4353
+ type: Injectable,
4354
+ args: [{
4355
+ providedIn: 'root'
4356
+ }]
4357
+ }] });
4358
+
4359
+ class BizyStorageService {
4360
+ get(key) {
4361
+ const item = localStorage.getItem(key);
4362
+ try {
4363
+ return JSON.parse(item);
4364
+ }
4365
+ catch (e) {
4366
+ return item;
4367
+ }
4368
+ }
4369
+ set(key, value) {
4370
+ if (typeof value === 'object') {
4371
+ localStorage.setItem(key, JSON.stringify(value));
4372
+ }
4373
+ else if (typeof value === 'string') {
4374
+ localStorage.setItem(key, value);
4375
+ }
4376
+ else {
4377
+ localStorage.setItem(key, String(value));
4378
+ }
4379
+ }
4380
+ remove(key) {
4381
+ localStorage.removeItem(key);
4382
+ }
4383
+ clear() {
4384
+ localStorage.clear();
4385
+ }
4386
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4387
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyStorageService, providedIn: 'root' });
4388
+ }
4389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyStorageService, decorators: [{
4390
+ type: Injectable,
4391
+ args: [{
4392
+ providedIn: 'root'
4393
+ }]
4394
+ }] });
4395
+
4396
+ var COLOR;
4397
+ (function (COLOR) {
4398
+ COLOR["DEFAULT"] = "#666666";
4399
+ COLOR["INFO"] = "#2484C6";
4400
+ COLOR["SUCCESS"] = "#65BF6C";
4401
+ COLOR["WARNING"] = "#F7A64C";
4402
+ COLOR["ERROR"] = "#EF4C59";
4403
+ })(COLOR || (COLOR = {}));
4404
+ class BizyLogService {
4405
+ #lastLogTimestamp = 0;
4406
+ #log(log, color, param) {
4407
+ const difference = this.#lastLogTimestamp ? Date.now() - this.#lastLogTimestamp : 0;
4408
+ this.#lastLogTimestamp = Date.now();
4409
+ const timestampStyles = 'color: #EE5DFF';
4410
+ const logStyles = `color: ${color}; font-size: 12px;`;
4411
+ const date = new Date();
4412
+ if (param) {
4413
+ console.log(`%c${date.toLocaleString()}: %c${log} %c(+${difference}ms)`, timestampStyles, logStyles, timestampStyles, param);
4414
+ }
4415
+ else {
4416
+ console.log(`%c${date.toLocaleString()}: %c${log} %c(+${difference}ms)`, timestampStyles, logStyles, timestampStyles);
4417
+ }
4418
+ }
4419
+ debug(data, param) {
4420
+ if (typeof data === 'string') {
4421
+ this.#log(data, COLOR.DEFAULT, param);
4422
+ }
4423
+ else {
4424
+ this.#template({ ...data, param: data.param, title: 'Debug', color: COLOR.DEFAULT });
4425
+ }
4426
+ }
4427
+ info(data, param) {
4428
+ if (typeof data === 'string') {
4429
+ this.#log(data, COLOR.INFO, param);
4430
+ }
4431
+ else {
4432
+ this.#template({ ...data, param: data.param, title: 'Info', color: COLOR.INFO });
4433
+ }
4434
+ }
4435
+ success(data, param) {
4436
+ if (typeof data === 'string') {
4437
+ this.#log(data, COLOR.SUCCESS, param);
4438
+ }
4439
+ else {
4440
+ this.#template({ ...data, param: data.param, title: 'Success', color: COLOR.SUCCESS });
4441
+ }
4442
+ }
4443
+ warning(data, param) {
4444
+ if (typeof data === 'string') {
4445
+ this.#log(data, COLOR.WARNING, param);
4446
+ }
4447
+ else {
4448
+ this.#template({ ...data, param: data.param, title: 'Warning', color: COLOR.WARNING });
4449
+ }
4450
+ }
4451
+ error(data, param) {
4452
+ if (typeof data === 'string') {
4453
+ this.#log(data, COLOR.ERROR, param);
4454
+ }
4455
+ else {
4456
+ this.#template({ ...data, param: data.param, title: 'Error', color: COLOR.ERROR });
4457
+ }
4458
+ }
4459
+ /** DEPRECATED */
4460
+ templateDebug(data) {
4461
+ this.#template({ ...data, title: 'Debug', color: COLOR.DEFAULT });
4462
+ }
4463
+ /** DEPRECATED */
4464
+ templateSucc(data) {
4465
+ this.#template({ ...data, title: 'Success', color: COLOR.SUCCESS });
4466
+ }
4467
+ /** DEPRECATED */
4468
+ templateInfo(data) {
4469
+ this.#template({ ...data, title: 'Info', color: COLOR.INFO });
4470
+ }
4471
+ /** DEPRECATED */
4472
+ templateWarn(data) {
4473
+ this.#template({ ...data, title: 'Warning', color: COLOR.WARNING });
4474
+ }
4475
+ /** DEPRECATED */
4476
+ templateError(data) {
4477
+ this.#template({ ...data, title: 'Error', color: COLOR.ERROR });
4478
+ }
4479
+ #template(data) {
4480
+ const log = `(${data.title}) ${data.fileName} - ${data.functionName}`;
4481
+ this.#log(log, data.color, data.param);
4482
+ }
4483
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyLogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4484
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyLogService, providedIn: 'root' });
4485
+ }
4486
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyLogService, decorators: [{
4487
+ type: Injectable,
4488
+ args: [{
4489
+ providedIn: 'root'
4490
+ }]
4491
+ }] });
4492
+
4493
+ class BizyCopyToClipboardService {
4494
+ #clipboard = inject(Clipboard);
4495
+ copy(data) {
4496
+ return new Promise((resolve, reject) => {
4497
+ try {
4498
+ if (!data) {
4499
+ resolve();
4692
4500
  return;
4693
4501
  }
4694
- this.#echarts = echarts.init(this.#chartContainer);
4695
- this.#echarts.setOption({ ...option, series: option.series.map(_serie => { return { ..._serie, data: this.#data }; }) });
4696
- this.#echarts.on('click', params => {
4697
- this.onSelect.emit(params.name);
4698
- });
4699
- }));
4700
- }));
4502
+ setTimeout(() => {
4503
+ let toCopy = '';
4504
+ if (typeof data === 'string' || data instanceof String) {
4505
+ toCopy = data;
4506
+ }
4507
+ else if (data.items && data.items.length > 0 && data.model) {
4508
+ for (const key in data.model) {
4509
+ if (key) {
4510
+ toCopy += `${data.model[key]},`;
4511
+ }
4512
+ }
4513
+ data.items.forEach(_item => {
4514
+ // Remove the last character (',')
4515
+ toCopy = toCopy.slice(0, -2);
4516
+ toCopy += '\n';
4517
+ for (const key in data.model) {
4518
+ let value = _item;
4519
+ const nestedProperty = key.split('.');
4520
+ nestedProperty.forEach(_property => {
4521
+ value = value[_property];
4522
+ });
4523
+ if (typeof value !== undefined && value !== null) {
4524
+ toCopy += `${String(value).replace(/\n/g, '')},`;
4525
+ }
4526
+ else {
4527
+ toCopy += ',';
4528
+ }
4529
+ }
4530
+ });
4531
+ }
4532
+ const pending = this.#clipboard.beginCopy(toCopy);
4533
+ let remainingAttempts = 3;
4534
+ const attempt = () => {
4535
+ const result = pending.copy();
4536
+ if (!result && --remainingAttempts) {
4537
+ setTimeout(attempt);
4538
+ }
4539
+ else {
4540
+ // Remember to destroy when you're done!
4541
+ pending.destroy();
4542
+ resolve();
4543
+ }
4544
+ };
4545
+ attempt();
4546
+ }, 100);
4547
+ }
4548
+ catch (error) {
4549
+ reject(error);
4550
+ }
4551
+ });
4701
4552
  }
4702
- #createChartContainer = () => {
4703
- if (this.#chartContainer || !this.elementRef || !this.elementRef.nativeElement) {
4704
- return;
4553
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCopyToClipboardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4554
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCopyToClipboardService, providedIn: 'root' });
4555
+ }
4556
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyCopyToClipboardService, decorators: [{
4557
+ type: Injectable,
4558
+ args: [{
4559
+ providedIn: 'root'
4560
+ }]
4561
+ }] });
4562
+
4563
+ var BIZY_FORMAT_SECONDS_LANGUAGE;
4564
+ (function (BIZY_FORMAT_SECONDS_LANGUAGE) {
4565
+ BIZY_FORMAT_SECONDS_LANGUAGE["SPANISH"] = "es";
4566
+ BIZY_FORMAT_SECONDS_LANGUAGE["ENGLISH"] = "en";
4567
+ })(BIZY_FORMAT_SECONDS_LANGUAGE || (BIZY_FORMAT_SECONDS_LANGUAGE = {}));
4568
+ var BIZY_FORMAT_SECONDS_FORMAT;
4569
+ (function (BIZY_FORMAT_SECONDS_FORMAT) {
4570
+ BIZY_FORMAT_SECONDS_FORMAT["DATE_TIME"] = "date-time";
4571
+ BIZY_FORMAT_SECONDS_FORMAT["TIME"] = "time";
4572
+ })(BIZY_FORMAT_SECONDS_FORMAT || (BIZY_FORMAT_SECONDS_FORMAT = {}));
4573
+ class BizyFormatSecondsService {
4574
+ #options = {
4575
+ language: BIZY_FORMAT_SECONDS_LANGUAGE.SPANISH,
4576
+ format: BIZY_FORMAT_SECONDS_FORMAT.TIME
4577
+ };
4578
+ getOptions() {
4579
+ return this.#options;
4580
+ }
4581
+ setOptions(options) {
4582
+ if (options && options.language) {
4583
+ this.#options.language = options.language;
4705
4584
  }
4706
- let elementWidth = this.elementRef.nativeElement.offsetWidth || MIN_CHART_SIZE;
4707
- let elementHeight = this.elementRef.nativeElement.offsetHeight || MIN_CHART_SIZE;
4708
- let minWidth = MIN_CHART_SIZE;
4709
- let minHeight = MIN_CHART_SIZE;
4710
- const chartMinWidth = getComputedStyle(this.document.body).getPropertyValue('--bizy-chart-min-width');
4711
- const pieChartMinHeight = getComputedStyle(this.document.body).getPropertyValue('--bizy-chart-min-height');
4712
- if (Number(chartMinWidth)) {
4713
- minWidth = Number(chartMinWidth);
4585
+ if (options && options.format) {
4586
+ this.#options.format = options.format;
4714
4587
  }
4715
- if (Number(pieChartMinHeight)) {
4716
- minHeight = Number(pieChartMinHeight);
4588
+ }
4589
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormatSecondsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4590
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormatSecondsService, providedIn: 'root' });
4591
+ }
4592
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyFormatSecondsService, decorators: [{
4593
+ type: Injectable,
4594
+ args: [{
4595
+ providedIn: 'root'
4596
+ }]
4597
+ }] });
4598
+
4599
+ /**
4600
+ * Copyright 2020 Google LLC
4601
+ *
4602
+ * Licensed under the Apache License, Version 2.0 (the 'License');
4603
+ * you may not use this file except in compliance with the License.
4604
+ * You may obtain a copy of the License at
4605
+ *
4606
+ * http://www.apache.org/licenses/LICENSE-2.0
4607
+ *
4608
+ * Unless required by applicable law or agreed to in writing, software
4609
+ * distributed under the License is distributed on an 'AS IS' BASIS,
4610
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4611
+ * See the License for the specific language governing permissions and
4612
+ * limitations under the License.
4613
+ */
4614
+ // This function's role is to enable smooth transition to the brave new world of
4615
+ // User-Agent Client Hints. If you have legacy code that relies on
4616
+ // `navigator.userAgent` and which relies on entropy that will go away by
4617
+ // default, you *need* to refactor it to use UA-CH. This function is to be used
4618
+ // as a stop gap, to enable smooth transition during that period.
4619
+ /**
4620
+ * @param {string[]} hints
4621
+ * @return {Promise<string|undefined>} A Promise that resolves to a string if a
4622
+ * UA could be synthesized from client hints, otherwise undefined.
4623
+ */
4624
+ async function getUserAgentUsingClientHints(hints) {
4625
+ // Helper functions for platform specific strings
4626
+ const GetCrosSpecificString = (values) => {
4627
+ let osCPUFragment = '';
4628
+ if (values.bitness == '64') {
4629
+ if (values.architecture == 'x86') {
4630
+ osCPUFragment = 'x86_64';
4631
+ }
4632
+ else if (values.architecture == 'arm') {
4633
+ osCPUFragment = 'aarch64';
4634
+ }
4717
4635
  }
4718
- const width = Math.max(elementWidth, minWidth);
4719
- const height = Math.max(elementHeight, minHeight);
4720
- this.#chartContainer = this.renderer.createElement('div');
4721
- this.renderer.setStyle(this.#chartContainer, 'width', `${width}px`);
4722
- this.renderer.setStyle(this.#chartContainer, 'height', `${height}px`);
4723
- this.renderer.appendChild(this.elementRef.nativeElement, this.#chartContainer);
4724
- this.ref.detectChanges();
4636
+ else if (values.architecture == 'arm' && values.bitness == '32') {
4637
+ osCPUFragment = 'armv7l';
4638
+ }
4639
+ if (osCPUFragment == '') {
4640
+ return `X11; CrOS ${values.platformVersion}`;
4641
+ }
4642
+ return `X11; CrOS ${osCPUFragment} ${values.platformVersion}`;
4725
4643
  };
4726
- #deleteChartContainer = () => {
4727
- if (!this.#chartContainer || !this.elementRef || !this.elementRef.nativeElement) {
4728
- return;
4644
+ const GetWindowsSpecificString = (values) => {
4645
+ let osCPUFragment = '';
4646
+ if (values.architecture == 'x86' && values.bitness == '64') {
4647
+ osCPUFragment = '; Win64; x64';
4648
+ }
4649
+ else if (values.architecture == 'arm') {
4650
+ osCPUFragment = '; ARM';
4651
+ }
4652
+ else if (values.wow64 === true) {
4653
+ osCPUFragment = '; WOW64';
4654
+ }
4655
+ return `Windows NT ${getWindowsPlatformVersion(values.platformVersion)}${osCPUFragment}`;
4656
+ };
4657
+ const GetMacSpecificString = (values) => {
4658
+ let newUA = 'Macintosh;';
4659
+ newUA += values.architecture === 'arm' ? ' ARM ' : ' Intel ';
4660
+ newUA += 'Mac OS X ';
4661
+ let macVersion = values.platformVersion;
4662
+ if (macVersion.indexOf('.') > -1) {
4663
+ macVersion = macVersion.split('.').join('_');
4664
+ }
4665
+ newUA += macVersion;
4666
+ return newUA;
4667
+ };
4668
+ const GetAndroidSpecificString = (values) => {
4669
+ let newUA = 'Linux; Android ';
4670
+ newUA += values.platformVersion;
4671
+ if (values.model) {
4672
+ newUA += '; ';
4673
+ newUA += values.model;
4674
+ }
4675
+ return newUA;
4676
+ };
4677
+ const Initialize = (values) => {
4678
+ if (!values.architecture) {
4679
+ values.architecture = 'x86';
4680
+ }
4681
+ if (!values.bitness) {
4682
+ values.bitness = '64';
4683
+ }
4684
+ if (!values.model) {
4685
+ values.model = '';
4686
+ }
4687
+ if (!values.platform) {
4688
+ values.platform = 'Windows';
4689
+ }
4690
+ if (!values.platformVersion) {
4691
+ values.platformVersion = '10.0';
4692
+ }
4693
+ if (!values.wow64) {
4694
+ values.wow64 = false;
4729
4695
  }
4730
- this.#echarts.clear();
4731
- this.renderer.removeChild(this.elementRef.nativeElement, this.#chartContainer);
4732
- this.#chartContainer = null;
4733
- this.ref.detectChanges();
4696
+ return values;
4734
4697
  };
4735
- ngOnDestroy() {
4736
- this.#subscription.unsubscribe();
4737
- if (this.#mutationObserver) {
4738
- this.#mutationObserver.disconnect();
4698
+ // @ts-ignore-error
4699
+ if (!navigator.userAgentData) {
4700
+ return Promise.resolve('');
4701
+ }
4702
+ // Verify that this is a Chromium-based browser
4703
+ let isChromium = false;
4704
+ let chromiumVersion;
4705
+ // eslint-disable-next-line prefer-regex-literals
4706
+ const isChromeUAPattern = new RegExp('AppleWebKit/537.36 \\(KHTML, like Gecko\\) Chrome/\\d+.\\d+.\\d+.\\d+ (Mobile )?Safari/537.36$');
4707
+ // @ts-ignore-error
4708
+ navigator.userAgentData.brands.forEach(value => {
4709
+ if (value.brand == 'Chromium') {
4710
+ // Let's double check the UA string as well, so we don't accidentally
4711
+ // capture a headless browser or friendly bot (which should report as
4712
+ // HeadlessChrome or something entirely different).
4713
+ isChromium = isChromeUAPattern.test(navigator.userAgent);
4714
+ chromiumVersion = value.version;
4739
4715
  }
4740
- if (this.#resizeObserver) {
4741
- this.#resizeObserver.disconnect();
4716
+ });
4717
+ // @ts-ignore
4718
+ if (!isChromium || chromiumVersion < 100) {
4719
+ // If this is not a Chromium-based browser, the UA string should be very
4720
+ // different. Or, if this is a Chromium lower than 100, it doesn't have
4721
+ // all the hints we rely on. So let's bail.
4722
+ return Promise.resolve('');
4723
+ }
4724
+ // Main logic
4725
+ return new Promise(resolve => {
4726
+ // @ts-ignore-error
4727
+ navigator.userAgentData.getHighEntropyValues(hints).then(values => {
4728
+ let initialValues = {
4729
+ // @ts-ignore-error
4730
+ platform: navigator.userAgentData?.platform,
4731
+ version: chromiumVersion
4732
+ };
4733
+ values = Object.assign(initialValues, values);
4734
+ values = Initialize(values);
4735
+ let newUA = 'Mozilla/5.0 (';
4736
+ if (['Chrome OS', 'Chromium OS'].includes(values.platform)) {
4737
+ newUA += GetCrosSpecificString(values);
4738
+ }
4739
+ else if (values.platform == 'Windows') {
4740
+ newUA += GetWindowsSpecificString(values);
4741
+ }
4742
+ else if (values.platform == 'macOS') {
4743
+ newUA += GetMacSpecificString(values);
4744
+ }
4745
+ else if (values.platform == 'Android') {
4746
+ newUA += GetAndroidSpecificString(values);
4747
+ }
4748
+ else {
4749
+ newUA += 'X11; Linux x86_64';
4750
+ }
4751
+ newUA += ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/';
4752
+ newUA += getVersion(values?.fullVersionList, initialValues.version);
4753
+ // @ts-ignore-error
4754
+ if (navigator.userAgentData.mobile) {
4755
+ newUA += ' Mobile';
4756
+ }
4757
+ newUA += ' Safari/537.36';
4758
+ resolve(newUA);
4759
+ });
4760
+ });
4761
+ }
4762
+ function getVersion(fullVersionList, majorVersion) {
4763
+ // If we don't get a fullVersionList, or it's somehow undefined, return
4764
+ // the reduced version number.
4765
+ return (fullVersionList?.find((item) => item.brand == 'Google Chrome')?.version ||
4766
+ `${majorVersion}.0.0.0`);
4767
+ }
4768
+ function getWindowsPlatformVersion(platformVersion) {
4769
+ // https://wicg.github.io/ua-client-hints/#get-the-legacy-windows-version-number
4770
+ const versionMap = new Map([
4771
+ ['0.3.0', '6.3'], // Windows 8.1
4772
+ ['0.2.0', '6.2'], // Windows 8
4773
+ ['0.1.0', '6.1'] // Windows 7
4774
+ ]);
4775
+ if (versionMap.has(platformVersion)) {
4776
+ return versionMap.get(platformVersion);
4777
+ }
4778
+ // Windows 10 and above send "Windows NT 10.0"
4779
+ return '10.0';
4780
+ }
4781
+ /**
4782
+ * @param {string[]} hints
4783
+ * @return {Promise<string|undefined>} A Promise that resolves on overriding the
4784
+ * navigator.userAgent string.
4785
+ */
4786
+ async function overrideUserAgentUsingClientHints(hints) {
4787
+ return new Promise(resolve => {
4788
+ getUserAgentUsingClientHints(hints).then(newUA => {
4789
+ if (newUA) {
4790
+ // Got a new UA value. Now override `navigator.userAgent`.
4791
+ Object.defineProperty(navigator, 'userAgent', {
4792
+ value: newUA,
4793
+ writable: false,
4794
+ configurable: true
4795
+ });
4796
+ }
4797
+ else {
4798
+ newUA = navigator.userAgent;
4799
+ }
4800
+ resolve(newUA);
4801
+ });
4802
+ });
4803
+ }
4804
+ const exportedForTests = { getVersion, getWindowsPlatformVersion };
4805
+
4806
+ class BizyDeviceService {
4807
+ #device = inject(DeviceDetectorService);
4808
+ async getUserAgent() {
4809
+ try {
4810
+ const userAgent = await overrideUserAgentUsingClientHints([
4811
+ 'architecture',
4812
+ 'bitness',
4813
+ 'model',
4814
+ 'platformVersion',
4815
+ 'uaFullVersion',
4816
+ 'fullVersionList'
4817
+ ]);
4818
+ return userAgent;
4742
4819
  }
4743
- if (this.#echarts) {
4744
- this.#echarts.clear();
4820
+ catch {
4821
+ return window.navigator.userAgent;
4745
4822
  }
4746
4823
  }
4747
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartComponent, deps: [{ token: ElementRef }, { token: DOCUMENT }, { token: ChangeDetectorRef }, { token: Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
4748
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyPieChartComponent, isStandalone: true, selector: "bizy-pie-chart", inputs: { resizeRef: "resizeRef", tooltip: "tooltip", type: "type", download: "download", onLabelFormatter: "onLabelFormatter", onTooltipFormatter: "onTooltipFormatter", data: "data" }, outputs: { onSelect: "onSelect", onDownload: "onDownload" }, ngImport: i0, template: '', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4824
+ isMobile = () => this.#device.isMobile();
4825
+ isTablet = () => this.#device.isTablet();
4826
+ isDesktop = () => this.#device.isDesktop();
4827
+ isPortrait = () => this.#device.orientation === 'portrait';
4828
+ isLandscape = () => this.#device.orientation === 'landscape';
4829
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyDeviceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4830
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyDeviceService, providedIn: 'root' });
4749
4831
  }
4750
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartComponent, decorators: [{
4751
- type: Component,
4752
- args: [{
4753
- selector: 'bizy-pie-chart',
4754
- template: '',
4755
- imports: [CommonModule],
4756
- changeDetection: ChangeDetectionStrategy.OnPush
4757
- }]
4758
- }], ctorParameters: () => [{ type: i0.ElementRef, decorators: [{
4759
- type: Inject,
4760
- args: [ElementRef]
4761
- }] }, { type: Document, decorators: [{
4762
- type: Inject,
4763
- args: [DOCUMENT]
4764
- }] }, { type: i0.ChangeDetectorRef, decorators: [{
4765
- type: Inject,
4766
- args: [ChangeDetectorRef]
4767
- }] }, { type: i0.Renderer2, decorators: [{
4768
- type: Inject,
4769
- args: [Renderer2]
4770
- }] }], propDecorators: { resizeRef: [{
4771
- type: Input
4772
- }], tooltip: [{
4773
- type: Input
4774
- }], type: [{
4775
- type: Input
4776
- }], download: [{
4777
- type: Input
4778
- }], onLabelFormatter: [{
4779
- type: Input
4780
- }], onTooltipFormatter: [{
4781
- type: Input
4782
- }], onSelect: [{
4783
- type: Output
4784
- }], onDownload: [{
4785
- type: Output
4786
- }], data: [{
4787
- type: Input
4788
- }] } });
4832
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyDeviceService, decorators: [{
4833
+ type: Injectable,
4834
+ args: [{ providedIn: 'root' }]
4835
+ }] });
4789
4836
 
4790
- const COMPONENTS$c = [
4791
- BizyPieChartComponent,
4837
+ const SERVICES = [
4838
+ BizyAnimationService,
4839
+ BizyDeviceService,
4840
+ BizyCacheService,
4841
+ BizyCopyToClipboardService,
4842
+ BizyExportToCSVService,
4843
+ BizyFormatSecondsService,
4844
+ BizyKeyboardService,
4845
+ BizyLogService,
4846
+ BizyRouterService,
4847
+ BizyStorageService,
4848
+ BizyValidatorService,
4849
+ BizyViewportService
4792
4850
  ];
4793
- class BizyPieChartModule {
4794
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4795
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartModule, imports: [BizyPieChartComponent], exports: [BizyPieChartComponent] });
4796
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartModule, imports: [COMPONENTS$c] });
4851
+ class BizyServicesModule {
4852
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyServicesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4853
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: BizyServicesModule });
4854
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyServicesModule, providers: SERVICES });
4797
4855
  }
4798
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPieChartModule, decorators: [{
4856
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyServicesModule, decorators: [{
4799
4857
  type: NgModule,
4800
4858
  args: [{
4801
- imports: COMPONENTS$c,
4802
- exports: COMPONENTS$c,
4859
+ providers: SERVICES
4803
4860
  }]
4804
4861
  }] });
4805
4862
 
4806
- class BizyPopupWrapperComponent {
4807
- dynamicComponentContainer;
4808
- #data = inject(DIALOG_DATA);
4809
- #dialogRef = inject(DialogRef);
4810
- #popup = inject(BizyPopupService);
4811
- #ref = inject(ChangeDetectorRef);
4812
- disabled = false;
4813
- disableClose = false;
4814
- disableDrag = false;
4815
- ngAfterViewInit() {
4816
- this.loadDynamicComponent();
4817
- if (this.#data && this.#data.disableClose) {
4818
- this.disableClose = this.#data.disableClose;
4819
- }
4820
- if (this.#data && this.#data.disableDrag) {
4821
- this.disableDrag = this.#data.disableDrag;
4822
- }
4823
- }
4824
- loadDynamicComponent = () => {
4825
- if (this.#data && this.#data.component) {
4826
- this.dynamicComponentContainer.clear();
4827
- this.dynamicComponentContainer.createComponent(this.#data.component);
4828
- this.#ref.detectChanges();
4829
- }
4830
- };
4831
- async close() {
4832
- this.disabled = true;
4833
- this.#popup.close({ id: this.#dialogRef.id });
4834
- }
4835
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPopupWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4836
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: BizyPopupWrapperComponent, isStandalone: true, selector: "bizy-popup-wrapper", viewQueries: [{ propertyName: "dynamicComponentContainer", first: true, predicate: ["dynamicComponentContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div class=\"bizy-popup-wrapper\" cdkDrag>\n\n <button *ngIf=\"!disableDrag\" class=\"bizy-popup-wrapper__drag-button\" cdkDragHandle>\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"bizy-popup-wrapper__drag-button__icon\">\n <path d=\"M278.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-64 64c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l9.4-9.4V224H109.3l9.4-9.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-64 64c-12.5 12.5-12.5 32.8 0 45.3l64 64c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-9.4-9.4H224V402.7l-9.4-9.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l64 64c12.5 12.5 32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-9.4 9.4V288H402.7l-9.4 9.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3l-64-64c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l9.4 9.4H288V109.3l9.4 9.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-64-64z\"/>\n </svg>\n\n </button>\n\n <button *ngIf=\"!disableClose\" class=\"bizy-popup-wrapper__close-button\" (click)=\"close()\" (keyup.enter)=\"close()\">\n\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\" class=\"bizy-popup-wrapper__close-button__icon\">\n <path d=\"M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z\"/>\n </svg>\n\n </button>\n\n <ng-container #dynamicComponentContainer></ng-container>\n\n</div>", styles: [":host{font-size:1rem;position:fixed!important;inset:50%;transform:translate(-50%,-50%);min-height:150px;min-width:150px;width:fit-content;height:fit-content;z-index:10}.bizy-popup-wrapper{position:relative;padding:var(--bizy-popup-padding);background-color:var(--bizy-popup-background-color);min-width:var(--bizy-popup-min-width);width:var(--bizy-popup-width);max-width:var(--bizy-popup-max-width)}.bizy-popup-wrapper__drag-button{position:absolute;left:-.9rem;top:-.9rem;border:var(--bizy-popup-drag-button-border);border-radius:50%;padding:.2rem;place-items:center;display:grid;background-color:var(--bizy-popup-drag-button-background-color);cursor:pointer;transition:transform .2s;z-index:1}.bizy-popup-wrapper__drag-button:hover{transform:scale(1.1)}.bizy-popup-wrapper__drag-button__icon{height:1rem}.bizy-popup-wrapper__drag-button__icon{fill:var(--bizy-popup-drag-button-color)}.bizy-popup-wrapper__close-button{position:absolute;right:-.9rem;top:-.9rem;border:var(--bizy-popup-close-button-border);border-radius:50%;padding:.25rem .35rem;place-items:center;display:grid;background-color:var(--bizy-popup-close-button-background-color);cursor:pointer;transition:transform .2s;z-index:1}.bizy-popup-wrapper__close-button:hover .bizy-popup-wrapper__close-button__icon{transform:scale(1.1)}.bizy-popup-wrapper__close-button:hover .bizy-popup-wrapper__close-button__icon{fill:var(--bizy-popup-close-button-hover-color)}.bizy-popup-wrapper__close-button__icon{height:1rem;transition:fill .2s ease,}.bizy-popup-wrapper__close-button__icon{fill:var(--bizy-popup-close-button-color)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: DialogModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2$3.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2$3.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4837
- }
4838
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyPopupWrapperComponent, decorators: [{
4839
- type: Component,
4840
- args: [{ selector: 'bizy-popup-wrapper', imports: [CommonModule, DialogModule, DragDropModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"bizy-popup-wrapper\" cdkDrag>\n\n <button *ngIf=\"!disableDrag\" class=\"bizy-popup-wrapper__drag-button\" cdkDragHandle>\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" class=\"bizy-popup-wrapper__drag-button__icon\">\n <path d=\"M278.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-64 64c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l9.4-9.4V224H109.3l9.4-9.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-64 64c-12.5 12.5-12.5 32.8 0 45.3l64 64c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-9.4-9.4H224V402.7l-9.4-9.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l64 64c12.5 12.5 32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-9.4 9.4V288H402.7l-9.4 9.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3l-64-64c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l9.4 9.4H288V109.3l9.4 9.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-64-64z\"/>\n </svg>\n\n </button>\n\n <button *ngIf=\"!disableClose\" class=\"bizy-popup-wrapper__close-button\" (click)=\"close()\" (keyup.enter)=\"close()\">\n\n\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\" class=\"bizy-popup-wrapper__close-button__icon\">\n <path d=\"M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z\"/>\n </svg>\n\n </button>\n\n <ng-container #dynamicComponentContainer></ng-container>\n\n</div>", styles: [":host{font-size:1rem;position:fixed!important;inset:50%;transform:translate(-50%,-50%);min-height:150px;min-width:150px;width:fit-content;height:fit-content;z-index:10}.bizy-popup-wrapper{position:relative;padding:var(--bizy-popup-padding);background-color:var(--bizy-popup-background-color);min-width:var(--bizy-popup-min-width);width:var(--bizy-popup-width);max-width:var(--bizy-popup-max-width)}.bizy-popup-wrapper__drag-button{position:absolute;left:-.9rem;top:-.9rem;border:var(--bizy-popup-drag-button-border);border-radius:50%;padding:.2rem;place-items:center;display:grid;background-color:var(--bizy-popup-drag-button-background-color);cursor:pointer;transition:transform .2s;z-index:1}.bizy-popup-wrapper__drag-button:hover{transform:scale(1.1)}.bizy-popup-wrapper__drag-button__icon{height:1rem}.bizy-popup-wrapper__drag-button__icon{fill:var(--bizy-popup-drag-button-color)}.bizy-popup-wrapper__close-button{position:absolute;right:-.9rem;top:-.9rem;border:var(--bizy-popup-close-button-border);border-radius:50%;padding:.25rem .35rem;place-items:center;display:grid;background-color:var(--bizy-popup-close-button-background-color);cursor:pointer;transition:transform .2s;z-index:1}.bizy-popup-wrapper__close-button:hover .bizy-popup-wrapper__close-button__icon{transform:scale(1.1)}.bizy-popup-wrapper__close-button:hover .bizy-popup-wrapper__close-button__icon{fill:var(--bizy-popup-close-button-hover-color)}.bizy-popup-wrapper__close-button__icon{height:1rem;transition:fill .2s ease,}.bizy-popup-wrapper__close-button__icon{fill:var(--bizy-popup-close-button-color)}\n"] }]
4841
- }], propDecorators: { dynamicComponentContainer: [{
4842
- type: ViewChild,
4843
- args: ['dynamicComponentContainer', { read: ViewContainerRef }]
4844
- }] } });
4845
-
4846
4863
  class BizyPopupService {
4847
4864
  #animation = inject(BizyAnimationService);
4848
4865
  #validator = inject(BizyValidatorService);