OpenSlides/client/src/app/shared/shared.module.ts

288 lines
11 KiB
TypeScript
Raw Normal View History

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CommonModule, DecimalPipe } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
// MaterialUI modules
import { MatBadgeModule } from '@angular/material/badge';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import { MatButtonModule } from '@angular/material/button';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatNativeDateModule, DateAdapter } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDividerModule } from '@angular/material/divider';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatSliderModule } from '@angular/material/slider';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatSortModule } from '@angular/material/sort';
import { MatStepperModule } from '@angular/material/stepper';
import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatChipsModule } from '@angular/material/chips';
import { MatRadioModule } from '@angular/material/radio';
import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
import { MatDialogModule } from '@angular/material/dialog';
import { MatListModule } from '@angular/material/list';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatMenuModule } from '@angular/material/menu';
2018-08-16 17:03:39 +02:00
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import { DragDropModule } from '@angular/cdk/drag-drop';
Replaces the old `angular2tree` with a custom drag&drop tree Calculates the direction of the moving. Finishes the moving of nodes in same level Adds some style Sets the padding dynamically Adds placeholder depends on the horizontal movement Set the placeholder at the correct place, so the user can see, where he will drop the moved node Finishes moving of nodes - Old parents change their option to expand. - New parents change their option to expand. - If the user moves a node between nodes with a higher level, the node will be moved to the next index with same or lower level. Fixes the visibility of moved node - If the new parent is not visible, the moved node will not be seen. If the user moves an expanded node, the new parent should expanded, too, if it's not already. Sending successfully data to the server - Sorting the items Handles moving nodes between parent and children - If the user moves a node between a parent and its children, the children will be relinked to the moved node as their new parent. Replaces the old `sorting-tree` to a new one - The new `sorted-tree` replaces the old `sorting-tree`. - The old package `angular-tree-component` was removed. - The user will only see the buttons to save or cancel his changes, if he made changes. - The buttons, that do not work currently, were removed. Adds a guard to check if the user made changes. - If the user made changes but he has not saved them, then there is a dialog that will prompt to ask for confirmation. Before cancelling the changes the user has to confirm this.
2019-02-22 12:04:36 +01:00
import { CdkTreeModule } from '@angular/cdk/tree';
import { ScrollingModule } from '@angular/cdk/scrolling';
// ngx-translate
import { TranslateModule } from '@ngx-translate/core';
2018-11-16 16:09:15 +01:00
// ngx-file-drop
import { NgxFileDropModule } from 'ngx-file-drop';
2018-11-16 16:09:15 +01:00
2018-11-20 13:31:56 +01:00
// TinyMCE
import { EditorModule } from '@tinymce/tinymce-angular';
// directives
import { PermsDirective } from './directives/perms.directive';
import { DomChangeDirective } from './directives/dom-change.directive';
import { AutofocusDirective } from './directives/autofocus.directive';
// PblNgrid. Cleanup Required.
import { PblNgridModule } from '@pebula/ngrid';
import { PblNgridMaterialModule } from '@pebula/ngrid-material';
// components
import { HeadBarComponent } from './components/head-bar/head-bar.component';
import { LegalNoticeContentComponent } from './components/legal-notice-content/legal-notice-content.component';
import { PrivacyPolicyContentComponent } from './components/privacy-policy-content/privacy-policy-content.component';
import { SearchValueSelectorComponent } from './components/search-value-selector/search-value-selector.component';
import { OpenSlidesDateAdapter } from './date-adapter';
2018-10-01 15:36:16 +02:00
import { PromptDialogComponent } from './components/prompt-dialog/prompt-dialog.component';
import { SortingListComponent } from './components/sorting-list/sorting-list.component';
import { SortingTreeComponent } from './components/sorting-tree/sorting-tree.component';
2018-11-27 22:44:37 +01:00
import { ChoiceDialogComponent } from './components/choice-dialog/choice-dialog.component';
import { SortFilterBarComponent } from './components/sort-filter-bar/sort-filter-bar.component';
import { SortBottomSheetComponent } from './components/sort-filter-bar/sort-bottom-sheet/sort-bottom-sheet.component';
import { FilterMenuComponent } from './components/sort-filter-bar/filter-menu/filter-menu.component';
2019-01-16 15:54:34 +01:00
import { LogoComponent } from './components/logo/logo.component';
2019-01-18 16:55:56 +01:00
import { C4DialogComponent, CopyrightSignComponent } from './components/copyright-sign/copyright-sign.component';
import { ProjectorButtonComponent } from './components/projector-button/projector-button.component';
import { ProjectionDialogComponent } from './components/projection-dialog/projection-dialog.component';
import { ResizedDirective } from './directives/resized.directive';
import { MetaTextBlockComponent } from './components/meta-text-block/meta-text-block.component';
import { OpenSlidesTranslateModule } from '../core/translate/openslides-translate-module';
import { ProjectorComponent } from './components/projector/projector.component';
import { SlideContainerComponent } from './components/slide-container/slide-container.component';
2019-02-14 16:02:18 +01:00
import { CountdownTimeComponent } from './components/contdown-time/countdown-time.component';
import { MediaUploadContentComponent } from './components/media-upload-content/media-upload-content.component';
import { PrecisionPipe } from './pipes/precision.pipe';
import { SpeakerButtonComponent } from './components/speaker-button/speaker-button.component';
import { GridLayoutComponent } from './components/grid-layout/grid-layout.component';
import { TileComponent } from './components/tile/tile.component';
import { BlockTileComponent } from './components/block-tile/block-tile.component';
import { IconContainerComponent } from './components/icon-container/icon-container.component';
import { ListViewTableComponent } from './components/list-view-table/list-view-table.component';
2019-06-03 17:04:30 +02:00
import { AgendaContentObjectFormComponent } from './components/agenda-content-object-form/agenda-content-object-form.component';
import { ExtensionFieldComponent } from './components/extension-field/extension-field.component';
import { AttachmentControlComponent } from './components/attachment-control/attachment-control.component';
/**
* Share Module for all "dumb" components and pipes.
*
* These components don not import and inject services from core or other features
* in their constructors.
*
* Should receive all data though attributes in the template of the component using them.
* No dependency to the rest of our application.
*/
@NgModule({
imports: [
CommonModule,
FormsModule,
2018-08-16 17:03:39 +02:00
MatFormFieldModule,
MatSelectModule,
ReactiveFormsModule,
MatAutocompleteModule,
MatButtonModule,
MatCheckboxModule,
MatToolbarModule,
MatDatepickerModule,
MatNativeDateModule,
MatCardModule,
MatInputModule,
2018-08-08 17:25:39 +02:00
MatTableModule,
2018-08-09 13:27:04 +02:00
MatSortModule,
2018-08-08 17:25:39 +02:00
MatPaginatorModule,
2018-11-16 16:09:15 +01:00
MatProgressBarModule,
MatProgressSpinnerModule,
MatSidenavModule,
MatListModule,
MatExpansionModule,
MatMenuModule,
MatDialogModule,
MatSnackBarModule,
MatChipsModule,
2018-10-22 16:44:18 +02:00
MatBottomSheetModule,
2018-09-18 18:27:14 +02:00
MatTooltipModule,
2018-11-12 15:24:23 +01:00
MatBadgeModule,
// TODO: there is an error with missing icons
// we either wait or include a fixed version manually (dirty)
// https://github.com/google/material-design-icons/issues/786
MatIconModule,
2018-09-30 18:43:20 +02:00
MatRadioModule,
MatButtonToggleModule,
2018-11-04 11:11:48 +01:00
MatStepperModule,
2019-01-11 18:55:09 +01:00
MatTabsModule,
MatSliderModule,
MatDividerModule,
DragDropModule,
OpenSlidesTranslateModule.forChild(),
RouterModule,
2018-11-16 16:09:15 +01:00
NgxMatSelectSearchModule,
NgxFileDropModule,
EditorModule,
CdkTreeModule,
ScrollingModule,
PblNgridModule,
PblNgridMaterialModule
],
exports: [
FormsModule,
MatAutocompleteModule,
2018-08-16 17:03:39 +02:00
MatFormFieldModule,
MatSelectModule,
ReactiveFormsModule,
MatButtonModule,
MatCheckboxModule,
MatToolbarModule,
MatCardModule,
MatDatepickerModule,
MatInputModule,
2018-08-08 17:25:39 +02:00
MatTableModule,
2018-08-09 13:27:04 +02:00
MatSortModule,
2018-08-08 17:25:39 +02:00
MatPaginatorModule,
2018-11-16 16:09:15 +01:00
MatProgressBarModule,
MatProgressSpinnerModule,
MatSidenavModule,
MatListModule,
MatExpansionModule,
MatMenuModule,
MatDialogModule,
MatSnackBarModule,
MatChipsModule,
2018-09-18 18:27:14 +02:00
MatTooltipModule,
2019-01-11 18:55:09 +01:00
MatTabsModule,
2018-11-12 15:24:23 +01:00
MatBadgeModule,
MatIconModule,
2018-09-30 18:43:20 +02:00
MatRadioModule,
MatButtonToggleModule,
2018-11-04 11:11:48 +01:00
MatStepperModule,
MatSliderModule,
MatDividerModule,
DragDropModule,
NgxMatSelectSearchModule,
NgxFileDropModule,
TranslateModule,
OpenSlidesTranslateModule,
PermsDirective,
DomChangeDirective,
AutofocusDirective,
HeadBarComponent,
SearchValueSelectorComponent,
LegalNoticeContentComponent,
2018-10-01 15:36:16 +02:00
PrivacyPolicyContentComponent,
PromptDialogComponent,
2018-11-20 13:31:56 +01:00
SortingListComponent,
EditorModule,
SortingTreeComponent,
SortFilterBarComponent,
2019-01-18 16:55:56 +01:00
LogoComponent,
CopyrightSignComponent,
C4DialogComponent,
ProjectorButtonComponent,
ProjectionDialogComponent,
ResizedDirective,
MetaTextBlockComponent,
ProjectorComponent,
SlideContainerComponent,
CountdownTimeComponent,
MediaUploadContentComponent,
AttachmentControlComponent,
PrecisionPipe,
SpeakerButtonComponent,
GridLayoutComponent,
TileComponent,
BlockTileComponent,
ScrollingModule,
IconContainerComponent,
SpeakerButtonComponent,
PblNgridModule,
PblNgridMaterialModule,
2019-06-03 17:04:30 +02:00
ListViewTableComponent,
AgendaContentObjectFormComponent,
ExtensionFieldComponent
],
declarations: [
PermsDirective,
DomChangeDirective,
AutofocusDirective,
HeadBarComponent,
LegalNoticeContentComponent,
PrivacyPolicyContentComponent,
2018-10-01 15:36:16 +02:00
SearchValueSelectorComponent,
PromptDialogComponent,
SortingListComponent,
2018-11-27 22:44:37 +01:00
SortingTreeComponent,
2018-10-22 16:44:18 +02:00
ChoiceDialogComponent,
SortFilterBarComponent,
SortBottomSheetComponent,
2019-01-16 15:54:34 +01:00
FilterMenuComponent,
2019-01-18 16:55:56 +01:00
LogoComponent,
CopyrightSignComponent,
C4DialogComponent,
ProjectorButtonComponent,
ProjectionDialogComponent,
ResizedDirective,
MetaTextBlockComponent,
ProjectorComponent,
2019-02-14 16:02:18 +01:00
SlideContainerComponent,
CountdownTimeComponent,
MediaUploadContentComponent,
PrecisionPipe,
SpeakerButtonComponent,
GridLayoutComponent,
TileComponent,
BlockTileComponent,
IconContainerComponent,
2019-06-03 17:04:30 +02:00
ListViewTableComponent,
AgendaContentObjectFormComponent,
ExtensionFieldComponent,
AttachmentControlComponent
],
providers: [
{ provide: DateAdapter, useClass: OpenSlidesDateAdapter },
SearchValueSelectorComponent,
SortingListComponent,
2018-10-22 16:44:18 +02:00
SortingTreeComponent,
SortFilterBarComponent,
SortBottomSheetComponent,
DecimalPipe
2018-10-22 16:44:18 +02:00
],
entryComponents: [
SortBottomSheetComponent,
C4DialogComponent,
PromptDialogComponent,
ChoiceDialogComponent,
ProjectionDialogComponent
]
})
export class SharedModule {}