@cuby-ui/core 0.0.104 → 0.0.106
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/components/context-menu/context-menu.component.d.ts +5 -5
- package/components/root/index.d.ts +1 -0
- package/components/root/root.options.d.ts +1 -0
- package/components/select/select.component.d.ts +6 -2
- package/esm2020/components/context-menu/context-menu.component.mjs +24 -23
- package/esm2020/components/root/index.mjs +2 -1
- package/esm2020/components/root/root.component.mjs +3 -2
- package/esm2020/components/root/root.options.mjs +2 -0
- package/esm2020/components/select/select.component.mjs +38 -6
- package/fesm2015/cuby-ui-core.mjs +252 -219
- package/fesm2015/cuby-ui-core.mjs.map +1 -1
- package/fesm2020/cuby-ui-core.mjs +251 -218
- package/fesm2020/cuby-ui-core.mjs.map +1 -1
- package/package.json +3 -3
- package/styles/theme.scss +4 -0
- package/styles/variables/colors.scss +2 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, ChangeDetectionStrategy, InjectionToken, inject, Input, HostBinding, ViewChild, EventEmitter, Output, NgModule, Injector, Injectable, TemplateRef, ContentChildren,
|
|
2
|
+
import { Component, ChangeDetectionStrategy, InjectionToken, inject, Input, HostBinding, ViewChild, EventEmitter, Output, NgModule, Injector, Injectable, TemplateRef, ContentChildren, ElementRef, HostListener, ChangeDetectorRef, ViewContainerRef, Directive } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule, DOCUMENT } from '@angular/common';
|
|
5
5
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
6
6
|
import { cuiIsIcon, CUI_ICONS } from '@cuby-ui/icons';
|
|
7
7
|
import * as i2 from '@cuby-ui/cdk';
|
|
8
|
-
import { cuiCreateToken, cuiCreateTokenFromFactory, CuiDestroyService, CuiLetDirective, CuiFilterPipe, CuiPopoverService, CUI_LOCAL_STORAGE, CuiItemDirective, CUI_WINDOW, CuiClickOutsideDirective, CuiTargetDirective,
|
|
8
|
+
import { cuiCreateToken, cuiCreateTokenFromFactory, CuiDestroyService, CuiLetDirective, CuiFilterPipe, CuiPopoverService, CUI_LOCAL_STORAGE, CuiItemDirective, CuiFocusTrapDirective, CUI_WINDOW, CuiClickOutsideDirective, CuiTargetDirective, cuiProvide, CuiAutoResizingDirective } from '@cuby-ui/cdk';
|
|
9
9
|
import { BehaviorSubject, takeUntil, fromEvent, take } from 'rxjs';
|
|
10
10
|
import * as i2$1 from '@angular/forms';
|
|
11
11
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
@@ -714,162 +714,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
714
714
|
}]
|
|
715
715
|
}] });
|
|
716
716
|
|
|
717
|
-
|
|
717
|
+
const CUI_ROOT_SELECTOR = 'cui-root';
|
|
718
|
+
|
|
719
|
+
const CUI_DIALOGS = cuiCreateToken(new BehaviorSubject([]));
|
|
720
|
+
const CUI_DIALOG_DEFAULT_OPTIONS = {
|
|
721
|
+
size: 'auto',
|
|
722
|
+
data: undefined
|
|
723
|
+
};
|
|
724
|
+
const CUI_DIALOG_OPTIONS = cuiCreateToken(CUI_DIALOG_DEFAULT_OPTIONS);
|
|
725
|
+
const CUI_DIALOG_CONTEXT = new InjectionToken('');
|
|
726
|
+
|
|
727
|
+
class CuiDialogsComponent {
|
|
718
728
|
constructor() {
|
|
719
|
-
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
720
|
-
this.element = inject(ElementRef).nativeElement;
|
|
721
|
-
this.document = inject(DOCUMENT);
|
|
722
|
-
this.documentElement = this.document.documentElement;
|
|
723
|
-
this.window = inject(CUI_WINDOW);
|
|
724
729
|
this.destroy$ = inject(CuiDestroyService, { self: true });
|
|
725
|
-
this.
|
|
726
|
-
this.cuiTargetDirective = inject(CuiTargetDirective, { self: true });
|
|
727
|
-
this.EXTRA_OFFSET_LEFT = 0;
|
|
728
|
-
this.EXTRA_OFFSET_TOP = 0;
|
|
729
|
-
this.isVisible = false;
|
|
730
|
-
this.isHidden = false;
|
|
730
|
+
this.dialogs$ = inject(CUI_DIALOGS);
|
|
731
731
|
}
|
|
732
732
|
ngOnInit() {
|
|
733
|
-
this.
|
|
734
|
-
}
|
|
735
|
-
ngAfterViewInit() {
|
|
736
|
-
this.initTargetElementListener();
|
|
737
|
-
}
|
|
738
|
-
onSelect(item) {
|
|
739
|
-
this.isVisible = false;
|
|
740
|
-
item.command?.();
|
|
741
|
-
}
|
|
742
|
-
onClose() {
|
|
743
|
-
this.close();
|
|
744
|
-
}
|
|
745
|
-
onStopClickPropagation(event) {
|
|
746
|
-
event.stopPropagation();
|
|
747
|
-
}
|
|
748
|
-
trackByFn(_, item) {
|
|
749
|
-
return item.label;
|
|
733
|
+
this.initDialogInjectorsSubscription();
|
|
750
734
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
.pipe(takeUntil(this.destroy$))
|
|
754
|
-
.subscribe((target) => {
|
|
755
|
-
if (this.target.contains(target)) {
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
this.isVisible = false;
|
|
759
|
-
});
|
|
735
|
+
trackByFn(_, dialog) {
|
|
736
|
+
return dialog.id;
|
|
760
737
|
}
|
|
761
|
-
|
|
762
|
-
this.
|
|
763
|
-
event.stopPropagation();
|
|
764
|
-
this.document.body.click();
|
|
765
|
-
this.isVisible = !this.isVisible;
|
|
766
|
-
if (this.isVisible) {
|
|
767
|
-
this.changePosition(event.clientX, event.clientY);
|
|
768
|
-
this.initHidingSubscription();
|
|
769
|
-
}
|
|
770
|
-
this.changeDetectorRef.markForCheck();
|
|
771
|
-
};
|
|
772
|
-
this.cuiTargetDirective.clicked
|
|
738
|
+
initDialogInjectorsSubscription() {
|
|
739
|
+
this.dialogs$
|
|
773
740
|
.pipe(takeUntil(this.destroy$))
|
|
774
|
-
.subscribe(this.
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
this.initHidingFromWindowEvent('scroll');
|
|
778
|
-
this.initHidingFromWindowEvent('resize');
|
|
741
|
+
.subscribe(dialogs => this.dialogInjectors = dialogs.map(useValue => Injector.create({
|
|
742
|
+
providers: [{ provide: CUI_DIALOG_CONTEXT, useValue }]
|
|
743
|
+
})));
|
|
779
744
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
});
|
|
745
|
+
}
|
|
746
|
+
CuiDialogsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
747
|
+
CuiDialogsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiDialogsComponent, selector: "cui-dialogs", providers: [CuiDestroyService], ngImport: i0, template: "<ng-container *cuiLet=\"dialogs$ | async as dialogs\">\n <ng-container *ngFor=\"let dialog of dialogs; let i = index; trackBy: trackByFn\">\n <ng-container *ngComponentOutlet=\"dialog.component; injector: dialogInjectors[i]\"></ng-container>\n </ng-container>\n <div\n *ngIf=\"dialogs!.length\"\n class=\"c-overlay\"\n ></div>\n</ng-container>\n", styles: [".c-overlay{position:fixed;inset:0;background:var(--cui-base-900);opacity:.3}\n"], dependencies: [{ kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.CuiLetDirective, selector: "[cuiLet]", inputs: ["cuiLet"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
748
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogsComponent, decorators: [{
|
|
749
|
+
type: Component,
|
|
750
|
+
args: [{ selector: 'cui-dialogs', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], template: "<ng-container *cuiLet=\"dialogs$ | async as dialogs\">\n <ng-container *ngFor=\"let dialog of dialogs; let i = index; trackBy: trackByFn\">\n <ng-container *ngComponentOutlet=\"dialog.component; injector: dialogInjectors[i]\"></ng-container>\n </ng-container>\n <div\n *ngIf=\"dialogs!.length\"\n class=\"c-overlay\"\n ></div>\n</ng-container>\n", styles: [".c-overlay{position:fixed;inset:0;background:var(--cui-base-900);opacity:.3}\n"] }]
|
|
751
|
+
}] });
|
|
752
|
+
|
|
753
|
+
class CuiRootComponent {
|
|
754
|
+
constructor() {
|
|
755
|
+
this.document = inject(DOCUMENT);
|
|
756
|
+
this.theme$ = inject(CuiThemeService);
|
|
757
|
+
this.destroy$ = inject(CuiDestroyService);
|
|
787
758
|
}
|
|
788
|
-
|
|
789
|
-
this.
|
|
759
|
+
ngOnInit() {
|
|
760
|
+
this.initThemeSubscription();
|
|
790
761
|
}
|
|
791
|
-
|
|
792
|
-
this.
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
const width = this.element.offsetWidth;
|
|
796
|
-
const height = this.element.offsetHeight;
|
|
797
|
-
let left = x;
|
|
798
|
-
let top = y;
|
|
799
|
-
if (left + width > clientWidth) {
|
|
800
|
-
left -= width;
|
|
801
|
-
}
|
|
802
|
-
if (top + height > clientHeight) {
|
|
803
|
-
top -= height;
|
|
804
|
-
}
|
|
805
|
-
left = Math.max(left, this.EXTRA_OFFSET_LEFT);
|
|
806
|
-
top = Math.max(top, this.EXTRA_OFFSET_TOP);
|
|
807
|
-
this.isHidden = false;
|
|
808
|
-
this.clientX = left;
|
|
809
|
-
this.clientY = top;
|
|
810
|
-
this.changeDetectorRef.markForCheck();
|
|
811
|
-
});
|
|
762
|
+
initThemeSubscription() {
|
|
763
|
+
this.theme$
|
|
764
|
+
.pipe(takeUntil(this.destroy$))
|
|
765
|
+
.subscribe(theme => this.document.documentElement.setAttribute('cuiTheme', theme));
|
|
812
766
|
}
|
|
813
767
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type:
|
|
768
|
+
CuiRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
769
|
+
CuiRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiRootComponent, selector: "cui-root", providers: [CuiDestroyService], ngImport: i0, template: "<div class=\"c-content\">\n <ng-content />\n</div>\n<cui-dialogs />\n<cui-alerts />\n", styles: [".c-content{isolation:isolate}\n"], dependencies: [{ kind: "component", type: CuiDialogsComponent, selector: "cui-dialogs" }, { kind: "component", type: CuiAlertsComponent, selector: "cui-alerts" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
770
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, decorators: [{
|
|
817
771
|
type: Component,
|
|
818
|
-
args: [{ selector:
|
|
819
|
-
CuiClickOutsideDirective,
|
|
820
|
-
{
|
|
821
|
-
directive: CuiTargetDirective,
|
|
822
|
-
inputs: ['ccTarget: target']
|
|
823
|
-
}
|
|
824
|
-
], template: "<ul\n *ngIf=\"isVisible\"\n class=\"c-ul\"\n>\n <li\n *ngFor=\"let item of items; trackBy: trackByFn\"\n [style.color]=\"item.color\"\n >\n <button\n class=\"c-button\"\n (click)=\"onSelect(item)\"\n >\n <cui-svg\n *ngIf=\"item.icon\"\n [icon]=\"item.icon\"\n [color]=\"item.color\"\n ></cui-svg>\n <span>{{ item.label }}</span>\n </button>\n </li>\n</ul>\n", styles: [":host{position:fixed;z-index:2;display:block;width:268px;border-radius:8px}:host._hidden{visibility:hidden}.c-ul{padding:7px 0;margin:0;list-style:none;font-weight:400;font-size:14px;line-height:20px;box-shadow:0 1px 4px #0000000a,0 1px 4px #0000000a;border:1px solid var(--cui-base-200);border-radius:inherit;background:var(--cui-base-0);color:var(--cui-base-900);font-family:var(--cui-main-font)}.c-button{padding:8px 11px 8px 0;border:0;flex-shrink:0;outline:none;cursor:pointer;appearance:none;color:inherit;font:inherit;background:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent;padding:8px 11px;width:100%;display:flex;align-items:center;gap:12px}.c-button:active{background:var(--cui-base-50)}@media (hover: hover){.c-button:hover{background:var(--cui-base-50)}}\n"] }]
|
|
825
|
-
}], propDecorators: { items: [{
|
|
826
|
-
type: Input
|
|
827
|
-
}], target: [{
|
|
828
|
-
type: Input
|
|
829
|
-
}], isHidden: [{
|
|
830
|
-
type: HostBinding,
|
|
831
|
-
args: ['class._hidden']
|
|
832
|
-
}], clientX: [{
|
|
833
|
-
type: HostBinding,
|
|
834
|
-
args: ['style.left.px']
|
|
835
|
-
}], clientY: [{
|
|
836
|
-
type: HostBinding,
|
|
837
|
-
args: ['style.top.px']
|
|
838
|
-
}], onClose: [{
|
|
839
|
-
type: HostListener,
|
|
840
|
-
args: ['window:resize']
|
|
841
|
-
}], onStopClickPropagation: [{
|
|
842
|
-
type: HostListener,
|
|
843
|
-
args: ['click', ['$event']]
|
|
844
|
-
}] } });
|
|
845
|
-
|
|
846
|
-
class CuiContextMenuModule {
|
|
847
|
-
}
|
|
848
|
-
CuiContextMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
849
|
-
CuiContextMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuModule, declarations: [CuiContextMenuComponent], imports: [CommonModule,
|
|
850
|
-
CuiSvgModule], exports: [CuiContextMenuComponent] });
|
|
851
|
-
CuiContextMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuModule, imports: [CommonModule,
|
|
852
|
-
CuiSvgModule] });
|
|
853
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuModule, decorators: [{
|
|
854
|
-
type: NgModule,
|
|
855
|
-
args: [{
|
|
856
|
-
imports: [
|
|
857
|
-
CommonModule,
|
|
858
|
-
CuiSvgModule
|
|
859
|
-
],
|
|
860
|
-
declarations: [CuiContextMenuComponent],
|
|
861
|
-
exports: [CuiContextMenuComponent]
|
|
862
|
-
}]
|
|
772
|
+
args: [{ selector: CUI_ROOT_SELECTOR, changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], template: "<div class=\"c-content\">\n <ng-content />\n</div>\n<cui-dialogs />\n<cui-alerts />\n", styles: [".c-content{isolation:isolate}\n"] }]
|
|
863
773
|
}] });
|
|
864
774
|
|
|
865
|
-
const CUI_DIALOGS = cuiCreateToken(new BehaviorSubject([]));
|
|
866
|
-
const CUI_DIALOG_DEFAULT_OPTIONS = {
|
|
867
|
-
size: 'auto',
|
|
868
|
-
data: undefined
|
|
869
|
-
};
|
|
870
|
-
const CUI_DIALOG_OPTIONS = cuiCreateToken(CUI_DIALOG_DEFAULT_OPTIONS);
|
|
871
|
-
const CUI_DIALOG_CONTEXT = new InjectionToken('');
|
|
872
|
-
|
|
873
775
|
const ContentType = {
|
|
874
776
|
String: 'string',
|
|
875
777
|
Template: 'template',
|
|
@@ -937,32 +839,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
937
839
|
args: ['document:keydown.escape', ['$event']]
|
|
938
840
|
}] } });
|
|
939
841
|
|
|
940
|
-
class CuiDialogsComponent {
|
|
941
|
-
constructor() {
|
|
942
|
-
this.destroy$ = inject(CuiDestroyService, { self: true });
|
|
943
|
-
this.dialogs$ = inject(CUI_DIALOGS);
|
|
944
|
-
}
|
|
945
|
-
ngOnInit() {
|
|
946
|
-
this.initDialogInjectorsSubscription();
|
|
947
|
-
}
|
|
948
|
-
trackByFn(_, dialog) {
|
|
949
|
-
return dialog.id;
|
|
950
|
-
}
|
|
951
|
-
initDialogInjectorsSubscription() {
|
|
952
|
-
this.dialogs$
|
|
953
|
-
.pipe(takeUntil(this.destroy$))
|
|
954
|
-
.subscribe(dialogs => this.dialogInjectors = dialogs.map(useValue => Injector.create({
|
|
955
|
-
providers: [{ provide: CUI_DIALOG_CONTEXT, useValue }]
|
|
956
|
-
})));
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
CuiDialogsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
960
|
-
CuiDialogsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiDialogsComponent, selector: "cui-dialogs", providers: [CuiDestroyService], ngImport: i0, template: "<ng-container *cuiLet=\"dialogs$ | async as dialogs\">\n <ng-container *ngFor=\"let dialog of dialogs; let i = index; trackBy: trackByFn\">\n <ng-container *ngComponentOutlet=\"dialog.component; injector: dialogInjectors[i]\"></ng-container>\n </ng-container>\n <div\n *ngIf=\"dialogs!.length\"\n class=\"c-overlay\"\n ></div>\n</ng-container>\n", styles: [".c-overlay{position:fixed;inset:0;background:var(--cui-base-900);opacity:.3}\n"], dependencies: [{ kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.CuiLetDirective, selector: "[cuiLet]", inputs: ["cuiLet"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
961
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogsComponent, decorators: [{
|
|
962
|
-
type: Component,
|
|
963
|
-
args: [{ selector: 'cui-dialogs', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], template: "<ng-container *cuiLet=\"dialogs$ | async as dialogs\">\n <ng-container *ngFor=\"let dialog of dialogs; let i = index; trackBy: trackByFn\">\n <ng-container *ngComponentOutlet=\"dialog.component; injector: dialogInjectors[i]\"></ng-container>\n </ng-container>\n <div\n *ngIf=\"dialogs!.length\"\n class=\"c-overlay\"\n ></div>\n</ng-container>\n", styles: [".c-overlay{position:fixed;inset:0;background:var(--cui-base-900);opacity:.3}\n"] }]
|
|
964
|
-
}] });
|
|
965
|
-
|
|
966
842
|
class CuiDialogActionsComponent {
|
|
967
843
|
}
|
|
968
844
|
CuiDialogActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -1042,6 +918,176 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1042
918
|
}]
|
|
1043
919
|
}] });
|
|
1044
920
|
|
|
921
|
+
class CuiRootModule {
|
|
922
|
+
}
|
|
923
|
+
CuiRootModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
924
|
+
CuiRootModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiRootModule, declarations: [CuiRootComponent], imports: [CommonModule,
|
|
925
|
+
CuiDialogModule,
|
|
926
|
+
CuiAlertModule], exports: [CuiRootComponent] });
|
|
927
|
+
CuiRootModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootModule, imports: [CommonModule,
|
|
928
|
+
CuiDialogModule,
|
|
929
|
+
CuiAlertModule] });
|
|
930
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootModule, decorators: [{
|
|
931
|
+
type: NgModule,
|
|
932
|
+
args: [{
|
|
933
|
+
imports: [
|
|
934
|
+
CommonModule,
|
|
935
|
+
CuiDialogModule,
|
|
936
|
+
CuiAlertModule
|
|
937
|
+
],
|
|
938
|
+
declarations: [CuiRootComponent],
|
|
939
|
+
exports: [CuiRootComponent]
|
|
940
|
+
}]
|
|
941
|
+
}] });
|
|
942
|
+
|
|
943
|
+
class CuiContextMenuComponent {
|
|
944
|
+
constructor() {
|
|
945
|
+
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
946
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
947
|
+
this.document = inject(DOCUMENT);
|
|
948
|
+
this.documentElement = this.document.documentElement;
|
|
949
|
+
this.window = inject(CUI_WINDOW);
|
|
950
|
+
this.destroy$ = inject(CuiDestroyService, { self: true });
|
|
951
|
+
this.cuiClickOutsideDirective = inject(CuiClickOutsideDirective, { self: true });
|
|
952
|
+
this.cuiTargetDirective = inject(CuiTargetDirective, { self: true });
|
|
953
|
+
this.EXTRA_OFFSET_LEFT = 0;
|
|
954
|
+
this.EXTRA_OFFSET_TOP = 0;
|
|
955
|
+
this.isVisible = false;
|
|
956
|
+
}
|
|
957
|
+
ngOnInit() {
|
|
958
|
+
this.initClickOutsideSubscription();
|
|
959
|
+
}
|
|
960
|
+
ngAfterViewInit() {
|
|
961
|
+
this.initTargetElementListener();
|
|
962
|
+
}
|
|
963
|
+
onSelect(item) {
|
|
964
|
+
this.close();
|
|
965
|
+
item.command?.();
|
|
966
|
+
}
|
|
967
|
+
onClose() {
|
|
968
|
+
this.close();
|
|
969
|
+
}
|
|
970
|
+
onStopClickPropagation(event) {
|
|
971
|
+
event.stopPropagation();
|
|
972
|
+
}
|
|
973
|
+
trackByFn(_, item) {
|
|
974
|
+
return item.label;
|
|
975
|
+
}
|
|
976
|
+
initClickOutsideSubscription() {
|
|
977
|
+
this.cuiClickOutsideDirective.cuiClickOutside
|
|
978
|
+
.pipe(takeUntil(this.destroy$))
|
|
979
|
+
.subscribe((target) => {
|
|
980
|
+
if (this.target.contains(target)) {
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
this.close();
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
initTargetElementListener() {
|
|
987
|
+
this.targetEventListener = (event) => {
|
|
988
|
+
event.stopPropagation();
|
|
989
|
+
this.document.body.click();
|
|
990
|
+
this.isVisible = !this.isVisible;
|
|
991
|
+
this.viewContainerRef.clear();
|
|
992
|
+
if (this.isVisible) {
|
|
993
|
+
this.renderList();
|
|
994
|
+
this.changePosition(event.clientX, event.clientY);
|
|
995
|
+
this.initHidingSubscription();
|
|
996
|
+
}
|
|
997
|
+
this.changeDetectorRef.markForCheck();
|
|
998
|
+
};
|
|
999
|
+
this.cuiTargetDirective.clicked
|
|
1000
|
+
.pipe(takeUntil(this.destroy$))
|
|
1001
|
+
.subscribe(this.targetEventListener);
|
|
1002
|
+
}
|
|
1003
|
+
initHidingSubscription() {
|
|
1004
|
+
this.initHidingFromWindowEvent('scroll');
|
|
1005
|
+
this.initHidingFromWindowEvent('resize');
|
|
1006
|
+
}
|
|
1007
|
+
initHidingFromWindowEvent(eventName) {
|
|
1008
|
+
fromEvent(this.window, eventName)
|
|
1009
|
+
.pipe(take(1))
|
|
1010
|
+
.subscribe(() => {
|
|
1011
|
+
this.close();
|
|
1012
|
+
this.changeDetectorRef.markForCheck();
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
close() {
|
|
1016
|
+
this.isVisible = false;
|
|
1017
|
+
this.viewContainerRef.clear();
|
|
1018
|
+
}
|
|
1019
|
+
renderList() {
|
|
1020
|
+
const embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.list);
|
|
1021
|
+
this.node = embeddedViewRef.rootNodes[0];
|
|
1022
|
+
embeddedViewRef.detectChanges();
|
|
1023
|
+
this.document.querySelector(CUI_ROOT_SELECTOR).appendChild(this.node);
|
|
1024
|
+
}
|
|
1025
|
+
changePosition(x, y) {
|
|
1026
|
+
setTimeout(() => {
|
|
1027
|
+
const { clientWidth, clientHeight } = this.documentElement;
|
|
1028
|
+
const width = this.node.offsetWidth;
|
|
1029
|
+
const height = this.node.offsetHeight;
|
|
1030
|
+
let left = x;
|
|
1031
|
+
let top = y;
|
|
1032
|
+
if (left + width > clientWidth) {
|
|
1033
|
+
left -= width;
|
|
1034
|
+
}
|
|
1035
|
+
if (top + height > clientHeight) {
|
|
1036
|
+
top -= height;
|
|
1037
|
+
}
|
|
1038
|
+
left = Math.max(left, this.EXTRA_OFFSET_LEFT);
|
|
1039
|
+
top = Math.max(top, this.EXTRA_OFFSET_TOP);
|
|
1040
|
+
this.node.style.left = left + 'px';
|
|
1041
|
+
this.node.style.top = top + 'px';
|
|
1042
|
+
this.changeDetectorRef.markForCheck();
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
CuiContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1047
|
+
CuiContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiContextMenuComponent, selector: "cui-context-menu[items][target]", inputs: { items: "items", target: "target" }, host: { listeners: { "window:resize": "onClose()", "click": "onStopClickPropagation($event)" } }, providers: [CuiDestroyService], viewQueries: [{ propertyName: "list", first: true, predicate: ["list"], descendants: true }], hostDirectives: [{ directive: i2.CuiClickOutsideDirective }, { directive: i2.CuiTargetDirective, inputs: ["ccTarget", "target"] }], ngImport: i0, template: "<ng-template #list>\n <div class=\"c-container\">\n <ul\n *ngIf=\"isVisible\"\n class=\"c-ul\"\n >\n <li\n *ngFor=\"let item of items; trackBy: trackByFn\"\n [style.color]=\"item.color\"\n >\n <button\n type=\"button\"\n class=\"c-button\"\n (click)=\"onSelect(item)\"\n >\n <cui-svg\n *ngIf=\"item.icon\"\n [icon]=\"item.icon\"\n [color]=\"item.color\"\n ></cui-svg>\n <span>{{ item.label }}</span>\n </button>\n </li>\n </ul>\n </div>\n</ng-template>\n", styles: [":host{display:none}.c-container{position:fixed;width:268px;border-radius:8px}.c-ul{padding:7px 0;margin:0;list-style:none;font-weight:400;font-size:14px;line-height:20px;box-shadow:0 1px 4px #0000000a,0 1px 4px #0000000a;border:1px solid var(--cui-base-200);border-radius:inherit;background:var(--cui-base-0);color:var(--cui-base-900);font-family:var(--cui-main-font)}.c-button{padding:8px 11px 8px 0;border:0;flex-shrink:0;outline:none;cursor:pointer;appearance:none;color:inherit;font:inherit;background:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent;padding:8px 11px;width:100%;display:flex;align-items:center;gap:12px}.c-button:active{background:var(--cui-base-50)}@media (hover: hover){.c-button:hover{background:var(--cui-base-50)}}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CuiSvgComponent, selector: "cui-svg[icon]", inputs: ["width", "height", "strokeWidth", "color", "icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1048
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuComponent, decorators: [{
|
|
1049
|
+
type: Component,
|
|
1050
|
+
args: [{ selector: 'cui-context-menu[items][target]', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], hostDirectives: [
|
|
1051
|
+
CuiClickOutsideDirective,
|
|
1052
|
+
{
|
|
1053
|
+
directive: CuiTargetDirective,
|
|
1054
|
+
inputs: ['ccTarget: target']
|
|
1055
|
+
}
|
|
1056
|
+
], template: "<ng-template #list>\n <div class=\"c-container\">\n <ul\n *ngIf=\"isVisible\"\n class=\"c-ul\"\n >\n <li\n *ngFor=\"let item of items; trackBy: trackByFn\"\n [style.color]=\"item.color\"\n >\n <button\n type=\"button\"\n class=\"c-button\"\n (click)=\"onSelect(item)\"\n >\n <cui-svg\n *ngIf=\"item.icon\"\n [icon]=\"item.icon\"\n [color]=\"item.color\"\n ></cui-svg>\n <span>{{ item.label }}</span>\n </button>\n </li>\n </ul>\n </div>\n</ng-template>\n", styles: [":host{display:none}.c-container{position:fixed;width:268px;border-radius:8px}.c-ul{padding:7px 0;margin:0;list-style:none;font-weight:400;font-size:14px;line-height:20px;box-shadow:0 1px 4px #0000000a,0 1px 4px #0000000a;border:1px solid var(--cui-base-200);border-radius:inherit;background:var(--cui-base-0);color:var(--cui-base-900);font-family:var(--cui-main-font)}.c-button{padding:8px 11px 8px 0;border:0;flex-shrink:0;outline:none;cursor:pointer;appearance:none;color:inherit;font:inherit;background:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent;padding:8px 11px;width:100%;display:flex;align-items:center;gap:12px}.c-button:active{background:var(--cui-base-50)}@media (hover: hover){.c-button:hover{background:var(--cui-base-50)}}\n"] }]
|
|
1057
|
+
}], propDecorators: { items: [{
|
|
1058
|
+
type: Input
|
|
1059
|
+
}], target: [{
|
|
1060
|
+
type: Input
|
|
1061
|
+
}], list: [{
|
|
1062
|
+
type: ViewChild,
|
|
1063
|
+
args: ['list']
|
|
1064
|
+
}], onClose: [{
|
|
1065
|
+
type: HostListener,
|
|
1066
|
+
args: ['window:resize']
|
|
1067
|
+
}], onStopClickPropagation: [{
|
|
1068
|
+
type: HostListener,
|
|
1069
|
+
args: ['click', ['$event']]
|
|
1070
|
+
}] } });
|
|
1071
|
+
|
|
1072
|
+
class CuiContextMenuModule {
|
|
1073
|
+
}
|
|
1074
|
+
CuiContextMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1075
|
+
CuiContextMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuModule, declarations: [CuiContextMenuComponent], imports: [CommonModule,
|
|
1076
|
+
CuiSvgModule], exports: [CuiContextMenuComponent] });
|
|
1077
|
+
CuiContextMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuModule, imports: [CommonModule,
|
|
1078
|
+
CuiSvgModule] });
|
|
1079
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuModule, decorators: [{
|
|
1080
|
+
type: NgModule,
|
|
1081
|
+
args: [{
|
|
1082
|
+
imports: [
|
|
1083
|
+
CommonModule,
|
|
1084
|
+
CuiSvgModule
|
|
1085
|
+
],
|
|
1086
|
+
declarations: [CuiContextMenuComponent],
|
|
1087
|
+
exports: [CuiContextMenuComponent]
|
|
1088
|
+
}]
|
|
1089
|
+
}] });
|
|
1090
|
+
|
|
1045
1091
|
class CuiFormFieldComponent {
|
|
1046
1092
|
}
|
|
1047
1093
|
CuiFormFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -1814,55 +1860,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1814
1860
|
}]
|
|
1815
1861
|
}] });
|
|
1816
1862
|
|
|
1817
|
-
class CuiRootComponent {
|
|
1818
|
-
constructor() {
|
|
1819
|
-
this.document = inject(DOCUMENT);
|
|
1820
|
-
this.theme$ = inject(CuiThemeService);
|
|
1821
|
-
this.destroy$ = inject(CuiDestroyService);
|
|
1822
|
-
}
|
|
1823
|
-
ngOnInit() {
|
|
1824
|
-
this.initThemeSubscription();
|
|
1825
|
-
}
|
|
1826
|
-
initThemeSubscription() {
|
|
1827
|
-
this.theme$
|
|
1828
|
-
.pipe(takeUntil(this.destroy$))
|
|
1829
|
-
.subscribe(theme => this.document.documentElement.setAttribute('cuiTheme', theme));
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
CuiRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1833
|
-
CuiRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiRootComponent, selector: "cui-root", providers: [CuiDestroyService], ngImport: i0, template: "<div class=\"c-content\">\n <ng-content />\n</div>\n<cui-dialogs />\n<cui-alerts />\n", styles: [".c-content{isolation:isolate}\n"], dependencies: [{ kind: "component", type: CuiDialogsComponent, selector: "cui-dialogs" }, { kind: "component", type: CuiAlertsComponent, selector: "cui-alerts" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1834
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootComponent, decorators: [{
|
|
1835
|
-
type: Component,
|
|
1836
|
-
args: [{ selector: 'cui-root', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], template: "<div class=\"c-content\">\n <ng-content />\n</div>\n<cui-dialogs />\n<cui-alerts />\n", styles: [".c-content{isolation:isolate}\n"] }]
|
|
1837
|
-
}] });
|
|
1838
|
-
|
|
1839
|
-
class CuiRootModule {
|
|
1840
|
-
}
|
|
1841
|
-
CuiRootModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1842
|
-
CuiRootModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiRootModule, declarations: [CuiRootComponent], imports: [CommonModule,
|
|
1843
|
-
CuiDialogModule,
|
|
1844
|
-
CuiAlertModule], exports: [CuiRootComponent] });
|
|
1845
|
-
CuiRootModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootModule, imports: [CommonModule,
|
|
1846
|
-
CuiDialogModule,
|
|
1847
|
-
CuiAlertModule] });
|
|
1848
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiRootModule, decorators: [{
|
|
1849
|
-
type: NgModule,
|
|
1850
|
-
args: [{
|
|
1851
|
-
imports: [
|
|
1852
|
-
CommonModule,
|
|
1853
|
-
CuiDialogModule,
|
|
1854
|
-
CuiAlertModule
|
|
1855
|
-
],
|
|
1856
|
-
declarations: [CuiRootComponent],
|
|
1857
|
-
exports: [CuiRootComponent]
|
|
1858
|
-
}]
|
|
1859
|
-
}] });
|
|
1860
|
-
|
|
1861
1863
|
class CuiSelectComponent {
|
|
1862
1864
|
constructor() {
|
|
1863
1865
|
this.element = inject(ElementRef).nativeElement;
|
|
1864
1866
|
this.document = inject(DOCUMENT);
|
|
1865
1867
|
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
1868
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
1866
1869
|
this.destroy$ = inject(CuiDestroyService, { self: true });
|
|
1867
1870
|
this.cuiTextFieldController = inject(CUI_TEXT_FIELD_CONTROLLER);
|
|
1868
1871
|
this.cuiClickOutsideDirective = inject(CuiClickOutsideDirective, { self: true });
|
|
@@ -1924,6 +1927,10 @@ class CuiSelectComponent {
|
|
|
1924
1927
|
onClose() {
|
|
1925
1928
|
this.close();
|
|
1926
1929
|
}
|
|
1930
|
+
onWindowResize() {
|
|
1931
|
+
this.button.nativeElement.blur();
|
|
1932
|
+
this.close();
|
|
1933
|
+
}
|
|
1927
1934
|
initClickOutsideSubscription() {
|
|
1928
1935
|
this.cuiClickOutsideDirective.cuiClickOutside
|
|
1929
1936
|
.pipe(takeUntil(this.destroy$))
|
|
@@ -1936,38 +1943,64 @@ class CuiSelectComponent {
|
|
|
1936
1943
|
}
|
|
1937
1944
|
open() {
|
|
1938
1945
|
this.isOpened = true;
|
|
1939
|
-
const { bottom: elementRectBottom } = this.element.getBoundingClientRect();
|
|
1946
|
+
const { top: elementRectTop, left: elementRectLeft, bottom: elementRectBottom } = this.element.getBoundingClientRect();
|
|
1940
1947
|
const distanceToBottom = this.document.documentElement.clientHeight
|
|
1941
1948
|
- (elementRectBottom + this.SPACE_BETWEEN_BUTTON_AND_OPTIONS);
|
|
1949
|
+
const embeddedViewRef = this.viewContainerRef.createEmbeddedView(this.optionsWrapper);
|
|
1950
|
+
const node = embeddedViewRef.rootNodes[0];
|
|
1951
|
+
const nodeStyles = node.style;
|
|
1942
1952
|
this.isOptionsListAbove = distanceToBottom < this.getOptionsListHeightContainer.nativeElement.offsetHeight;
|
|
1953
|
+
embeddedViewRef.detectChanges();
|
|
1954
|
+
nodeStyles.width = this.element.offsetWidth + 'px';
|
|
1955
|
+
nodeStyles.left = window.scrollX + elementRectLeft + 'px';
|
|
1956
|
+
if (this.isOptionsListAbove) {
|
|
1957
|
+
nodeStyles.top = window.scrollY + elementRectTop
|
|
1958
|
+
- this.getOptionsListHeightContainer.nativeElement.offsetHeight
|
|
1959
|
+
- this.SPACE_BETWEEN_BUTTON_AND_OPTIONS
|
|
1960
|
+
+ 'px';
|
|
1961
|
+
}
|
|
1962
|
+
else {
|
|
1963
|
+
nodeStyles.top = window.scrollY + elementRectBottom + this.SPACE_BETWEEN_BUTTON_AND_OPTIONS + 'px';
|
|
1964
|
+
}
|
|
1965
|
+
this.document.querySelector(CUI_ROOT_SELECTOR).appendChild(embeddedViewRef.rootNodes[0]);
|
|
1943
1966
|
}
|
|
1944
1967
|
close() {
|
|
1945
1968
|
this.isOpened = false;
|
|
1969
|
+
this.viewContainerRef.clear();
|
|
1946
1970
|
}
|
|
1947
1971
|
}
|
|
1948
1972
|
CuiSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1949
|
-
CuiSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiSelectComponent, selector: "cui-select[options]", inputs: { options: "options", defaultOptionText: "defaultOptionText" }, host: { properties: { "style.--c-gap": "this.gap" } }, providers: [
|
|
1973
|
+
CuiSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: CuiSelectComponent, selector: "cui-select[options]", inputs: { options: "options", defaultOptionText: "defaultOptionText" }, host: { listeners: { "window:resize": "onWindowResize()" }, properties: { "style.--c-gap": "this.gap" } }, providers: [
|
|
1950
1974
|
CUI_TEXT_FILED_CONTROLLER_PROVIDER,
|
|
1951
1975
|
cuiProvide(NG_VALUE_ACCESSOR, CuiSelectComponent, true),
|
|
1952
1976
|
CuiDestroyService
|
|
1953
|
-
], viewQueries: [{ propertyName: "getOptionsListHeightContainer", first: true, predicate: ["getOptionsListHeightContainer"], descendants: true }], hostDirectives: [{ directive: i2.CuiClickOutsideDirective }], ngImport: i0, template: "<button\n type=\"button\"\n [attr.id]=\"id\"\n [attr.data-size]=\"size\"\n [disabled]=\"isDisabled\"\n class=\"c-button\"\n [class.c-button_with-error]=\"isError\"\n (click)=\"onSwitch()\"\n>\n <ng-container *ngIf=\"selectedOption; else placeholderTemplate\">\n {{ selectedOption.label }}\n </ng-container>\n <ng-template #placeholderTemplate>\n <span class=\"c-placeholder\">{{ placeholder }}</span>\n </ng-template>\n <cui-svg\n icon=\"cuiIconChevronDown\"\n color=\"var(--cui-base-500)\"\n />\n</button>\n<
|
|
1977
|
+
], viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true }, { propertyName: "getOptionsListHeightContainer", first: true, predicate: ["getOptionsListHeightContainer"], descendants: true }, { propertyName: "optionsWrapper", first: true, predicate: ["optionsWrapper"], descendants: true }], hostDirectives: [{ directive: i2.CuiClickOutsideDirective }], ngImport: i0, template: "<button\n #button\n type=\"button\"\n [attr.id]=\"id\"\n [attr.data-size]=\"size\"\n [disabled]=\"isDisabled\"\n class=\"c-button\"\n [class.c-button_active]=\"isOpened\"\n [class.c-button_with-error]=\"isError\"\n (click)=\"onSwitch()\"\n>\n <ng-container *ngIf=\"selectedOption; else placeholderTemplate\">\n {{ selectedOption.label }}\n </ng-container>\n <ng-template #placeholderTemplate>\n <span class=\"c-placeholder\">{{ placeholder }}</span>\n </ng-template>\n <cui-svg\n icon=\"cuiIconChevronDown\"\n color=\"var(--cui-base-500)\"\n />\n</button>\n<ng-template #optionsWrapper>\n <div\n class=\"c-options__wrapper\"\n [class.c-options__wrapper_top]=\"isOptionsListAbove\"\n >\n <ng-container *ngTemplateOutlet=\"optionsList\"/>\n </div>\n</ng-template>\n<div\n #getOptionsListHeightContainer\n class=\"c-get-options-list-height-container\"\n>\n <ng-container *ngTemplateOutlet=\"optionsList\"/>\n</div>\n<ng-template #optionsList>\n <ul\n class=\"c-options\"\n [class.c-options_top]=\"isOptionsListAbove\"\n >\n <ng-container *ngIf=\"options.length; else empty\">\n <li *ngFor=\"let option of options; trackBy: trackByFn\">\n <button\n type=\"button\"\n class=\"c-option-button\"\n [class.c-option-button_selected]=\"selectedOption === option\"\n (click)=\"onSelect(option)\"\n >\n <span>{{ option.label }}</span>\n <cui-svg\n *ngIf=\"selectedOption === option\"\n icon=\"cuiIconCheckSm\"\n color=\"var(--cui-info)\"\n class=\"c-option-button__icon\"\n />\n </button>\n </li>\n </ng-container>\n <ng-template #empty>\n <li *ngIf=\"defaultOptionText\">\n <button\n type=\"button\"\n class=\"c-option-button\"\n (click)=\"onClose()\"\n >\n {{ defaultOptionText }}\n </button>\n </li>\n </ng-template>\n </ul>\n</ng-template>\n", styles: [":host{display:block;font-family:var(--cui-main-font);position:relative}.c-button{border:0;flex-shrink:0;outline:none;appearance:none;color:inherit;font:inherit;background:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent;padding:0 13px;font-weight:400;font-size:14px;line-height:20px;display:flex;justify-content:space-between;align-items:center;gap:8px;width:100%;border:1px solid var(--cui-base-200);border-radius:8px;cursor:pointer;background:var(--cui-input);color:var(--cui-base-900);font-family:var(--cui-main-font)}.c-button:hover{border-color:var(--cui-base-300)}.c-button_active.c-button_active,.c-button:focus{box-shadow:0 0 0 2px var(--cui-focus);border-color:var(--cui-info)}.c-button:disabled{cursor:not-allowed;opacity:.5;background:var(--cui-base-50);border-color:var(--cui-base-200)}.c-button[data-size=sm]{padding-top:7px;padding-bottom:7px}.c-button[data-size=md]{padding-top:8px;padding-bottom:8px}.c-button_with-error{border-color:var(--cui-danger)}.c-button_with-error:focus{box-shadow:0 0 0 2px #d92d2040;border-color:var(--cui-danger)}.c-placeholder{color:var(--cui-base-400)}.c-options__wrapper{position:absolute;font-family:var(--cui-main-font)}.c-get-options-list-height-container{position:fixed;visibility:hidden}.c-options{padding:7px 0;margin:0;list-style:none;font-weight:400;font-size:14px;line-height:20px;box-shadow:0 1px 4px #0000000a,0 1px 4px #0000000a;overflow:auto;max-height:180px;border:1px solid var(--cui-base-200);border-radius:8px;background:var(--cui-base-0);color:var(--cui-base-900)}.c-option-button{padding:8px 11px 8px 0;border:0;flex-shrink:0;outline:none;cursor:pointer;appearance:none;color:inherit;font:inherit;background:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent;padding:8px 11px;width:100%;display:flex;align-items:center;gap:12px}.c-option-button:active{background:var(--cui-base-50)}@media (hover: hover){.c-option-button:hover{background:var(--cui-base-50)}}.c-option-button_selected{background:var(--cui-base-50)}.c-option-button__icon{margin-left:auto}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CuiSvgComponent, selector: "cui-svg[icon]", inputs: ["width", "height", "strokeWidth", "color", "icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1954
1978
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiSelectComponent, decorators: [{
|
|
1955
1979
|
type: Component,
|
|
1956
1980
|
args: [{ selector: 'cui-select[options]', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1957
1981
|
CUI_TEXT_FILED_CONTROLLER_PROVIDER,
|
|
1958
1982
|
cuiProvide(NG_VALUE_ACCESSOR, CuiSelectComponent, true),
|
|
1959
1983
|
CuiDestroyService
|
|
1960
|
-
], hostDirectives: [CuiClickOutsideDirective], template: "<button\n type=\"button\"\n [attr.id]=\"id\"\n [attr.data-size]=\"size\"\n [disabled]=\"isDisabled\"\n class=\"c-button\"\n [class.c-button_with-error]=\"isError\"\n (click)=\"onSwitch()\"\n>\n <ng-container *ngIf=\"selectedOption; else placeholderTemplate\">\n {{ selectedOption.label }}\n </ng-container>\n <ng-template #placeholderTemplate>\n <span class=\"c-placeholder\">{{ placeholder }}</span>\n </ng-template>\n <cui-svg\n icon=\"cuiIconChevronDown\"\n color=\"var(--cui-base-500)\"\n />\n</button>\n<
|
|
1984
|
+
], hostDirectives: [CuiClickOutsideDirective], template: "<button\n #button\n type=\"button\"\n [attr.id]=\"id\"\n [attr.data-size]=\"size\"\n [disabled]=\"isDisabled\"\n class=\"c-button\"\n [class.c-button_active]=\"isOpened\"\n [class.c-button_with-error]=\"isError\"\n (click)=\"onSwitch()\"\n>\n <ng-container *ngIf=\"selectedOption; else placeholderTemplate\">\n {{ selectedOption.label }}\n </ng-container>\n <ng-template #placeholderTemplate>\n <span class=\"c-placeholder\">{{ placeholder }}</span>\n </ng-template>\n <cui-svg\n icon=\"cuiIconChevronDown\"\n color=\"var(--cui-base-500)\"\n />\n</button>\n<ng-template #optionsWrapper>\n <div\n class=\"c-options__wrapper\"\n [class.c-options__wrapper_top]=\"isOptionsListAbove\"\n >\n <ng-container *ngTemplateOutlet=\"optionsList\"/>\n </div>\n</ng-template>\n<div\n #getOptionsListHeightContainer\n class=\"c-get-options-list-height-container\"\n>\n <ng-container *ngTemplateOutlet=\"optionsList\"/>\n</div>\n<ng-template #optionsList>\n <ul\n class=\"c-options\"\n [class.c-options_top]=\"isOptionsListAbove\"\n >\n <ng-container *ngIf=\"options.length; else empty\">\n <li *ngFor=\"let option of options; trackBy: trackByFn\">\n <button\n type=\"button\"\n class=\"c-option-button\"\n [class.c-option-button_selected]=\"selectedOption === option\"\n (click)=\"onSelect(option)\"\n >\n <span>{{ option.label }}</span>\n <cui-svg\n *ngIf=\"selectedOption === option\"\n icon=\"cuiIconCheckSm\"\n color=\"var(--cui-info)\"\n class=\"c-option-button__icon\"\n />\n </button>\n </li>\n </ng-container>\n <ng-template #empty>\n <li *ngIf=\"defaultOptionText\">\n <button\n type=\"button\"\n class=\"c-option-button\"\n (click)=\"onClose()\"\n >\n {{ defaultOptionText }}\n </button>\n </li>\n </ng-template>\n </ul>\n</ng-template>\n", styles: [":host{display:block;font-family:var(--cui-main-font);position:relative}.c-button{border:0;flex-shrink:0;outline:none;appearance:none;color:inherit;font:inherit;background:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent;padding:0 13px;font-weight:400;font-size:14px;line-height:20px;display:flex;justify-content:space-between;align-items:center;gap:8px;width:100%;border:1px solid var(--cui-base-200);border-radius:8px;cursor:pointer;background:var(--cui-input);color:var(--cui-base-900);font-family:var(--cui-main-font)}.c-button:hover{border-color:var(--cui-base-300)}.c-button_active.c-button_active,.c-button:focus{box-shadow:0 0 0 2px var(--cui-focus);border-color:var(--cui-info)}.c-button:disabled{cursor:not-allowed;opacity:.5;background:var(--cui-base-50);border-color:var(--cui-base-200)}.c-button[data-size=sm]{padding-top:7px;padding-bottom:7px}.c-button[data-size=md]{padding-top:8px;padding-bottom:8px}.c-button_with-error{border-color:var(--cui-danger)}.c-button_with-error:focus{box-shadow:0 0 0 2px #d92d2040;border-color:var(--cui-danger)}.c-placeholder{color:var(--cui-base-400)}.c-options__wrapper{position:absolute;font-family:var(--cui-main-font)}.c-get-options-list-height-container{position:fixed;visibility:hidden}.c-options{padding:7px 0;margin:0;list-style:none;font-weight:400;font-size:14px;line-height:20px;box-shadow:0 1px 4px #0000000a,0 1px 4px #0000000a;overflow:auto;max-height:180px;border:1px solid var(--cui-base-200);border-radius:8px;background:var(--cui-base-0);color:var(--cui-base-900)}.c-option-button{padding:8px 11px 8px 0;border:0;flex-shrink:0;outline:none;cursor:pointer;appearance:none;color:inherit;font:inherit;background:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent;padding:8px 11px;width:100%;display:flex;align-items:center;gap:12px}.c-option-button:active{background:var(--cui-base-50)}@media (hover: hover){.c-option-button:hover{background:var(--cui-base-50)}}.c-option-button_selected{background:var(--cui-base-50)}.c-option-button__icon{margin-left:auto}\n"] }]
|
|
1961
1985
|
}], propDecorators: { options: [{
|
|
1962
1986
|
type: Input
|
|
1963
1987
|
}], defaultOptionText: [{
|
|
1964
1988
|
type: Input
|
|
1989
|
+
}], button: [{
|
|
1990
|
+
type: ViewChild,
|
|
1991
|
+
args: ['button']
|
|
1965
1992
|
}], getOptionsListHeightContainer: [{
|
|
1966
1993
|
type: ViewChild,
|
|
1967
1994
|
args: ['getOptionsListHeightContainer']
|
|
1995
|
+
}], optionsWrapper: [{
|
|
1996
|
+
type: ViewChild,
|
|
1997
|
+
args: ['optionsWrapper']
|
|
1968
1998
|
}], gap: [{
|
|
1969
1999
|
type: HostBinding,
|
|
1970
2000
|
args: ['style.--c-gap']
|
|
2001
|
+
}], onWindowResize: [{
|
|
2002
|
+
type: HostListener,
|
|
2003
|
+
args: ['window:resize']
|
|
1971
2004
|
}] } });
|
|
1972
2005
|
|
|
1973
2006
|
class CuiSelectModule {
|
|
@@ -2062,5 +2095,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2062
2095
|
* Generated bundle index. Do not edit.
|
|
2063
2096
|
*/
|
|
2064
2097
|
|
|
2065
|
-
export { CUI_ALERTS, CUI_ALERT_CONTEXT, CUI_ALERT_DEFAULT_OPTIONS, CUI_ALERT_OPTIONS, CUI_BANNER_DEFAULT_OPTIONS, CUI_BANNER_OPTIONS, CUI_BUTTON_DEFAULT_OPTIONS, CUI_BUTTON_OPTIONS, CUI_DEFAULT_THEME, CUI_DIALOGS, CUI_DIALOG_CONTEXT, CUI_DIALOG_DEFAULT_OPTIONS, CUI_DIALOG_OPTIONS, CUI_NOTIFICATION_DEFAULT_OPTIONS, CUI_NOTIFICATION_OPTIONS, CUI_TEXT_FIELD_CONTROLLER, CUI_TEXT_FIELD_ICON_LEFT, CUI_TEXT_FIELD_ID, CUI_TEXT_FIELD_IS_ERROR, CUI_TEXT_FIELD_PLACEHOLDER, CUI_TEXT_FIELD_SIZE, CUI_TEXT_FILED_CONTROLLER_PROVIDER, CUI_THEME, CUI_THEME_STORAGE_DEFAULT_KEY, CUI_THEME_STORAGE_KEY, ContentType, CuiAccordionComponent, CuiAccordionItemComponent, CuiAccordionModule, CuiAlertComponent, CuiAlertModule, CuiAlertService, CuiAlertsComponent, CuiBadgeComponent, CuiBadgeModule, CuiBannerComponent, CuiBannerModule, CuiBreadcrumbComponent, CuiBreadcrumbsComponent, CuiBreadcrumbsModule, CuiButtonComponent, CuiButtonGroupComponent, CuiButtonGroupModule, CuiButtonModule, CuiCheckboxComponent, CuiCheckboxModule, CuiContextMenuComponent, CuiContextMenuModule, CuiDialogActionsComponent, CuiDialogComponent, CuiDialogHeaderComponent, CuiDialogModule, CuiDialogService, CuiDialogsComponent, CuiFormFieldComponent, CuiFormFieldModule, CuiHintComponent, CuiHintModule, CuiIconButtonComponent, CuiIconButtonModule, CuiInputModule, CuiInputNumberComponent, CuiInputNumberModule, CuiInputPasswordComponent, CuiInputPasswordModule, CuiInputTextComponent, CuiLabelComponent, CuiLabelModule, CuiNotificationComponent, CuiNotificationModule, CuiRadioComponent, CuiRadioModule, CuiRootComponent, CuiRootModule, CuiSelectComponent, CuiSelectModule, CuiSvgComponent, CuiSvgModule, CuiTextFieldController, CuiTextFieldControllerModule, CuiTextFieldIconLeftDirective, CuiTextFieldIdDirective, CuiTextFieldIsErrorDirective, CuiTextFieldPlaceholderDirective, CuiTextFieldSizeDirective, CuiTextareaComponent, CuiTextareaModule, CuiThemeService, CuiToggleComponent, CuiToggleModule, cuiRemoveSpaces, cuiReplace };
|
|
2098
|
+
export { CUI_ALERTS, CUI_ALERT_CONTEXT, CUI_ALERT_DEFAULT_OPTIONS, CUI_ALERT_OPTIONS, CUI_BANNER_DEFAULT_OPTIONS, CUI_BANNER_OPTIONS, CUI_BUTTON_DEFAULT_OPTIONS, CUI_BUTTON_OPTIONS, CUI_DEFAULT_THEME, CUI_DIALOGS, CUI_DIALOG_CONTEXT, CUI_DIALOG_DEFAULT_OPTIONS, CUI_DIALOG_OPTIONS, CUI_NOTIFICATION_DEFAULT_OPTIONS, CUI_NOTIFICATION_OPTIONS, CUI_ROOT_SELECTOR, CUI_TEXT_FIELD_CONTROLLER, CUI_TEXT_FIELD_ICON_LEFT, CUI_TEXT_FIELD_ID, CUI_TEXT_FIELD_IS_ERROR, CUI_TEXT_FIELD_PLACEHOLDER, CUI_TEXT_FIELD_SIZE, CUI_TEXT_FILED_CONTROLLER_PROVIDER, CUI_THEME, CUI_THEME_STORAGE_DEFAULT_KEY, CUI_THEME_STORAGE_KEY, ContentType, CuiAccordionComponent, CuiAccordionItemComponent, CuiAccordionModule, CuiAlertComponent, CuiAlertModule, CuiAlertService, CuiAlertsComponent, CuiBadgeComponent, CuiBadgeModule, CuiBannerComponent, CuiBannerModule, CuiBreadcrumbComponent, CuiBreadcrumbsComponent, CuiBreadcrumbsModule, CuiButtonComponent, CuiButtonGroupComponent, CuiButtonGroupModule, CuiButtonModule, CuiCheckboxComponent, CuiCheckboxModule, CuiContextMenuComponent, CuiContextMenuModule, CuiDialogActionsComponent, CuiDialogComponent, CuiDialogHeaderComponent, CuiDialogModule, CuiDialogService, CuiDialogsComponent, CuiFormFieldComponent, CuiFormFieldModule, CuiHintComponent, CuiHintModule, CuiIconButtonComponent, CuiIconButtonModule, CuiInputModule, CuiInputNumberComponent, CuiInputNumberModule, CuiInputPasswordComponent, CuiInputPasswordModule, CuiInputTextComponent, CuiLabelComponent, CuiLabelModule, CuiNotificationComponent, CuiNotificationModule, CuiRadioComponent, CuiRadioModule, CuiRootComponent, CuiRootModule, CuiSelectComponent, CuiSelectModule, CuiSvgComponent, CuiSvgModule, CuiTextFieldController, CuiTextFieldControllerModule, CuiTextFieldIconLeftDirective, CuiTextFieldIdDirective, CuiTextFieldIsErrorDirective, CuiTextFieldPlaceholderDirective, CuiTextFieldSizeDirective, CuiTextareaComponent, CuiTextareaModule, CuiThemeService, CuiToggleComponent, CuiToggleModule, cuiRemoveSpaces, cuiReplace };
|
|
2066
2099
|
//# sourceMappingURL=cuby-ui-core.mjs.map
|