this.registerAsync(CatalogDataSource);
this.bindActions(CatalogDataSourceActions);
this.bindActions(CatalogItemsActions);
+ this.exportPublicMethods({
+ getCatalogs: this.getCatalogs,
+ getCatalogItemById: this.getCatalogItemById,
+ getCatalogItemByUid: this.getCatalogItemByUid,
+ getTransientCatalogs: this.getTransientCatalogs,
+ getTransientCatalogItemById: this.getTransientCatalogItemById,
+ getTransientCatalogItemByUid: this.getTransientCatalogItemByUid
+ });
}
resetSelectionState = () => {
return this.catalogs || (this.catalogs = []);
}
+ getTransientCatalogs() {
+ return this.state.catalogs || (this.state.catalogs = []);
+ }
+
getAllSelectedCatalogItems() {
return this.getCatalogs().reduce((r, d) => {
d.descriptors.forEach(d => {
}, [])[0];
}
+ getTransientCatalogItemById(id) {
+ return this.getTransientCatalogs().reduce((r, catalog) => {
+ return r.concat(catalog.descriptors.filter(d => d.id === id));
+ }, [])[0];
+ }
+
getCatalogItemByUid(uid) {
return this.getCatalogs().reduce((r, catalog) => {
return r.concat(catalog.descriptors.filter(d => UID.from(d) === uid));
}, [])[0];
}
+ getTransientCatalogItemByUid(uid) {
+ return this.getTransientCatalogs().reduce((r, catalog) => {
+ return r.concat(catalog.descriptors.filter(d => UID.from(d) === uid));
+ }, [])[0];
+ }
+
removeCatalogItem(deleteItem = {}) {
this.getCatalogs().map(catalog => {
catalog.descriptors = catalog.descriptors.filter(d => d.id !== deleteItem.id);