@ecodev/natural 63.5.0 → 63.5.1
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.
|
@@ -21,7 +21,6 @@ import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
|
|
|
21
21
|
import * as i1$1 from '@angular/cdk/portal';
|
|
22
22
|
import { BasePortalOutlet, CdkPortalOutlet, PortalModule, ComponentPortal } from '@angular/cdk/portal';
|
|
23
23
|
import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
24
|
-
import { trigger, state, transition, style, animate, sequence, query, group } from '@angular/animations';
|
|
25
24
|
import * as i6 from '@angular/material/checkbox';
|
|
26
25
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
27
26
|
import * as i5 from '@angular/material/datepicker';
|
|
@@ -2807,53 +2806,14 @@ function replaceToday(selection) {
|
|
|
2807
2806
|
return selection;
|
|
2808
2807
|
}
|
|
2809
2808
|
|
|
2810
|
-
/**
|
|
2811
|
-
* Animations used by the mat-menu component.
|
|
2812
|
-
* Animation duration and timing values are based on:
|
|
2813
|
-
* https://material.io/guidelines/components/menus.html#menus-usage
|
|
2814
|
-
*/
|
|
2815
|
-
const naturalDropdownAnimations = {
|
|
2816
|
-
/**
|
|
2817
|
-
* This animation controls the menu panel's entry and exit from the page.
|
|
2818
|
-
*
|
|
2819
|
-
* When the menu panel is added to the DOM, it scales in and fades in its border.
|
|
2820
|
-
*
|
|
2821
|
-
* When the menu panel is removed from the DOM, it simply fades out after a brief
|
|
2822
|
-
* delay to display the ripple.
|
|
2823
|
-
*/
|
|
2824
|
-
transformMenu: trigger('transformMenu', [
|
|
2825
|
-
state('void', style({
|
|
2826
|
-
opacity: 0,
|
|
2827
|
-
// This starts off from 0.01, instead of 0, because there's an issue in the Angular animations
|
|
2828
|
-
// as of 4.2, which causes the animation to be skipped if it starts from 0.
|
|
2829
|
-
transform: 'scale(0.01, 0.01)',
|
|
2830
|
-
})),
|
|
2831
|
-
transition('void => enter', sequence([
|
|
2832
|
-
query('.natural-dropdown-container-content', style({ opacity: 0 })),
|
|
2833
|
-
animate('100ms linear', style({ opacity: 1, transform: 'scale(1, 0.5)' })),
|
|
2834
|
-
group([
|
|
2835
|
-
query('.natural-dropdown-container-content', animate('400ms cubic-bezier(0.55, 0, 0.55, 0.2)', style({ opacity: 1 }))),
|
|
2836
|
-
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({ transform: 'scale(1, 1)' })),
|
|
2837
|
-
]),
|
|
2838
|
-
])),
|
|
2839
|
-
transition('* => void', animate('150ms 50ms linear', style({ opacity: 0 }))),
|
|
2840
|
-
]),
|
|
2841
|
-
/**
|
|
2842
|
-
* This animation fades in the background color and content of the menu panel
|
|
2843
|
-
* after its containing element is scaled in.
|
|
2844
|
-
*/
|
|
2845
|
-
fadeInItems: trigger('fadeInItems', [
|
|
2846
|
-
// TODO(crisbeto): this is inside the `transformMenu`
|
|
2847
|
-
// now. Remove next time we do breaking changes.
|
|
2848
|
-
state('showing', style({ opacity: 1 })),
|
|
2849
|
-
transition('void => *', [style({ opacity: 0 }), animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')]),
|
|
2850
|
-
]),
|
|
2851
|
-
};
|
|
2852
|
-
|
|
2853
2809
|
function throwMatDialogContentAlreadyAttachedError() {
|
|
2854
2810
|
throw Error('Attempting to attach dialog content after content is already attached');
|
|
2855
2811
|
}
|
|
2856
2812
|
const NATURAL_DROPDOWN_CONTAINER_DATA = new InjectionToken('NaturalDropdownContainerData');
|
|
2813
|
+
/** Name of the enter animation `@keyframes`. */
|
|
2814
|
+
const ENTER_ANIMATION = '_mat-menu-enter';
|
|
2815
|
+
/** Name of the exit animation `@keyframes`. */
|
|
2816
|
+
const EXIT_ANIMATION = '_mat-menu-exit';
|
|
2857
2817
|
class NaturalDropdownContainerComponent extends BasePortalOutlet {
|
|
2858
2818
|
elementRef = inject(ElementRef);
|
|
2859
2819
|
focusTrapFactory = inject(ConfigurableFocusTrapFactory);
|
|
@@ -2861,19 +2821,16 @@ class NaturalDropdownContainerComponent extends BasePortalOutlet {
|
|
|
2861
2821
|
portalOutlet = viewChild.required(CdkPortalOutlet);
|
|
2862
2822
|
closed = new Subject();
|
|
2863
2823
|
/** Current state of the panel animation. */
|
|
2864
|
-
panelAnimationState = '
|
|
2824
|
+
panelAnimationState = 'enter';
|
|
2865
2825
|
/** Emits whenever an animation on the menu completes. */
|
|
2866
2826
|
animationDone = new Subject();
|
|
2867
2827
|
focusTrap = null;
|
|
2868
2828
|
elementFocusedBeforeDialogWasOpened = null;
|
|
2869
|
-
constructor() {
|
|
2870
|
-
super();
|
|
2871
|
-
}
|
|
2872
2829
|
ngOnDestroy() {
|
|
2873
2830
|
this.closed.complete();
|
|
2874
2831
|
}
|
|
2875
2832
|
close() {
|
|
2876
|
-
this.
|
|
2833
|
+
this.panelAnimationState = 'void';
|
|
2877
2834
|
}
|
|
2878
2835
|
attachTemplatePortal(portal) {
|
|
2879
2836
|
return this.portalOutlet().attachTemplatePortal(portal);
|
|
@@ -2885,17 +2842,19 @@ class NaturalDropdownContainerComponent extends BasePortalOutlet {
|
|
|
2885
2842
|
}
|
|
2886
2843
|
return portalOutlet.attachComponentPortal(portal);
|
|
2887
2844
|
}
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2845
|
+
/** Callback that is invoked when the panel animation completes. */
|
|
2846
|
+
onAnimationDone(state) {
|
|
2847
|
+
const isExit = state === EXIT_ANIMATION;
|
|
2848
|
+
if (isExit || state === ENTER_ANIMATION) {
|
|
2849
|
+
if (isExit) {
|
|
2850
|
+
this.restoreFocus();
|
|
2851
|
+
this.closed.next();
|
|
2852
|
+
}
|
|
2853
|
+
else {
|
|
2854
|
+
this.trapFocus();
|
|
2855
|
+
}
|
|
2856
|
+
this.animationDone.next(isExit ? 'void' : 'enter');
|
|
2897
2857
|
}
|
|
2898
|
-
this.animationDone.next();
|
|
2899
2858
|
}
|
|
2900
2859
|
trapFocus() {
|
|
2901
2860
|
if (!this.focusTrap) {
|
|
@@ -2914,13 +2873,13 @@ class NaturalDropdownContainerComponent extends BasePortalOutlet {
|
|
|
2914
2873
|
this.focusTrap.destroy();
|
|
2915
2874
|
}
|
|
2916
2875
|
}
|
|
2917
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: NaturalDropdownContainerComponent, deps:
|
|
2918
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.13", type: NaturalDropdownContainerComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"natural-dropdown-container mat-elevation-z2\"\n role=\"menu\"\n tabindex=\"-1\"\n [
|
|
2876
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: NaturalDropdownContainerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2877
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.13", type: NaturalDropdownContainerComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"natural-dropdown-container mat-elevation-z2\"\n role=\"menu\"\n tabindex=\"-1\"\n [class.mat-menu-panel-exit-animation]=\"panelAnimationState === 'void'\"\n (animationend)=\"onAnimationDone($event.animationName)\"\n (animationcancel)=\"onAnimationDone($event.animationName)\"\n>\n <div class=\"natural-dropdown-container-content\">\n <ng-template cdkPortalOutlet />\n </div>\n\n @if (data.showValidateButton) {\n <div class=\"natural-dropdown-validate-button\">\n <button color=\"primary\" mat-raised-button i18n (click)=\"close()\">Valider</button>\n </div>\n }\n</div>\n", styles: ["@keyframes _mat-menu-enter{0%{transform:scale(.8);opacity:0}to{transform:none;opacity:1}}@keyframes _mat-menu-exit{0%{opacity:1}to{opacity:0}}.natural-dropdown-container{display:flex;flex-direction:column;animation:_mat-menu-enter .12s cubic-bezier(0,0,.2,1);border-radius:2px;height:100%}.natural-dropdown-container-content{flex:1;padding:5px;overflow:auto}.natural-dropdown-container .natural-dropdown-validate-button{display:flex;flex:none;flex-direction:row;justify-content:flex-end;margin:5px}.natural-dropdown-container.mat-menu-panel-exit-animation{animation:_mat-menu-exit .1s 25ms linear forwards}\n"], dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i1$1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
2919
2878
|
}
|
|
2920
2879
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: NaturalDropdownContainerComponent, decorators: [{
|
|
2921
2880
|
type: Component,
|
|
2922
|
-
args: [{ encapsulation: ViewEncapsulation.None, preserveWhitespaces: false,
|
|
2923
|
-
}]
|
|
2881
|
+
args: [{ encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, imports: [PortalModule, MatButtonModule], template: "<div\n class=\"natural-dropdown-container mat-elevation-z2\"\n role=\"menu\"\n tabindex=\"-1\"\n [class.mat-menu-panel-exit-animation]=\"panelAnimationState === 'void'\"\n (animationend)=\"onAnimationDone($event.animationName)\"\n (animationcancel)=\"onAnimationDone($event.animationName)\"\n>\n <div class=\"natural-dropdown-container-content\">\n <ng-template cdkPortalOutlet />\n </div>\n\n @if (data.showValidateButton) {\n <div class=\"natural-dropdown-validate-button\">\n <button color=\"primary\" mat-raised-button i18n (click)=\"close()\">Valider</button>\n </div>\n }\n</div>\n", styles: ["@keyframes _mat-menu-enter{0%{transform:scale(.8);opacity:0}to{transform:none;opacity:1}}@keyframes _mat-menu-exit{0%{opacity:1}to{opacity:0}}.natural-dropdown-container{display:flex;flex-direction:column;animation:_mat-menu-enter .12s cubic-bezier(0,0,.2,1);border-radius:2px;height:100%}.natural-dropdown-container-content{flex:1;padding:5px;overflow:auto}.natural-dropdown-container .natural-dropdown-validate-button{display:flex;flex:none;flex-direction:row;justify-content:flex-end;margin:5px}.natural-dropdown-container.mat-menu-panel-exit-animation{animation:_mat-menu-exit .1s 25ms linear forwards}\n"] }]
|
|
2882
|
+
}] });
|
|
2924
2883
|
|
|
2925
2884
|
class NaturalDropdownRef {
|
|
2926
2885
|
dropdownContainer;
|
|
@@ -2965,8 +2924,6 @@ class NaturalDropdownService {
|
|
|
2965
2924
|
const containerRef = overlayRef.attach(containerPortal);
|
|
2966
2925
|
const dropdownContainer = containerRef.instance;
|
|
2967
2926
|
const dropdownRef = new NaturalDropdownRef(dropdownContainer, component, customProviders, this.injector, containerRef);
|
|
2968
|
-
// Start animation that shows menu
|
|
2969
|
-
dropdownContainer.startAnimation();
|
|
2970
2927
|
const close = () => {
|
|
2971
2928
|
if (dropdownRef.componentInstance.isValid() && dropdownRef.componentInstance.isDirty()) {
|
|
2972
2929
|
dropdownRef.close({
|