Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
751 B

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
// tslint:disable: prefer-for-of
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { Types } from './../utils/types';
export function sorted<T>(event: CdkDragDrop<ReadonlyArray<T>>): ReadonlyArray<T> {
const items = <T[]>event.container.data;
moveItemInArray(items, event.previousIndex, event.currentIndex);
return items;
}
export function getFiles(files: FileList | ReadonlyArray<File>) {
if (Types.isArray(files)) {
return files;
}
const result: File[] = [];
for (let i = 0; i < files.length; i++) {
result.push(files[i]);
}
return result;
}