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'"
|
||||
[src]="getIcon(file.content.mimeType)" [alt]="mimeTypeIcon" (click)="fileClicked(file)"
|
||||
(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)"
|
||||
role="button" tabindex="0" class="adf-file">{{file.name}}</span>
|
||||
<span class="adf-upload-widget__button adf-file" matLine id="{{'file-'+file.id}}" (click)="fileClicked(file)" (keyup.enter)="fileClicked(file)"
|
||||
role="button" tabindex="0">{{file.name}}</span>
|
||||
<button *ngIf="!field.readOnly" mat-icon-button [id]="'file-'+file.id+'-remove'"
|
||||
(click)="removeFile(file);" (keyup.enter)="removeFile(file);">
|
||||
<mat-icon class="mat-24">highlight_off</mat-icon>
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
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';
|
||||
|
||||
describe('ProcessNameCloudPipe', () => {
|
||||
@ -35,10 +35,9 @@ describe('ProcessNameCloudPipe', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
providers: [LocalizedDatePipe]
|
||||
providers: [ProcessNameCloudPipe]
|
||||
});
|
||||
const localizedDatePipe = TestBed.inject(LocalizedDatePipe);
|
||||
processNamePipe = new ProcessNameCloudPipe(localizedDatePipe);
|
||||
processNamePipe = TestBed.inject(ProcessNameCloudPipe);
|
||||
});
|
||||
|
||||
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 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 {
|
||||
constructor(private localizedDatePipe: LocalizedDatePipe) {
|
||||
}
|
||||
constructor(private localizedDatePipe: LocalizedDatePipe) {}
|
||||
|
||||
transform(processNameFormat: string, processInstance?: ProcessInstanceCloud): string {
|
||||
let processName = processNameFormat;
|
||||
if (processName.match(DATE_TIME_IDENTIFIER_REG_EXP)) {
|
||||
const presentDateTime = getTime(new Date());
|
||||
processName = processName.replace(
|
||||
DATE_TIME_IDENTIFIER_REG_EXP,
|
||||
this.localizedDatePipe.transform(presentDateTime, 'medium')
|
||||
);
|
||||
processName = processName.replace(DATE_TIME_IDENTIFIER_REG_EXP, this.localizedDatePipe.transform(presentDateTime, 'medium'));
|
||||
}
|
||||
|
||||
if (processName.match(PROCESS_DEFINITION_IDENTIFIER_REG_EXP)) {
|
||||
const selectedProcessDefinitionName = processInstance ? processInstance.processDefinitionName : '';
|
||||
processName = processName.replace(
|
||||
PROCESS_DEFINITION_IDENTIFIER_REG_EXP,
|
||||
selectedProcessDefinitionName
|
||||
);
|
||||
processName = processName.replace(PROCESS_DEFINITION_IDENTIFIER_REG_EXP, selectedProcessDefinitionName);
|
||||
}
|
||||
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';
|
||||
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';
|
||||
import { ProcessNameCloudPipe } from './pipes/process-name-cloud.pipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -47,7 +47,7 @@ import { RichTextEditorModule } from './rich-text-editor/rich-text-editor.module
|
||||
PeopleCloudModule,
|
||||
FormCloudModule,
|
||||
TaskFormModule,
|
||||
ProcessServicesCloudPipeModule,
|
||||
ProcessNameCloudPipe,
|
||||
ApolloModule,
|
||||
RichTextEditorModule
|
||||
],
|
||||
@ -60,7 +60,7 @@ import { RichTextEditorModule } from './rich-text-editor/rich-text-editor.module
|
||||
FormCloudModule,
|
||||
TaskFormModule,
|
||||
PeopleCloudModule,
|
||||
ProcessServicesCloudPipeModule,
|
||||
ProcessNameCloudPipe,
|
||||
RichTextEditorModule
|
||||
]
|
||||
})
|
||||
|
@ -24,7 +24,7 @@ import { CoreModule } from '@alfresco/adf-core';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { EditProcessFilterCloudComponent } from './components/edit-process-filter-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 { DateRangeFilterComponent } from '../../common/date-range-filter/date-range-filter.component';
|
||||
|
||||
@ -35,7 +35,7 @@ import { DateRangeFilterComponent } from '../../common/date-range-filter/date-ra
|
||||
HttpClientModule,
|
||||
CommonModule,
|
||||
MaterialModule,
|
||||
AppListCloudModule,
|
||||
...APP_LIST_CLOUD_DIRECTIVES,
|
||||
CoreModule,
|
||||
DateRangeFilterComponent,
|
||||
PeopleCloudModule
|
||||
|
@ -22,7 +22,7 @@ import { TaskFiltersCloudComponent } from './components/task-filters-cloud.compo
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
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 { EditServiceTaskFilterCloudComponent } from './components/edit-task-filters/edit-service-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,
|
||||
CommonModule,
|
||||
MaterialModule,
|
||||
AppListCloudModule,
|
||||
...APP_LIST_CLOUD_DIRECTIVES,
|
||||
CoreModule,
|
||||
GroupCloudModule,
|
||||
DateRangeFilterComponent,
|
||||
|
@ -28,7 +28,6 @@ export * from './lib/rich-text-editor/public-api';
|
||||
export * from './lib/types';
|
||||
export * from './lib/common/index';
|
||||
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/date-cloud-filter.model';
|
||||
export * from './lib/models/application-version.model';
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
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 { MatSelectChange } from '@angular/material/select';
|
||||
import { ProcessService } from '../../services/process.service';
|
||||
@ -59,7 +59,6 @@ describe('StartProcessComponent', () => {
|
||||
getTestBed().configureTestingModule({
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, StartProcessInstanceComponent],
|
||||
providers: [
|
||||
LocalizedDatePipe,
|
||||
{ provide: FormRenderingService, useClass: ProcessFormRenderingService },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||
]
|
||||
|
@ -65,6 +65,7 @@ const PROCESS_DEFINITION_IDENTIFIER_REG_EXP = new RegExp('%{processdefinition}',
|
||||
EmptyContentComponent,
|
||||
StartFormComponent
|
||||
],
|
||||
providers: [LocalizedDatePipe],
|
||||
templateUrl: './start-process.component.html',
|
||||
styleUrls: ['./start-process.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
|
Loading…
x
Reference in New Issue
Block a user