c3-components 0.10.2 → 0.11.0
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/c3-components.mjs +103 -3
- package/fesm2022/c3-components.mjs.map +1 -1
- package/lib/c3-menu/c3-menu.module.d.ts +11 -0
- package/lib/c3-menu/components/c3-menu/c3-menu.component.d.ts +7 -0
- package/lib/c3-menu/components/c3-menu/c3-menu.component.scss +3 -0
- package/lib/c3-menu/components/c3-nav-item/c3-nav-item.component.d.ts +14 -0
- package/lib/c3-menu/components/c3-nav-item/c3-nav-item.component.scss +3 -0
- package/lib/c3-menu/services/c3-menu.service.d.ts +15 -0
- package/lib/c3-menu/styles/_c3-menu.scss +108 -0
- package/lib/c3-styles/_c3-core.scss +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +6 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { TemplateRef, Component, ViewChild, Input, forwardRef, Directive, HostListener, NgModule, Inject, signal, ViewContainerRef, viewChild, inject, Injector, effect, Injectable, input, Pipe, EventEmitter, Output, ViewEncapsulation, Optional, output, computed, HostBinding, model, ElementRef, contentChild, contentChildren } from '@angular/core';
|
|
2
|
+
import { TemplateRef, Component, ViewChild, Input, forwardRef, Directive, HostListener, NgModule, Inject, signal, ViewContainerRef, viewChild, inject, Injector, effect, Injectable, input, Pipe, EventEmitter, Output, ViewEncapsulation, Optional, output, computed, HostBinding, model, ElementRef, contentChild, contentChildren, DestroyRef } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2$1 from '@angular/forms';
|
|
@@ -8,7 +8,7 @@ import * as i1$1 from '@angular/cdk/overlay';
|
|
|
8
8
|
import { OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
9
9
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
10
10
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
11
|
-
import { Subscription, Subject, merge, takeUntil, BehaviorSubject, filter, skip, debounceTime, mergeMap, tap, of, map } from 'rxjs';
|
|
11
|
+
import { Subscription, Subject, merge, takeUntil, BehaviorSubject, filter, skip, debounceTime, mergeMap, tap, of, map, startWith } from 'rxjs';
|
|
12
12
|
import * as i1$2 from '@angular/material/dialog';
|
|
13
13
|
import { MAT_DIALOG_DATA, MatDialog, MatDialogModule } from '@angular/material/dialog';
|
|
14
14
|
import * as i2 from '@angular/material/button';
|
|
@@ -38,6 +38,9 @@ import * as i4 from '@angular/material/progress-spinner';
|
|
|
38
38
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
39
39
|
import * as i1$5 from '@angular/material/tree';
|
|
40
40
|
import { MatTreeFlattener, MatTreeFlatDataSource, MatTreeModule } from '@angular/material/tree';
|
|
41
|
+
import * as i1$6 from '@angular/router';
|
|
42
|
+
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
|
43
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
41
44
|
|
|
42
45
|
class C3DropdownComponent {
|
|
43
46
|
constructor(_changeDetectorRef) {
|
|
@@ -2173,6 +2176,103 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
2173
2176
|
}]
|
|
2174
2177
|
}] });
|
|
2175
2178
|
|
|
2179
|
+
class C3MenuService {
|
|
2180
|
+
constructor() {
|
|
2181
|
+
this.selectedElement = null;
|
|
2182
|
+
this.currentRoute = signal('');
|
|
2183
|
+
this.isHeadless = signal(false);
|
|
2184
|
+
this._router = inject(Router);
|
|
2185
|
+
this._ar = inject(ActivatedRoute);
|
|
2186
|
+
this.currentRoute.set(this._router.routerState.snapshot.url);
|
|
2187
|
+
this.currentRouteChange = this._router.events.pipe(filter((status) => status.urlAfterRedirects !== undefined && status.state === undefined), map((status) => {
|
|
2188
|
+
this.currentRoute.set(status.urlAfterRedirects);
|
|
2189
|
+
return status.urlAfterRedirects;
|
|
2190
|
+
}));
|
|
2191
|
+
this.isHeadless.set(this._ar.snapshot.queryParams['headless'] === 'true');
|
|
2192
|
+
console.log(this.isHeadless());
|
|
2193
|
+
}
|
|
2194
|
+
clickItem(event, route) {
|
|
2195
|
+
if (this.selectedElement !== event.target.parentElement.parentElement &&
|
|
2196
|
+
event.target.parentElement.parentElement.tagName === "LI")
|
|
2197
|
+
this.setSelectedItem(event.target.parentElement.parentElement);
|
|
2198
|
+
}
|
|
2199
|
+
setSelectedItem(element) {
|
|
2200
|
+
if (this.selectedElement)
|
|
2201
|
+
this.selectedElement.classList.remove("active-item");
|
|
2202
|
+
this.selectedElement = element;
|
|
2203
|
+
this.selectedElement.classList.add("active-item");
|
|
2204
|
+
}
|
|
2205
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2206
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuService, providedIn: 'root' }); }
|
|
2207
|
+
}
|
|
2208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuService, decorators: [{
|
|
2209
|
+
type: Injectable,
|
|
2210
|
+
args: [{
|
|
2211
|
+
providedIn: 'root'
|
|
2212
|
+
}]
|
|
2213
|
+
}], ctorParameters: () => [] });
|
|
2214
|
+
|
|
2215
|
+
class C3MenuComponent {
|
|
2216
|
+
constructor() {
|
|
2217
|
+
this._c3Menu = inject(C3MenuService);
|
|
2218
|
+
}
|
|
2219
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2220
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: C3MenuComponent, isStandalone: false, selector: "c3-menu", ngImport: i0, template: "@if(!_c3Menu.isHeadless()) {\n <div id=\"app-menu\">\n <div class=\"ui-scroll\">\n <ul>\n <ng-content></ng-content>\n </ul>\n </div>\n </div>\n}\n<div class=\"layout-main\" [class.headless]=\"_c3Menu.isHeadless()\">\n <router-outlet></router-outlet>\n</div>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1$6.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
|
|
2221
|
+
}
|
|
2222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuComponent, decorators: [{
|
|
2223
|
+
type: Component,
|
|
2224
|
+
args: [{ selector: 'c3-menu', standalone: false, template: "@if(!_c3Menu.isHeadless()) {\n <div id=\"app-menu\">\n <div class=\"ui-scroll\">\n <ul>\n <ng-content></ng-content>\n </ul>\n </div>\n </div>\n}\n<div class=\"layout-main\" [class.headless]=\"_c3Menu.isHeadless()\">\n <router-outlet></router-outlet>\n</div>\n", styles: [":host{display:block}\n"] }]
|
|
2225
|
+
}] });
|
|
2226
|
+
|
|
2227
|
+
class C3NavItemComponent {
|
|
2228
|
+
constructor() {
|
|
2229
|
+
this.route = input.required();
|
|
2230
|
+
this.itemTitle = input.required();
|
|
2231
|
+
this.check = input(null);
|
|
2232
|
+
this.isExternal = input(false);
|
|
2233
|
+
this.element = viewChild('button', {
|
|
2234
|
+
read: (ElementRef),
|
|
2235
|
+
});
|
|
2236
|
+
this._menu = inject(C3MenuService);
|
|
2237
|
+
this.destroyRef = inject(DestroyRef);
|
|
2238
|
+
this.currentRouteChangeSubscription = signal(null);
|
|
2239
|
+
effect(() => {
|
|
2240
|
+
if (!this.currentRouteChangeSubscription() && this.element()) {
|
|
2241
|
+
const subscribtion = this._menu.currentRouteChange
|
|
2242
|
+
.pipe(startWith(this._menu.currentRoute()), map((url) => url), takeUntilDestroyed(this.destroyRef))
|
|
2243
|
+
.subscribe((url) => {
|
|
2244
|
+
const _regex = new RegExp(this.check() || this.route());
|
|
2245
|
+
console.log(_regex, url);
|
|
2246
|
+
if (_regex.exec(url) && this.element())
|
|
2247
|
+
this._menu.setSelectedItem(this.element().nativeElement);
|
|
2248
|
+
});
|
|
2249
|
+
this.currentRouteChangeSubscription.set(subscribtion);
|
|
2250
|
+
}
|
|
2251
|
+
});
|
|
2252
|
+
}
|
|
2253
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3NavItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2254
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.4", type: C3NavItemComponent, isStandalone: false, selector: "c3-nav-item", inputs: { route: { classPropertyName: "route", publicName: "route", isSignal: true, isRequired: true, transformFunction: null }, itemTitle: { classPropertyName: "itemTitle", publicName: "itemTitle", isSignal: true, isRequired: true, transformFunction: null }, check: { classPropertyName: "check", publicName: "check", isSignal: true, isRequired: false, transformFunction: null }, isExternal: { classPropertyName: "isExternal", publicName: "isExternal", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "element", first: true, predicate: ["button"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<li #button>\n <a matRipple matRippleColor=\"#ffffff66\" [routerLink]=\"isExternal() ? null : route()\" [href]=\"isExternal() ? route() : null\">\n <ng-content></ng-content>\n <span> {{ itemTitle() }} </span>\n </a>\n</li>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1$6.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i3$1.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }] }); }
|
|
2255
|
+
}
|
|
2256
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3NavItemComponent, decorators: [{
|
|
2257
|
+
type: Component,
|
|
2258
|
+
args: [{ selector: 'c3-nav-item', standalone: false, template: "<li #button>\n <a matRipple matRippleColor=\"#ffffff66\" [routerLink]=\"isExternal() ? null : route()\" [href]=\"isExternal() ? route() : null\">\n <ng-content></ng-content>\n <span> {{ itemTitle() }} </span>\n </a>\n</li>\n", styles: [":host{display:block}\n"] }]
|
|
2259
|
+
}], ctorParameters: () => [] });
|
|
2260
|
+
|
|
2261
|
+
class C3MenuModule {
|
|
2262
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2263
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.4", ngImport: i0, type: C3MenuModule, declarations: [C3MenuComponent, C3NavItemComponent], imports: [CommonModule, RouterModule, MatRippleModule], exports: [C3MenuComponent, C3NavItemComponent] }); }
|
|
2264
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuModule, imports: [CommonModule, RouterModule, MatRippleModule] }); }
|
|
2265
|
+
}
|
|
2266
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuModule, decorators: [{
|
|
2267
|
+
type: NgModule,
|
|
2268
|
+
args: [{
|
|
2269
|
+
imports: [CommonModule, RouterModule, MatRippleModule],
|
|
2270
|
+
declarations: [C3MenuComponent, C3NavItemComponent],
|
|
2271
|
+
exports: [C3MenuComponent, C3NavItemComponent],
|
|
2272
|
+
providers: [],
|
|
2273
|
+
}]
|
|
2274
|
+
}] });
|
|
2275
|
+
|
|
2176
2276
|
/*
|
|
2177
2277
|
* Public API Surface of c3-components
|
|
2178
2278
|
*/
|
|
@@ -2181,5 +2281,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
2181
2281
|
* Generated bundle index. Do not edit.
|
|
2182
2282
|
*/
|
|
2183
2283
|
|
|
2184
|
-
export { C3AlertDialogComponent, C3AutoAnimateDirective, C3DialogEmbedChildComponent, C3DialogModule, C3DialogService, C3DialogTemplateComponent, C3DropdownComponent, C3DropdownModule, C3DropdownTrigger, C3ExpansionComponent, C3ExpansionHeaderComponent, C3ExpansionModule, C3FileDisplayCardComponent, C3FileDisplayGridComponent, C3FileDisplayIconComponent, C3FileDisplayListComponent, C3FileDisplayerModule, C3FileViewer, C3FileViewerComponent, C3FileViewerDialog, C3FileViewerDialogComponent, C3FileViewerModule, C3FlowingMenuComponent, C3FlowingMenuItemComponent, C3FlowingMenuItemContentComponent, C3FlowingMenuModule, C3OpenDialogDirective, C3PreventClickDirective, C3PreventKeyboardEventDirective, C3PromptDialogComponent, C3SafeUrlPipe, C3SelectOnFocusDirective, C3StopPropagationDirective, C3TraceCardAlignLeftDirective, C3TraceCardAlignRightDirective, C3TraceCardComponent, C3TraceCardContentComponent, C3TraceCardModule, C3TraceCardTitleComponent, C3TreeComponent, ConfirmDialogComponent, CustomFileEvent, FullScreenDirective, MAT_DROPDOWN_VALUE_ACCESSOR, booleanSignal };
|
|
2284
|
+
export { C3AlertDialogComponent, C3AutoAnimateDirective, C3DialogEmbedChildComponent, C3DialogModule, C3DialogService, C3DialogTemplateComponent, C3DropdownComponent, C3DropdownModule, C3DropdownTrigger, C3ExpansionComponent, C3ExpansionHeaderComponent, C3ExpansionModule, C3FileDisplayCardComponent, C3FileDisplayGridComponent, C3FileDisplayIconComponent, C3FileDisplayListComponent, C3FileDisplayerModule, C3FileViewer, C3FileViewerComponent, C3FileViewerDialog, C3FileViewerDialogComponent, C3FileViewerModule, C3FlowingMenuComponent, C3FlowingMenuItemComponent, C3FlowingMenuItemContentComponent, C3FlowingMenuModule, C3MenuComponent, C3MenuModule, C3NavItemComponent, C3OpenDialogDirective, C3PreventClickDirective, C3PreventKeyboardEventDirective, C3PromptDialogComponent, C3SafeUrlPipe, C3SelectOnFocusDirective, C3StopPropagationDirective, C3TraceCardAlignLeftDirective, C3TraceCardAlignRightDirective, C3TraceCardComponent, C3TraceCardContentComponent, C3TraceCardModule, C3TraceCardTitleComponent, C3TreeComponent, ConfirmDialogComponent, CustomFileEvent, FullScreenDirective, MAT_DROPDOWN_VALUE_ACCESSOR, booleanSignal };
|
|
2185
2285
|
//# sourceMappingURL=c3-components.mjs.map
|