@bizy/core 19.14.2 → 19.14.3

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