mirror of https://github.com/Squidex/squidex.git
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.
31 lines
717 B
31 lines
717 B
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
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;
|
|
}
|
|
|