@alauda-fe/dynamic-plugin-shared 0.0.4-alpha.2 → 0.0.4-alpha.3

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.
@@ -10,7 +10,7 @@ import { dissocPath, converge, mergeAll, mergeDeepRight, path, assocPath, identi
10
10
  import { compare } from 'compare-versions';
11
11
  export { compareVersions as compareVersionToNum, satisfies as satisfiesVersion } from 'compare-versions';
12
12
  import * as i0 from '@angular/core';
13
- import { inject, Directive, NgZone, Injectable, IterableDiffers, isDevMode, Pipe, ChangeDetectorRef, Input, ViewContainerRef, TemplateRef, ɵstringify as _stringify, ElementRef, ComponentFactoryResolver, HostBinding, ChangeDetectionStrategy, Component, EventEmitter, Output, HostListener, Inject, Host, booleanAttribute, forwardRef, ContentChild, Optional, ViewEncapsulation, ViewChild, Injector, ApplicationRef, ViewChildren, ContentChildren, InjectionToken, input, NgModule, computed } from '@angular/core';
13
+ import { inject, Directive, NgZone, Injectable, IterableDiffers, isDevMode, Pipe, ChangeDetectorRef, Input, ViewContainerRef, TemplateRef, ɵstringify as _stringify, ElementRef, ComponentFactoryResolver, Injector, runInInjectionContext, HostBinding, ChangeDetectionStrategy, Component, EventEmitter, Output, HostListener, Inject, Host, booleanAttribute, forwardRef, ContentChild, Optional, ViewEncapsulation, ViewChild, ApplicationRef, ViewChildren, ContentChildren, InjectionToken, input, NgModule, computed } from '@angular/core';
14
14
  import parser from 'cron-parser';
15
15
  import dayjs from 'dayjs';
16
16
  import timezone from 'dayjs/plugin/timezone';
@@ -3367,6 +3367,7 @@ class ReadonlyFieldDirective {
3367
3367
  this.control = inject(NgControl);
3368
3368
  this.cfr = inject(ComponentFactoryResolver);
3369
3369
  this.viewContainerRef = inject(ViewContainerRef);
3370
+ this.injector = inject(Injector);
3370
3371
  // 仅考虑当前control,子control无法知晓父FormItemControl元素 ,包裹了多少个control,以及各自处于什么状态,该情况自行处理
3371
3372
  this.controlDirective = inject(FormItemControlDirective, {
3372
3373
  optional: true,
@@ -3392,7 +3393,9 @@ class ReadonlyFieldDirective {
3392
3393
  // formControl will compose multi validators to 1, no matter defined in template nor FormBuilder
3393
3394
  const { validator, asyncValidator } = controlEntity;
3394
3395
  this.isControlRequired = this.controlDirective?.required || false;
3395
- const portalOutlet = new CdkPortalOutlet(this.cfr, this.viewContainerRef);
3396
+ const portalOutlet = runInInjectionContext(this.injector, () => {
3397
+ return new CdkPortalOutlet(this.cfr, this.viewContainerRef);
3398
+ });
3396
3399
  const portal = this.template
3397
3400
  ? new TemplatePortal(this.template, this.viewContainerRef, this.templateContext)
3398
3401
  : new ComponentPortal(SpanComponent, this.viewContainerRef);