shared.module.ts 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import { OverlayModule } from '@angular/cdk/overlay';
  2. import { CommonModule } from '@angular/common';
  3. import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
  4. import { FormsModule, ReactiveFormsModule } from '@angular/forms';
  5. import { RouterModule } from '@angular/router';
  6. import { ClarityModule } from '@clr/angular';
  7. import { NgSelectModule } from '@ng-select/ng-select';
  8. import { TranslateModule } from '@ngx-translate/core';
  9. import { NgxPaginationModule } from 'ngx-pagination';
  10. import {
  11. ActionBarComponent,
  12. ActionBarLeftComponent,
  13. ActionBarRightComponent,
  14. } from './components/action-bar/action-bar.component';
  15. import { AffixedInputComponent } from './components/affixed-input/affixed-input.component';
  16. import { PercentageSuffixInputComponent } from './components/affixed-input/percentage-suffix-input.component';
  17. import { ChipComponent } from './components/chip/chip.component';
  18. import { ConfigurableInputComponent } from './components/configurable-input/configurable-input.component';
  19. import { CurrencyInputComponent } from './components/currency-input/currency-input.component';
  20. import { CustomFieldControlComponent } from './components/custom-field-control/custom-field-control.component';
  21. import { CustomerLabelComponent } from './components/customer-label/customer-label.component';
  22. import { DataTableColumnComponent } from './components/data-table/data-table-column.component';
  23. import { DataTableComponent } from './components/data-table/data-table.component';
  24. import { DropdownItemDirective } from './components/dropdown/dropdown-item.directive';
  25. import { DropdownMenuComponent } from './components/dropdown/dropdown-menu.component';
  26. import { DropdownTriggerDirective } from './components/dropdown/dropdown-trigger.directive';
  27. import { DropdownComponent } from './components/dropdown/dropdown.component';
  28. import { FacetValueChipComponent } from './components/facet-value-chip/facet-value-chip.component';
  29. import { FacetValueSelectorComponent } from './components/facet-value-selector/facet-value-selector.component';
  30. import { FormFieldControlDirective } from './components/form-field/form-field-control.directive';
  31. import { FormFieldComponent } from './components/form-field/form-field.component';
  32. import { FormItemComponent } from './components/form-item/form-item.component';
  33. import { ItemsPerPageControlsComponent } from './components/items-per-page-controls/items-per-page-controls.component';
  34. import { LanguageSelectorComponent } from './components/language-selector/language-selector.component';
  35. import { DialogButtonsDirective } from './components/modal-dialog/dialog-buttons.directive';
  36. import { DialogComponentOutletComponent } from './components/modal-dialog/dialog-component-outlet.component';
  37. import { DialogTitleDirective } from './components/modal-dialog/dialog-title.directive';
  38. import { ModalDialogComponent } from './components/modal-dialog/modal-dialog.component';
  39. import { OrderStateLabelComponent } from './components/order-state-label/order-state-label.component';
  40. import { PaginationControlsComponent } from './components/pagination-controls/pagination-controls.component';
  41. import { RichTextEditorComponent } from './components/rich-text-editor/rich-text-editor.component';
  42. import { SelectToggleComponent } from './components/select-toggle/select-toggle.component';
  43. import { SimpleDialogComponent } from './components/simple-dialog/simple-dialog.component';
  44. import { TableRowActionComponent } from './components/table-row-action/table-row-action.component';
  45. import { TitleInputComponent } from './components/title-input/title-input.component';
  46. import { BackgroundColorFromDirective } from './directives/background-color-from.directive';
  47. import { CurrencyNamePipe } from './pipes/currency-name.pipe';
  48. import { FileSizePipe } from './pipes/file-size.pipe';
  49. import { SentenceCasePipe } from './pipes/sentence-case.pipe';
  50. import { ModalService } from './providers/modal/modal.service';
  51. import { CanDeactivateDetailGuard } from './providers/routing/can-deactivate-detail-guard';
  52. const IMPORTS = [
  53. ClarityModule,
  54. CommonModule,
  55. FormsModule,
  56. ReactiveFormsModule,
  57. RouterModule,
  58. NgSelectModule,
  59. NgxPaginationModule,
  60. TranslateModule,
  61. OverlayModule,
  62. ];
  63. const DECLARATIONS = [
  64. ActionBarComponent,
  65. ActionBarLeftComponent,
  66. ActionBarRightComponent,
  67. ConfigurableInputComponent,
  68. AffixedInputComponent,
  69. BackgroundColorFromDirective,
  70. ChipComponent,
  71. CurrencyInputComponent,
  72. CurrencyNamePipe,
  73. CustomerLabelComponent,
  74. CustomFieldControlComponent,
  75. DataTableComponent,
  76. DataTableColumnComponent,
  77. FacetValueSelectorComponent,
  78. ItemsPerPageControlsComponent,
  79. PaginationControlsComponent,
  80. TableRowActionComponent,
  81. FacetValueChipComponent,
  82. FileSizePipe,
  83. FormFieldComponent,
  84. FormFieldControlDirective,
  85. FormItemComponent,
  86. ModalDialogComponent,
  87. PercentageSuffixInputComponent,
  88. DialogComponentOutletComponent,
  89. DialogButtonsDirective,
  90. DialogTitleDirective,
  91. SelectToggleComponent,
  92. LanguageSelectorComponent,
  93. RichTextEditorComponent,
  94. SimpleDialogComponent,
  95. TitleInputComponent,
  96. SentenceCasePipe,
  97. DropdownComponent,
  98. DropdownMenuComponent,
  99. DropdownTriggerDirective,
  100. DropdownItemDirective,
  101. OrderStateLabelComponent,
  102. ];
  103. @NgModule({
  104. imports: IMPORTS,
  105. exports: [...IMPORTS, ...DECLARATIONS],
  106. declarations: DECLARATIONS,
  107. providers: [
  108. // This needs to be shared, since lazy-loaded
  109. // modules have their own entryComponents which
  110. // are unknown to the CoreModule instance of ModalService.
  111. // See https://github.com/angular/angular/issues/14324#issuecomment-305650763
  112. ModalService,
  113. CanDeactivateDetailGuard,
  114. ],
  115. entryComponents: [ModalDialogComponent, SimpleDialogComponent],
  116. schemas: [CUSTOM_ELEMENTS_SCHEMA],
  117. })
  118. export class SharedModule {}