@cuby-ui/core 0.0.49 → 0.0.51
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 +4 -5
- package/esm2020/components/context-menu/context-menu.component.mjs +14 -11
- package/fesm2015/cuby-ui-core.mjs +13 -10
- package/fesm2015/cuby-ui-core.mjs.map +1 -1
- package/fesm2020/cuby-ui-core.mjs +13 -10
- package/fesm2020/cuby-ui-core.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/theme.scss +11 -0
- package/styles/variables/colors.scss +11 -0
|
@@ -5,7 +5,7 @@ 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, CuiClickOutsideDirective, cuiProvide, CuiAutoResizingDirective } from '@cuby-ui/cdk';
|
|
8
|
+
import { cuiCreateToken, cuiCreateTokenFromFactory, CuiDestroyService, CuiLetDirective, CuiFilterPipe, CuiPopoverService, CUI_LOCAL_STORAGE, CuiItemDirective, CuiClickOutsideDirective, CuiTargetDirective, cuiProvide, CuiAutoResizingDirective } from '@cuby-ui/cdk';
|
|
9
9
|
import { BehaviorSubject, takeUntil } from 'rxjs';
|
|
10
10
|
import * as i2$1 from '@angular/forms';
|
|
11
11
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
@@ -727,6 +727,7 @@ class CuiContextMenuComponent {
|
|
|
727
727
|
this.documentElement = this.document.documentElement;
|
|
728
728
|
this.destroy$ = inject(CuiDestroyService, { self: true });
|
|
729
729
|
this.cuiClickOutsideDirective = inject(CuiClickOutsideDirective, { self: true });
|
|
730
|
+
this.cuiTargetDirective = inject(CuiTargetDirective, { self: true });
|
|
730
731
|
this.EXTRA_OFFSET_LEFT = 0;
|
|
731
732
|
this.EXTRA_OFFSET_TOP = 0;
|
|
732
733
|
this.isVisible = false;
|
|
@@ -738,9 +739,6 @@ class CuiContextMenuComponent {
|
|
|
738
739
|
ngAfterViewInit() {
|
|
739
740
|
this.initTargetElementListener();
|
|
740
741
|
}
|
|
741
|
-
ngOnDestroy() {
|
|
742
|
-
this.destroyTargetElementListener();
|
|
743
|
-
}
|
|
744
742
|
onSelect(item) {
|
|
745
743
|
this.isVisible = false;
|
|
746
744
|
item.command?.();
|
|
@@ -772,10 +770,9 @@ class CuiContextMenuComponent {
|
|
|
772
770
|
}
|
|
773
771
|
this.changeDetectorRef.markForCheck();
|
|
774
772
|
};
|
|
775
|
-
this.
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
this.target.removeEventListener('click', this.targetEventListener);
|
|
773
|
+
this.cuiTargetDirective.clicked
|
|
774
|
+
.pipe(takeUntil(this.destroy$))
|
|
775
|
+
.subscribe(this.targetEventListener);
|
|
779
776
|
}
|
|
780
777
|
changePosition(x, y) {
|
|
781
778
|
this.isHidden = true;
|
|
@@ -801,10 +798,16 @@ class CuiContextMenuComponent {
|
|
|
801
798
|
}
|
|
802
799
|
}
|
|
803
800
|
CuiContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
804
|
-
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:scroll": "onClose()", "window:resize": "onClose()", "click": "onStopClickPropagation($event)" }, properties: { "class._hidden": "this.isHidden", "style.left.px": "this.clientX", "style.top.px": "this.clientY" } }, providers: [CuiDestroyService], hostDirectives: [{ directive: i2.CuiClickOutsideDirective }], ngImport: i0, 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;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 });
|
|
801
|
+
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:scroll": "onClose()", "window:resize": "onClose()", "click": "onStopClickPropagation($event)" }, properties: { "class._hidden": "this.isHidden", "style.left.px": "this.clientX", "style.top.px": "this.clientY" } }, providers: [CuiDestroyService], hostDirectives: [{ directive: i2.CuiClickOutsideDirective }, { directive: i2.CuiTargetDirective, inputs: ["ccTarget", "target"] }], ngImport: i0, 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;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 });
|
|
805
802
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContextMenuComponent, decorators: [{
|
|
806
803
|
type: Component,
|
|
807
|
-
args: [{ selector: 'cui-context-menu[items][target]', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], hostDirectives: [
|
|
804
|
+
args: [{ selector: 'cui-context-menu[items][target]', changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiDestroyService], hostDirectives: [
|
|
805
|
+
CuiClickOutsideDirective,
|
|
806
|
+
{
|
|
807
|
+
directive: CuiTargetDirective,
|
|
808
|
+
inputs: ['ccTarget: target']
|
|
809
|
+
}
|
|
810
|
+
], 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;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"] }]
|
|
808
811
|
}], propDecorators: { items: [{
|
|
809
812
|
type: Input
|
|
810
813
|
}], target: [{
|