mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[AAE-12723] Move rich text editor in Process cloud (#8283)
* move rich text editor in Process cloud * fix import * fix * fix
This commit is contained in:
@@ -58,7 +58,6 @@ import { SearchTextModule } from './search-text/search-text-input.module';
|
||||
import { AlfrescoJsClientsModule } from '@alfresco/adf-core/api';
|
||||
import { AuthenticationInterceptor, Authentication } from '@alfresco/adf-core/auth';
|
||||
import { LegacyApiClientModule } from './api-factories/legacy-api-client.module';
|
||||
import { RichTextEditorModule } from './rich-text-editor/rich-text-editor.module';
|
||||
import { HttpClientModule, HttpClientXsrfModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { AuthenticationService } from './auth/services/authentication.service';
|
||||
import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';
|
||||
@@ -112,7 +111,6 @@ const defaultConfig: Config = { useAngularBasedHttpClientInAlfrescoJs: false };
|
||||
BlankPageModule,
|
||||
LegacyApiClientModule,
|
||||
AlfrescoJsClientsModule,
|
||||
RichTextEditorModule,
|
||||
HttpClientModule,
|
||||
HttpClientXsrfModule.withOptions({
|
||||
cookieName: 'CSRF-TOKEN',
|
||||
@@ -151,8 +149,7 @@ const defaultConfig: Config = { useAngularBasedHttpClientInAlfrescoJs: false };
|
||||
IconModule,
|
||||
NotificationHistoryModule,
|
||||
SearchTextModule,
|
||||
BlankPageModule,
|
||||
RichTextEditorModule
|
||||
BlankPageModule
|
||||
]
|
||||
})
|
||||
export class CoreModule {
|
||||
|
||||
@@ -22,6 +22,8 @@ export class FormFieldTypes {
|
||||
static GROUP: string = 'group';
|
||||
static DYNAMIC_TABLE: string = 'dynamic-table';
|
||||
static TEXT: string = 'text';
|
||||
static STRING: string = 'string';
|
||||
static INTEGER: string = 'integer';
|
||||
static MULTILINE_TEXT: string = 'multi-line-text';
|
||||
static DROPDOWN: string = 'dropdown';
|
||||
static HYPERLINK: string = 'hyperlink';
|
||||
@@ -42,6 +44,8 @@ export class FormFieldTypes {
|
||||
static PROPERTIES_VIEWER: string = 'properties-viewer';
|
||||
static ALFRESCO_FILE_VIEWER: string = 'file-viewer';
|
||||
static VIEWER: string = 'base-viewer';
|
||||
static DISPLAY_RICH_TEXT: string = 'display-rich-text';
|
||||
static JSON: string = 'json';
|
||||
|
||||
static READONLY_TYPES: string[] = [
|
||||
FormFieldTypes.HYPERLINK,
|
||||
|
||||
@@ -30,7 +30,6 @@ import { TextWidgetComponent } from './text/text.widget';
|
||||
import { DateTimeWidgetComponent } from './date-time/date-time.widget';
|
||||
import { JsonWidgetComponent } from './json/json.widget';
|
||||
import { BaseViewerWidgetComponent } from './base-viewer/base-viewer.widget';
|
||||
import { DisplayRichTextWidgetComponent } from './display-rich-text/display-rich-text.widget';
|
||||
|
||||
// core
|
||||
export * from './widget.component';
|
||||
@@ -50,7 +49,6 @@ export * from './error/error.component';
|
||||
export * from './date-time/date-time.widget';
|
||||
export * from './json/json.widget';
|
||||
export * from './base-viewer/base-viewer.widget';
|
||||
export * from './display-rich-text/display-rich-text.widget';
|
||||
export * from './text/text-mask.component';
|
||||
|
||||
export const WIDGET_DIRECTIVES: any[] = [
|
||||
@@ -66,8 +64,7 @@ export const WIDGET_DIRECTIVES: any[] = [
|
||||
ErrorWidgetComponent,
|
||||
DateTimeWidgetComponent,
|
||||
JsonWidgetComponent,
|
||||
BaseViewerWidgetComponent,
|
||||
DisplayRichTextWidgetComponent
|
||||
BaseViewerWidgetComponent
|
||||
];
|
||||
|
||||
export const MASK_DIRECTIVE: any[] = [
|
||||
|
||||
@@ -20,8 +20,7 @@ import {
|
||||
FormFieldTypes,
|
||||
UnknownWidgetComponent,
|
||||
TextWidgetComponent,
|
||||
JsonWidgetComponent,
|
||||
DisplayRichTextWidgetComponent
|
||||
JsonWidgetComponent
|
||||
} from '../components/widgets';
|
||||
import { FormRenderingService } from './form-rendering.service';
|
||||
|
||||
@@ -101,9 +100,4 @@ describe('FormRenderingService', () => {
|
||||
expect(type).toBe(JsonWidgetComponent);
|
||||
});
|
||||
|
||||
it('should resolve Display Rich Text widget for display-rich-text field type', () => {
|
||||
const resolver = service.getComponentTypeResolver('display-rich-text');
|
||||
const type = resolver(null);
|
||||
expect(type).toBe(DisplayRichTextWidgetComponent);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,9 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DynamicComponentMapper, DynamicComponentResolveFunction, DynamicComponentResolver } from '../../common/services/dynamic-component-mapper.service';
|
||||
import {
|
||||
DynamicComponentMapper,
|
||||
DynamicComponentResolveFunction,
|
||||
DynamicComponentResolver
|
||||
} from '../../common/services/dynamic-component-mapper.service';
|
||||
import { Injectable, Type } from '@angular/core';
|
||||
import * as widgets from '../components/widgets';
|
||||
import { FormFieldTypes } from '../components/widgets';
|
||||
|
||||
/* eslint-disable id-blacklist */
|
||||
@Injectable({
|
||||
@@ -27,19 +32,18 @@ export class FormRenderingService extends DynamicComponentMapper {
|
||||
|
||||
protected defaultValue: Type<any> = widgets.UnknownWidgetComponent;
|
||||
protected types: { [key: string]: DynamicComponentResolveFunction } = {
|
||||
text: DynamicComponentResolver.fromType(widgets.TextWidgetComponent),
|
||||
string: DynamicComponentResolver.fromType(widgets.TextWidgetComponent),
|
||||
integer: DynamicComponentResolver.fromType(widgets.NumberWidgetComponent),
|
||||
'multi-line-text': DynamicComponentResolver.fromType(widgets.MultilineTextWidgetComponentComponent),
|
||||
boolean: DynamicComponentResolver.fromType(widgets.CheckboxWidgetComponent),
|
||||
date: DynamicComponentResolver.fromType(widgets.DateWidgetComponent),
|
||||
amount: DynamicComponentResolver.fromType(widgets.AmountWidgetComponent),
|
||||
hyperlink: DynamicComponentResolver.fromType(widgets.HyperlinkWidgetComponent),
|
||||
'readonly-text': DynamicComponentResolver.fromType(widgets.DisplayTextWidgetComponent),
|
||||
json: DynamicComponentResolver.fromType(widgets.JsonWidgetComponent),
|
||||
readonly: DynamicComponentResolver.fromType(widgets.TextWidgetComponent),
|
||||
datetime: DynamicComponentResolver.fromType(widgets.DateTimeWidgetComponent),
|
||||
'base-viewer': DynamicComponentResolver.fromType(widgets.BaseViewerWidgetComponent),
|
||||
'display-rich-text': DynamicComponentResolver.fromType(widgets.DisplayRichTextWidgetComponent)
|
||||
[FormFieldTypes.TEXT]: DynamicComponentResolver.fromType(widgets.TextWidgetComponent),
|
||||
[FormFieldTypes.STRING]: DynamicComponentResolver.fromType(widgets.TextWidgetComponent),
|
||||
[FormFieldTypes.INTEGER]: DynamicComponentResolver.fromType(widgets.NumberWidgetComponent),
|
||||
[FormFieldTypes.MULTILINE_TEXT]: DynamicComponentResolver.fromType(widgets.MultilineTextWidgetComponentComponent),
|
||||
[FormFieldTypes.BOOLEAN]: DynamicComponentResolver.fromType(widgets.CheckboxWidgetComponent),
|
||||
[FormFieldTypes.DATE]: DynamicComponentResolver.fromType(widgets.DateWidgetComponent),
|
||||
[FormFieldTypes.AMOUNT]: DynamicComponentResolver.fromType(widgets.AmountWidgetComponent),
|
||||
[FormFieldTypes.HYPERLINK]: DynamicComponentResolver.fromType(widgets.HyperlinkWidgetComponent),
|
||||
[FormFieldTypes.READONLY_TEXT]: DynamicComponentResolver.fromType(widgets.DisplayTextWidgetComponent),
|
||||
[FormFieldTypes.JSON]: DynamicComponentResolver.fromType(widgets.JsonWidgetComponent),
|
||||
[FormFieldTypes.DISPLAY_VALUE]: DynamicComponentResolver.fromType(widgets.TextWidgetComponent),
|
||||
[FormFieldTypes.DATETIME]: DynamicComponentResolver.fromType(widgets.DateTimeWidgetComponent),
|
||||
[FormFieldTypes.VIEWER]: DynamicComponentResolver.fromType(widgets.BaseViewerWidgetComponent)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ export * from './lib/dialogs/index';
|
||||
export * from './lib/icon/index';
|
||||
export * from './lib/notifications/index';
|
||||
export * from './lib/blank-page/index';
|
||||
export * from './lib/rich-text-editor/index';
|
||||
export * from './lib/search-text/index';
|
||||
export * from './lib/snackbar-content/index';
|
||||
export * from './lib/translation/index';
|
||||
|
||||
@@ -25,6 +25,7 @@ import { GroupCloudWidgetComponent } from './widgets/group/group-cloud.widget';
|
||||
import { PropertiesViewerWidgetComponent } from './widgets/properties-viewer/properties-viewer.widget';
|
||||
import { RadioButtonsCloudWidgetComponent } from './widgets/radio-buttons/radio-buttons-cloud.widget';
|
||||
import { FileViewerWidgetComponent } from './widgets/file-viewer/file-viewer.widget';
|
||||
import { DisplayRichTextWidgetComponent } from './widgets/display-rich-text/display-rich-text.widget';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -41,7 +42,8 @@ export class CloudFormRenderingService extends FormRenderingService {
|
||||
[FormFieldTypes.FUNCTIONAL_GROUP]: () => GroupCloudWidgetComponent,
|
||||
[FormFieldTypes.PROPERTIES_VIEWER]: () => PropertiesViewerWidgetComponent,
|
||||
[FormFieldTypes.RADIO_BUTTONS]: () => RadioButtonsCloudWidgetComponent,
|
||||
[FormFieldTypes.ALFRESCO_FILE_VIEWER]: () => FileViewerWidgetComponent
|
||||
[FormFieldTypes.ALFRESCO_FILE_VIEWER]: () => FileViewerWidgetComponent,
|
||||
[FormFieldTypes.DISPLAY_RICH_TEXT]: () => DisplayRichTextWidgetComponent
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { CoreTestingModule, setupTestBed } from '../../../../testing';
|
||||
import { CoreTestingModule, setupTestBed } from '@alfresco/adf-core';
|
||||
|
||||
import { DisplayRichTextWidgetComponent } from './display-rich-text.widget';
|
||||
|
||||
+1
-2
@@ -18,8 +18,7 @@
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
import { WidgetComponent } from '../widget.component';
|
||||
import { WidgetComponent, FormService } from '@alfresco/adf-core';
|
||||
/* cspell:disable-next-line */
|
||||
import edjsHTML from 'editorjs-html';
|
||||
@Component({
|
||||
@@ -40,6 +40,7 @@ import { PropertiesViewerWrapperComponent } from './components/widgets/propertie
|
||||
import { RadioButtonsCloudWidgetComponent } from './components/widgets/radio-buttons/radio-buttons-cloud.widget';
|
||||
import { FilePropertiesTableCloudComponent } from './components/widgets/attach-file/file-properties-table-cloud.component';
|
||||
import { FileViewerWidgetComponent } from './components/widgets/file-viewer/file-viewer.widget';
|
||||
import { RichTextEditorModule } from '../rich-text-editor';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -54,7 +55,8 @@ import { FileViewerWidgetComponent } from './components/widgets/file-viewer/file
|
||||
GroupCloudModule,
|
||||
ContentMetadataModule,
|
||||
UploadModule,
|
||||
AlfrescoViewerModule
|
||||
AlfrescoViewerModule,
|
||||
RichTextEditorModule
|
||||
],
|
||||
declarations: [
|
||||
FormCloudComponent,
|
||||
|
||||
@@ -35,6 +35,7 @@ import { PeopleCloudModule } from './people/people-cloud.module';
|
||||
import { CloudFormRenderingService } from './form/components/cloud-form-rendering.service';
|
||||
import { ProcessServicesCloudPipeModule } from './pipes/process-services-cloud-pipe.module';
|
||||
import { ApolloModule } from 'apollo-angular';
|
||||
import { RichTextEditorModule } from './rich-text-editor/rich-text-editor.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -47,7 +48,8 @@ import { ApolloModule } from 'apollo-angular';
|
||||
FormCloudModule,
|
||||
TaskFormModule,
|
||||
ProcessServicesCloudPipeModule,
|
||||
ApolloModule
|
||||
ApolloModule,
|
||||
RichTextEditorModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
@@ -67,7 +69,8 @@ import { ApolloModule } from 'apollo-angular';
|
||||
FormCloudModule,
|
||||
TaskFormModule,
|
||||
PeopleCloudModule,
|
||||
ProcessServicesCloudPipeModule
|
||||
ProcessServicesCloudPipeModule,
|
||||
RichTextEditorModule
|
||||
]
|
||||
})
|
||||
export class ProcessServicesCloudModule {
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
|
||||
import { RichTextEditorModule } from './rich-text-editor.module';
|
||||
import { Meta, moduleMetadata, Story } from '@storybook/angular';
|
||||
import { CoreStoryModule } from '../testing/core.story.module';
|
||||
import { ProcessServicesCloudStoryModule } from '../testing/process-services-cloud-story.module';
|
||||
import { RichTextEditorComponent } from './rich-text-editor.component';
|
||||
import { exampleData } from './mocks/rich-text-editor.mock';
|
||||
|
||||
@@ -26,7 +26,7 @@ export default {
|
||||
title: 'Core/Rich Text Editor/Rich Text Editor',
|
||||
decorators: [
|
||||
moduleMetadata({
|
||||
imports: [CoreStoryModule, RichTextEditorModule]
|
||||
imports: [ProcessServicesCloudStoryModule, RichTextEditorModule]
|
||||
})
|
||||
],
|
||||
argTypes: {
|
||||
+1
-1
@@ -22,7 +22,7 @@ import { Subject } from 'rxjs';
|
||||
import { editorJsConfig } from './editorjs-config';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-rich-text-editor',
|
||||
selector: 'adf-cloud-rich-text-editor',
|
||||
templateUrl: './rich-text-editor.component.html',
|
||||
styleUrls: ['./rich-text-editor.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
@@ -23,6 +23,8 @@ export * from './lib/group/public-api';
|
||||
export * from './lib/people/public-api';
|
||||
export * from './lib/form/public-api';
|
||||
export * from './lib/services/public-api';
|
||||
export * from './lib/rich-text-editor/public-api';
|
||||
|
||||
export * from './lib/types';
|
||||
export * from './lib/pipes/process-name-cloud.pipe';
|
||||
export * from './lib/pipes/process-services-cloud-pipe.module';
|
||||
|
||||
Reference in New Issue
Block a user