mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
migrate cloud components
This commit is contained in:
+2
-2
@@ -81,7 +81,7 @@ describe('DisplayRichTextWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [CoreTestingModule, DisplayRichTextWidgetComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(DisplayRichTextWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
@@ -94,7 +94,7 @@ describe('DisplayRichTextWidgetComponent', () => {
|
||||
expect(widget).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should parse editorjs data to html', async () => {
|
||||
it('should parse editor.js data to html', async () => {
|
||||
const expectedHtml =
|
||||
'<h1>Editor.js</h1><p class="ce-tune-alignment--left">Display some <font color="#ff1300">formatted</font> <mark class="cdx-marker">text</mark></p>';
|
||||
|
||||
|
||||
+1
@@ -24,6 +24,7 @@ import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
@Component({
|
||||
selector: 'display-rich-text',
|
||||
standalone: true,
|
||||
templateUrl: './display-rich-text.widget.html',
|
||||
styleUrls: ['./display-rich-text.widget.scss'],
|
||||
host: {
|
||||
|
||||
+2
-4
@@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { FileViewerWidgetComponent } from './file-viewer.widget';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormModel, FormService, FormFieldModel } from '@alfresco/adf-core';
|
||||
import { FormModel, FormService, FormFieldModel, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
|
||||
describe('FileViewerWidgetComponent', () => {
|
||||
@@ -44,8 +43,7 @@ describe('FileViewerWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [FileViewerWidgetComponent],
|
||||
imports: [NoopTranslateModule, FileViewerWidgetComponent],
|
||||
providers: [{ provide: FormService, useValue: formServiceStub }],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
+6
-1
@@ -16,12 +16,17 @@
|
||||
*/
|
||||
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { FormService, BaseViewerWidgetComponent } from '@alfresco/adf-core';
|
||||
import { FormService, BaseViewerWidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AlfrescoViewerComponent } from '@alfresco/adf-content-services';
|
||||
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
@Component({
|
||||
selector: 'file-viewer-widget',
|
||||
standalone: true,
|
||||
imports: [CommonModule, TranslateModule, AlfrescoViewerComponent, ErrorWidgetComponent],
|
||||
templateUrl: './file-viewer.widget.html',
|
||||
styleUrls: ['./file-viewer.widget.scss'],
|
||||
host: {
|
||||
|
||||
+1
-2
@@ -33,8 +33,7 @@ describe('GroupCloudWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessServiceCloudTestingModule],
|
||||
declarations: [GroupCloudWidgetComponent],
|
||||
imports: [ProcessServiceCloudTestingModule, GroupCloudWidgetComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
fixture = TestBed.createComponent(GroupCloudWidgetComponent);
|
||||
|
||||
+16
-13
@@ -16,17 +16,22 @@
|
||||
*/
|
||||
|
||||
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { WidgetComponent, FormService } from '@alfresco/adf-core';
|
||||
import { WidgetComponent, FormService, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { UntypedFormControl } from '@angular/forms';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import { ComponentSelectionMode } from '../../../../types';
|
||||
import { IdentityGroupModel } from '../../../../group/models/identity-group.model';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { GroupCloudComponent } from '../../../../group/components/group-cloud.component';
|
||||
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
@Component({
|
||||
selector: 'group-cloud-widget',
|
||||
standalone: true,
|
||||
imports: [CommonModule, TranslateModule, ErrorWidgetComponent, GroupCloudComponent],
|
||||
templateUrl: './group-cloud.widget.html',
|
||||
host: {
|
||||
'(click)': 'event($event)',
|
||||
@@ -42,7 +47,6 @@ import { IdentityGroupModel } from '../../../../group/models/identity-group.mode
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class GroupCloudWidgetComponent extends WidgetComponent implements OnInit, OnDestroy {
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
typeId = 'GroupCloudWidgetComponent';
|
||||
@@ -66,17 +70,16 @@ export class GroupCloudWidgetComponent extends WidgetComponent implements OnInit
|
||||
this.validate = this.field.readOnly ? false : true;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||
this.search = new UntypedFormControl({value: '', disabled: this.field.readOnly}, []),
|
||||
|
||||
this.search.statusChanges
|
||||
.pipe(
|
||||
filter((value: string) => value === 'INVALID'),
|
||||
takeUntil(this.onDestroy$)
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.field.markAsInvalid();
|
||||
this.field.form.markAsInvalid();
|
||||
});
|
||||
(this.search = new UntypedFormControl({ value: '', disabled: this.field.readOnly }, [])),
|
||||
this.search.statusChanges
|
||||
.pipe(
|
||||
filter((value: string) => value === 'INVALID'),
|
||||
takeUntil(this.onDestroy$)
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.field.markAsInvalid();
|
||||
this.field.form.markAsInvalid();
|
||||
});
|
||||
|
||||
this.search.statusChanges
|
||||
.pipe(
|
||||
|
||||
@@ -69,7 +69,10 @@ import { FormSpinnerComponent } from './components/spinner/form-spinner.componen
|
||||
FormSpinnerComponent,
|
||||
UploadCloudWidgetComponent,
|
||||
AttachFileCloudWidgetComponent,
|
||||
FilePropertiesTableCloudComponent
|
||||
FilePropertiesTableCloudComponent,
|
||||
DisplayRichTextWidgetComponent,
|
||||
FileViewerWidgetComponent,
|
||||
GroupCloudWidgetComponent
|
||||
],
|
||||
declarations: [
|
||||
FormCloudComponent,
|
||||
@@ -77,11 +80,8 @@ import { FormSpinnerComponent } from './components/spinner/form-spinner.componen
|
||||
FormCustomOutcomesComponent,
|
||||
RadioButtonsCloudWidgetComponent,
|
||||
PeopleCloudWidgetComponent,
|
||||
GroupCloudWidgetComponent,
|
||||
PropertiesViewerWrapperComponent,
|
||||
PropertiesViewerWidgetComponent,
|
||||
FileViewerWidgetComponent,
|
||||
DisplayRichTextWidgetComponent
|
||||
PropertiesViewerWidgetComponent
|
||||
],
|
||||
exports: [
|
||||
FormCloudComponent,
|
||||
|
||||
@@ -72,7 +72,7 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, GroupCloudModule]
|
||||
imports: [CoreTestingModule, GroupCloudModule, GroupCloudComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(GroupCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
OnDestroy,
|
||||
Inject
|
||||
} from '@angular/core';
|
||||
import { UntypedFormControl } from '@angular/forms';
|
||||
import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
||||
import { trigger, state, style, transition, animate } from '@angular/animations';
|
||||
import { BehaviorSubject, Observable, Subject } from 'rxjs';
|
||||
import { distinctUntilChanged, switchMap, mergeMap, filter, tap, takeUntil, debounceTime } from 'rxjs/operators';
|
||||
@@ -37,9 +37,33 @@ import { ComponentSelectionMode } from '../../types';
|
||||
import { IdentityGroupModel } from '../models/identity-group.model';
|
||||
import { IdentityGroupServiceInterface } from '../services/identity-group.service.interface';
|
||||
import { IDENTITY_GROUP_SERVICE_TOKEN } from '../services/identity-group-service.token';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-group',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
TranslateModule,
|
||||
MatIconModule,
|
||||
MatFormFieldModule,
|
||||
MatProgressBarModule,
|
||||
MatSelectModule,
|
||||
MatAutocompleteModule,
|
||||
MatChipsModule,
|
||||
MatInputModule,
|
||||
ReactiveFormsModule,
|
||||
MatButtonModule
|
||||
],
|
||||
templateUrl: './group-cloud.component.html',
|
||||
styleUrls: ['./group-cloud.component.scss'],
|
||||
animations: [
|
||||
|
||||
@@ -16,20 +16,13 @@
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { GroupCloudComponent } from './components/group-cloud.component';
|
||||
import { InitialGroupNamePipe } from './pipe/group-initial.pipe';
|
||||
import { IDENTITY_GROUP_SERVICE_TOKEN } from './services/identity-group-service.token';
|
||||
import { IdentityGroupService } from './services/identity-group.service';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, MaterialModule, FormsModule, ReactiveFormsModule, CoreModule, MatProgressBarModule],
|
||||
declarations: [GroupCloudComponent, InitialGroupNamePipe],
|
||||
imports: [GroupCloudComponent, InitialGroupNamePipe],
|
||||
providers: [{ provide: IDENTITY_GROUP_SERVICE_TOKEN, useExisting: IdentityGroupService }],
|
||||
exports: [GroupCloudComponent, InitialGroupNamePipe]
|
||||
})
|
||||
|
||||
@@ -19,10 +19,10 @@ import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { IdentityGroupModel } from '../models/identity-group.model';
|
||||
|
||||
@Pipe({
|
||||
name: 'groupNameInitial'
|
||||
name: 'groupNameInitial',
|
||||
standalone: true
|
||||
})
|
||||
export class InitialGroupNamePipe implements PipeTransform {
|
||||
|
||||
transform(group: IdentityGroupModel): string {
|
||||
let result = '';
|
||||
if (group) {
|
||||
@@ -32,7 +32,7 @@ export class InitialGroupNamePipe implements PipeTransform {
|
||||
}
|
||||
|
||||
getInitialGroupName(groupName: string) {
|
||||
groupName = (groupName ? groupName[0] : '');
|
||||
groupName = groupName ? groupName[0] : '';
|
||||
return groupName;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user