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