mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
[DURACOM-191] fix circular dependencies
This commit is contained in:
@@ -23,8 +23,8 @@ import { BUNDLE } from './shared/bundle.resource-type';
|
||||
import { CONFIG_PROPERTY } from './shared/config-property.resource-type';
|
||||
import { POOL_TASK } from './tasks/models/pool-task-object.resource-type';
|
||||
import { SUPERVISION_ORDER } from './supervision-order/models/supervision-order.resource-type';
|
||||
import { WorkspaceItem } from './submission/models/workspaceitem.model';
|
||||
import { WorkflowItem } from './submission/models/workflowitem.model';
|
||||
import { WORKSPACEITEM } from './eperson/models/workspaceitem.resource-type';
|
||||
import { WORKFLOWITEM } from './eperson/models/workflowitem.resource-type';
|
||||
import { SUBMISSION_CC_LICENSE_URL } from './submission/models/submission-cc-licence-link.resource-type';
|
||||
import { SUBMISSION_CC_LICENSE } from './submission/models/submission-cc-licence.resource-type';
|
||||
import { RESOURCE_POLICY } from './resource-policy/models/resource-policy.resource-type';
|
||||
@@ -80,8 +80,8 @@ export const LAZY_DATA_SERVICES: LazyDataServicesMap = {
|
||||
[POOL_TASK.value]: () => import('./tasks/pool-task-data.service').then(m => m.PoolTaskDataService),
|
||||
[CLAIMED_TASK.value]: () => import('./tasks/claimed-task-data.service').then(m => m.ClaimedTaskDataService),
|
||||
[SUPERVISION_ORDER.value]: () => import('./supervision-order/supervision-order-data.service').then(m => m.SupervisionOrderDataService),
|
||||
[WorkspaceItem.type.value]: () => import('./submission/workspaceitem-data.service').then(m => m.WorkspaceitemDataService),
|
||||
[WorkflowItem.type.value]: () => import('./submission/workflowitem-data.service').then(m => m.WorkflowItemDataService),
|
||||
[WORKSPACEITEM.value]: () => import('./submission/workspaceitem-data.service').then(m => m.WorkspaceitemDataService),
|
||||
[WORKFLOWITEM.value]: () => import('./submission/workflowitem-data.service').then(m => m.WorkflowItemDataService),
|
||||
[VOCABULARY.value]: () => import('./submission/vocabularies/vocabulary.data.service').then(m => m.VocabularyDataService),
|
||||
[VOCABULARY_ENTRY_DETAIL.value]: () => import('./submission/vocabularies/vocabulary-entry-details.data.service').then(m => m.VocabularyEntryDetailsDataService),
|
||||
[SUBMISSION_CC_LICENSE_URL.value]: () => import('./submission/submission-cc-license-url-data.service').then(m => m.SubmissionCcLicenseUrlDataService),
|
||||
|
@@ -10,7 +10,12 @@ import { CheckAuthenticationTokenAction } from './core/auth/auth.actions';
|
||||
import { CorrelationIdService } from './correlation-id/correlation-id.service';
|
||||
import { APP_INITIALIZER, Inject, Provider, Type } from '@angular/core';
|
||||
import { makeStateKey, TransferState } from '@angular/platform-browser';
|
||||
import { APP_CONFIG, APP_DATA_SERVICES_MAP, AppConfig } from '../config/app-config.interface';
|
||||
import {
|
||||
APP_CONFIG,
|
||||
APP_DATA_SERVICES_MAP,
|
||||
APP_DYNAMIC_FORM_CONTROL_FN,
|
||||
AppConfig
|
||||
} from '../config/app-config.interface';
|
||||
import { environment } from '../environments/environment';
|
||||
import { AppState } from './app.reducer';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
@@ -25,6 +30,7 @@ import { distinctUntilChanged, find } from 'rxjs/operators';
|
||||
import { Observable } from 'rxjs';
|
||||
import { MenuService } from './shared/menu/menu.service';
|
||||
import { LAZY_DATA_SERVICES } from './core/data-services-map';
|
||||
import { dsDynamicFormControlMapFn } from './shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
||||
|
||||
/**
|
||||
* Performs the initialization of the app.
|
||||
@@ -95,6 +101,10 @@ export abstract class InitService {
|
||||
provide: APP_DATA_SERVICES_MAP,
|
||||
useValue: LAZY_DATA_SERVICES,
|
||||
},
|
||||
{
|
||||
provide: APP_DYNAMIC_FORM_CONTROL_FN,
|
||||
useValue: dsDynamicFormControlMapFn,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -26,9 +26,8 @@ import { RelatedItemsComponent } from './simple/related-items/related-items-comp
|
||||
import {
|
||||
ThemedMetadataRepresentationListComponent
|
||||
} from './simple/metadata-representation-list/themed-metadata-representation-list.component';
|
||||
import {
|
||||
dsDynamicFormControlMapFn
|
||||
} from '../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component';
|
||||
|
||||
import { dsDynamicFormControlMapFn } from '../shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
||||
|
||||
const ENTRY_COMPONENTS = [
|
||||
ItemVersionsDeleteModalComponent,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, DebugElement, NgZone, SimpleChange } from '@angular/core';
|
||||
import { UntypedFormControl, UntypedFormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { FormsModule, ReactiveFormsModule, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
@@ -25,7 +25,9 @@ import {
|
||||
DynamicSliderModel,
|
||||
DynamicSwitchModel,
|
||||
DynamicTextAreaModel,
|
||||
DynamicTimePickerModel, MATCH_VISIBLE, OR_OPERATOR
|
||||
DynamicTimePickerModel,
|
||||
MATCH_VISIBLE,
|
||||
OR_OPERATOR
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import {
|
||||
DynamicNGBootstrapCalendarComponent,
|
||||
@@ -39,10 +41,7 @@ import {
|
||||
} from '@ng-dynamic-forms/ui-ng-bootstrap';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import {
|
||||
DsDynamicFormControlContainerComponent,
|
||||
dsDynamicFormControlMapFn
|
||||
} from './ds-dynamic-form-control-container.component';
|
||||
import { DsDynamicFormControlContainerComponent } from './ds-dynamic-form-control-container.component';
|
||||
import { DynamicDsDatePickerModel } from './models/date-picker/date-picker.model';
|
||||
import { DynamicRelationGroupModel } from './models/relation-group/dynamic-relation-group.model';
|
||||
import { DynamicListCheckboxGroupModel } from './models/list/dynamic-list-checkbox-group.model';
|
||||
@@ -55,7 +54,9 @@ import { DynamicOneboxModel } from './models/onebox/dynamic-onebox.model';
|
||||
import { DynamicQualdropModel } from './models/ds-dynamic-qualdrop.model';
|
||||
import { DynamicLookupNameModel } from './models/lookup/dynamic-lookup-name.model';
|
||||
import { DsDynamicOneboxComponent } from './models/onebox/dynamic-onebox.component';
|
||||
import { DsDynamicScrollableDropdownComponent } from './models/scrollable-dropdown/dynamic-scrollable-dropdown.component';
|
||||
import {
|
||||
DsDynamicScrollableDropdownComponent
|
||||
} from './models/scrollable-dropdown/dynamic-scrollable-dropdown.component';
|
||||
import { DsDynamicTagComponent } from './models/tag/dynamic-tag.component';
|
||||
import { DsDynamicListComponent } from './models/list/dynamic-list.component';
|
||||
import { DsDatePickerComponent } from './models/date-picker/date-picker.component';
|
||||
@@ -80,6 +81,7 @@ import { FormBuilderService } from '../form-builder.service';
|
||||
import { NgxMaskModule } from 'ngx-mask';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../environments/environment';
|
||||
import { dsDynamicFormControlMapFn } from './ds-dynamic-form-control-map-fn';
|
||||
|
||||
function getMockDsDynamicTypeBindRelationService(): DsDynamicTypeBindRelationService {
|
||||
return jasmine.createSpyObj('DsDynamicTypeBindRelationService', {
|
||||
|
@@ -4,7 +4,8 @@ import {
|
||||
Component,
|
||||
ComponentFactoryResolver,
|
||||
ContentChildren,
|
||||
EventEmitter, Inject,
|
||||
EventEmitter,
|
||||
Inject,
|
||||
Input,
|
||||
NgZone,
|
||||
OnChanges,
|
||||
@@ -20,17 +21,7 @@ import {
|
||||
import { FormsModule, ReactiveFormsModule, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
||||
|
||||
import {
|
||||
DYNAMIC_FORM_CONTROL_TYPE_ARRAY,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_GROUP,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_INPUT,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_SELECT,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_TIMEPICKER,
|
||||
DynamicDatePickerModel,
|
||||
DynamicFormArrayGroupModel,
|
||||
DynamicFormArrayModel,
|
||||
DynamicFormComponentService,
|
||||
@@ -45,43 +36,13 @@ import {
|
||||
DynamicFormValidationService,
|
||||
DynamicTemplateDirective,
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import {
|
||||
DynamicNGBootstrapCalendarComponent,
|
||||
DynamicNGBootstrapCheckboxComponent,
|
||||
DynamicNGBootstrapCheckboxGroupComponent,
|
||||
DynamicNGBootstrapInputComponent,
|
||||
DynamicNGBootstrapRadioGroupComponent,
|
||||
DynamicNGBootstrapSelectComponent,
|
||||
DynamicNGBootstrapTextAreaComponent,
|
||||
DynamicNGBootstrapTimePickerComponent
|
||||
} from '@ng-dynamic-forms/ui-ng-bootstrap';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import {
|
||||
ExistingMetadataListElementComponent,
|
||||
ReorderableRelationship
|
||||
} from './existing-metadata-list-element/existing-metadata-list-element.component';
|
||||
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_ONEBOX } from './models/onebox/dynamic-onebox.model';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN } from './models/scrollable-dropdown/dynamic-scrollable-dropdown.model';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_TAG } from './models/tag/dynamic-tag.model';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER } from './models/date-picker/date-picker.model';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP } from './models/lookup/dynamic-lookup.model';
|
||||
import { DynamicListCheckboxGroupModel } from './models/list/dynamic-list-checkbox-group.model';
|
||||
import { DynamicListRadioGroupModel } from './models/list/dynamic-list-radio-group.model';
|
||||
import { hasNoValue, hasValue, isNotEmpty, isNotUndefined } from '../../../empty.util';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME } from './models/lookup/dynamic-lookup-name.model';
|
||||
import { DsDynamicTagComponent } from './models/tag/dynamic-tag.component';
|
||||
import { DsDatePickerComponent } from './models/date-picker/date-picker.component';
|
||||
import { DsDynamicListComponent } from './models/list/dynamic-list.component';
|
||||
import { DsDynamicOneboxComponent } from './models/onebox/dynamic-onebox.component';
|
||||
import { DsDynamicScrollableDropdownComponent } from './models/scrollable-dropdown/dynamic-scrollable-dropdown.component';
|
||||
import { DsDynamicLookupComponent } from './models/lookup/dynamic-lookup.component';
|
||||
import { DsDynamicFormGroupComponent } from './models/form-group/dynamic-form-group.component';
|
||||
import { DsDynamicFormArrayComponent } from './models/array-group/dynamic-form-array.component';
|
||||
import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components';
|
||||
import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_CUSTOM_SWITCH } from './models/custom-switch/custom-switch.model';
|
||||
import { CustomSwitchComponent } from './models/custom-switch/custom-switch.component';
|
||||
import { find, map, startWith, switchMap, take } from 'rxjs/operators';
|
||||
import { combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs';
|
||||
import { DsDynamicTypeBindRelationService } from './ds-dynamic-type-bind-relation.service';
|
||||
@@ -90,8 +51,6 @@ import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||
import { NgbModal, NgbModalRef, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { RelationshipDataService } from '../../../../core/data/relationship-data.service';
|
||||
import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service';
|
||||
import { DsDynamicDisabledComponent } from './models/disabled/dynamic-disabled.component';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_DISABLED } from './models/disabled/dynamic-disabled.model';
|
||||
import { DsDynamicLookupRelationModalComponent } from './relation-lookup-modal/dynamic-lookup-relation-modal.component';
|
||||
import {
|
||||
getAllSucceededRemoteData,
|
||||
@@ -119,81 +78,19 @@ import { followLink } from '../../../utils/follow-link-config.model';
|
||||
import { paginatedRelationsToItems } from '../../../../item-page/simple/item-types/shared/item-relationships-utils';
|
||||
import { RelationshipOptions } from '../models/relationship-options.model';
|
||||
import { FormBuilderService } from '../form-builder.service';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './ds-dynamic-form-constants';
|
||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
|
||||
import {
|
||||
APP_CONFIG,
|
||||
APP_DYNAMIC_FORM_CONTROL_FN,
|
||||
AppConfig,
|
||||
DynamicFormControlFn
|
||||
} from '../../../../../config/app-config.interface';
|
||||
import { itemLinksToFollow } from '../../../utils/relation-query.utils';
|
||||
import { AsyncPipe, NgClass, NgForOf, NgIf, NgTemplateOutlet } from '@angular/common';
|
||||
import {
|
||||
ExistingRelationListElementComponent
|
||||
} from './existing-relation-list-element/existing-relation-list-element.component';
|
||||
|
||||
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
|
||||
switch (model.type) {
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_ARRAY:
|
||||
return DsDynamicFormArrayComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX:
|
||||
return DynamicNGBootstrapCheckboxComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP:
|
||||
return (model instanceof DynamicListCheckboxGroupModel) ? DsDynamicListComponent : DynamicNGBootstrapCheckboxGroupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER:
|
||||
const datepickerModel = model as DynamicDatePickerModel;
|
||||
|
||||
return datepickerModel.inline ? DynamicNGBootstrapCalendarComponent : DsDatePickerInlineComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_GROUP:
|
||||
return DsDynamicFormGroupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_INPUT:
|
||||
return DynamicNGBootstrapInputComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP:
|
||||
return (model instanceof DynamicListRadioGroupModel) ? DsDynamicListComponent : DynamicNGBootstrapRadioGroupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_SELECT:
|
||||
return DynamicNGBootstrapSelectComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA:
|
||||
return DynamicNGBootstrapTextAreaComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_TIMEPICKER:
|
||||
return DynamicNGBootstrapTimePickerComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_ONEBOX:
|
||||
return DsDynamicOneboxComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN:
|
||||
return DsDynamicScrollableDropdownComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_TAG:
|
||||
return DsDynamicTagComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP:
|
||||
return DsDynamicRelationGroupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER:
|
||||
return DsDatePickerComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP:
|
||||
return DsDynamicLookupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME:
|
||||
return DsDynamicLookupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_DISABLED:
|
||||
return DsDynamicDisabledComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_CUSTOM_SWITCH:
|
||||
return CustomSwitchComponent;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'ds-dynamic-form-control-container',
|
||||
styleUrls: ['./ds-dynamic-form-control-container.component.scss'],
|
||||
@@ -260,7 +157,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
fetchThumbnail: boolean;
|
||||
|
||||
get componentType(): Type<DynamicFormControl> | null {
|
||||
return dsDynamicFormControlMapFn(this.model);
|
||||
return this.dynamicFormControlFn(this.model);
|
||||
}
|
||||
|
||||
constructor(
|
||||
@@ -283,6 +180,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
public formBuilderService: FormBuilderService,
|
||||
private submissionService: SubmissionService,
|
||||
@Inject(APP_CONFIG) protected appConfig: AppConfig,
|
||||
@Inject(APP_DYNAMIC_FORM_CONTROL_FN) protected dynamicFormControlFn: DynamicFormControlFn,
|
||||
) {
|
||||
super(ref, componentFactoryResolver, layoutService, validationService, dynamicFormComponentService, relationService);
|
||||
this.fetchThumbnail = this.appConfig.browseBy.showThumbnails;
|
||||
|
@@ -0,0 +1,119 @@
|
||||
import {
|
||||
DYNAMIC_FORM_CONTROL_TYPE_ARRAY,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_GROUP,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_INPUT,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_SELECT,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA,
|
||||
DYNAMIC_FORM_CONTROL_TYPE_TIMEPICKER,
|
||||
DynamicDatePickerModel,
|
||||
DynamicFormControl,
|
||||
DynamicFormControlModel
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import { Type } from '@angular/core';
|
||||
import { DsDynamicFormArrayComponent } from './models/array-group/dynamic-form-array.component';
|
||||
import {
|
||||
DynamicNGBootstrapCalendarComponent,
|
||||
DynamicNGBootstrapCheckboxComponent,
|
||||
DynamicNGBootstrapCheckboxGroupComponent,
|
||||
DynamicNGBootstrapInputComponent,
|
||||
DynamicNGBootstrapRadioGroupComponent,
|
||||
DynamicNGBootstrapSelectComponent,
|
||||
DynamicNGBootstrapTextAreaComponent,
|
||||
DynamicNGBootstrapTimePickerComponent
|
||||
} from '@ng-dynamic-forms/ui-ng-bootstrap';
|
||||
import { DynamicListCheckboxGroupModel } from './models/list/dynamic-list-checkbox-group.model';
|
||||
import { DsDynamicListComponent } from './models/list/dynamic-list.component';
|
||||
import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component';
|
||||
import { DsDynamicFormGroupComponent } from './models/form-group/dynamic-form-group.component';
|
||||
import { DynamicListRadioGroupModel } from './models/list/dynamic-list-radio-group.model';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_ONEBOX } from './models/onebox/dynamic-onebox.model';
|
||||
import { DsDynamicOneboxComponent } from './models/onebox/dynamic-onebox.component';
|
||||
import {
|
||||
DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN
|
||||
} from './models/scrollable-dropdown/dynamic-scrollable-dropdown.model';
|
||||
import {
|
||||
DsDynamicScrollableDropdownComponent
|
||||
} from './models/scrollable-dropdown/dynamic-scrollable-dropdown.component';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_TAG } from './models/tag/dynamic-tag.model';
|
||||
import { DsDynamicTagComponent } from './models/tag/dynamic-tag.component';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './ds-dynamic-form-constants';
|
||||
import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER } from './models/date-picker/date-picker.model';
|
||||
import { DsDatePickerComponent } from './models/date-picker/date-picker.component';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP } from './models/lookup/dynamic-lookup.model';
|
||||
import { DsDynamicLookupComponent } from './models/lookup/dynamic-lookup.component';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME } from './models/lookup/dynamic-lookup-name.model';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_DISABLED } from './models/disabled/dynamic-disabled.model';
|
||||
import { DsDynamicDisabledComponent } from './models/disabled/dynamic-disabled.component';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_CUSTOM_SWITCH } from './models/custom-switch/custom-switch.model';
|
||||
import { CustomSwitchComponent } from './models/custom-switch/custom-switch.component';
|
||||
|
||||
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
|
||||
switch (model.type) {
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_ARRAY:
|
||||
return DsDynamicFormArrayComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX:
|
||||
return DynamicNGBootstrapCheckboxComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_CHECKBOX_GROUP:
|
||||
return (model instanceof DynamicListCheckboxGroupModel) ? DsDynamicListComponent : DynamicNGBootstrapCheckboxGroupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER:
|
||||
const datepickerModel = model as DynamicDatePickerModel;
|
||||
|
||||
return datepickerModel.inline ? DynamicNGBootstrapCalendarComponent : DsDatePickerInlineComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_GROUP:
|
||||
return DsDynamicFormGroupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_INPUT:
|
||||
return DynamicNGBootstrapInputComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_RADIO_GROUP:
|
||||
return (model instanceof DynamicListRadioGroupModel) ? DsDynamicListComponent : DynamicNGBootstrapRadioGroupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_SELECT:
|
||||
return DynamicNGBootstrapSelectComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA:
|
||||
return DynamicNGBootstrapTextAreaComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_TIMEPICKER:
|
||||
return DynamicNGBootstrapTimePickerComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_ONEBOX:
|
||||
return DsDynamicOneboxComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN:
|
||||
return DsDynamicScrollableDropdownComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_TAG:
|
||||
return DsDynamicTagComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP:
|
||||
return DsDynamicRelationGroupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER:
|
||||
return DsDatePickerComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP:
|
||||
return DsDynamicLookupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME:
|
||||
return DsDynamicLookupComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_DISABLED:
|
||||
return DsDynamicDisabledComponent;
|
||||
|
||||
case DYNAMIC_FORM_CONTROL_TYPE_CUSTOM_SWITCH:
|
||||
return CustomSwitchComponent;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -2,28 +2,60 @@ import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormComponent } from './form.component';
|
||||
import { DsDynamicFormComponent } from './builder/ds-dynamic-form-ui/ds-dynamic-form.component';
|
||||
import { DsDynamicFormControlContainerComponent, dsDynamicFormControlMapFn } from './builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component';
|
||||
import {
|
||||
DsDynamicFormControlContainerComponent
|
||||
} from './builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component';
|
||||
import { DsDynamicListComponent } from './builder/ds-dynamic-form-ui/models/list/dynamic-list.component';
|
||||
import { DsDynamicLookupComponent } from './builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component';
|
||||
import { DsDynamicDisabledComponent } from './builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component';
|
||||
import { DsDynamicLookupRelationModalComponent } from './builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component';
|
||||
import { DsDynamicScrollableDropdownComponent } from './builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component';
|
||||
import {
|
||||
DsDynamicLookupRelationModalComponent
|
||||
} from './builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component';
|
||||
import {
|
||||
DsDynamicScrollableDropdownComponent
|
||||
} from './builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component';
|
||||
import { DsDynamicTagComponent } from './builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component';
|
||||
import { DsDynamicOneboxComponent } from './builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component';
|
||||
import { DsDynamicRelationGroupComponent } from './builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components';
|
||||
import {
|
||||
DsDynamicRelationGroupComponent
|
||||
} from './builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.components';
|
||||
import { DsDatePickerComponent } from './builder/ds-dynamic-form-ui/models/date-picker/date-picker.component';
|
||||
import { DsDynamicFormGroupComponent } from './builder/ds-dynamic-form-ui/models/form-group/dynamic-form-group.component';
|
||||
import { DsDynamicFormArrayComponent } from './builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component';
|
||||
import { DsDatePickerInlineComponent } from './builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component';
|
||||
import { DsDynamicLookupRelationSearchTabComponent } from './builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component';
|
||||
import { DsDynamicLookupRelationSelectionTabComponent } from './builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component';
|
||||
import { DsDynamicLookupRelationExternalSourceTabComponent } from './builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component';
|
||||
import {
|
||||
DsDynamicFormGroupComponent
|
||||
} from './builder/ds-dynamic-form-ui/models/form-group/dynamic-form-group.component';
|
||||
import {
|
||||
DsDynamicFormArrayComponent
|
||||
} from './builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component';
|
||||
import {
|
||||
DsDatePickerInlineComponent
|
||||
} from './builder/ds-dynamic-form-ui/models/date-picker-inline/dynamic-date-picker-inline.component';
|
||||
import {
|
||||
DsDynamicLookupRelationSearchTabComponent
|
||||
} from './builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component';
|
||||
import {
|
||||
DsDynamicLookupRelationSelectionTabComponent
|
||||
} from './builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component';
|
||||
import {
|
||||
DsDynamicLookupRelationExternalSourceTabComponent
|
||||
} from './builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { SearchModule } from '../search/search.module';
|
||||
import { DYNAMIC_FORM_CONTROL_MAP_FN, DynamicFormLayoutService, DynamicFormsCoreModule, DynamicFormService, DynamicFormValidationService } from '@ng-dynamic-forms/core';
|
||||
import { ExistingMetadataListElementComponent } from './builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component';
|
||||
import { ExistingRelationListElementComponent } from './builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component';
|
||||
import { ExternalSourceEntryImportModalComponent } from './builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component';
|
||||
import {
|
||||
DYNAMIC_FORM_CONTROL_MAP_FN,
|
||||
DynamicFormLayoutService,
|
||||
DynamicFormsCoreModule,
|
||||
DynamicFormService,
|
||||
DynamicFormValidationService
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import {
|
||||
ExistingMetadataListElementComponent
|
||||
} from './builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component';
|
||||
import {
|
||||
ExistingRelationListElementComponent
|
||||
} from './builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component';
|
||||
import {
|
||||
ExternalSourceEntryImportModalComponent
|
||||
} from './builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component';
|
||||
import { CustomSwitchComponent } from './builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.component';
|
||||
import { DynamicFormsNGBootstrapUIModule } from '@ng-dynamic-forms/ui-ng-bootstrap';
|
||||
import { ChipsComponent } from './chips/chips.component';
|
||||
@@ -36,11 +68,18 @@ import { FormBuilderService } from './builder/form-builder.service';
|
||||
import { DsDynamicTypeBindRelationService } from './builder/ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||
import { FormService } from './form.service';
|
||||
import { NgxMaskModule } from 'ngx-mask';
|
||||
import { ThemedExternalSourceEntryImportModalComponent } from './builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/themed-external-source-entry-import-modal.component';
|
||||
import {
|
||||
ThemedExternalSourceEntryImportModalComponent
|
||||
} from './builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/themed-external-source-entry-import-modal.component';
|
||||
import { NgbDatepickerModule, NgbTimepickerModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { CdkTreeModule } from '@angular/cdk/tree';
|
||||
import { ThemedDynamicLookupRelationSearchTabComponent } from './builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/themed-dynamic-lookup-relation-search-tab.component';
|
||||
import { ThemedDynamicLookupRelationExternalSourceTabComponent } from './builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/themed-dynamic-lookup-relation-external-source-tab.component';
|
||||
import {
|
||||
ThemedDynamicLookupRelationSearchTabComponent
|
||||
} from './builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/themed-dynamic-lookup-relation-search-tab.component';
|
||||
import {
|
||||
ThemedDynamicLookupRelationExternalSourceTabComponent
|
||||
} from './builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/themed-dynamic-lookup-relation-external-source-tab.component';
|
||||
import { dsDynamicFormControlMapFn } from './builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn';
|
||||
|
||||
const COMPONENTS = [
|
||||
CustomSwitchComponent,
|
||||
|
@@ -24,6 +24,7 @@ import { FilterVocabularyConfig } from './filter-vocabulary-config';
|
||||
import { DiscoverySortConfig } from './discovery-sort.config';
|
||||
import { QualityAssuranceConfig } from './quality-assurance.config';
|
||||
import { HALDataService } from '../app/core/data/base/hal-data-service.interface';
|
||||
import { DynamicFormControl } from '@ng-dynamic-forms/core/lib/component/dynamic-form-control-interface';
|
||||
|
||||
interface AppConfig extends Config {
|
||||
ui: UIServerConfig;
|
||||
@@ -64,8 +65,12 @@ const APP_CONFIG_STATE = makeStateKey<AppConfig>('APP_CONFIG_STATE');
|
||||
export interface LazyDataServicesMap {
|
||||
[type: string]: () => Promise<Type<HALDataService<any>>>
|
||||
}
|
||||
|
||||
export type DynamicFormControlFn = (model: string) => Type<DynamicFormControl>;
|
||||
export const APP_DATA_SERVICES_MAP: InjectionToken<LazyDataServicesMap> = new InjectionToken<LazyDataServicesMap>('APP_DATA_SERVICES_MAP');
|
||||
|
||||
export const APP_DYNAMIC_FORM_CONTROL_FN: InjectionToken<DynamicFormControlFn> = new InjectionToken<DynamicFormControlFn>('APP_DYNAMIC_FORM_CONTROL_FN');
|
||||
|
||||
export {
|
||||
AppConfig,
|
||||
APP_CONFIG,
|
||||
|
Reference in New Issue
Block a user