c3-components 0.10.0 → 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.
@@ -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) {
@@ -636,6 +639,7 @@ class C3DialogTemplateComponent {
636
639
  this.templateRef = viewChild('internalTemplate', {
637
640
  read: TemplateRef,
638
641
  });
642
+ this.dialogRef = signal(null);
639
643
  }
640
644
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3DialogTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
641
645
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.4", type: C3DialogTemplateComponent, isStandalone: false, selector: "c3-dialog-template", viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["internalTemplate"], descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<ng-template #internalTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] }); }
@@ -825,7 +829,8 @@ class C3OpenDialogDirective {
825
829
  openDialog($event) {
826
830
  if (!this.template()?.templateRef())
827
831
  return;
828
- this._dialog.createDialogFromTemplate(this.template().templateRef());
832
+ const dialog = this._dialog.createDialogFromTemplate(this.template().templateRef());
833
+ this.template()?.dialogRef.set(dialog);
829
834
  }
830
835
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: C3OpenDialogDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
831
836
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.4", type: C3OpenDialogDirective, isStandalone: false, selector: "[c3-dialog]", inputs: { template: { classPropertyName: "template", publicName: "c3-dialog", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "openDialog($event)" } }, ngImport: i0 }); }
@@ -2171,6 +2176,103 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
2171
2176
  }]
2172
2177
  }] });
2173
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
+
2174
2276
  /*
2175
2277
  * Public API Surface of c3-components
2176
2278
  */
@@ -2179,5 +2281,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
2179
2281
  * Generated bundle index. Do not edit.
2180
2282
  */
2181
2283
 
2182
- 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 };
2183
2285
  //# sourceMappingURL=c3-components.mjs.map