Browse Source

core module standalone migration

migrating-abp-packages/core
erdemcaygor 1 year ago
parent
commit
d487efc6cc
  1. 1
      npm/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts
  2. 3
      npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts
  3. 3
      npm/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts
  4. 2
      npm/ng-packs/packages/core/src/lib/components/router-outlet.component.ts
  5. 13
      npm/ng-packs/packages/core/src/lib/core.module.ts
  6. 1
      npm/ng-packs/packages/core/src/lib/pipes/safe-html.pipe.ts
  7. 33
      npm/ng-packs/packages/core/src/lib/pipes/short-date-time.pipe.ts
  8. 33
      npm/ng-packs/packages/core/src/lib/pipes/short-date.pipe.ts
  9. 33
      npm/ng-packs/packages/core/src/lib/pipes/short-time.pipe.ts
  10. 1
      npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts
  11. 1
      npm/ng-packs/packages/core/src/lib/pipes/to-injector.pipe.ts

1
npm/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts

@ -3,7 +3,6 @@ import { ControlValueAccessor } from '@angular/forms';
// Not an abstract class on purpose. Do not change!
@Component({
standalone: false,
template: '',
})
export class AbstractNgModelComponent<T = any, U = T> implements ControlValueAccessor {

3
npm/ng-packs/packages/core/src/lib/components/dynamic-layout.component.ts

@ -12,9 +12,9 @@ import { findRoute, getRoutePath } from '../utils/route-utils';
import { TreeNode } from '../utils/tree-utils';
import { DYNAMIC_LAYOUTS_TOKEN } from '../tokens/dynamic-layout.token';
import { EnvironmentService } from '../services';
import { CommonModule } from '@angular/common';
@Component({
standalone: false,
selector: 'abp-dynamic-layout',
template: `
@if (isLayoutVisible) {
@ -22,6 +22,7 @@ import { EnvironmentService } from '../services';
}
`,
providers: [SubscriptionService],
imports: [CommonModule],
})
export class DynamicLayoutComponent implements OnInit {
layout?: Type<any>;

3
npm/ng-packs/packages/core/src/lib/components/replaceable-route-container.component.ts

@ -4,14 +4,15 @@ import { distinctUntilChanged } from 'rxjs/operators';
import { ReplaceableComponents } from '../models/replaceable-components';
import { ReplaceableComponentsService } from '../services/replaceable-components.service';
import { SubscriptionService } from '../services/subscription.service';
import { CommonModule } from '@angular/common';
@Component({
standalone: false,
selector: 'abp-replaceable-route-container',
template: `
<ng-container *ngComponentOutlet="externalComponent || defaultComponent"></ng-container>
`,
providers: [SubscriptionService],
imports: [CommonModule],
})
export class ReplaceableRouteContainerComponent implements OnInit {
defaultComponent!: Type<any>;

2
npm/ng-packs/packages/core/src/lib/components/router-outlet.component.ts

@ -2,9 +2,9 @@ import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
@Component({
standalone: false,
selector: 'abp-router-outlet',
template: ` <router-outlet></router-outlet> `,
imports: [RouterModule],
})
export class RouterOutletComponent {}

13
npm/ng-packs/packages/core/src/lib/core.module.ts

@ -73,19 +73,18 @@ const standaloneDirectives = [
RouterModule,
LocalizationModule,
...standaloneDirectives,
],
declarations: [
AbstractNgModelComponent,
DynamicLayoutComponent,
ReplaceableRouteContainerComponent,
RouterOutletComponent,
SortPipe,
SafeHtmlPipe,
ToInjectorPipe,
ShortDateTimePipe,
ShortTimePipe,
ShortDatePipe,
SafeHtmlPipe,
SortPipe,
ToInjectorPipe,
RouterOutletComponent,
AbstractNgModelComponent,
],
declarations: [],
providers: [LocalizationPipe, provideHttpClient(withInterceptorsFromDi())],
})
export class BaseCoreModule {}

1
npm/ng-packs/packages/core/src/lib/pipes/safe-html.pipe.ts

@ -3,7 +3,6 @@ import { DomSanitizer } from '@angular/platform-browser';
@Injectable()
@Pipe({
standalone: false,
name: 'abpSafeHtml',
})
export class SafeHtmlPipe implements PipeTransform {

33
npm/ng-packs/packages/core/src/lib/pipes/short-date-time.pipe.ts

@ -4,30 +4,31 @@ import { ConfigStateService } from '../services';
import { getShortDateShortTimeFormat } from '../utils/date-utils';
@Pipe({
standalone: false,
name: 'shortDateTime',
pure: true,
})
export class ShortDateTimePipe extends DatePipe implements PipeTransform {
constructor(private configStateService: ConfigStateService,
constructor(
private configStateService: ConfigStateService,
@Inject(LOCALE_ID) locale: string,
@Inject(DATE_PIPE_DEFAULT_TIMEZONE) @Optional() defaultTimezone?: string|null
) {
super(locale, defaultTimezone)
@Inject(DATE_PIPE_DEFAULT_TIMEZONE) @Optional() defaultTimezone?: string | null,
) {
super(locale, defaultTimezone);
}
transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
transform(
value: Date | string | number,
format?: string,
timezone?: string,
locale?: string,
): string | null;
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
transform(
value: string|number|Date|null|undefined, timezone?: string,
locale?: string): string|null {
const format = getShortDateShortTimeFormat(this.configStateService);
return super.transform(value,format,timezone,locale)
value: string | number | Date | null | undefined,
timezone?: string,
locale?: string,
): string | null {
const format = getShortDateShortTimeFormat(this.configStateService);
return super.transform(value, format, timezone, locale);
}
}

33
npm/ng-packs/packages/core/src/lib/pipes/short-date.pipe.ts

@ -4,30 +4,31 @@ import { ConfigStateService } from '../services';
import { getShortDateFormat } from '../utils/date-utils';
@Pipe({
standalone: false,
name: 'shortDate',
pure: true,
})
export class ShortDatePipe extends DatePipe implements PipeTransform {
constructor(private configStateService: ConfigStateService,
constructor(
private configStateService: ConfigStateService,
@Inject(LOCALE_ID) locale: string,
@Inject(DATE_PIPE_DEFAULT_TIMEZONE) @Optional() defaultTimezone?: string|null
) {
super(locale, defaultTimezone)
@Inject(DATE_PIPE_DEFAULT_TIMEZONE) @Optional() defaultTimezone?: string | null,
) {
super(locale, defaultTimezone);
}
transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
transform(
value: Date | string | number,
format?: string,
timezone?: string,
locale?: string,
): string | null;
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
transform(
value: string|number|Date|null|undefined, timezone?: string,
locale?: string): string|null {
const format = getShortDateFormat(this.configStateService);
return super.transform(value,format,timezone,locale)
value: string | number | Date | null | undefined,
timezone?: string,
locale?: string,
): string | null {
const format = getShortDateFormat(this.configStateService);
return super.transform(value, format, timezone, locale);
}
}

33
npm/ng-packs/packages/core/src/lib/pipes/short-time.pipe.ts

@ -4,30 +4,31 @@ import { ConfigStateService } from '../services';
import { getShortTimeFormat } from '../utils/date-utils';
@Pipe({
standalone: false,
name: 'shortTime',
pure: true,
})
export class ShortTimePipe extends DatePipe implements PipeTransform {
constructor(private configStateService: ConfigStateService,
constructor(
private configStateService: ConfigStateService,
@Inject(LOCALE_ID) locale: string,
@Inject(DATE_PIPE_DEFAULT_TIMEZONE) @Optional() defaultTimezone?: string|null
) {
super(locale, defaultTimezone)
@Inject(DATE_PIPE_DEFAULT_TIMEZONE) @Optional() defaultTimezone?: string | null,
) {
super(locale, defaultTimezone);
}
transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null;
transform(
value: Date | string | number,
format?: string,
timezone?: string,
locale?: string,
): string | null;
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null;
transform(
value: string|number|Date|null|undefined, timezone?: string,
locale?: string): string|null {
const format = getShortTimeFormat(this.configStateService);
return super.transform(value,format,timezone,locale)
value: string | number | Date | null | undefined,
timezone?: string,
locale?: string,
): string | null {
const format = getShortTimeFormat(this.configStateService);
return super.transform(value, format, timezone, locale);
}
}

1
npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts

@ -3,7 +3,6 @@ export type SortOrder = 'asc' | 'desc';
@Injectable()
@Pipe({
standalone: false,
name: 'abpSort',
})
export class SortPipe implements PipeTransform {

1
npm/ng-packs/packages/core/src/lib/pipes/to-injector.pipe.ts

@ -5,7 +5,6 @@ export const INJECTOR_PIPE_DATA_TOKEN = new InjectionToken<PipeTransform>(
);
@Pipe({
standalone: false,
name: 'toInjector',
})
export class ToInjectorPipe implements PipeTransform {

Loading…
Cancel
Save