mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-3115] Content node selector - Ability to select multiple files (#5904)
* Ability to select multiple files * Fix unit test * Rename event into NodeSelected * restrict the typo Co-authored-by: Denys Vuika <denys.vuika@alfresco.com> Co-authored-by: Denys Vuika <denys.vuika@alfresco.com>
This commit is contained in:
@@ -108,17 +108,22 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent
|
||||
}
|
||||
|
||||
openSelectDialog() {
|
||||
const filesSaved: Node[] = [];
|
||||
const selectedMode = this.field.params.multiple ? 'multiple' : 'single';
|
||||
|
||||
this.contentNodeSelectorService
|
||||
.openUploadFileDialog(this.field.form.contentHost)
|
||||
.openUploadFileDialog(this.field.form.contentHost, '-my-', selectedMode)
|
||||
.subscribe((selections: Node[]) => {
|
||||
selections.forEach(node => (node['isExternal'] = true));
|
||||
filesSaved.push(selections[0]);
|
||||
this.fixIncompatibilityFromPreviousAndNewForm(filesSaved);
|
||||
const selectionWithoutDuplication = this.removeExistingSelection(selections);
|
||||
this.fixIncompatibilityFromPreviousAndNewForm(selectionWithoutDuplication);
|
||||
});
|
||||
}
|
||||
|
||||
removeExistingSelection(selections: Node[]) {
|
||||
const existingNode: Node[] = [...this.field.value || []];
|
||||
return selections.filter(opt => !existingNode.some( (node) => node.id === opt.id));
|
||||
}
|
||||
|
||||
isContentSourceSelected(): boolean {
|
||||
return (
|
||||
this.field.params &&
|
||||
|
@@ -32,7 +32,7 @@ export class ContentCloudNodeSelectorService {
|
||||
private dialog: MatDialog) {
|
||||
}
|
||||
|
||||
openUploadFileDialog(contentHost: string): Observable<Node[]> {
|
||||
openUploadFileDialog(contentHost: string, currentFolderId?: string, selectionMode?: string): Observable<Node[]> {
|
||||
const changedConfig = this.apiService.lastConfig;
|
||||
changedConfig.provider = 'ALL';
|
||||
changedConfig.hostEcm = contentHost.replace('/alfresco', '');
|
||||
@@ -44,8 +44,9 @@ export class ContentCloudNodeSelectorService {
|
||||
const data = <ContentNodeSelectorComponentData> {
|
||||
title: 'Select a file',
|
||||
actionName: 'Choose',
|
||||
currentFolderId: '-my-',
|
||||
currentFolderId,
|
||||
select,
|
||||
selectionMode,
|
||||
isSelectionValid: (entry: Node) => entry.isFile,
|
||||
showFilesInResult: true
|
||||
};
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
import { TRANSLATION_PROVIDER, CoreModule, FormRenderingService } from '@alfresco/adf-core';
|
||||
import { AppListCloudModule } from './app/app-list-cloud.module';
|
||||
import { TaskCloudModule } from './task/task-cloud.module';
|
||||
@@ -54,9 +54,7 @@ import { ProcessServicesCloudPipeModule } from './pipes/process-services-cloud-p
|
||||
}
|
||||
},
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService },
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService },
|
||||
FormRenderingService,
|
||||
{ provide: FormRenderingService, useClass: CloudFormRenderingService }
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
],
|
||||
exports: [
|
||||
AppListCloudModule,
|
||||
@@ -69,4 +67,30 @@ import { ProcessServicesCloudPipeModule } from './pipes/process-services-cloud-p
|
||||
ProcessServicesCloudPipeModule
|
||||
]
|
||||
})
|
||||
export class ProcessServicesCloudModule { }
|
||||
export class ProcessServicesCloudModule {
|
||||
static forRoot(): ModuleWithProviders<ProcessServicesCloudModule> {
|
||||
return {
|
||||
ngModule: ProcessServicesCloudModule,
|
||||
providers: [
|
||||
{
|
||||
provide: TRANSLATION_PROVIDER,
|
||||
multi: true,
|
||||
useValue: {
|
||||
name: 'adf-process-services-cloud',
|
||||
source: 'assets/adf-process-services-cloud'
|
||||
}
|
||||
},
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService },
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService },
|
||||
FormRenderingService,
|
||||
{ provide: FormRenderingService, useClass: CloudFormRenderingService }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
static forChild(): ModuleWithProviders<ProcessServicesCloudModule> {
|
||||
return {
|
||||
ngModule: ProcessServicesCloudModule
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@ import { ProcessDefinitionCloud } from '../models/process-definition-cloud.model
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { TaskVariableCloud } from '../../../form/models/task-variable-cloud.model';
|
||||
import { ProcessNameCloudPipe } from '../../../pipes/process-name-cloud.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-start-process',
|
||||
templateUrl: './start-process-cloud.component.html',
|
||||
|
Reference in New Issue
Block a user