diff --git a/npm/ng-packs/packages/core/src/lib/core.module.ts b/npm/ng-packs/packages/core/src/lib/core.module.ts index 7529f62c5e..d951f965ee 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -16,7 +16,6 @@ import { InitDirective } from './directives/init.directive'; import { PermissionDirective } from './directives/permission.directive'; import { ReplaceableTemplateDirective } from './directives/replaceable-template.directive'; import { StopPropagationDirective } from './directives/stop-propagation.directive'; -import { VisibilityDirective } from './directives/visibility.directive'; import { OAuthConfigurationHandler } from './handlers/oauth-configuration.handler'; import { RoutesHandler } from './handlers/routes.handler'; import { ApiInterceptor } from './interceptors/api.interceptor'; @@ -24,6 +23,7 @@ import { LocalizationModule } from './localization.module'; import { ABP } from './models/common'; import { LocalizationPipe } from './pipes/localization.pipe'; import { SortPipe } from './pipes/sort.pipe'; +import { CookieLanguageProvider } from './providers/cookie-language.provider'; import { LocaleProvider } from './providers/locale.provider'; import { LocalizationService } from './services/localization.service'; import { oAuthStorage } from './strategies/auth-flow.strategy'; @@ -32,7 +32,6 @@ import { TENANT_KEY } from './tokens/tenant-key.token'; import { noop } from './utils/common-utils'; import './utils/date-extensions'; import { getInitialData, localeInitializer } from './utils/initial-utils'; -import { CookieLanguageProvider } from './providers/cookie-language.provider'; export function storageFactory(): OAuthStorage { return oAuthStorage; @@ -65,7 +64,6 @@ export function storageFactory(): OAuthStorage { RouterOutletComponent, SortPipe, StopPropagationDirective, - VisibilityDirective, ], imports: [ OAuthModule, @@ -90,7 +88,6 @@ export function storageFactory(): OAuthStorage { RouterOutletComponent, SortPipe, StopPropagationDirective, - VisibilityDirective, ], providers: [LocalizationPipe], entryComponents: [ diff --git a/npm/ng-packs/packages/core/src/lib/directives/index.ts b/npm/ng-packs/packages/core/src/lib/directives/index.ts index 3322b14257..8f05e2daae 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/index.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/index.ts @@ -6,4 +6,3 @@ export * from './init.directive'; export * from './permission.directive'; export * from './replaceable-template.directive'; export * from './stop-propagation.directive'; -export * from './visibility.directive'; diff --git a/npm/ng-packs/packages/core/src/lib/directives/permission.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/permission.directive.ts index 2e16cc0f2f..891c4c6e8c 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/permission.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/permission.directive.ts @@ -40,28 +40,12 @@ export class PermissionDirective implements OnDestroy, OnChanges { .getGrantedPolicy$(this.condition) .pipe(distinctUntilChanged()) .subscribe(isGranted => { - if (this.templateRef) this.initStructural(isGranted); - else this.initAttribute(isGranted); - + this.vcRef.clear(); + if (isGranted) this.vcRef.createEmbeddedView(this.templateRef); this.cdRef.detectChanges(); }); } - private initStructural(isGranted: boolean) { - this.vcRef.clear(); - - if (isGranted) this.vcRef.createEmbeddedView(this.templateRef); - } - - /** - * @deprecated Will be deleted in v5.0 - */ - private initAttribute(isGranted: boolean) { - if (!isGranted) { - this.renderer.removeChild(this.elRef.nativeElement.parentElement, this.elRef.nativeElement); - } - } - ngOnDestroy(): void { if (this.subscription) this.subscription.unsubscribe(); } diff --git a/npm/ng-packs/packages/core/src/lib/directives/visibility.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/visibility.directive.ts deleted file mode 100644 index 20d341b36d..0000000000 --- a/npm/ng-packs/packages/core/src/lib/directives/visibility.directive.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { AfterViewInit, Directive, ElementRef, Input, Optional, Renderer2 } from '@angular/core'; -import { Subject } from 'rxjs'; - -/** - * - * @deprecated To be deleted in v5.0 - */ -@Directive({ - selector: '[abpVisibility]', -}) -export class VisibilityDirective implements AfterViewInit { - @Input('abpVisibility') - focusedElement: HTMLElement; - - completed$ = new Subject(); - - constructor(@Optional() private elRef: ElementRef, private renderer: Renderer2) {} - - ngAfterViewInit() { - if (!this.focusedElement && this.elRef) { - this.focusedElement = this.elRef.nativeElement; - } - - const observer = new MutationObserver(mutations => { - mutations.forEach(mutation => { - if (!mutation.target) return; - - const htmlNodes = - Array.from(mutation.target.childNodes || []).filter( - node => node instanceof HTMLElement, - ) || []; - - if (!htmlNodes.length) { - this.removeFromDOM(); - } - }); - }); - - observer.observe(this.focusedElement, { - childList: true, - }); - - setTimeout(() => { - const htmlNodes = - Array.from(this.focusedElement.childNodes || []).filter( - node => node instanceof HTMLElement, - ) || []; - - if (!htmlNodes.length) this.removeFromDOM(); - }, 0); - - this.completed$.subscribe(() => observer.disconnect()); - } - - disconnect() { - this.completed$.next(); - this.completed$.complete(); - } - - removeFromDOM() { - if (!this.elRef.nativeElement) return; - - this.renderer.removeChild(this.elRef.nativeElement.parentElement, this.elRef.nativeElement); - this.disconnect(); - } -} diff --git a/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts b/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts deleted file mode 100644 index eecc4874b9..0000000000 --- a/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { ABP } from './common'; - -export namespace ApplicationConfiguration { - /** - * @deprecated Use the ApplicationConfigurationDto interface instead. To be deleted in v5.0. - */ - export interface Response { - localization: Localization; - auth: Auth; - setting: Value; - currentUser: CurrentUser; - currentTenant: CurrentTenant; - features: Value; - } - - /** - * @deprecated Use the ApplicationLocalizationConfigurationDto interface instead. To be deleted in v5.0. - */ - export interface Localization { - currentCulture: CurrentCulture; - defaultResourceName: string; - languages: Language[]; - values: LocalizationValue; - } - - /** - * @deprecated Use the Record> type instead. To be deleted in v5.0. - */ - export interface LocalizationValue { - [key: string]: { [key: string]: string }; - } - - /** - * @deprecated Use the LanguageInfo interface instead. To be deleted in v5.0. - */ - export interface Language { - cultureName: string; - uiCultureName: string; - displayName: string; - flagIcon: string; - } - - /** - * @deprecated Use the CurrentCultureDto interface instead. To be deleted in v5.0. - */ - export interface CurrentCulture { - cultureName: string; - dateTimeFormat: DateTimeFormat; - displayName: string; - englishName: string; - isRightToLeft: boolean; - name: string; - nativeName: string; - threeLetterIsoLanguageName: string; - twoLetterIsoLanguageName: string; - } - - /** - * @deprecated Use the DateTimeFormatDto interface instead. To be deleted in v5.0. - */ - export interface DateTimeFormat { - calendarAlgorithmType: string; - dateSeparator: string; - fullDateTimePattern: string; - longTimePattern: string; - shortDatePattern: string; - shortTimePattern: string; - } - - /** - * @deprecated Use the ApplicationAuthConfigurationDto interface instead. To be deleted in v5.0. - */ - export interface Auth { - policies: Policy; - grantedPolicies: Policy; - } - - /** - * @deprecated Use the Record type instead. To be deleted in v5.0. - */ - export interface Policy { - [key: string]: boolean; - } - - /** - * @deprecated To be deleted in v5.0. - */ - export interface Value { - values: ABP.Dictionary; - } - - /** - * @deprecated Use the CurrentUserDto interface instead. To be deleted in v5.0. - */ - export interface CurrentUser { - email: string; - emailVerified: false; - id: string; - isAuthenticated: boolean; - roles: string[]; - tenantId: string; - userName: string; - name: string; - phoneNumber: string; - phoneNumberVerified: boolean; - surName: string; - } - - /** - * @deprecated Use the CurrentTenantDto interface instead. To be deleted in v5.0. - */ - export interface CurrentTenant { - id: string; - name: string; - isAvailable?: boolean; - } -} diff --git a/npm/ng-packs/packages/core/src/lib/models/index.ts b/npm/ng-packs/packages/core/src/lib/models/index.ts index f41e208924..75450106ac 100644 --- a/npm/ng-packs/packages/core/src/lib/models/index.ts +++ b/npm/ng-packs/packages/core/src/lib/models/index.ts @@ -1,4 +1,3 @@ -export * from './application-configuration'; export * from './auth'; export * from './common'; export * from './dtos'; diff --git a/npm/ng-packs/packages/core/src/lib/models/session.ts b/npm/ng-packs/packages/core/src/lib/models/session.ts index 7ce516a180..e86e0a2616 100644 --- a/npm/ng-packs/packages/core/src/lib/models/session.ts +++ b/npm/ng-packs/packages/core/src/lib/models/session.ts @@ -4,20 +4,5 @@ export namespace Session { export interface State { language: string; tenant: CurrentTenantDto; - /** - * - * @deprecated To be deleted in v5.0 - */ - sessionDetail: SessionDetail; - } - - /** - * - * @deprecated To be deleted in v5.0 - */ - export interface SessionDetail { - openedTabCount: number; - lastExitTime: number; - remember: boolean; } } diff --git a/npm/ng-packs/packages/core/src/lib/services/application-configuration.service.ts b/npm/ng-packs/packages/core/src/lib/services/application-configuration.service.ts deleted file mode 100644 index cda78e79f3..0000000000 --- a/npm/ng-packs/packages/core/src/lib/services/application-configuration.service.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; -import { Rest } from '../models/rest'; -import { ApplicationConfigurationDto } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models'; -import { RestService } from './rest.service'; - -/** - * @deprecated Use AbpApplicationConfigurationService instead. To be deleted in v5.0. - */ -@Injectable({ - providedIn: 'root', -}) -export class ApplicationConfigurationService { - constructor(private rest: RestService) {} - - getConfiguration(): Observable { - const request: Rest.Request = { - method: 'GET', - url: '/api/abp/application-configuration', - }; - - return this.rest.request(request, {}); - } -} diff --git a/npm/ng-packs/packages/core/src/lib/services/auth.service.ts b/npm/ng-packs/packages/core/src/lib/services/auth.service.ts index 816e5a5905..aa920c1633 100644 --- a/npm/ng-packs/packages/core/src/lib/services/auth.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/auth.service.ts @@ -42,13 +42,6 @@ export class AuthService { return this.strategy.logout(queryParams); } - /** - * @deprecated Use navigateToLogin method instead. To be deleted in v5.0 - */ - initLogin() { - this.strategy.navigateToLogin(); - } - navigateToLogin(queryParams?: Params) { this.strategy.navigateToLogin(queryParams); } diff --git a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts index 69cf23e8a4..3aadfa898b 100644 --- a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts @@ -1,9 +1,9 @@ import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; -import { map, take, switchMap } from 'rxjs/operators'; +import { map, switchMap, take } from 'rxjs/operators'; +import { AbpApplicationConfigurationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service'; import { ApplicationConfigurationDto } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models'; import { InternalStore } from '../utils/internal-store-utils'; -import { AbpApplicationConfigurationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service'; @Injectable({ providedIn: 'root', @@ -24,15 +24,7 @@ export class ConfigStateService { private initUpdateStream() { this.updateSubject .pipe(switchMap(() => this.abpConfigService.get())) - .subscribe(res => this.setState(res)); - } - - /** - * @deprecated do not use this method directly, instead call refreshAppState - * This method will be private in v5.0 - */ - setState(state: ApplicationConfigurationDto) { - this.store.set(state); + .subscribe(res => this.store.set(res)); } refreshAppState() { diff --git a/npm/ng-packs/packages/core/src/lib/services/index.ts b/npm/ng-packs/packages/core/src/lib/services/index.ts index e79fb59e4f..d5940e1b54 100644 --- a/npm/ng-packs/packages/core/src/lib/services/index.ts +++ b/npm/ng-packs/packages/core/src/lib/services/index.ts @@ -1,4 +1,3 @@ -export * from './application-configuration.service'; export * from './auth.service'; export * from './config-state.service'; export * from './content-projection.service'; diff --git a/npm/ng-packs/packages/core/src/lib/services/multi-tenancy.service.ts b/npm/ng-packs/packages/core/src/lib/services/multi-tenancy.service.ts index 99371f91e7..00b056ec8c 100644 --- a/npm/ng-packs/packages/core/src/lib/services/multi-tenancy.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/multi-tenancy.service.ts @@ -1,16 +1,14 @@ -import { Injectable, Inject } from '@angular/core'; -import { switchMap, map } from 'rxjs/operators'; -import { Observable } from 'rxjs'; -import { ABP } from '../models/common'; +import { Inject, Injectable } from '@angular/core'; +import { map, switchMap } from 'rxjs/operators'; +import { AbpTenantService } from '../proxy/pages/abp/multi-tenancy'; import { - FindTenantResultDto, CurrentTenantDto, + FindTenantResultDto, } from '../proxy/volo/abp/asp-net-core/mvc/multi-tenancy/models'; -import { RestService } from './rest.service'; -import { AbpTenantService } from '../proxy/pages/abp/multi-tenancy'; +import { TENANT_KEY } from '../tokens/tenant-key.token'; import { ConfigStateService } from './config-state.service'; +import { RestService } from './rest.service'; import { SessionStateService } from './session-state.service'; -import { TENANT_KEY } from '../tokens/tenant-key.token'; @Injectable({ providedIn: 'root' }) export class MultiTenancyService { @@ -33,30 +31,6 @@ export class MultiTenancyService { @Inject(TENANT_KEY) public tenantKey: string, ) {} - /** - * @deprecated Use AbpTenantService.findTenantByName method instead. To be deleted in v5.0. - */ - findTenantByName(name: string, headers: ABP.Dictionary): Observable { - return this.restService.request( - { - url: `/api/abp/multi-tenancy/tenants/by-name/${name}`, - method: 'GET', - headers, - }, - { apiName: this.apiName }, - ); - } - - /** - * @deprecated Use AbpTenantService.findTenantById method instead. To be deleted in v5.0. - */ - findTenantById(id: string, headers: ABP.Dictionary): Observable { - return this.restService.request( - { url: `/api/abp/multi-tenancy/tenants/by-id/${id}`, method: 'GET', headers }, - { apiName: this.apiName }, - ); - } - setTenantByName(tenantName: string) { return this.tenantService .findTenantByName(tenantName, { [this.tenantKey]: '' }) diff --git a/npm/ng-packs/packages/core/src/lib/utils/rxjs-utils.ts b/npm/ng-packs/packages/core/src/lib/utils/rxjs-utils.ts index 4a237abbfc..9d81d523cb 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/rxjs-utils.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/rxjs-utils.ts @@ -1,31 +1,3 @@ -import { Observable, Subject } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; - function isFunction(value) { return typeof value === 'function'; } - -/** - * @deprecated no longer working, please use SubscriptionService (https://docs.abp.io/en/abp/latest/UI/Angular/Subscription-Service) instead. - */ -export const takeUntilDestroy = - (componentInstance, destroyMethodName = 'ngOnDestroy') => - (source: Observable) => { - const originalDestroy = componentInstance[destroyMethodName]; - if (isFunction(originalDestroy) === false) { - throw new Error( - `${componentInstance.constructor.name} is using untilDestroyed but doesn't implement ${destroyMethodName}`, - ); - } - if (!componentInstance['__takeUntilDestroy']) { - componentInstance['__takeUntilDestroy'] = new Subject(); - - componentInstance[destroyMethodName] = function () { - // eslint-disable-next-line prefer-rest-params - isFunction(originalDestroy) && originalDestroy.apply(this, arguments); - componentInstance['__takeUntilDestroy'].next(true); - componentInstance['__takeUntilDestroy'].complete(); - }; - } - return source.pipe(takeUntil(componentInstance['__takeUntilDestroy'])); - }; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts index 5fe1fbb572..c131167685 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts @@ -7,8 +7,5 @@ export * from './loading/loading.component'; export * from './modal/modal-close.directive'; export * from './modal/modal-ref.service'; export * from './modal/modal.component'; -export * from './sort-order-icon/sort-order-icon.component'; -export * from './table-empty-message/table-empty-message.component'; -export * from './table/table.component'; export * from './toast-container/toast-container.component'; export * from './toast/toast.component'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal-container.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal-container.component.ts deleted file mode 100644 index 1b07955270..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal-container.component.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Component, ViewChild, ViewContainerRef } from '@angular/core'; - -/** - * @deprecated To be removed in v5.0 - */ -@Component({ - selector: 'abp-modal-container', - template: '', -}) -export class ModalContainerComponent { - @ViewChild('container', { static: true, read: ViewContainerRef }) - container: ViewContainerRef; -} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts index 44aea4d9f7..44e077160b 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts @@ -2,7 +2,6 @@ import { SubscriptionService, uuid } from '@abp/ng.core'; import { Component, ContentChild, - ElementRef, EventEmitter, Inject, Input, @@ -32,19 +31,6 @@ export type ModalSize = 'sm' | 'md' | 'lg' | 'xl'; providers: [SubscriptionService], }) export class ModalComponent implements OnInit, OnDestroy, DismissableModal { - /** - * @deprecated Use centered property of options input instead. To be deleted in v5.0. - */ - @Input() centered = false; - /** - * @deprecated Use windowClass property of options input instead. To be deleted in v5.0. - */ - @Input() modalClass = ''; - /** - * @deprecated Use size property of options input instead. To be deleted in v5.0. - */ - @Input() size: ModalSize = 'lg'; - @Input() get visible(): boolean { return this._visible; @@ -81,12 +67,6 @@ export class ModalComponent implements OnInit, OnDestroy, DismissableModal { @ContentChild(ButtonComponent, { static: false, read: ButtonComponent }) abpSubmit: ButtonComponent; - /** - * @deprecated will be removed in v5.0 - */ - @ContentChild('abpClose', { static: false, read: ElementRef }) - abpClose: ElementRef; - @Output() readonly visibleChange = new EventEmitter(); @Output() readonly init = new EventEmitter(); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.html deleted file mode 100644 index a3a142cc01..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.html +++ /dev/null @@ -1,3 +0,0 @@ -
- -
diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.ts deleted file mode 100644 index 439989ef73..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Component, EventEmitter, Input, Output } from '@angular/core'; - -/** - * @deprecated To be deleted in v5.0. Use ngx-datatale instead. - */ -@Component({ - selector: 'abp-sort-order-icon', - templateUrl: './sort-order-icon.component.html', -}) -export class SortOrderIconComponent { - private _order: 'asc' | 'desc' | ''; - private _selectedSortKey: string; - - @Input() - sortKey: string; - - @Input() - set selectedSortKey(value: string) { - this._selectedSortKey = value; - this.selectedSortKeyChange.emit(value); - } - get selectedSortKey(): string { - return this._selectedSortKey; - } - - @Input() - set order(value: 'asc' | 'desc' | '') { - this._order = value; - this.orderChange.emit(value); - } - get order(): 'asc' | 'desc' | '' { - return this._order; - } - - @Output() readonly orderChange = new EventEmitter(); - @Output() readonly selectedSortKeyChange = new EventEmitter(); - - @Input() - iconClass: string; - - get icon(): string { - if (this.selectedSortKey === this.sortKey) return `sorting_${this.order}`; - else return 'sorting'; - } - - sort(key: string) { - this.selectedSortKey = key; - switch (this.order) { - case '': - this.order = 'asc'; - this.orderChange.emit('asc'); - break; - case 'asc': - this.order = 'desc'; - this.orderChange.emit('desc'); - break; - case 'desc': - this.order = ''; - this.orderChange.emit(''); - break; - } - } -} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/table-empty-message/table-empty-message.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/table-empty-message/table-empty-message.component.ts deleted file mode 100644 index d5e20cf568..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/table-empty-message/table-empty-message.component.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Component, Input } from '@angular/core'; - -@Component({ - // eslint-disable-next-line @angular-eslint/component-selector - selector: '[abp-table-empty-message]', - template: ` - - {{ emptyMessage | abpLocalization }} - - `, -}) -export class TableEmptyMessageComponent { - @Input() - colspan = 2; - - @Input() - message: string; - - @Input() - localizationResource = 'AbpAccount'; - - @Input() - localizationProp = 'NoDataAvailableInDatatable'; - - get emptyMessage(): string { - return this.message || `${this.localizationResource}::${this.localizationProp}`; - } -} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.html deleted file mode 100644 index 6cbea56304..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.html +++ /dev/null @@ -1,81 +0,0 @@ -
-
- -
- -
-
-
- - -
-
-
-
- - - - -
-
-
-
- - - -
-
-
-
- - - - - - -
-
- - - - - - - - - - - - - - - - - - - - {{ - emptyMessage | abpLocalization - }} - - diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.scss b/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.scss deleted file mode 100644 index 98d4eb5811..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.scss +++ /dev/null @@ -1,337 +0,0 @@ -.ui-table { - position: relative; - - .ui-table-tbody > tr:nth-child(even):hover, - .ui-table-tbody > tr:hover { - filter: brightness(90%); - } - - .ui-table-empty { - padding: 20px 0; - text-align: center; - border: 1px solid #e0e0e0; - border-top-width: 0; - } - - .ui-table-caption, - .ui-table-summary { - background-color: #f4f4f4; - color: #333333; - border: 1px solid #c8c8c8; - padding: 0.571em 1em; - text-align: center; - } - .ui-table-caption { - border-bottom: 0 none; - font-weight: 700; - } - .ui-table-summary { - border-top: 0 none; - font-weight: 700; - } - .ui-table-thead > tr > th { - padding: 0.571em 0.857em; - border: 1px solid #c8c8c8; - font-weight: 700; - color: #333333; - background-color: #f4f4f4; - } - .ui-table-tbody > tr > td { - padding: 0.571em 0.857em; - } - .ui-table-tfoot > tr > td { - padding: 0.571em 0.857em; - border: 1px solid #c8c8c8; - font-weight: 700; - color: #333333; - background-color: #ffffff; - } - .ui-sortable-column { - -moz-transition: box-shadow 0.2s; - -o-transition: box-shadow 0.2s; - -webkit-transition: box-shadow 0.2s; - transition: box-shadow 0.2s; - } - .ui-sortable-column:focus { - outline: 0 none; - outline-offset: 0; - -webkit-box-shadow: inset 0 0 0 0.2em #8dcdff; - -moz-box-shadow: inset 0 0 0 0.2em #8dcdff; - box-shadow: inset 0 0 0 0.2em #8dcdff; - } - .ui-sortable-column .ui-sortable-column-icon { - color: #848484; - } - .ui-sortable-column:not(.ui-state-highlight):hover { - background-color: #e0e0e0; - color: #333333; - } - .ui-sortable-column:not(.ui-state-highlight):hover .ui-sortable-column-icon { - color: #333333; - } - .ui-sortable-column.ui-state-highlight { - background-color: #007ad9; - color: #ffffff; - } - .ui-sortable-column.ui-state-highlight .ui-sortable-column-icon { - color: #ffffff; - } - .ui-editable-column input { - font-size: 14px; - font-family: 'Open Sans', 'Helvetica Neue', sans-serif; - } - .ui-editable-column input:focus { - outline: 1px solid #007ad9; - outline-offset: 2px; - } - .ui-table-tbody > tr { - background-color: #ffffff; - color: #333333; - } - .ui-table-tbody > tr > td { - background-color: inherit; - border: 1px solid #c8c8c8; - } - .ui-table-tbody > tr.ui-state-highlight { - background-color: #007ad9; - color: #ffffff; - } - .ui-table-tbody > tr.ui-state-highlight a { - color: #ffffff; - } - .ui-table-tbody > tr.ui-contextmenu-selected { - background-color: #007ad9; - color: #ffffff; - } - .ui-table-tbody > tr.ui-table-dragpoint-top > td { - -webkit-box-shadow: inset 0 2px 0 0 #007ad9; - -moz-box-shadow: inset 0 2px 0 0 #007ad9; - box-shadow: inset 0 2px 0 0 #007ad9; - } - .ui-table-tbody > tr.ui-table-dragpoint-bottom > td { - -webkit-box-shadow: inset 0 -2px 0 0 #007ad9; - -moz-box-shadow: inset 0 -2px 0 0 #007ad9; - box-shadow: inset 0 -2px 0 0 #007ad9; - } - .ui-table-tbody > tr:nth-child(even) { - background-color: #f9f9f9; - } - .ui-table-tbody > tr:nth-child(even).ui-state-highlight { - background-color: #007ad9; - color: #ffffff; - } - .ui-table-tbody > tr:nth-child(even).ui-state-highlight a { - color: #ffffff; - } - .ui-table-tbody > tr:nth-child(even).ui-contextmenu-selected { - background-color: #007ad9; - color: #ffffff; - } - - &.ui-table-hoverable-rows - .ui-table-tbody - > tr.ui-selectable-row:not(.ui-state-highlight):not(.ui-contextmenu-selected):hover { - cursor: pointer; - background-color: #eaeaea; - color: #333333; - } - .ui-column-resizer-helper { - background-color: #007ad9; - } - @media screen and (max-width: 40em) { - &.ui-table-responsive .ui-table-tbody > tr > td { - border: 0 none; - } - } - - table { - border-collapse: collapse; - width: 100%; - table-layout: fixed; - } - - .ui-table-tbody > tr > td, - .ui-table-tfoot > tr > td, - .ui-table-thead > tr > th { - padding: 0.571em 0.857em; - } - - .ui-sortable-column { - cursor: pointer; - } - - p-sorticon { - vertical-align: middle; - } - - .ui-table-auto-layout > .ui-table-wrapper { - overflow-x: auto; - } - - .ui-table-auto-layout > .ui-table-wrapper > table { - table-layout: auto; - } - - .ui-table-caption, - .ui-table-summary { - padding: 0.25em 0.5em; - text-align: center; - font-weight: 700; - } - - .ui-table-caption { - border-bottom: 0; - } - - .ui-table-summary { - border-top: 0; - } - - .ui-table-scrollable-wrapper { - position: relative; - } - - .ui-table-scrollable-footer, - .ui-table-scrollable-header { - overflow: hidden; - border: 0; - } - - .ui-table-scrollable-body { - overflow: auto; - position: relative; - } - - .ui-table-virtual-table { - position: absolute; - } - - .ui-table-loading-virtual-table { - display: none; - } - - .ui-table-frozen-view .ui-table-scrollable-body { - overflow: hidden; - } - - .ui-table-frozen-view > .ui-table-scrollable-body > table > .ui-table-tbody > tr > td:last-child { - border-right: 0; - } - - .ui-table-unfrozen-view { - position: absolute; - top: 0; - } - - .ui-table-resizable > .ui-table-wrapper { - overflow-x: auto; - } - - .ui-table-resizable .ui-table-tbody > tr > td, - .ui-table-resizable .ui-table-tfoot > tr > td, - .ui-table-resizable .ui-table-thead > tr > th { - overflow: hidden; - } - - .ui-table-resizable .ui-resizable-column { - background-clip: padding-box; - position: relative; - } - - .ui-table-resizable-fit .ui-resizable-column:last-child .ui-column-resizer { - display: none; - } - - .ui-column-resizer { - display: block; - position: absolute !important; - top: 0; - right: 0; - margin: 0; - width: 0.5em; - height: 100%; - padding: 0; - cursor: col-resize; - border: 1px solid rgba(0, 0, 0, 0); - } - - .ui-column-resizer-helper { - width: 1px; - position: absolute; - z-index: 10; - display: none; - } - - .ui-table-tbody > tr > td.ui-editing-cell { - padding: 0; - } - - .ui-table-tbody > tr > td.ui-editing-cell p-celleditor > * { - width: 100%; - } - - .ui-table-reorder-indicator-down, - .ui-table-reorder-indicator-up { - position: absolute; - display: none; - } - - .ui-table-responsive .ui-table-tbody > tr > td .ui-column-title { - display: none; - } - - @media screen and (max-width: 40em) { - .ui-table-responsive .ui-table-tfoot > tr > td, - .ui-table-responsive .ui-table-thead > tr > th, - .ui-table-responsive colgroup { - display: none !important; - } - .ui-table-responsive .ui-table-tbody > tr > td { - text-align: left; - display: block; - border: 0; - width: 100% !important; - box-sizing: border-box; - float: left; - clear: left; - } - .ui-table-responsive .ui-table-tbody > tr > td .ui-column-title { - padding: 0.4em; - min-width: 30%; - display: inline-block; - margin: -0.4em 1em -0.4em -0.4em; - font-weight: 700; - } - } - - .ui-widget { - font-family: 'Open Sans', 'Helvetica Neue', sans-serif; - font-size: 14px; - text-decoration: none; - } - - .page-item.disabled .page-link, - .page-link { - background-color: transparent; - border: none; - } - - .page-item.disabled .page-link { - box-shadow: none; - } - - .pagination { - margin-bottom: 0; - } - - .pagination-wrapper { - display: flex; - justify-content: center; - border-top: 0; - padding: 0; - } - - .op-0 { - opacity: 0; - } -} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.ts deleted file mode 100644 index 0baf78f883..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { - Component, - ElementRef, - EventEmitter, - Input, - OnInit, - Output, - TemplateRef, - TrackByFunction, - ViewChild, - ViewEncapsulation, -} from '@angular/core'; - -/** - * - * @deprecated To be deleted in v5.0. Use ngx-datatale instead. - */ -@Component({ - selector: 'abp-table', - templateUrl: 'table.component.html', - styleUrls: ['table.component.scss'], - encapsulation: ViewEncapsulation.None, -}) -export class TableComponent implements OnInit { - private _totalRecords: number; - bodyScrollLeft = 0; - - @Input() - value: any[]; - - @Input() - headerTemplate: TemplateRef; - - @Input() - bodyTemplate: TemplateRef; - - @Input() - colgroupTemplate: TemplateRef; - - @Input() - scrollHeight: string; - - @Input() - scrollable: boolean; - - @Input() - rows: number; - - @Input() - page = 1; - - @Input() - trackingProp = 'id'; - - @Input() - emptyMessage = 'AbpAccount::NoDataAvailableInDatatable'; - - @Output() - readonly pageChange = new EventEmitter(); - - @ViewChild('wrapper', { read: ElementRef }) - wrapperRef: ElementRef; - - @Input() - get totalRecords(): number { - return this._totalRecords || this.value.length; - } - set totalRecords(newValue: number) { - if (newValue < 0) this._totalRecords = 0; - - this._totalRecords = newValue; - } - - get totalPages(): number { - if (!this.rows) { - return; - } - - return Math.ceil(this.totalRecords / this.rows); - } - - get slicedValue(): any[] { - if (!this.rows || this.rows >= this.value.length) { - return this.value; - } - - const start = (this.page - 1) * this.rows; - return this.value.slice(start, start + this.rows); - } - - marginCalculator: MarginCalculator; - - trackByFn: TrackByFunction = (_, value) => { - return typeof value === 'object' ? value[this.trackingProp] || value : value; - }; - - ngOnInit() { - this.marginCalculator = document.body.dir === 'rtl' ? rtlCalculator : ltrCalculator; - } -} - -function ltrCalculator(div: HTMLDivElement): string { - return `0 auto 0 -${div.scrollLeft}px`; -} - -function rtlCalculator(div: HTMLDivElement): string { - return `0 ${-(div.scrollWidth - div.clientWidth - div.scrollLeft)}px 0 auto`; -} - -type MarginCalculator = (div: HTMLDivElement) => string; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts index 64b849d4fe..b0a79877fe 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts @@ -1,5 +1,4 @@ +export * from './ellipsis.directive'; export * from './loading.directive'; export * from './ngx-datatable-default.directive'; export * from './ngx-datatable-list.directive'; -export * from './table-sort.directive'; -export * from './ellipsis.directive'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts deleted file mode 100644 index 90e8b5e6e1..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { SortOrder, SortPipe } from '@abp/ng.core'; -import { - ChangeDetectorRef, - Directive, - Host, - Input, - OnChanges, - Optional, - Self, - SimpleChanges, -} from '@angular/core'; -import clone from 'just-clone'; -import { TableComponent } from '../components/table/table.component'; - -export interface TableSortOptions { - key: string; - order: SortOrder; -} - -/** - * - * @deprecated To be deleted in v5.0 - */ -@Directive({ - selector: '[abpTableSort]', - providers: [SortPipe], -}) -export class TableSortDirective implements OnChanges { - @Input() - abpTableSort: TableSortOptions; - - @Input() - value: any[] = []; - - get table(): TableComponent | any { - return ( - this.abpTable || this.cdRef['_view'].component || this.cdRef['context'] // 'context' for ivy - ); - } - - constructor( - @Host() @Optional() @Self() private abpTable: TableComponent, - private sortPipe: SortPipe, - private cdRef: ChangeDetectorRef, - ) {} - - ngOnChanges({ value, abpTableSort }: SimpleChanges) { - if (this.table && (value || abpTableSort)) { - this.abpTableSort = this.abpTableSort || ({} as TableSortOptions); - this.table.value = this.sortPipe.transform( - clone(this.value), - this.abpTableSort.order, - this.abpTableSort.key, - ); - } - } -} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/index.ts index 1b39fcc0f0..5b97363917 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/services/index.ts @@ -1,5 +1,4 @@ export * from './confirmation.service'; -export * from './modal.service'; -export * from './toaster.service'; export * from './nav-items.service'; export * from './page-alert.service'; +export * from './toaster.service'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/modal.service.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/modal.service.ts deleted file mode 100644 index a75cfe5089..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/modal.service.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { ContentProjectionService, PROJECTION_STRATEGY } from '@abp/ng.core'; -import { ComponentRef, Injectable, TemplateRef, ViewContainerRef, OnDestroy } from '@angular/core'; -import { ModalContainerComponent } from '../components/modal/modal-container.component'; - -/** - * @deprecated Use ng-bootstrap modal. To be deleted in v5.0. - */ -@Injectable({ - providedIn: 'root', -}) -export class ModalService implements OnDestroy { - private containerComponentRef: ComponentRef; - - constructor(private contentProjectionService: ContentProjectionService) { - this.setContainer(); - } - - private setContainer() { - this.containerComponentRef = this.contentProjectionService.projectContent( - PROJECTION_STRATEGY.AppendComponentToBody(ModalContainerComponent), - ); - - this.containerComponentRef.changeDetectorRef.detectChanges(); - } - - clearModal() { - this.getContainer().clear(); - this.detectChanges(); - } - - detectChanges() { - this.containerComponentRef.changeDetectorRef.detectChanges(); - } - - getContainer(): ViewContainerRef { - return this.containerComponentRef.instance.container; - } - - renderTemplate(template: TemplateRef, context?: T) { - const containerRef = this.getContainer(); - - const strategy = PROJECTION_STRATEGY.ProjectTemplateToContainer( - template, - containerRef, - context, - ); - - this.contentProjectionService.projectContent(strategy); - } - - ngOnDestroy() { - this.containerComponentRef.destroy(); - } -} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts index 8a9b6ed201..8575e834ed 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts @@ -17,11 +17,7 @@ import { HttpErrorWrapperComponent } from './components/http-error-wrapper/http- import { LoaderBarComponent } from './components/loader-bar/loader-bar.component'; import { LoadingComponent } from './components/loading/loading.component'; import { ModalCloseDirective } from './components/modal/modal-close.directive'; -import { ModalContainerComponent } from './components/modal/modal-container.component'; import { ModalComponent } from './components/modal/modal.component'; -import { SortOrderIconComponent } from './components/sort-order-icon/sort-order-icon.component'; -import { TableEmptyMessageComponent } from './components/table-empty-message/table-empty-message.component'; -import { TableComponent } from './components/table/table.component'; import { ToastContainerComponent } from './components/toast-container/toast-container.component'; import { ToastComponent } from './components/toast/toast.component'; import { DEFAULT_VALIDATION_BLUEPRINTS } from './constants/validation'; @@ -29,7 +25,6 @@ import { EllipsisModule } from './directives/ellipsis.directive'; import { LoadingDirective } from './directives/loading.directive'; import { NgxDatatableDefaultDirective } from './directives/ngx-datatable-default.directive'; import { NgxDatatableListDirective } from './directives/ngx-datatable-list.directive'; -import { TableSortDirective } from './directives/table-sort.directive'; import { ErrorHandler } from './handlers/error.handler'; import { initLazyStyleHandler } from './handlers/lazy-style.handler'; import { RootParams } from './models/common'; @@ -46,15 +41,11 @@ const declarationsWithExports = [ LoaderBarComponent, LoadingComponent, ModalComponent, - TableComponent, - TableEmptyMessageComponent, ToastComponent, ToastContainerComponent, - SortOrderIconComponent, NgxDatatableDefaultDirective, NgxDatatableListDirective, LoadingDirective, - TableSortDirective, ModalCloseDirective, ]; @@ -66,13 +57,12 @@ const declarationsWithExports = [ NgbPaginationModule, EllipsisModule, ], - declarations: [...declarationsWithExports, HttpErrorWrapperComponent, ModalContainerComponent], + declarations: [...declarationsWithExports, HttpErrorWrapperComponent], exports: [NgxDatatableModule, EllipsisModule, ...declarationsWithExports], providers: [DatePipe], entryComponents: [ HttpErrorWrapperComponent, LoadingComponent, - ModalContainerComponent, ToastContainerComponent, ConfirmationComponent, ],