mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
pipe fixes and conversion
This commit is contained in:
parent
7b88c10137
commit
6d9838eaf4
@ -9,8 +9,8 @@
|
|||||||
<img matListItemLine class="adf-upload-widget__icon" [id]="'file-'+file.id+'-icon'"
|
<img matListItemLine class="adf-upload-widget__icon" [id]="'file-'+file.id+'-icon'"
|
||||||
[src]="getIcon(file.content.mimeType)" [alt]="mimeTypeIcon" (click)="fileClicked(file)"
|
[src]="getIcon(file.content.mimeType)" [alt]="mimeTypeIcon" (click)="fileClicked(file)"
|
||||||
(keyup.enter)="fileClicked(file)" role="button" tabindex="0" />
|
(keyup.enter)="fileClicked(file)" role="button" tabindex="0" />
|
||||||
<span class="adf-upload-widget__button" matLine id="{{'file-'+file.id}}" (click)="fileClicked(file)" (keyup.enter)="fileClicked(file)"
|
<span class="adf-upload-widget__button adf-file" matLine id="{{'file-'+file.id}}" (click)="fileClicked(file)" (keyup.enter)="fileClicked(file)"
|
||||||
role="button" tabindex="0" class="adf-file">{{file.name}}</span>
|
role="button" tabindex="0">{{file.name}}</span>
|
||||||
<button *ngIf="!field.readOnly" mat-icon-button [id]="'file-'+file.id+'-remove'"
|
<button *ngIf="!field.readOnly" mat-icon-button [id]="'file-'+file.id+'-remove'"
|
||||||
(click)="removeFile(file);" (keyup.enter)="removeFile(file);">
|
(click)="removeFile(file);" (keyup.enter)="removeFile(file);">
|
||||||
<mat-icon class="mat-24">highlight_off</mat-icon>
|
<mat-icon class="mat-24">highlight_off</mat-icon>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ProcessNameCloudPipe } from './process-name-cloud.pipe';
|
import { ProcessNameCloudPipe } from './process-name-cloud.pipe';
|
||||||
import { LocalizedDatePipe, CoreTestingModule } from '@alfresco/adf-core';
|
import { CoreTestingModule } from '@alfresco/adf-core';
|
||||||
import { ProcessInstanceCloud } from '../process/start-process/models/process-instance-cloud.model';
|
import { ProcessInstanceCloud } from '../process/start-process/models/process-instance-cloud.model';
|
||||||
|
|
||||||
describe('ProcessNameCloudPipe', () => {
|
describe('ProcessNameCloudPipe', () => {
|
||||||
@ -35,10 +35,9 @@ describe('ProcessNameCloudPipe', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule],
|
imports: [CoreTestingModule],
|
||||||
providers: [LocalizedDatePipe]
|
providers: [ProcessNameCloudPipe]
|
||||||
});
|
});
|
||||||
const localizedDatePipe = TestBed.inject(LocalizedDatePipe);
|
processNamePipe = TestBed.inject(ProcessNameCloudPipe);
|
||||||
processNamePipe = new ProcessNameCloudPipe(localizedDatePipe);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not modify the name when there is no identifier', () => {
|
it('should not modify the name when there is no identifier', () => {
|
||||||
|
@ -23,27 +23,26 @@ import { getTime } from 'date-fns';
|
|||||||
export const DATE_TIME_IDENTIFIER_REG_EXP = new RegExp('%{datetime}', 'i');
|
export const DATE_TIME_IDENTIFIER_REG_EXP = new RegExp('%{datetime}', 'i');
|
||||||
export const PROCESS_DEFINITION_IDENTIFIER_REG_EXP = new RegExp('%{processdefinition}', 'i');
|
export const PROCESS_DEFINITION_IDENTIFIER_REG_EXP = new RegExp('%{processdefinition}', 'i');
|
||||||
|
|
||||||
@Pipe({ name: 'processNameCloud' })
|
/**
|
||||||
|
* TODO: This pipe is not used in the HTML templates, only instantiated from code.
|
||||||
|
*/
|
||||||
|
@Pipe({
|
||||||
|
name: 'processNameCloud',
|
||||||
|
standalone: true
|
||||||
|
})
|
||||||
export class ProcessNameCloudPipe implements PipeTransform {
|
export class ProcessNameCloudPipe implements PipeTransform {
|
||||||
constructor(private localizedDatePipe: LocalizedDatePipe) {
|
constructor(private localizedDatePipe: LocalizedDatePipe) {}
|
||||||
}
|
|
||||||
|
|
||||||
transform(processNameFormat: string, processInstance?: ProcessInstanceCloud): string {
|
transform(processNameFormat: string, processInstance?: ProcessInstanceCloud): string {
|
||||||
let processName = processNameFormat;
|
let processName = processNameFormat;
|
||||||
if (processName.match(DATE_TIME_IDENTIFIER_REG_EXP)) {
|
if (processName.match(DATE_TIME_IDENTIFIER_REG_EXP)) {
|
||||||
const presentDateTime = getTime(new Date());
|
const presentDateTime = getTime(new Date());
|
||||||
processName = processName.replace(
|
processName = processName.replace(DATE_TIME_IDENTIFIER_REG_EXP, this.localizedDatePipe.transform(presentDateTime, 'medium'));
|
||||||
DATE_TIME_IDENTIFIER_REG_EXP,
|
|
||||||
this.localizedDatePipe.transform(presentDateTime, 'medium')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processName.match(PROCESS_DEFINITION_IDENTIFIER_REG_EXP)) {
|
if (processName.match(PROCESS_DEFINITION_IDENTIFIER_REG_EXP)) {
|
||||||
const selectedProcessDefinitionName = processInstance ? processInstance.processDefinitionName : '';
|
const selectedProcessDefinitionName = processInstance ? processInstance.processDefinitionName : '';
|
||||||
processName = processName.replace(
|
processName = processName.replace(PROCESS_DEFINITION_IDENTIFIER_REG_EXP, selectedProcessDefinitionName);
|
||||||
PROCESS_DEFINITION_IDENTIFIER_REG_EXP,
|
|
||||||
selectedProcessDefinitionName
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return processName;
|
return processName;
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @license
|
|
||||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { ProcessNameCloudPipe } from './process-name-cloud.pipe';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
declarations: [
|
|
||||||
ProcessNameCloudPipe
|
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
ProcessNameCloudPipe
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class ProcessServicesCloudPipeModule {
|
|
||||||
}
|
|
@ -33,9 +33,9 @@ import {
|
|||||||
} from './services/public-api';
|
} from './services/public-api';
|
||||||
import { PeopleCloudModule } from './people/people-cloud.module';
|
import { PeopleCloudModule } from './people/people-cloud.module';
|
||||||
import { CloudFormRenderingService } from './form/components/cloud-form-rendering.service';
|
import { CloudFormRenderingService } from './form/components/cloud-form-rendering.service';
|
||||||
import { ProcessServicesCloudPipeModule } from './pipes/process-services-cloud-pipe.module';
|
|
||||||
import { ApolloModule } from 'apollo-angular';
|
import { ApolloModule } from 'apollo-angular';
|
||||||
import { RichTextEditorModule } from './rich-text-editor/rich-text-editor.module';
|
import { RichTextEditorModule } from './rich-text-editor/rich-text-editor.module';
|
||||||
|
import { ProcessNameCloudPipe } from './pipes/process-name-cloud.pipe';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@ -47,7 +47,7 @@ import { RichTextEditorModule } from './rich-text-editor/rich-text-editor.module
|
|||||||
PeopleCloudModule,
|
PeopleCloudModule,
|
||||||
FormCloudModule,
|
FormCloudModule,
|
||||||
TaskFormModule,
|
TaskFormModule,
|
||||||
ProcessServicesCloudPipeModule,
|
ProcessNameCloudPipe,
|
||||||
ApolloModule,
|
ApolloModule,
|
||||||
RichTextEditorModule
|
RichTextEditorModule
|
||||||
],
|
],
|
||||||
@ -60,7 +60,7 @@ import { RichTextEditorModule } from './rich-text-editor/rich-text-editor.module
|
|||||||
FormCloudModule,
|
FormCloudModule,
|
||||||
TaskFormModule,
|
TaskFormModule,
|
||||||
PeopleCloudModule,
|
PeopleCloudModule,
|
||||||
ProcessServicesCloudPipeModule,
|
ProcessNameCloudPipe,
|
||||||
RichTextEditorModule
|
RichTextEditorModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -24,7 +24,7 @@ import { CoreModule } from '@alfresco/adf-core';
|
|||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
import { EditProcessFilterCloudComponent } from './components/edit-process-filter-cloud.component';
|
import { EditProcessFilterCloudComponent } from './components/edit-process-filter-cloud.component';
|
||||||
import { ProcessFilterDialogCloudComponent } from './components/process-filter-dialog-cloud.component';
|
import { ProcessFilterDialogCloudComponent } from './components/process-filter-dialog-cloud.component';
|
||||||
import { AppListCloudModule } from './../../app/app-list-cloud.module';
|
import { APP_LIST_CLOUD_DIRECTIVES } from './../../app/app-list-cloud.module';
|
||||||
import { PeopleCloudModule } from '../../people/people-cloud.module';
|
import { PeopleCloudModule } from '../../people/people-cloud.module';
|
||||||
import { DateRangeFilterComponent } from '../../common/date-range-filter/date-range-filter.component';
|
import { DateRangeFilterComponent } from '../../common/date-range-filter/date-range-filter.component';
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ import { DateRangeFilterComponent } from '../../common/date-range-filter/date-ra
|
|||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
AppListCloudModule,
|
...APP_LIST_CLOUD_DIRECTIVES,
|
||||||
CoreModule,
|
CoreModule,
|
||||||
DateRangeFilterComponent,
|
DateRangeFilterComponent,
|
||||||
PeopleCloudModule
|
PeopleCloudModule
|
||||||
|
@ -22,7 +22,7 @@ import { TaskFiltersCloudComponent } from './components/task-filters-cloud.compo
|
|||||||
import { MaterialModule } from '../../material.module';
|
import { MaterialModule } from '../../material.module';
|
||||||
import { CoreModule } from '@alfresco/adf-core';
|
import { CoreModule } from '@alfresco/adf-core';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
import { AppListCloudModule } from './../../app/app-list-cloud.module';
|
import { APP_LIST_CLOUD_DIRECTIVES } from './../../app/app-list-cloud.module';
|
||||||
import { PeopleCloudModule } from '../../people/people-cloud.module';
|
import { PeopleCloudModule } from '../../people/people-cloud.module';
|
||||||
import { EditServiceTaskFilterCloudComponent } from './components/edit-task-filters/edit-service-task-filter-cloud.component';
|
import { EditServiceTaskFilterCloudComponent } from './components/edit-task-filters/edit-service-task-filter-cloud.component';
|
||||||
import { EditTaskFilterCloudComponent } from './components/edit-task-filters/edit-task-filter-cloud.component';
|
import { EditTaskFilterCloudComponent } from './components/edit-task-filters/edit-task-filter-cloud.component';
|
||||||
@ -40,7 +40,7 @@ import { DateRangeFilterComponent } from '../../common/date-range-filter/date-ra
|
|||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
AppListCloudModule,
|
...APP_LIST_CLOUD_DIRECTIVES,
|
||||||
CoreModule,
|
CoreModule,
|
||||||
GroupCloudModule,
|
GroupCloudModule,
|
||||||
DateRangeFilterComponent,
|
DateRangeFilterComponent,
|
||||||
|
@ -28,7 +28,6 @@ export * from './lib/rich-text-editor/public-api';
|
|||||||
export * from './lib/types';
|
export * from './lib/types';
|
||||||
export * from './lib/common/index';
|
export * from './lib/common/index';
|
||||||
export * from './lib/pipes/process-name-cloud.pipe';
|
export * from './lib/pipes/process-name-cloud.pipe';
|
||||||
export * from './lib/pipes/process-services-cloud-pipe.module';
|
|
||||||
export * from './lib/models/process-definition-cloud.model';
|
export * from './lib/models/process-definition-cloud.model';
|
||||||
export * from './lib/models/date-cloud-filter.model';
|
export * from './lib/models/date-cloud-filter.model';
|
||||||
export * from './lib/models/application-version.model';
|
export * from './lib/models/application-version.model';
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { SimpleChange } from '@angular/core';
|
import { SimpleChange } from '@angular/core';
|
||||||
import { ComponentFixture, getTestBed } from '@angular/core/testing';
|
import { ComponentFixture, getTestBed } from '@angular/core/testing';
|
||||||
import { AppConfigService, AppConfigServiceMock, FormRenderingService, LocalizedDatePipe, NoopTranslateModule } from '@alfresco/adf-core';
|
import { AppConfigService, AppConfigServiceMock, FormRenderingService, NoopTranslateModule } from '@alfresco/adf-core';
|
||||||
import { of, throwError } from 'rxjs';
|
import { of, throwError } from 'rxjs';
|
||||||
import { MatSelectChange } from '@angular/material/select';
|
import { MatSelectChange } from '@angular/material/select';
|
||||||
import { ProcessService } from '../../services/process.service';
|
import { ProcessService } from '../../services/process.service';
|
||||||
@ -59,7 +59,6 @@ describe('StartProcessComponent', () => {
|
|||||||
getTestBed().configureTestingModule({
|
getTestBed().configureTestingModule({
|
||||||
imports: [NoopTranslateModule, NoopAnimationsModule, StartProcessInstanceComponent],
|
imports: [NoopTranslateModule, NoopAnimationsModule, StartProcessInstanceComponent],
|
||||||
providers: [
|
providers: [
|
||||||
LocalizedDatePipe,
|
|
||||||
{ provide: FormRenderingService, useClass: ProcessFormRenderingService },
|
{ provide: FormRenderingService, useClass: ProcessFormRenderingService },
|
||||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||||
]
|
]
|
||||||
|
@ -65,6 +65,7 @@ const PROCESS_DEFINITION_IDENTIFIER_REG_EXP = new RegExp('%{processdefinition}',
|
|||||||
EmptyContentComponent,
|
EmptyContentComponent,
|
||||||
StartFormComponent
|
StartFormComponent
|
||||||
],
|
],
|
||||||
|
providers: [LocalizedDatePipe],
|
||||||
templateUrl: './start-process.component.html',
|
templateUrl: './start-process.component.html',
|
||||||
styleUrls: ['./start-process.component.scss'],
|
styleUrls: ['./start-process.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user