c3-components 0.10.2 → 0.11.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.
@@ -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,102 @@ 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
+ }
2193
+ clickItem(event, route) {
2194
+ if (this.selectedElement !== event.target.parentElement.parentElement &&
2195
+ event.target.parentElement.parentElement.tagName === "LI")
2196
+ this.setSelectedItem(event.target.parentElement.parentElement);
2197
+ }
2198
+ setSelectedItem(element) {
2199
+ if (this.selectedElement)
2200
+ this.selectedElement.classList.remove("active-item");
2201
+ this.selectedElement = element;
2202
+ this.selectedElement.classList.add("active-item");
2203
+ }
2204
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2205
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuService, providedIn: 'root' }); }
2206
+ }
2207
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuService, decorators: [{
2208
+ type: Injectable,
2209
+ args: [{
2210
+ providedIn: 'root'
2211
+ }]
2212
+ }], ctorParameters: () => [] });
2213
+
2214
+ class C3MenuComponent {
2215
+ constructor() {
2216
+ this._c3Menu = inject(C3MenuService);
2217
+ }
2218
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2219
+ 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"] }] }); }
2220
+ }
2221
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuComponent, decorators: [{
2222
+ type: Component,
2223
+ 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"] }]
2224
+ }] });
2225
+
2226
+ class C3NavItemComponent {
2227
+ constructor() {
2228
+ this.route = input.required();
2229
+ this.itemTitle = input.required();
2230
+ this.check = input(null);
2231
+ this.isExternal = input(false);
2232
+ this.element = viewChild('button', {
2233
+ read: (ElementRef),
2234
+ });
2235
+ this._menu = inject(C3MenuService);
2236
+ this.destroyRef = inject(DestroyRef);
2237
+ this.currentRouteChangeSubscription = signal(null);
2238
+ effect(() => {
2239
+ if (!this.currentRouteChangeSubscription() && this.element()) {
2240
+ const subscribtion = this._menu.currentRouteChange
2241
+ .pipe(startWith(this._menu.currentRoute()), map((url) => url), takeUntilDestroyed(this.destroyRef))
2242
+ .subscribe((url) => {
2243
+ const _regex = new RegExp(this.check() || this.route());
2244
+ console.log(_regex, url);
2245
+ if (_regex.exec(url) && this.element())
2246
+ this._menu.setSelectedItem(this.element().nativeElement);
2247
+ });
2248
+ this.currentRouteChangeSubscription.set(subscribtion);
2249
+ }
2250
+ });
2251
+ }
2252
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3NavItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2253
+ 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"] }] }); }
2254
+ }
2255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3NavItemComponent, decorators: [{
2256
+ type: Component,
2257
+ 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"] }]
2258
+ }], ctorParameters: () => [] });
2259
+
2260
+ class C3MenuModule {
2261
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2262
+ 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] }); }
2263
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuModule, imports: [CommonModule, RouterModule, MatRippleModule] }); }
2264
+ }
2265
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3MenuModule, decorators: [{
2266
+ type: NgModule,
2267
+ args: [{
2268
+ imports: [CommonModule, RouterModule, MatRippleModule],
2269
+ declarations: [C3MenuComponent, C3NavItemComponent],
2270
+ exports: [C3MenuComponent, C3NavItemComponent],
2271
+ providers: [],
2272
+ }]
2273
+ }] });
2274
+
2176
2275
  /*
2177
2276
  * Public API Surface of c3-components
2178
2277
  */
@@ -2181,5 +2280,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
2181
2280
  * Generated bundle index. Do not edit.
2182
2281
  */
2183
2282
 
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 };
2283
+ 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
2284
  //# sourceMappingURL=c3-components.mjs.map