otimus-library 0.3.39 → 0.3.40
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.
- package/fesm2022/otimus-library.mjs +227 -2
- package/fesm2022/otimus-library.mjs.map +1 -1
- package/index.d.ts +37 -2
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import * as i2 from '@angular/platform-browser';
|
|
|
8
8
|
import * as i5 from '@angular/forms';
|
|
9
9
|
import { FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
10
10
|
import * as i1$1 from '@angular/common/http';
|
|
11
|
-
import { ComponentPortal } from '@angular/cdk/portal';
|
|
11
|
+
import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
|
|
12
12
|
import * as i3 from '@angular/cdk/overlay';
|
|
13
13
|
|
|
14
14
|
class OtimusLibraryService {
|
|
@@ -2619,6 +2619,231 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
2619
2619
|
type: Input
|
|
2620
2620
|
}] } });
|
|
2621
2621
|
|
|
2622
|
+
class OcOverlayComponent {
|
|
2623
|
+
constructor(overlay, viewContainerRef) {
|
|
2624
|
+
this.overlay = overlay;
|
|
2625
|
+
this.viewContainerRef = viewContainerRef;
|
|
2626
|
+
this.ocContent = null;
|
|
2627
|
+
this.ocTrigger = 'click';
|
|
2628
|
+
this.ocPosition = 'center';
|
|
2629
|
+
this.ocShowBackdrop = true;
|
|
2630
|
+
this.ocCloseOnBackdropClick = true;
|
|
2631
|
+
this.ocWidth = 'auto';
|
|
2632
|
+
this.ocHeight = 'auto';
|
|
2633
|
+
this.ocStyle = 'otimus';
|
|
2634
|
+
this.ocDisabled = false;
|
|
2635
|
+
this.ocZIndex = 1000;
|
|
2636
|
+
this.ocOpen = new EventEmitter();
|
|
2637
|
+
this.ocClose = new EventEmitter();
|
|
2638
|
+
this.ocToggle = new EventEmitter();
|
|
2639
|
+
this.overlayRef = null;
|
|
2640
|
+
this.portal = null;
|
|
2641
|
+
this.isOverlayOpen = false;
|
|
2642
|
+
}
|
|
2643
|
+
ngAfterViewInit() {
|
|
2644
|
+
this.setupEventListeners();
|
|
2645
|
+
}
|
|
2646
|
+
ngOnDestroy() {
|
|
2647
|
+
this.closeOverlay();
|
|
2648
|
+
}
|
|
2649
|
+
setupEventListeners() {
|
|
2650
|
+
if (!this.trigger || this.ocDisabled)
|
|
2651
|
+
return;
|
|
2652
|
+
const triggerElement = this.trigger.nativeElement;
|
|
2653
|
+
if (this.ocTrigger === 'click') {
|
|
2654
|
+
triggerElement.addEventListener('click', (event) => {
|
|
2655
|
+
event.stopPropagation();
|
|
2656
|
+
this.toggleOverlay();
|
|
2657
|
+
});
|
|
2658
|
+
}
|
|
2659
|
+
else if (this.ocTrigger === 'hover') {
|
|
2660
|
+
triggerElement.addEventListener('mouseenter', () => {
|
|
2661
|
+
this.openOverlay();
|
|
2662
|
+
});
|
|
2663
|
+
triggerElement.addEventListener('mouseleave', () => {
|
|
2664
|
+
// Add a small delay before closing to allow moving into the overlay
|
|
2665
|
+
setTimeout(() => {
|
|
2666
|
+
this.closeOverlay();
|
|
2667
|
+
}, 100);
|
|
2668
|
+
});
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
toggleOverlay() {
|
|
2672
|
+
if (this.isOverlayOpen) {
|
|
2673
|
+
this.closeOverlay();
|
|
2674
|
+
}
|
|
2675
|
+
else {
|
|
2676
|
+
this.openOverlay();
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
openOverlay() {
|
|
2680
|
+
if (this.isOverlayOpen || this.ocDisabled || !this.overlayTemplate) {
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2683
|
+
const overlayConfig = this.getOverlayConfig();
|
|
2684
|
+
this.overlayRef = this.overlay.create(overlayConfig);
|
|
2685
|
+
this.portal = new TemplatePortal(this.overlayTemplate, this.viewContainerRef);
|
|
2686
|
+
this.overlayRef.attach(this.portal);
|
|
2687
|
+
this.isOverlayOpen = true;
|
|
2688
|
+
// Handle backdrop click
|
|
2689
|
+
if (this.ocShowBackdrop && this.ocCloseOnBackdropClick) {
|
|
2690
|
+
this.overlayRef.backdropClick().subscribe(() => {
|
|
2691
|
+
this.closeOverlay();
|
|
2692
|
+
});
|
|
2693
|
+
}
|
|
2694
|
+
this.ocOpen.emit();
|
|
2695
|
+
this.ocToggle.emit(true);
|
|
2696
|
+
}
|
|
2697
|
+
closeOverlay() {
|
|
2698
|
+
if (!this.overlayRef || !this.isOverlayOpen) {
|
|
2699
|
+
return;
|
|
2700
|
+
}
|
|
2701
|
+
this.overlayRef.detach();
|
|
2702
|
+
this.overlayRef.dispose();
|
|
2703
|
+
this.overlayRef = null;
|
|
2704
|
+
this.portal = null;
|
|
2705
|
+
this.isOverlayOpen = false;
|
|
2706
|
+
this.ocClose.emit();
|
|
2707
|
+
this.ocToggle.emit(false);
|
|
2708
|
+
}
|
|
2709
|
+
getOverlayConfig() {
|
|
2710
|
+
const positionStrategy = this.overlay.position()
|
|
2711
|
+
.flexibleConnectedTo(this.trigger.nativeElement)
|
|
2712
|
+
.withPositions(this.getPositions())
|
|
2713
|
+
.withFlexibleDimensions(true)
|
|
2714
|
+
.withPush(false);
|
|
2715
|
+
return {
|
|
2716
|
+
positionStrategy,
|
|
2717
|
+
hasBackdrop: this.ocShowBackdrop,
|
|
2718
|
+
backdropClass: this.ocShowBackdrop ? undefined : 'cdk-overlay-transparent-backdrop',
|
|
2719
|
+
panelClass: ['oc-overlay-panel', `oc-overlay-${this.ocStyle}`],
|
|
2720
|
+
width: this.parseSize(this.ocWidth),
|
|
2721
|
+
height: this.parseSize(this.ocHeight),
|
|
2722
|
+
disposeOnNavigation: true
|
|
2723
|
+
};
|
|
2724
|
+
}
|
|
2725
|
+
getPositions() {
|
|
2726
|
+
const basePositions = [
|
|
2727
|
+
{
|
|
2728
|
+
originX: 'center',
|
|
2729
|
+
originY: 'bottom',
|
|
2730
|
+
overlayX: 'center',
|
|
2731
|
+
overlayY: 'top',
|
|
2732
|
+
offsetX: 0,
|
|
2733
|
+
offsetY: 8
|
|
2734
|
+
},
|
|
2735
|
+
{
|
|
2736
|
+
originX: 'center',
|
|
2737
|
+
originY: 'top',
|
|
2738
|
+
overlayX: 'center',
|
|
2739
|
+
overlayY: 'bottom',
|
|
2740
|
+
offsetX: 0,
|
|
2741
|
+
offsetY: -8
|
|
2742
|
+
},
|
|
2743
|
+
{
|
|
2744
|
+
originX: 'end',
|
|
2745
|
+
originY: 'center',
|
|
2746
|
+
overlayX: 'start',
|
|
2747
|
+
overlayY: 'center',
|
|
2748
|
+
offsetX: -8,
|
|
2749
|
+
offsetY: 0
|
|
2750
|
+
},
|
|
2751
|
+
{
|
|
2752
|
+
originX: 'start',
|
|
2753
|
+
originY: 'center',
|
|
2754
|
+
overlayX: 'end',
|
|
2755
|
+
overlayY: 'center',
|
|
2756
|
+
offsetX: 8,
|
|
2757
|
+
offsetY: 0
|
|
2758
|
+
}
|
|
2759
|
+
];
|
|
2760
|
+
// Position-specific configurations
|
|
2761
|
+
switch (this.ocPosition) {
|
|
2762
|
+
case 'top':
|
|
2763
|
+
return [
|
|
2764
|
+
{
|
|
2765
|
+
originX: 'center',
|
|
2766
|
+
originY: 'top',
|
|
2767
|
+
overlayX: 'center',
|
|
2768
|
+
overlayY: 'bottom',
|
|
2769
|
+
offsetX: 0,
|
|
2770
|
+
offsetY: -8
|
|
2771
|
+
},
|
|
2772
|
+
basePositions[0]
|
|
2773
|
+
];
|
|
2774
|
+
case 'bottom':
|
|
2775
|
+
return [
|
|
2776
|
+
basePositions[0],
|
|
2777
|
+
basePositions[1]
|
|
2778
|
+
];
|
|
2779
|
+
case 'left':
|
|
2780
|
+
return [
|
|
2781
|
+
{
|
|
2782
|
+
originX: 'start',
|
|
2783
|
+
originY: 'center',
|
|
2784
|
+
overlayX: 'end',
|
|
2785
|
+
overlayY: 'center',
|
|
2786
|
+
offsetX: -8,
|
|
2787
|
+
offsetY: 0
|
|
2788
|
+
},
|
|
2789
|
+
basePositions[2]
|
|
2790
|
+
];
|
|
2791
|
+
case 'right':
|
|
2792
|
+
return [
|
|
2793
|
+
basePositions[2],
|
|
2794
|
+
basePositions[3]
|
|
2795
|
+
];
|
|
2796
|
+
case 'center':
|
|
2797
|
+
default:
|
|
2798
|
+
return basePositions;
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
parseSize(size) {
|
|
2802
|
+
if (size === 'auto' || size === undefined) {
|
|
2803
|
+
return undefined;
|
|
2804
|
+
}
|
|
2805
|
+
return typeof size === 'number' ? `${size}px` : size;
|
|
2806
|
+
}
|
|
2807
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: OcOverlayComponent, deps: [{ token: i3.Overlay }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2808
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.9", type: OcOverlayComponent, isStandalone: true, selector: "oc-overlay", inputs: { ocContent: "ocContent", ocTrigger: "ocTrigger", ocPosition: "ocPosition", ocShowBackdrop: "ocShowBackdrop", ocCloseOnBackdropClick: "ocCloseOnBackdropClick", ocWidth: "ocWidth", ocHeight: "ocHeight", ocStyle: "ocStyle", ocDisabled: "ocDisabled", ocZIndex: "ocZIndex" }, outputs: { ocOpen: "ocOpen", ocClose: "ocClose", ocToggle: "ocToggle" }, viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }, { propertyName: "overlayTemplate", first: true, predicate: ["overlayTemplate"], descendants: true }], ngImport: i0, template: "<!-- Trigger element -->\n<div #trigger class=\"oc-overlay-trigger\" [ngClass]=\"{\n 'disabled': ocDisabled,\n 'shui': ocStyle === 'shui'\n}\">\n <ng-content select=\"[ocTrigger]\"></ng-content>\n</div>\n\n<!-- Template for overlay content -->\n<ng-template #overlayTemplate>\n <div class=\"oc-overlay-content\" [ngClass]=\"{\n 'shui': ocStyle === 'shui'\n }\">\n <ng-content></ng-content>\n </div>\n</ng-template>", styles: [".oc-overlay-trigger{display:inline-block;cursor:pointer;transition:opacity .2s ease}.oc-overlay-trigger.disabled{cursor:not-allowed;opacity:.6;pointer-events:none}.oc-overlay-trigger:hover:not(.disabled){opacity:.8}.oc-overlay-panel{border-radius:0 8px 8px;box-shadow:0 4px 8.7px #00000021;z-index:1000;max-width:90vw;max-height:90vh;overflow:auto;animation:showUp .15s ease}.oc-overlay-content{padding:16px;font-family:inherit;font-size:1rem;line-height:1.5;color:#8f9596;background-color:#f8f9ff;border:2px solid #ffffff;border-radius:12px}.oc-overlay-panel.oc-overlay-otimus .oc-overlay-content{color:#8f9596}.oc-overlay-panel.oc-overlay-shui{background-color:#f5f5f5;border:2px solid #ebebeb}.oc-overlay-panel.oc-overlay-shui .oc-overlay-content{color:#7d7d7d}.oc-overlay-backdrop{background-color:#00000052;animation:backdropFadeIn .2s ease-out}@keyframes showUp{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:scale(1)}}@keyframes backdropFadeIn{0%{opacity:0}to{opacity:1}}@media (max-width: 768px){.oc-overlay-panel{max-width:95vw;max-height:95vh}.oc-overlay-content{padding:12px;font-size:.875rem}}@media (prefers-contrast: high){.oc-overlay-panel{border-width:2px}}@media (prefers-reduced-motion: reduce){.oc-overlay-panel,.oc-overlay-backdrop{animation:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
2809
|
+
}
|
|
2810
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: OcOverlayComponent, decorators: [{
|
|
2811
|
+
type: Component,
|
|
2812
|
+
args: [{ selector: 'oc-overlay', imports: [CommonModule], template: "<!-- Trigger element -->\n<div #trigger class=\"oc-overlay-trigger\" [ngClass]=\"{\n 'disabled': ocDisabled,\n 'shui': ocStyle === 'shui'\n}\">\n <ng-content select=\"[ocTrigger]\"></ng-content>\n</div>\n\n<!-- Template for overlay content -->\n<ng-template #overlayTemplate>\n <div class=\"oc-overlay-content\" [ngClass]=\"{\n 'shui': ocStyle === 'shui'\n }\">\n <ng-content></ng-content>\n </div>\n</ng-template>", styles: [".oc-overlay-trigger{display:inline-block;cursor:pointer;transition:opacity .2s ease}.oc-overlay-trigger.disabled{cursor:not-allowed;opacity:.6;pointer-events:none}.oc-overlay-trigger:hover:not(.disabled){opacity:.8}.oc-overlay-panel{border-radius:0 8px 8px;box-shadow:0 4px 8.7px #00000021;z-index:1000;max-width:90vw;max-height:90vh;overflow:auto;animation:showUp .15s ease}.oc-overlay-content{padding:16px;font-family:inherit;font-size:1rem;line-height:1.5;color:#8f9596;background-color:#f8f9ff;border:2px solid #ffffff;border-radius:12px}.oc-overlay-panel.oc-overlay-otimus .oc-overlay-content{color:#8f9596}.oc-overlay-panel.oc-overlay-shui{background-color:#f5f5f5;border:2px solid #ebebeb}.oc-overlay-panel.oc-overlay-shui .oc-overlay-content{color:#7d7d7d}.oc-overlay-backdrop{background-color:#00000052;animation:backdropFadeIn .2s ease-out}@keyframes showUp{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:scale(1)}}@keyframes backdropFadeIn{0%{opacity:0}to{opacity:1}}@media (max-width: 768px){.oc-overlay-panel{max-width:95vw;max-height:95vh}.oc-overlay-content{padding:12px;font-size:.875rem}}@media (prefers-contrast: high){.oc-overlay-panel{border-width:2px}}@media (prefers-reduced-motion: reduce){.oc-overlay-panel,.oc-overlay-backdrop{animation:none}}\n"] }]
|
|
2813
|
+
}], ctorParameters: () => [{ type: i3.Overlay }, { type: i0.ViewContainerRef }], propDecorators: { ocContent: [{
|
|
2814
|
+
type: Input
|
|
2815
|
+
}], ocTrigger: [{
|
|
2816
|
+
type: Input
|
|
2817
|
+
}], ocPosition: [{
|
|
2818
|
+
type: Input
|
|
2819
|
+
}], ocShowBackdrop: [{
|
|
2820
|
+
type: Input
|
|
2821
|
+
}], ocCloseOnBackdropClick: [{
|
|
2822
|
+
type: Input
|
|
2823
|
+
}], ocWidth: [{
|
|
2824
|
+
type: Input
|
|
2825
|
+
}], ocHeight: [{
|
|
2826
|
+
type: Input
|
|
2827
|
+
}], ocStyle: [{
|
|
2828
|
+
type: Input
|
|
2829
|
+
}], ocDisabled: [{
|
|
2830
|
+
type: Input
|
|
2831
|
+
}], ocZIndex: [{
|
|
2832
|
+
type: Input
|
|
2833
|
+
}], ocOpen: [{
|
|
2834
|
+
type: Output
|
|
2835
|
+
}], ocClose: [{
|
|
2836
|
+
type: Output
|
|
2837
|
+
}], ocToggle: [{
|
|
2838
|
+
type: Output
|
|
2839
|
+
}], trigger: [{
|
|
2840
|
+
type: ViewChild,
|
|
2841
|
+
args: ['trigger']
|
|
2842
|
+
}], overlayTemplate: [{
|
|
2843
|
+
type: ViewChild,
|
|
2844
|
+
args: ['overlayTemplate']
|
|
2845
|
+
}] } });
|
|
2846
|
+
|
|
2622
2847
|
/*
|
|
2623
2848
|
* Public API Surface of otimus-library
|
|
2624
2849
|
*/
|
|
@@ -2627,5 +2852,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
2627
2852
|
* Generated bundle index. Do not edit.
|
|
2628
2853
|
*/
|
|
2629
2854
|
|
|
2630
|
-
export { OcAccordionComponent, OcAccordionItemComponent, OcAutocompleteComponent, OcBadgeComponent, OcButtonMenuComponent, OcCheckboxComponent, OcChipComponent, OcDateSelectComponent, OcFilterComponent, OcInputComponent, OcKeyValueComponent, OcLogComponent, OcMenuComponent, OcMenuHorizComponent, OcMenuHorizDirective, OcMessageComponent, OcModalComponent, OcModalFooterComponent, OcNotFoundComponent, OcPaginationComponent, OcProfileComponent, OcProgressComponent, OcStepComponent, OcStepperComponent, OcTabComponent, OcTabsComponent, OcToastComponent, OcToastService, OcToggleComponent, OcTooltipDirective, OtimusLibraryComponent, OtimusLibraryService, StyleThemeService };
|
|
2855
|
+
export { OcAccordionComponent, OcAccordionItemComponent, OcAutocompleteComponent, OcBadgeComponent, OcButtonMenuComponent, OcCheckboxComponent, OcChipComponent, OcDateSelectComponent, OcFilterComponent, OcInputComponent, OcKeyValueComponent, OcLogComponent, OcMenuComponent, OcMenuHorizComponent, OcMenuHorizDirective, OcMessageComponent, OcModalComponent, OcModalFooterComponent, OcNotFoundComponent, OcOverlayComponent, OcPaginationComponent, OcProfileComponent, OcProgressComponent, OcStepComponent, OcStepperComponent, OcTabComponent, OcTabsComponent, OcToastComponent, OcToastService, OcToggleComponent, OcTooltipDirective, OtimusLibraryComponent, OtimusLibraryService, StyleThemeService };
|
|
2631
2856
|
//# sourceMappingURL=otimus-library.mjs.map
|