remove file system tree store
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
import type { UmbTreeStore } from './tree-store.interface.js';
|
||||
import type { UmbFileSystemTreeItemModel } from './types.js';
|
||||
import { UmbStoreBase } from '@umbraco-cms/backoffice/store';
|
||||
import { UmbArrayState } from '@umbraco-cms/backoffice/observable-api';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @class UmbFileSystemTreeStore
|
||||
* @extends {UmbStoreBase}
|
||||
* @description - File System Tree Store
|
||||
*/
|
||||
export class UmbFileSystemTreeStore
|
||||
extends UmbStoreBase<UmbFileSystemTreeItemModel>
|
||||
implements UmbTreeStore<UmbFileSystemTreeItemModel>
|
||||
{
|
||||
constructor(host: UmbControllerHostElement, storeAlias: string) {
|
||||
super(host, storeAlias, new UmbArrayState<UmbFileSystemTreeItemModel>([], (x) => x.path));
|
||||
}
|
||||
|
||||
/**
|
||||
* An observable to observe the root items
|
||||
* @memberof UmbFileSystemTreeStore
|
||||
*/
|
||||
rootItems = this._data.asObservablePart((items) => items.filter((item) => item.path?.includes('/') === false));
|
||||
|
||||
/**
|
||||
* Returns an observable to observe the children of a given parent
|
||||
* @param {(string | null)} parentPath
|
||||
* @return {*}
|
||||
* @memberof UmbFileSystemTreeStore
|
||||
*/
|
||||
childrenOf(parentPath: string | null) {
|
||||
if (parentPath === null) {
|
||||
return this.rootItems;
|
||||
}
|
||||
|
||||
return this._data.asObservablePart((items) =>
|
||||
items.filter((item) => {
|
||||
const pathCut = item.path?.substring(0, item.path?.lastIndexOf('/'));
|
||||
return parentPath === pathCut;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an observable to observe the items with the given ids
|
||||
* @param {Array<string>} paths
|
||||
* @return {*}
|
||||
* @memberof UmbFileSystemTreeStore
|
||||
*/
|
||||
items(paths: Array<string>) {
|
||||
return this._data.asObservablePart((items) => items.filter((item) => paths.includes(item.path ?? '')));
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ export * from './types.js';
|
||||
export * from './tree-repository.interface.js';
|
||||
export * from './tree-store.interface.js';
|
||||
export * from './entity-tree-store.js';
|
||||
export * from './file-system-tree.store.js';
|
||||
|
||||
// Unique
|
||||
export * from './unique-tree-store.js';
|
||||
|
||||
Reference in New Issue
Block a user