align document store method names
This commit is contained in:
@@ -19,9 +19,18 @@ export class UmbStoreBase<StoreItemType = any> implements UmbStore<StoreItemType
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends items to the store
|
||||
* Append an item to the store
|
||||
* @param {StoreItemType} item
|
||||
* @memberof UmbStoreBase
|
||||
*/
|
||||
append(item: StoreItemType) {
|
||||
this._data.append([item]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends multiple items to the store
|
||||
* @param {Array<StoreItemType>} items
|
||||
* @memberof UmbEntityTreeStore
|
||||
* @memberof UmbStoreBase
|
||||
*/
|
||||
appendItems(items: Array<StoreItemType>) {
|
||||
this._data.append(items);
|
||||
@@ -29,9 +38,9 @@ export class UmbStoreBase<StoreItemType = any> implements UmbStore<StoreItemType
|
||||
|
||||
/**
|
||||
* Updates an item in the store
|
||||
* @param {string} id
|
||||
* @param {string} unique
|
||||
* @param {Partial<StoreItemType>} data
|
||||
* @memberof UmbEntityTreeStore
|
||||
* @memberof UmbStoreBase
|
||||
*/
|
||||
updateItem(unique: string, data: Partial<StoreItemType>) {
|
||||
this._data.updateOne(unique, data);
|
||||
@@ -39,10 +48,19 @@ export class UmbStoreBase<StoreItemType = any> implements UmbStore<StoreItemType
|
||||
|
||||
/**
|
||||
* Removes an item from the store
|
||||
* @param {string} id
|
||||
* @memberof UmbEntityTreeStore
|
||||
* @param {string} unique
|
||||
* @memberof UmbStoreBase
|
||||
*/
|
||||
removeItem(unique: string) {
|
||||
this._data.removeOne(unique);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes multiple items in the store with the given uniques
|
||||
* @param {string[]} uniques
|
||||
* @memberof UmbStoreBase
|
||||
*/
|
||||
removeItems(uniques: Array<string>) {
|
||||
this._data.remove(uniques);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,8 +238,7 @@ export class UmbDocumentRepository
|
||||
// TODO: we currently don't use the detail store for anything.
|
||||
// Consider to look up the data before fetching from the server.
|
||||
// Consider notify a workspace if a document is deleted from the store while someone is editing it.
|
||||
// TODO: would be nice to align the stores on methods/methodNames.
|
||||
this.#store?.remove([id]);
|
||||
this.#store?.removeItem(id);
|
||||
this.#treeStore?.removeItem(id);
|
||||
this.#itemStore?.removeItem(id);
|
||||
|
||||
@@ -260,9 +259,8 @@ export class UmbDocumentRepository
|
||||
// TODO: we currently don't use the detail store for anything.
|
||||
// Consider to look up the data before fetching from the server.
|
||||
// Consider notify a workspace if a document is deleted from the store while someone is editing it.
|
||||
// TODO: would be nice to align the stores on methods/methodNames.
|
||||
// TODO: Temp hack: would should update a property isTrashed (maybe) on the item instead of removing them.
|
||||
this.#store?.remove([id]);
|
||||
this.#store?.removeItem(id);
|
||||
this.#treeStore?.removeItem(id);
|
||||
this.#itemStore?.removeItem(id);
|
||||
|
||||
|
||||
@@ -20,15 +20,6 @@ export class UmbDocumentStore extends UmbStoreBase {
|
||||
super(host, UMB_DOCUMENT_STORE_CONTEXT_TOKEN.toString(), new UmbArrayState<DocumentResponseModel>([], (x) => x.id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a document to the store
|
||||
* @param {DocumentDetails} document
|
||||
* @memberof UmbDocumentDetailStore
|
||||
*/
|
||||
append(document: DocumentResponseModel) {
|
||||
this._data.append([document]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a document from the store
|
||||
* @param {string} id
|
||||
@@ -37,15 +28,6 @@ export class UmbDocumentStore extends UmbStoreBase {
|
||||
byId(id: DocumentResponseModel['id']) {
|
||||
return this._data.asObservablePart((x) => x.find((y) => y.id === id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes documents in the store with the given uniques
|
||||
* @param {string[]} uniques
|
||||
* @memberof UmbDocumentDetailStore
|
||||
*/
|
||||
remove(uniques: Array<DocumentResponseModel['id']>) {
|
||||
this._data.remove(uniques);
|
||||
}
|
||||
}
|
||||
|
||||
export const UMB_DOCUMENT_STORE_CONTEXT_TOKEN = new UmbContextToken<UmbDocumentStore>('UmbDocumentStore');
|
||||
|
||||
Reference in New Issue
Block a user