@smartsoft001/angular 2.190.0 → 2.192.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 { inject, Injectable, InjectionToken, ApplicationRef, NgModuleRef, PLATFORM_ID, Inject, signal, input, output, computed, Directive, ElementRef, ChangeDetectionStrategy, ViewEncapsulation, Component, afterRenderEffect, viewChild, EnvironmentInjector, createComponent, NgModule, ViewContainerRef, HostListener, Pipe, Type, model, ChangeDetectorRef, Injector, effect, runInInjectionContext, forwardRef, linkedSignal, untracked, Renderer2, DestroyRef, afterNextRender } from '@angular/core';
2
+ import { inject, Injectable, InjectionToken, ApplicationRef, NgModuleRef, PLATFORM_ID, Inject, signal, input, output, computed, Directive, ElementRef, ChangeDetectionStrategy, ViewEncapsulation, Component, afterRenderEffect, viewChild, EnvironmentInjector, createComponent, NgModule, ViewContainerRef, HostListener, Pipe, Type, model, ChangeDetectorRef, Injector, effect, runInInjectionContext, forwardRef, linkedSignal, untracked, DestroyRef, Renderer2, afterNextRender } from '@angular/core';
3
3
  import { Title, DomSanitizer } from '@angular/platform-browser';
4
4
  import { Router, NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
5
5
  import * as i1 from '@ngx-translate/core';
@@ -942,7 +942,9 @@ class CalendarService {
942
942
  const calendar = [firstMonth];
943
943
  const currentDate = moment().clone();
944
944
  const dateYearAgo = currentDate.clone().subtract(2, 'year');
945
- while (date.isSameOrAfter(dateYearAgo)) {
945
+ // Compared by month: at millisecond precision the outcome depended on
946
+ // whether the two moment() calls landed in the same millisecond.
947
+ while (date.isAfter(dateYearAgo, 'month')) {
946
948
  // creating one year calendar
947
949
  calendar.unshift(this.previousMonth());
948
950
  }
@@ -10347,6 +10349,38 @@ class DrawerComponent {
10347
10349
  ...(ngDevMode ? [{ debugName: "componentInputs" }] : /* istanbul ignore next */ []));
10348
10350
  outlet = viewChild(NgComponentOutlet, /* @ts-ignore */
10349
10351
  ...(ngDevMode ? [{ debugName: "outlet" }] : /* istanbul ignore next */ []));
10352
+ /** The wrapper's `<ng-content>`, captured once for whichever branch renders. */
10353
+ contentTemplate = viewChild.required('content', /* @ts-ignore */
10354
+ ...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
10355
+ destroyRef = inject(DestroyRef);
10356
+ renderer = inject(Renderer2);
10357
+ projectedNodes;
10358
+ /**
10359
+ * The projected content as `NgComponentOutlet` content, so an implementation
10360
+ * registered through `DRAWER_STANDARD_COMPONENT_TOKEN` receives it in its
10361
+ * (default) `<ng-content>` slot.
10362
+ *
10363
+ * The outlet takes DOM nodes, not a template, so the content template is
10364
+ * rendered once into a detached view, destroyed with the wrapper. That view
10365
+ * only holds the `<ng-content>` instruction: the projected nodes belong to
10366
+ * the host's view, which keeps change-detecting them. Its root nodes are
10367
+ * moved into a single `display: contents` element, and that element is what
10368
+ * gets projected: the implementation moves just that node in and out when it
10369
+ * shows or hides its slot (e.g. on open / close), and control flow at the root
10370
+ * of the content keeps inserting its nodes next to its anchor inside it.
10371
+ * Memoised, because a new array makes the outlet re-create the component.
10372
+ */
10373
+ projectedContent() {
10374
+ if (!this.projectedNodes) {
10375
+ const view = this.contentTemplate().createEmbeddedView(undefined);
10376
+ const slot = this.renderer.createElement('div');
10377
+ this.renderer.setStyle(slot, 'display', 'contents');
10378
+ view.rootNodes.forEach((node) => this.renderer.appendChild(slot, node));
10379
+ this.destroyRef.onDestroy(() => view.destroy());
10380
+ this.projectedNodes = [[slot]];
10381
+ }
10382
+ return this.projectedNodes;
10383
+ }
10350
10384
  constructor() {
10351
10385
  forwardOutletOutputs(this.outlet, {
10352
10386
  open: this.open,
@@ -10354,10 +10388,15 @@ class DrawerComponent {
10354
10388
  });
10355
10389
  }
10356
10390
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: DrawerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
10357
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: DrawerComponent, isStandalone: true, selector: "smart-drawer", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, cssClass: { classPropertyName: "cssClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", closed: "closed" }, host: { classAttribute: "smart:contents" }, viewQueries: [{ propertyName: "outlet", first: true, predicate: NgComponentOutlet, descendants: true, isSignal: true }], ngImport: i0, template: `
10391
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: DrawerComponent, isStandalone: true, selector: "smart-drawer", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, cssClass: { classPropertyName: "cssClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", closed: "closed" }, host: { classAttribute: "smart:contents" }, viewQueries: [{ propertyName: "outlet", first: true, predicate: NgComponentOutlet, descendants: true, isSignal: true }, { propertyName: "contentTemplate", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
10392
+ <ng-template #content><ng-content /></ng-template>
10358
10393
  @if (componentType()) {
10359
10394
  <ng-container
10360
- *ngComponentOutlet="componentType(); inputs: componentInputs()"
10395
+ *ngComponentOutlet="
10396
+ componentType();
10397
+ inputs: componentInputs();
10398
+ content: projectedContent()
10399
+ "
10361
10400
  />
10362
10401
  } @else {
10363
10402
  <smart-drawer-standard
@@ -10367,19 +10406,24 @@ class DrawerComponent {
10367
10406
  [class]="cssClass()"
10368
10407
  (closed)="closed.emit()"
10369
10408
  >
10370
- <ng-content />
10409
+ <ng-container [ngTemplateOutlet]="content" />
10371
10410
  </smart-drawer-standard>
10372
10411
  }
10373
- `, isInline: true, dependencies: [{ kind: "component", type: DrawerStandardComponent, selector: "smart-drawer-standard" }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
10412
+ `, isInline: true, dependencies: [{ kind: "component", type: DrawerStandardComponent, selector: "smart-drawer-standard" }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
10374
10413
  }
10375
10414
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: DrawerComponent, decorators: [{
10376
10415
  type: Component,
10377
10416
  args: [{
10378
10417
  selector: 'smart-drawer',
10379
10418
  template: `
10419
+ <ng-template #content><ng-content /></ng-template>
10380
10420
  @if (componentType()) {
10381
10421
  <ng-container
10382
- *ngComponentOutlet="componentType(); inputs: componentInputs()"
10422
+ *ngComponentOutlet="
10423
+ componentType();
10424
+ inputs: componentInputs();
10425
+ content: projectedContent()
10426
+ "
10383
10427
  />
10384
10428
  } @else {
10385
10429
  <smart-drawer-standard
@@ -10389,16 +10433,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
10389
10433
  [class]="cssClass()"
10390
10434
  (closed)="closed.emit()"
10391
10435
  >
10392
- <ng-content />
10436
+ <ng-container [ngTemplateOutlet]="content" />
10393
10437
  </smart-drawer-standard>
10394
10438
  }
10395
10439
  `,
10396
10440
  encapsulation: ViewEncapsulation.None,
10397
- imports: [DrawerStandardComponent, NgComponentOutlet],
10441
+ imports: [DrawerStandardComponent, NgComponentOutlet, NgTemplateOutlet],
10398
10442
  host: { class: 'smart:contents' },
10399
10443
  changeDetection: ChangeDetectionStrategy.OnPush,
10400
10444
  }]
10401
- }], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], cssClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], outlet: [{ type: i0.ViewChild, args: [i0.forwardRef(() => NgComponentOutlet), { isSignal: true }] }] } });
10445
+ }], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], cssClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], outlet: [{ type: i0.ViewChild, args: [i0.forwardRef(() => NgComponentOutlet), { isSignal: true }] }], contentTemplate: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }] } });
10402
10446
 
10403
10447
  class DropdownBaseComponent {
10404
10448
  static smartType = 'dropdown';