From ae31b57aa91a45d0b828ae64a7151f7d0b483661 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 4 Nov 2019 09:18:09 +0300 Subject: [PATCH] fix: move table-sort.directive to theme-shared resolves #2067 --- npm/ng-packs/packages/core/src/lib/core.module.ts | 3 --- npm/ng-packs/packages/core/src/lib/directives/index.ts | 1 - .../packages/theme-shared/src/lib/directives/index.ts | 1 + .../src/lib/directives/table-sort.directive.ts | 4 +++- .../src/lib/tests/table-sort.directive.spec.ts | 2 +- .../theme-shared/src/lib/theme-shared.module.ts | 10 ++++++---- npm/ng-packs/packages/theme-shared/src/public-api.ts | 1 + 7 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts rename npm/ng-packs/packages/{core => theme-shared}/src/lib/directives/table-sort.directive.ts (93%) rename npm/ng-packs/packages/{core => theme-shared}/src/lib/tests/table-sort.directive.spec.ts (100%) 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 2fe908cf8e3..d3c98f9925d 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -27,7 +27,6 @@ import { getInitialData, localeInitializer } from './utils/initial-utils'; import { ConfigPlugin, NGXS_CONFIG_PLUGIN_OPTIONS } from './plugins/config/config.plugin'; import { ForDirective } from './directives/for.directive'; import { AbstractNgModelComponent } from './abstracts/ng-model.component'; -import { TableSortDirective } from './directives/table-sort.directive'; @NgModule({ imports: [ @@ -47,7 +46,6 @@ import { TableSortDirective } from './directives/table-sort.directive'; EllipsisDirective, ForDirective, FormSubmitDirective, - TableSortDirective, LocalizationPipe, SortPipe, PermissionDirective, @@ -70,7 +68,6 @@ import { TableSortDirective } from './directives/table-sort.directive'; FormSubmitDirective, LocalizationPipe, SortPipe, - TableSortDirective, PermissionDirective, VisibilityDirective, InputEventDebounceDirective, 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 7b5927b3ada..7edf1b5f761 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/index.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/index.ts @@ -3,5 +3,4 @@ export * from './ellipsis.directive'; export * from './for.directive'; export * from './form-submit.directive'; export * from './permission.directive'; -export * from './table-sort.directive'; export * from './visibility.directive'; 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 new file mode 100644 index 00000000000..8efed514bf5 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts @@ -0,0 +1 @@ +export * from './table-sort.directive'; diff --git a/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts similarity index 93% rename from npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts rename to npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts index e9a58fe5892..5f42cc0144d 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts @@ -1,11 +1,13 @@ import { Directive, Input, Optional, Self, SimpleChanges, OnChanges } from '@angular/core'; import { Table } from 'primeng/table'; -import { SortPipe, SortOrder } from '../pipes/sort.pipe'; import clone from 'just-clone'; +import { SortPipe, SortOrder } from '@abp/ng.core'; + export interface TableSortOptions { key: string; order: SortOrder; } + @Directive({ selector: '[abpTableSort]', providers: [SortPipe], diff --git a/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/table-sort.directive.spec.ts similarity index 100% rename from npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts rename to npm/ng-packs/packages/theme-shared/src/lib/tests/table-sort.directive.spec.ts index 6a9401217ef..7c342174e6c 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/table-sort.directive.spec.ts @@ -1,6 +1,6 @@ import { SpectatorDirective, createDirectiveFactory } from '@ngneat/spectator/jest'; -import { TableSortDirective } from '../directives/table-sort.directive'; import { TableModule, Table } from 'primeng/table'; +import { TableSortDirective } from '../directives/table-sort.directive'; describe('TableSortDirective', () => { let spectator: SpectatorDirective; 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 1159b10735b..589b881c030 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 @@ -1,9 +1,9 @@ import { CoreModule, LazyLoadService } from '@abp/ng.core'; import { APP_INITIALIZER, Injector, ModuleWithProviders, NgModule } from '@angular/core'; +import { NgxValidateCoreModule } from '@ngx-validate/core'; import { MessageService } from 'primeng/components/common/messageservice'; import { ToastModule } from 'primeng/toast'; import { forkJoin } from 'rxjs'; -import { take } from 'rxjs/operators'; import { BreadcrumbComponent } from './components/breadcrumb/breadcrumb.component'; import { ButtonComponent } from './components/button/button.component'; import { ChangePasswordComponent } from './components/change-password/change-password.component'; @@ -13,13 +13,13 @@ import { ErrorComponent } from './components/error/error.component'; import { LoaderBarComponent } from './components/loader-bar/loader-bar.component'; import { ModalComponent } from './components/modal/modal.component'; import { ProfileComponent } from './components/profile/profile.component'; -import { ToastComponent } from './components/toast/toast.component'; import { SortOrderIconComponent } from './components/sort-order-icon/sort-order-icon.component'; +import { TableEmptyMessageComponent } from './components/table-empty-message/table-empty-message.component'; +import { ToastComponent } from './components/toast/toast.component'; import styles from './contants/styles'; +import { TableSortDirective } from './directives/table-sort.directive'; import { ErrorHandler } from './handlers/error.handler'; import { chartJsLoaded$ } from './utils/widget-utils'; -import { TableEmptyMessageComponent } from './components/table-empty-message/table-empty-message.component'; -import { NgxValidateCoreModule } from '@ngx-validate/core'; export function appendScript(injector: Injector) { const fn = () => { @@ -56,6 +56,7 @@ export function appendScript(injector: Injector) { TableEmptyMessageComponent, ToastComponent, SortOrderIconComponent, + TableSortDirective, ], exports: [ BreadcrumbComponent, @@ -69,6 +70,7 @@ export function appendScript(injector: Injector) { TableEmptyMessageComponent, ToastComponent, SortOrderIconComponent, + TableSortDirective, ], entryComponents: [ErrorComponent], }) diff --git a/npm/ng-packs/packages/theme-shared/src/public-api.ts b/npm/ng-packs/packages/theme-shared/src/public-api.ts index aaa54db7c2a..0cb3139a223 100644 --- a/npm/ng-packs/packages/theme-shared/src/public-api.ts +++ b/npm/ng-packs/packages/theme-shared/src/public-api.ts @@ -5,6 +5,7 @@ export * from './lib/theme-shared.module'; export * from './lib/animations'; export * from './lib/components'; +export * from './lib/directives'; export * from './lib/models'; export * from './lib/services'; export * from './lib/utils';